Package org.cip4.jdflib.datatypes
Class JDFXYPair
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,JDFBaseDataTypes
This class represents a x y pair (JDFXYPair). It is a whitespace separated list of 2 numbers.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.cip4.jdflib.datatypes.JDFNumList
JDFNumList.NormComparator, JDFNumList.VolumeComparatorNested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue -
Field Summary
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementDataFields inherited from class java.util.AbstractList
modCountFields inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION -
Constructor Summary
ConstructorsConstructorDescriptionconstructs a xy pair with all values set to 0.0 DoubleJDFXYPair(double x, double y) constructs a new JDFXYPair with the given double valuesJDFXYPair(int x, int y) constructs a new JDFXYPair with the given double valuesconstructs a xy pair with all values set via a String if a single numerical value is specified, s is padded with " 0"Deprecated.use typesafe constructorsJDFXYPair(JDFNumList nl) constructs a xy pair with all values set via a JDFNumberListconstructs a xy pair with all values set via a JDFNumberListconstructs a xy pair with all values set via a JDFNumberList -
Method Summary
Modifier and TypeMethodDescriptionclone()static JDFXYPairfactory for JDFXYPair that silently returns null in case of illegal stringsdoublegetX()getX - returns the x coordinatedoublegetY()getY - returns the y coordinatebooleanisGreater - equality operator >booleanisGreaterOrEqual - equality operator >=booleanisLess - equality operator <booleanisLessOrEqual - equality operator <=booleanreturn true if y is > xbooleanisValid()isValid - valid if the size of the vector is 2 and all instances are Double typessetString with some heuristics to allow for a single numerical or values like "i/j"voidsetX(double x) setX - sets the x coordinatevoidsetY(double y) setY - sets the y coordinateshift(double x, double y) voidswapXY()swap x and y coordinates -Methods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, contains, containsAll, copyNumList, doubleAt, elementAt, equals, getDouble, getDoubleList, getDoubleVector, getIntArray, getString, getString, hashCode, intAt, isValidString, matches, max, min, norm, removeElementAt, replaceElementAt, scale, scale, scaleFromCM, scaleFromCM, scaleFromMM, scaleFromMM, scaleToCM, scaleToCM, scaleToMM, scaleToMM, set, setX, shift, sort, subtract, toString, unify, volumeMethods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, forEach, get, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Constructor Details
-
JDFXYPair
public JDFXYPair()constructs a xy pair with all values set to 0.0 Double -
JDFXYPair
Deprecated.use typesafe constructorsconstructs a xy pair with all values set via a Vector of Double objects- Parameters:
v- Vector of Double- Throws:
DataFormatException- - if the Vector has not a valid format
-
JDFXYPair
constructs a xy pair with all values set via a String if a single numerical value is specified, s is padded with " 0"- Parameters:
s- the given String- Throws:
DataFormatException- - if the String has not a valid format
-
JDFXYPair
constructs a xy pair with all values set via a JDFNumberList- Parameters:
nl- the given number list- Throws:
DataFormatException- - if the JDFNumberList has not a valid format
-
JDFXYPair
constructs a xy pair with all values set via a JDFNumberList- Parameters:
shape- the given number list
-
JDFXYPair
constructs a xy pair with all values set via a JDFNumberList- Parameters:
nl- the given number list
-
JDFXYPair
public JDFXYPair(double x, double y) constructs a new JDFXYPair with the given double values- Parameters:
x- the x coordinatey- the y coordinate
-
JDFXYPair
public JDFXYPair(int x, int y) constructs a new JDFXYPair with the given double values- Parameters:
x- the x coordinatey- the y coordinate
-
-
Method Details
-
createXYPair
factory for JDFXYPair that silently returns null in case of illegal strings- Parameters:
s- the string to parse- Returns:
- the JDFXYPair, null if s is not compatible
-
isValid
isValid - valid if the size of the vector is 2 and all instances are Double types- Specified by:
isValidin classJDFNumList- Returns:
- boolean - true if all instances are Double or Integer types
- Throws:
DataFormatException- - if the Vector has not a valid format
-
getX
public double getX()getX - returns the x coordinate- Returns:
- double - the x coordinate
-
getPoint2D
- Returns:
-
setX
public void setX(double x) setX - sets the x coordinate- Parameters:
x- the x coordinate
-
getY
public double getY()getY - returns the y coordinate- Returns:
- double - the y coordinate
-
swapXY
public void swapXY()swap x and y coordinates - -
setY
public void setY(double y) setY - sets the y coordinate- Parameters:
y- the y coordinate
-
isGreaterOrEqual
isGreaterOrEqual - equality operator >=- Parameters:
x- the JDFXYPair object to compare to- Returns:
- boolean - true if this >= x
-
isLessOrEqual
isLessOrEqual - equality operator <=- Parameters:
x- the JDFXYPair object to compare to- Returns:
- boolean - true if this <= x
-
isGreater
isGreater - equality operator >- Parameters:
x- the JDFXYPair object to compare to- Returns:
- boolean - true if this > x
-
isPortrait
public boolean isPortrait()return true if y is > x- Returns:
-
isLess
isLess - equality operator <- Parameters:
x- the JDFXYPair object to compare to- Returns:
- boolean - true if this < x
-
setString
setString with some heuristics to allow for a single numerical or values like "i/j"- Overrides:
setStringin classJDFNumList- Throws:
DataFormatException- See Also:
-
shift
- Parameters:
x-y-- Returns:
-
shift
- Parameters:
xy-- Returns:
-
clone
- Overrides:
clonein classJDFNumList- See Also:
-