org.cip4.jdflib.datatypes
Class JDFShape

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.JDFShape
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Object>, Collection<Object>, List<Object>, RandomAccess, JDFBaseDataTypes

public class JDFShape
extends JDFNumList

This class is a representation of a JDFShape. It is a blank separated list of double values consisting of a width(x), a height(y) and a depth(z) value. this spans a standard right-handed xyz coordinate system

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
JDFShape()
          constructor - constructs a shape with all values set to 0.0 Double
JDFShape(double x, double y)
          constructor - constructs a new JDFShape with the given 2 double values third is default = 0.
JDFShape(double x, double y, double z)
          constructor - constructs a new JDFShape with the given double values
JDFShape(JDFNumList nl)
          constructor - constructs a shape with all values set via a JDFNumberList
JDFShape(JDFShape nl)
          constructor - constructs a shape with all values set via a JDFNumberList
JDFShape(String s)
          constructor - constructs a shape with all values set via a String
JDFShape(Vector v)
          Deprecated. use typesafe constructors
 
Method Summary
static JDFShape createShape(String s)
          factory for JDFShape that silently returns null in case of illegal strings
 boolean equals(Object other)
          equals - returns true if both JDFShapes are equal, otherwise false
 double getHeight()
          Deprecated. use getY - attention height and width were accidentally exchanged
 double getLength()
          Deprecated. use getZ
 double getWidth()
          Deprecated. use getX - attention height and width were accidentally exchanged
 double getX()
          getX - returns the width
 double getY()
          getY - returns the width
 double getZ()
          getZ - returns the z value
 int hashCode()
          hashCode complements equals() to fulfill the equals/hashCode contract
 boolean isGreater(JDFShape x)
          isGreater - equality operator >
 boolean isGreaterOrEqual(JDFShape x)
          isGreaterOrEqual - equality operator >=
 boolean isLess(JDFShape x)
          isLess - equality operator <
 boolean isLessOrEqual(JDFShape x)
          isLessOrEqual - equality operator <=
 boolean isValid()
          isValid - true if the size of the vector is 3 and all instances are Double types
 void setHeight(double height)
          Deprecated. attention height and width were accidentally exchanged
 void setLength(double length)
          Deprecated.  
 void setWidth(double width)
          Deprecated. attention height and width were accidentally exchanged
 void setX(double x)
          setWidth - sets the x value
 void setY(double y)
          setY - sets the height
 void setZ(double z)
          set the z value
 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, isValidString, matches, removeElementAt, replaceElementAt, scale, scaleFromCM, scaleFromMM, scaleToCM, scaleToMM, set, setString, 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

JDFShape

public JDFShape()
constructor - constructs a shape with all values set to 0.0 Double


JDFShape

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

constructor - constructs a shape with all values set via a Vector of Double objects

Parameters:
v - the given vector
Throws:
DataFormatException - - if the Vector has not a valid format

JDFShape

public JDFShape(String s)
         throws DataFormatException
constructor - constructs a shape with all values set via a String

Parameters:
s - the given String
Throws:
DataFormatException - - if the String has not a valid format

JDFShape

public JDFShape(JDFNumList nl)
         throws DataFormatException
constructor - constructs a shape with all values set via a JDFNumberList

Parameters:
nl - the given number list
Throws:
DataFormatException - - if the JDFNumberList has not a valid format

JDFShape

public JDFShape(JDFShape nl)
constructor - constructs a shape with all values set via a JDFNumberList

Parameters:
nl - the given number list

JDFShape

public JDFShape(double x,
                double y,
                double z)
constructor - constructs a new JDFShape with the given double values

Parameters:
x - the x value
y - the y value
z - the z value

JDFShape

public JDFShape(double x,
                double y)
constructor - constructs a new JDFShape with the given 2 double values third is default = 0.

Parameters:
x - the width
y - the height
Method Detail

createShape

public static JDFShape createShape(String s)
factory for JDFShape that silently returns null in case of illegal strings

Parameters:
s - the string to parse - if JDFXYPair compatible, a 0 z dimension value is assumed
Returns:
the JDFShape, null if s is not compatible

swapXY

public void swapXY()
swap x and y coordinates -


isValid

public boolean isValid()
                throws DataFormatException
isValid - true if the size of the vector is 3 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

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

hashCode

public int hashCode()
hashCode complements equals() to fulfill the equals/hashCode contract

Specified by:
hashCode in interface Collection<Object>
Specified by:
hashCode in interface List<Object>
Overrides:
hashCode in class JDFNumList

isGreaterOrEqual

public boolean isGreaterOrEqual(JDFShape x)
isGreaterOrEqual - equality operator >=

Parameters:
x - the JDFShape object to compare to
Returns:
boolean - true if this >= x

isLessOrEqual

public boolean isLessOrEqual(JDFShape x)
isLessOrEqual - equality operator <=

Parameters:
x - the JDFShape object to compare to
Returns:
boolean - true if this <= x

isGreater

public boolean isGreater(JDFShape x)
isGreater - equality operator >

Parameters:
x - the JDFShape object to compare to
Returns:
boolean - true if this > x

isLess

public boolean isLess(JDFShape x)
isLess - equality operator <

Parameters:
x - the JDFShape object to compare to
Returns:
boolean - true if this < x

getHeight

@Deprecated
public double getHeight()
Deprecated. use getY - attention height and width were accidentally exchanged

getHeight - returns the height

Returns:
double - the height

getY

public double getY()
getY - returns the width

Returns:
double - the width

setHeight

@Deprecated
public void setHeight(double height)
Deprecated. attention height and width were accidentally exchanged

setHeight - sets the height

Parameters:
height - the height

setY

public void setY(double y)
setY - sets the height

Parameters:
y - the height

getWidth

@Deprecated
public double getWidth()
Deprecated. use getX - attention height and width were accidentally exchanged

getWidth - returns the width

Returns:
double - the width

getX

public double getX()
getX - returns the width

Returns:
double - the width

setX

public void setX(double x)
setWidth - sets the x value

Parameters:
x - the width

setWidth

@Deprecated
public void setWidth(double width)
Deprecated. attention height and width were accidentally exchanged

setWidth - sets the width

Parameters:
width - the width

getLength

@Deprecated
public double getLength()
Deprecated. use getZ

getLength - returns the length

Returns:
double - the length

getZ

public double getZ()
getZ - returns the z value

Returns:
double - the length

setLength

@Deprecated
public void setLength(double length)
Deprecated. 

setLength - sets the length

Parameters:
length - the length

setZ

public void setZ(double z)
set the z value

Parameters:
z -


Copyright © 2013. All Rights Reserved.