Package org.cip4.jdflib.datatypes
Class JDFShape
- 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.JDFShape
-
- 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 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 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 JDFShape()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 valuesJDFShape(java.lang.String s)constructor - constructs a shape with all values set via a StringJDFShape(java.util.Vector v)Deprecated.use typesafe constructorsJDFShape(JDFNumList nl)constructor - constructs a shape with all values set via a JDFNumberListJDFShape(JDFShape nl)constructor - constructs a shape with all values set via a JDFNumberList
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static JDFShapecreateShape(java.lang.String s)factory for JDFShape that silently returns null in case of illegal stringsbooleanequals(java.lang.Object other)equals - returns true if both JDFShapes are equal, otherwise falsedoublegetHeight()Deprecated.use getY - attention height and width were accidentally exchangeddoublegetLength()Deprecated.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(JDFShape x)isGreater - equality operator >booleanisGreaterOrEqual(JDFShape x)isGreaterOrEqual - equality operator >=booleanisLess(JDFShape x)isLess - equality operator <booleanisLessOrEqual(JDFShape x)isLessOrEqual - 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, 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
-
JDFShape
public JDFShape()
constructor - constructs a shape with all values set to 0.0 Double
-
JDFShape
@Deprecated public JDFShape(java.util.Vector v) throws java.util.zip.DataFormatExceptionDeprecated.use typesafe constructorsconstructor - constructs a shape with all values set via a Vector of Double objects- Parameters:
v- the given vector- Throws:
java.util.zip.DataFormatException- - if the Vector has not a valid format
-
JDFShape
public JDFShape(java.lang.String s) throws java.util.zip.DataFormatExceptionconstructor - constructs a shape with all values set via a String- Parameters:
s- the given String- Throws:
java.util.zip.DataFormatException- - if the String has not a valid format
-
JDFShape
public JDFShape(JDFNumList nl) throws java.util.zip.DataFormatException
constructor - constructs a shape 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
-
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 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 Detail
-
createShape
public static JDFShape createShape(java.lang.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 java.util.zip.DataFormatExceptionisValid - 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:
java.util.zip.DataFormatException- - if the Vector has not a valid format
-
equals
public boolean equals(java.lang.Object other)
equals - returns true if both JDFShapes are equal, otherwise false- Specified by:
equalsin interfacejava.util.Collection<java.lang.Object>- Specified by:
equalsin interfacejava.util.List<java.lang.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 interfacejava.util.Collection<java.lang.Object>- Specified by:
hashCodein interfacejava.util.List<java.lang.Object>- Overrides:
hashCodein classJDFNumList
-
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 exchangedgetHeight - 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 exchangedsetHeight - 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 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 public void setWidth(double width)
Deprecated.attention height and width were accidentally exchangedsetWidth - sets the width- Parameters:
width- the width
-
getLength
@Deprecated public double 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 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-
-
-