Class Angle

java.lang.Object
com.adobe.xfa.ut.Angle

public final class Angle extends Object
A class to represent an angle between 0° and 360°.

Instances of this class are immutable. All change operations return a new instance of this Angle class.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Angle
    The Angle corresponding to the 0 angle.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates an Angle of 0°.
    Angle(double dDegrees)
    Instantiates an Angle from the given double value.
    Angle(int nDegrees)
    Instantiates an Angle from the given int value.
    Angle(int value, boolean isResolved)
    Instantiates an Angle from the given int value.
    Angle(long nDegrees)
    Instantiates an Angle from the given long value.
    Angle(Angle source)
    Deprecated.
    Angle is immutable, so there is no need to copy an instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Angle oAdd)
    Returns an Angle representing the addition of this object and the given Angle.
    int
    Gets this object's angle value.
    boolean
    equals(Object object)
    Determines if this object is equal to the given Object.
    double
    Gets this object's angle value.
    boolean
    gt(Angle compare)
    Determines if this object is greater than the given Angle.
    boolean
    gte(Angle compare)
    Determines if this object is greater than or equal to the given Angle.
    int
    Returns a hash code value for the object.
    boolean
    lt(Angle compare)
    Determines if this object is less than the given Angle.
    boolean
    lte(Angle compare)
    Determines if this object is less than or equal to the given Angle.
    subtract(Angle subtract)
    Returns an Angle representing the subtraction of this object and the given Angle.
    Returns a string representation of this object.
    static Angle
    The zero angle.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ZERO

      public static final Angle ZERO
      The Angle corresponding to the 0 angle.
  • Constructor Details

    • Angle

      public Angle()
      Instantiates an Angle of 0°.
    • Angle

      public Angle(Angle source)
      Deprecated.
      Angle is immutable, so there is no need to copy an instance.
      Instantiates an Angle from the given Angle.
      Parameters:
      source - the Angle to copy to this object.
    • Angle

      public Angle(double dDegrees)
      Instantiates an Angle from the given double value. Angle values are expressed in degrees: e.g., 15.5 means 15 and 1/2 degrees, not 15 degrees and 50 minutes.
      Parameters:
      dDegrees - the degree of the angle.
    • Angle

      public Angle(int nDegrees)
      Instantiates an Angle from the given int value.
      Parameters:
      nDegrees - the degree of the angle.
    • Angle

      public Angle(long nDegrees)
      Instantiates an Angle from the given long value.
      Parameters:
      nDegrees - the degree of the angle.
    • Angle

      public Angle(int value, boolean isResolved)
      Instantiates an Angle from the given int value.
      Parameters:
      value - the value of the angle.
      isResolved - when true, interpret the angle value as in unit of internal resolution; when false, interpret the angle value as a degree.
  • Method Details

    • add

      public Angle add(Angle oAdd)
      Returns an Angle representing the addition of this object and the given Angle.
      Parameters:
      oAdd - the Angle to subtract.
      Returns:
      an angle of the addition.
    • degrees

      public int degrees()
      Gets this object's angle value.
      Returns:
      the angle, in degrees, rounded to the closest integer.
    • equals

      public boolean equals(Object object)
      Determines if this object is equal to the given Object.
      Overrides:
      equals in class Object
      Parameters:
      object - the angle to compare.
      Returns:
      true if equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
    • getAngle

      public double getAngle()
      Gets this object's angle value.
      Returns:
      the angle in degrees.
    • gt

      public boolean gt(Angle compare)
      Determines if this object is greater than the given Angle.
      Parameters:
      compare - the Angle to compare.
      Returns:
      true if greater than, false otherwise.
    • gte

      public boolean gte(Angle compare)
      Determines if this object is greater than or equal to the given Angle.
      Parameters:
      compare - the Angle to compare.
      Returns:
      true if greater than, or equal to, false otherwise.
    • lt

      public boolean lt(Angle compare)
      Determines if this object is less than the given Angle.
      Parameters:
      compare - the Angle to compare.
      Returns:
      true if less than, false otherwise.
    • lte

      public boolean lte(Angle compare)
      Determines if this object is less than or equal to the given Angle.
      Parameters:
      compare - the Angle to compare.
      Returns:
      true if less than or equal to, false otherwise.
    • subtract

      public Angle subtract(Angle subtract)
      Returns an Angle representing the subtraction of this object and the given Angle.
      Parameters:
      subtract - the Angle to subtract.
      Returns:
      an angle of the subtraction.
    • toString

      public String toString()
      Returns a string representation of this object.
      Overrides:
      toString in class Object
    • zero

      public static Angle zero()
      The zero angle.
      Returns:
      the angle equal to 0°.