Record Class ImmutableVelocity<D extends Unit>

java.lang.Object
java.lang.Record
edu.wpi.first.units.measure.ImmutableVelocity<D>
All Implemented Interfaces:
Measure<VelocityUnit<D>>, Velocity<D>, Comparable<Measure<VelocityUnit<D>>>

public record ImmutableVelocity<D extends Unit>(double magnitude, double baseUnitMagnitude, VelocityUnit<D extends Unit> unit) extends Record implements Velocity<D>
  • Constructor Details

    • ImmutableVelocity

      public ImmutableVelocity(double magnitude, double baseUnitMagnitude, VelocityUnit<D> unit)
      Creates an instance of a ImmutableVelocity record class.
      Parameters:
      magnitude - the value for the magnitude record component
      baseUnitMagnitude - the value for the baseUnitMagnitude record component
      unit - the value for the unit record component
  • Method Details

    • copy

      public Velocity<D> copy()
      Description copied from interface: Measure
      Returns an immutable copy of this measure. The copy can be used freely and is guaranteed never to change.
      Specified by:
      copy in interface Measure<D extends Unit>
      Specified by:
      copy in interface Velocity<D extends Unit>
      Returns:
      the copied measure
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • magnitude

      public double magnitude()
      Returns the value of the magnitude record component.
      Specified by:
      magnitude in interface Measure<D extends Unit>
      Returns:
      the value of the magnitude record component
    • baseUnitMagnitude

      public double baseUnitMagnitude()
      Returns the value of the baseUnitMagnitude record component.
      Specified by:
      baseUnitMagnitude in interface Measure<D extends Unit>
      Returns:
      the value of the baseUnitMagnitude record component
    • unit

      public VelocityUnit<D> unit()
      Returns the value of the unit record component.
      Specified by:
      unit in interface Measure<D extends Unit>
      Specified by:
      unit in interface Velocity<D extends Unit>
      Returns:
      the value of the unit record component