Record Class ImmutableAngle

java.lang.Object
java.lang.Record
edu.wpi.first.units.measure.ImmutableAngle
All Implemented Interfaces:
Measure<AngleUnit>, Angle, Comparable<Measure<AngleUnit>>

public record ImmutableAngle(double magnitude, double baseUnitMagnitude, AngleUnit unit) extends Record implements Angle
  • Constructor Details

    • ImmutableAngle

      public ImmutableAngle(double magnitude, double baseUnitMagnitude, AngleUnit unit)
      Creates an instance of a ImmutableAngle 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 Angle 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 Angle
      Specified by:
      copy in interface Measure<AngleUnit>
      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<AngleUnit>
      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<AngleUnit>
      Returns:
      the value of the baseUnitMagnitude record component
    • unit

      public AngleUnit unit()
      Returns the value of the unit record component.
      Specified by:
      unit in interface Angle
      Specified by:
      unit in interface Measure<AngleUnit>
      Returns:
      the value of the unit record component