Package com.adobe.xfa.ut
Class Angle
- java.lang.Object
-
- com.adobe.xfa.ut.Angle
-
public final class Angle extends java.lang.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.
-
-
Constructor Summary
Constructors Constructor Description Angle()
Instantiates anAngle
of 0°.Angle(double dDegrees)
Instantiates anAngle
from the given double value.Angle(int nDegrees)
Instantiates anAngle
from the given int value.Angle(int value, boolean isResolved)
Instantiates anAngle
from the given int value.Angle(long nDegrees)
Instantiates anAngle
from the given long value.Angle(Angle source)
Deprecated.Angle is immutable, so there is no need to copy an instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Angle
add(Angle oAdd)
Returns anAngle
representing the addition of this object and the givenAngle
.int
degrees()
Gets this object's angle value.boolean
equals(java.lang.Object object)
Determines if this object is equal to the given Object.double
getAngle()
Gets this object's angle value.boolean
gt(Angle compare)
Determines if this object is greater than the givenAngle
.boolean
gte(Angle compare)
Determines if this object is greater than or equal to the givenAngle
.int
hashCode()
Returns a hash code value for the object.boolean
lt(Angle compare)
Determines if this object is less than the givenAngle
.boolean
lte(Angle compare)
Determines if this object is less than or equal to the givenAngle
.Angle
subtract(Angle subtract)
Returns anAngle
representing the subtraction of this object and the givenAngle
.java.lang.String
toString()
Returns a string representation of this object.static Angle
zero()
The zero angle.
-
-
-
Field Detail
-
ZERO
public static final Angle ZERO
TheAngle
corresponding to the 0 angle.
-
-
Constructor Detail
-
Angle
public Angle()
Instantiates anAngle
of 0°.
-
Angle
public Angle(Angle source)
Deprecated.Angle is immutable, so there is no need to copy an instance.Instantiates anAngle
from the givenAngle
.- Parameters:
source
- theAngle
to copy to this object.
-
Angle
public Angle(double dDegrees)
Instantiates anAngle
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 anAngle
from the given int value.- Parameters:
nDegrees
- the degree of the angle.
-
Angle
public Angle(long nDegrees)
Instantiates anAngle
from the given long value.- Parameters:
nDegrees
- the degree of the angle.
-
Angle
public Angle(int value, boolean isResolved)
Instantiates anAngle
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 Detail
-
add
public Angle add(Angle oAdd)
Returns anAngle
representing the addition of this object and the givenAngle
.- Parameters:
oAdd
- theAngle
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(java.lang.Object object)
Determines if this object is equal to the given Object.- Overrides:
equals
in classjava.lang.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 classjava.lang.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 givenAngle
.- Parameters:
compare
- theAngle
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 givenAngle
.- Parameters:
compare
- theAngle
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 givenAngle
.- Parameters:
compare
- theAngle
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 givenAngle
.- Parameters:
compare
- theAngle
to compare.- Returns:
- true if less than or equal to, false otherwise.
-
subtract
public Angle subtract(Angle subtract)
Returns anAngle
representing the subtraction of this object and the givenAngle
.- Parameters:
subtract
- theAngle
to subtract.- Returns:
- an angle of the subtraction.
-
toString
public java.lang.String toString()
Returns a string representation of this object.- Overrides:
toString
in classjava.lang.Object
-
zero
public static Angle zero()
The zero angle.- Returns:
- the angle equal to 0°.
-
-