Package com.adobe.xfa.ut
Class CoordPair
- java.lang.Object
-
- com.adobe.xfa.ut.CoordPair
-
public final class CoordPair extends java.lang.ObjectA class to describe a coordinate (in Euclidean space). It consists of a pair of (x, y) values.Instances of this class are immutable. All change operations return a new instance of this
CoordPairclass.
-
-
Constructor Summary
Constructors Constructor Description CoordPair()Instantiates aCoordPairwith the coordinate (0, 0).CoordPair(CoordPair source)Deprecated.CoordPair is immutable, so there is no need to copy an instance.CoordPair(UnitSpan x, UnitSpan y)Instantiates aCoordPairfrom the givenUnitSpan(s).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CoordPairadd(CoordPair add)Returns aCoordPairrepresenting the addition of this object and the givenCoordPair.booleanequals(java.lang.Object object)Determines if this object is equal to the givenObject.CoordPairgrid(CoordPair grid)Returns aCoordPairrepresenting thisCoordPairsnaped to the nearest grid coordinates of the givenCoordPair.booleangt(CoordPair compare)Determines if this object is greater than the givenCoordPair.inthashCode()booleanlt(CoordPair compare)Determines if this object is less than the givenCoordPair.booleannotEquals(java.lang.Object compare)Determines if this object is not equal to the givenObject.CoordPairrotatePoint(CoordPair oRPoint, Angle oAngle)Returns aCoordPairrepresenting the rotation of this object through the givenAngleand about the givenCoordPair.CoordPairround(CoordPair round)Returns aCoordPairrepresenting the rounding of this object's coordinates to the givenCoordPair.CoordPairscale(double dXScale, double dYScale)Returns aCoordPairrepresenting the scaling of this object to the given scaling factors.CoordPairsubtract(CoordPair subtract)Returns aCoordPairrepresenting the subtraction of this object and the givenCoordPair.UnitSpanx()Gets this object's x coordinate.UnitSpany()Gets this object's y coordinate.static CoordPairzeroZero()The zero (0, 0) coordinate.
-
-
-
Field Detail
-
ZERO_ZERO
public static final CoordPair ZERO_ZERO
TheCoordPaircorresponding to the (0, 0) origin.
-
-
Constructor Detail
-
CoordPair
public CoordPair()
Instantiates aCoordPairwith the coordinate (0, 0).- See Also:
zeroZero()
-
CoordPair
public CoordPair(CoordPair source)
Deprecated.CoordPair is immutable, so there is no need to copy an instance.Instantiates aCoordPairfrom the givenCoordPair.- Parameters:
source- theCoordPairto copy to this object.
-
-
Method Detail
-
grid
public CoordPair grid(CoordPair grid)
Returns aCoordPairrepresenting thisCoordPairsnaped to the nearest grid coordinates of the givenCoordPair.- Parameters:
grid- the grid coordinate- Returns:
- a coordinate aligned to the grid.
- See Also:
UnitSpan.grid(UnitSpan)
-
round
public CoordPair round(CoordPair round)
Returns aCoordPairrepresenting the rounding of this object's coordinates to the givenCoordPair.- Parameters:
round- the rounding coordinate.- Returns:
- a coordinate of the rounding.
- See Also:
UnitSpan.round(UnitSpan)
-
x
public UnitSpan x()
Gets this object's x coordinate.- Returns:
- the x coordinate.
-
y
public UnitSpan y()
Gets this object's y coordinate.- Returns:
- the y coordinate.
-
rotatePoint
public CoordPair rotatePoint(CoordPair oRPoint, Angle oAngle)
Returns aCoordPairrepresenting the rotation of this object through the givenAngleand about the givenCoordPair.- Parameters:
oRPoint- the point of rotation.oAngle- the angle of rotation.- Returns:
- a coordinate of the rotation.
-
equals
public boolean equals(java.lang.Object object)
Determines if this object is equal to the givenObject. Comparisons with instances of non-CoordPairobjects are never equal. When comparing instances ofCoordPairobjects, the object'sUnitSpancoordinates are each compared for equality.- Overrides:
equalsin classjava.lang.Object- Parameters:
object- theObjectto compare.- Returns:
- true if equal, false otherwise.
- See Also:
UnitSpan.equals(Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
notEquals
public boolean notEquals(java.lang.Object compare)
Determines if this object is not equal to the givenObject. Comparisons with instances of non-CoordPairobjects are always not equal. When comparing instances ofCoordPairobjects, the object'sUnitSpancoordinates are each compared for inequality.- Parameters:
compare- theObjectto compare.- Returns:
- true if not equal, false othewise.
- See Also:
equals(Object)
-
add
public CoordPair add(CoordPair add)
Returns aCoordPairrepresenting the addition of this object and the givenCoordPair.- Parameters:
add- theCoordPairto add.- Returns:
- a coordinate of the addition.
-
subtract
public CoordPair subtract(CoordPair subtract)
Returns aCoordPairrepresenting the subtraction of this object and the givenCoordPair.- Parameters:
subtract- theCoordPairto subtract.- Returns:
- a coordinate of the subtraction.
-
scale
public CoordPair scale(double dXScale, double dYScale)
Returns aCoordPairrepresenting the scaling of this object to the given scaling factors.- Parameters:
dXScale- the X coordinate scaling factor.dYScale- the Y coordinate scaling factor.- Returns:
- a coordinate of the scaling.
-
gt
public boolean gt(CoordPair compare)
Determines if this object is greater than the givenCoordPair. Coordinate comparisons rules are as follows: order by the y coordnate first, and if equal, then by the x coordinate.- Parameters:
compare- theCoordPairto compare.- Returns:
- true if greater than, false otherwise.
-
lt
public boolean lt(CoordPair compare)
Determines if this object is less than the givenCoordPair. Coordinate comparisons rules as as follows: order by the y coordnate first, and if equal, then by the x coordinate.- Parameters:
compare- theCoordPairto compare.- Returns:
- true if greater than, false otherwise.
-
zeroZero
public static CoordPair zeroZero()
The zero (0, 0) coordinate.- Returns:
- the coordinate equal to (0, 0).
-
-