Package org.cip4.jdflib.datatypes
Class JDFShape
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,JDFBaseDataTypes
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:
-
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
ConstructorsConstructorDescriptionJDFShape()constructor - constructs a shape with all values set to 0.0 DoubleJDFShape(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 valuesconstructor - constructs a shape with all values set via a StringDeprecated.use typesafe constructorsJDFShape(JDFNumList nl) constructor - constructs a shape with all values set via a JDFNumberListconstructor - constructs a shape with all values set via a JDFNumberList -
Method Summary
Modifier and TypeMethodDescriptionstatic JDFShapefactory for JDFShape that silently returns null in case of illegal stringsbooleanequals - returns true if both JDFShapes are equal, otherwise falsedoubleDeprecated.use getY - attention height and width were accidentally exchangeddoubleDeprecated.use getZdoublegetWidth()Deprecated.use getX - attention height and width were accidentally exchangeddoublegetX()getX - returns the widthdoublegetY()getY - returns the widthdoublegetZ()getZ - returns the z valueinthashCode()hashCode complements equals() to fulfill the equals/hashCode contractbooleanisGreater - equality operator >booleanisGreaterOrEqual - equality operator >=booleanisLess - equality operator <booleanisLessOrEqual - equality operator <=booleanisValid()isValid - true if the size of the vector is 3 and all instances are Double typesvoidsetHeight(double height) Deprecated.attention height and width were accidentally exchangedvoidsetLength(double length) Deprecated.voidsetWidth(double width) Deprecated.attention height and width were accidentally exchangedvoidsetX(double x) setWidth - sets the x valuevoidsetY(double y) setY - sets the heightvoidsetZ(double z) set the z valuevoidswapXY()swap x and y coordinates -Methods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, clone, contains, containsAll, copyNumList, doubleAt, elementAt, getDouble, getDoubleList, getDoubleVector, getIntArray, getString, getString, intAt, isValidString, matches, max, min, norm, removeElementAt, replaceElementAt, scale, scale, scaleFromCM, scaleFromCM, scaleFromMM, scaleFromMM, scaleToCM, scaleToCM, scaleToMM, scaleToMM, set, setString, 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
-
JDFShape
public JDFShape()constructor - constructs a shape with all values set to 0.0 Double -
JDFShape
Deprecated.use typesafe constructorsconstructor - 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
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
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
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 valuey- the y valuez- 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 widthy- the height
-
-
Method Details
-
createShape
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
isValid - true if the size of the vector is 3 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
-
equals
equals - returns true if both JDFShapes are equal, otherwise false- Specified by:
equalsin interfaceCollection<Object>- Specified by:
equalsin interfaceList<Object>- Overrides:
equalsin classJDFNumList- Returns:
- boolean - true if equal otherwise false
-
hashCode
public int hashCode()hashCode complements equals() to fulfill the equals/hashCode contract- Specified by:
hashCodein interfaceCollection<Object>- Specified by:
hashCodein interfaceList<Object>- Overrides:
hashCodein classJDFNumList
-
isGreaterOrEqual
isGreaterOrEqual - equality operator >=- Parameters:
x- the JDFShape object to compare to- Returns:
- boolean - true if this >= x
-
isLessOrEqual
isLessOrEqual - equality operator <=- Parameters:
x- the JDFShape object to compare to- Returns:
- boolean - true if this <= x
-
isGreater
isGreater - equality operator >- Parameters:
x- the JDFShape object to compare to- Returns:
- boolean - true if this > x
-
isLess
isLess - equality operator <- Parameters:
x- the JDFShape object to compare to- Returns:
- boolean - true if this < x
-
getHeight
Deprecated.use getY - attention height and width were accidentally exchangedgetHeight - returns the height- Returns:
- double - the height
-
getY
public double getY()getY - returns the width- Returns:
- double - the width
-
setHeight
Deprecated.attention height and width were accidentally exchangedsetHeight - sets the height- Parameters:
height- the height
-
setY
public void setY(double y) setY - sets the height- Parameters:
y- the height
-
getWidth
Deprecated.use getX - attention height and width were accidentally exchangedgetWidth - 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.attention height and width were accidentally exchangedsetWidth - sets the width- Parameters:
width- the width
-
getLength
Deprecated.use getZgetLength - returns the length- Returns:
- double - the length
-
getZ
public double getZ()getZ - returns the z value- Returns:
- double - the length
-
setLength
Deprecated.setLength - sets the length- Parameters:
length- the length
-
setZ
public void setZ(double z) set the z value- Parameters:
z-
-