Package org.cip4.jdflib.datatypes
Class JDFXYPair
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<java.lang.Object>
-
- org.cip4.jdflib.datatypes.JDFNumList
-
- org.cip4.jdflib.datatypes.JDFXYPair
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<java.lang.Object>,java.util.Collection<java.lang.Object>,java.util.List<java.lang.Object>,java.util.RandomAccess,JDFBaseDataTypes
public class JDFXYPair extends JDFNumList
This class represents a x y pair (JDFXYPair). It is a whitespace separated list of 2 numbers.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.cip4.jdflib.datatypes.JDFNumList
JDFNumList.NormComparator, JDFNumList.VolumeComparator
-
Nested classes/interfaces inherited from interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue
-
-
Field Summary
-
Fields 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
Constructors Constructor Description JDFXYPair()constructs 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 valuesJDFXYPair(java.lang.String s)constructs a xy pair with all values set via a String if a single numerical value is specified, s is padded with " 0"JDFXYPair(java.util.Vector v)Deprecated.use typesafe constructorsJDFXYPair(JDFNumList nl)constructs a xy pair with all values set via a JDFNumberListJDFXYPair(JDFShape shape)constructs a xy pair with all values set via a JDFNumberListJDFXYPair(JDFXYPair nl)constructs a xy pair with all values set via a JDFNumberList
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JDFXYPairclone()static JDFXYPaircreateXYPair(java.lang.String s)factory for JDFXYPair that silently returns null in case of illegal stringsjava.awt.geom.Point2DgetPoint2D()doublegetX()getX - returns the x coordinatedoublegetY()getY - returns the y coordinatebooleanisGreater(JDFXYPair x)isGreater - equality operator >booleanisGreaterOrEqual(JDFXYPair x)isGreaterOrEqual - equality operator >=booleanisLess(JDFXYPair x)isLess - equality operator <booleanisLessOrEqual(JDFXYPair x)isLessOrEqual - equality operator <=booleanisPortrait()return true if y is > xbooleanisValid()isValid - valid if the size of the vector is 2 and all instances are Double typesJDFXYPairsetString(java.lang.String string)setString 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 coordinateJDFXYPairshift(double x, double y)JDFXYPairshift(JDFXYPair xy)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, volume
-
Methods 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, trimToSize
-
-
-
-
Constructor Detail
-
JDFXYPair
public JDFXYPair()
constructs a xy pair with all values set to 0.0 Double
-
JDFXYPair
@Deprecated public JDFXYPair(java.util.Vector v) throws java.util.zip.DataFormatExceptionDeprecated.use typesafe constructorsconstructs a xy pair with all values set via a Vector of Double objects- Parameters:
v- Vector of Double- Throws:
java.util.zip.DataFormatException- - if the Vector has not a valid format
-
JDFXYPair
public JDFXYPair(java.lang.String s) throws java.util.zip.DataFormatExceptionconstructs 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:
java.util.zip.DataFormatException- - if the String has not a valid format
-
JDFXYPair
public JDFXYPair(JDFNumList nl) throws java.util.zip.DataFormatException
constructs a xy pair with all values set via a JDFNumberList- Parameters:
nl- the given number list- Throws:
java.util.zip.DataFormatException- - if the JDFNumberList has not a valid format
-
JDFXYPair
public JDFXYPair(JDFShape shape)
constructs a xy pair with all values set via a JDFNumberList- Parameters:
shape- the given number list
-
JDFXYPair
public JDFXYPair(JDFXYPair nl)
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 Detail
-
createXYPair
public static JDFXYPair createXYPair(java.lang.String s)
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
public boolean isValid() throws java.util.zip.DataFormatExceptionisValid - 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:
java.util.zip.DataFormatException- - if the Vector has not a valid format
-
getX
public double getX()
getX - returns the x coordinate- Returns:
- double - the x coordinate
-
getPoint2D
public java.awt.geom.Point2D 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
public boolean isGreaterOrEqual(JDFXYPair x)
isGreaterOrEqual - equality operator >=- Parameters:
x- the JDFXYPair object to compare to- Returns:
- boolean - true if this >= x
-
isLessOrEqual
public boolean isLessOrEqual(JDFXYPair x)
isLessOrEqual - equality operator <=- Parameters:
x- the JDFXYPair object to compare to- Returns:
- boolean - true if this <= x
-
isGreater
public boolean isGreater(JDFXYPair x)
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
public boolean isLess(JDFXYPair x)
isLess - equality operator <- Parameters:
x- the JDFXYPair object to compare to- Returns:
- boolean - true if this < x
-
setString
public JDFXYPair setString(java.lang.String string) throws java.util.zip.DataFormatException
setString with some heuristics to allow for a single numerical or values like "i/j"- Overrides:
setStringin classJDFNumList- Throws:
java.util.zip.DataFormatException- See Also:
JDFNumList.setString(java.lang.String)
-
shift
public JDFXYPair shift(double x, double y)
- Parameters:
x-y-- Returns:
-
clone
public JDFXYPair clone()
- Overrides:
clonein classJDFNumList- See Also:
JDFNumList.clone()
-
-