org.cip4.jdflib.datatypes
Class JDFXYPair

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<Object>
              extended by org.cip4.jdflib.datatypes.JDFNumList
                  extended by org.cip4.jdflib.datatypes.JDFXYPair
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Object>, Collection<Object>, List<Object>, 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 interface org.cip4.jdflib.datatypes.JDFBaseDataTypes
JDFBaseDataTypes.EnumFitsValue
 
Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
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
JDFXYPair()
          constructs a xy pair with all values set to 0.0 Double
JDFXYPair(double x, double y)
          constructs a new JDFXYPair with the given double values
JDFXYPair(JDFNumList nl)
          constructs a xy pair with all values set via a JDFNumberList
JDFXYPair(JDFShape shape)
          constructs a xy pair with all values set via a JDFNumberList
JDFXYPair(JDFXYPair nl)
          constructs a xy pair with all values set via a JDFNumberList
JDFXYPair(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(Vector v)
          Deprecated. use typesafe constructors
 
Method Summary
static JDFXYPair createXYPair(String s)
          factory for JDFXYPair that silently returns null in case of illegal strings
 boolean equals(Object other)
          equals - returns true if both JDFShapes are equal, otherwise false
 double getX()
          getX - returns the x coordinate
 double getY()
          getY - returns the y coordinate
 boolean isGreater(JDFXYPair x)
          isGreater - equality operator >
 boolean isGreaterOrEqual(JDFXYPair x)
          isGreaterOrEqual - equality operator >=
 boolean isLess(JDFXYPair x)
          isLess - equality operator <
 boolean isLessOrEqual(JDFXYPair x)
          isLessOrEqual - equality operator <=
 boolean isPortrait()
          return true if y is > x
 boolean isValid()
          isValid - valid if the size of the vector is 2 and all instances are Double types
 void setString(String string)
          setString with some heuristics to allow for a single numerical or values like "i/j"
 void setX(double x)
          setX - sets the x coordinate
 void setY(double y)
          setY - sets the y coordinate
 void swapXY()
          swap x and y coordinates -
 
Methods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, clone, contains, containsAll, copyNumList, doubleAt, elementAt, getDoubleList, getIntArray, getString, getString, hashCode, isValidString, matches, removeElementAt, replaceElementAt, scale, scaleFromCM, scaleFromMM, scaleToCM, scaleToMM, set, subtract, toString, unify
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elements, ensureCapacity, firstElement, get, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

JDFXYPair

public JDFXYPair()
constructs a xy pair with all values set to 0.0 Double


JDFXYPair

@Deprecated
public JDFXYPair(Vector v)
          throws DataFormatException
Deprecated. use typesafe constructors

constructs 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

public JDFXYPair(String s)
          throws DataFormatException
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

public JDFXYPair(JDFNumList nl)
          throws DataFormatException
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

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 coordinate
y - the y coordinate
Method Detail

createXYPair

public static JDFXYPair createXYPair(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 DataFormatException
isValid - valid if the size of the vector is 2 and all instances are Double types

Specified by:
isValid in class JDFNumList
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

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

equals

public boolean equals(Object other)
equals - returns true if both JDFShapes are equal, otherwise false

Specified by:
equals in interface Collection<Object>
Specified by:
equals in interface List<Object>
Overrides:
equals in class JDFNumList
Returns:
boolean - true if equal otherwise false

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 void setString(String string)
               throws DataFormatException
setString with some heuristics to allow for a single numerical or values like "i/j"

Overrides:
setString in class JDFNumList
Throws:
DataFormatException
See Also:
JDFNumList.setString(java.lang.String)


Copyright © 2013. All Rights Reserved.