Class Angle

  • All Implemented Interfaces:
    java.util.function.DoubleSupplier
    Direct Known Subclasses:
    Angle.Deg, Angle.Rad, Angle.Turn

    public abstract class Angle
    extends java.lang.Object
    implements java.util.function.DoubleSupplier
    Represents the angle concept.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static double DEG_TO_RAD
      Degrees to radians conversion factor.
      static double PI_OVER_TWO
      π/2.
      private static double RAD_TO_DEG
      Radians to degrees conversion factor.
      private static double TURN_TO_DEG
      Turns to degrees conversion factor.
      static double TWO_PI
      2π.
      private double value
      Value (unit depends on concrete instance).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Angle​(double value)  
    • Field Detail

      • TURN_TO_DEG

        private static final double TURN_TO_DEG
        Turns to degrees conversion factor.
        See Also:
        Constant Field Values
      • RAD_TO_DEG

        private static final double RAD_TO_DEG
        Radians to degrees conversion factor.
        See Also:
        Constant Field Values
      • DEG_TO_RAD

        private static final double DEG_TO_RAD
        Degrees to radians conversion factor.
        See Also:
        Constant Field Values
      • value

        private final double value
        Value (unit depends on concrete instance).
    • Constructor Detail

      • Angle

        private Angle​(double value)
        Parameters:
        value - Value in turns.
    • Method Detail

      • getAsDouble

        public double getAsDouble()
        Specified by:
        getAsDouble in interface java.util.function.DoubleSupplier
        Returns:
        the value.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Test for equality with another object. Objects are considered to be equal if their concrete types are equal and their values are exactly the same (or both are Double.NaN).
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - Object to test for equality with this instance.
        Returns:
        true if the objects are equal, false if other is null, not of the same type as this instance, or not equal to this instance.
      • toTurn

        public abstract Angle.Turn toTurn()
        Returns:
        the angle in turns.