Package org.cip4.jdflib.datatypes
Class JDFNumList
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,JDFBaseDataTypes
- Direct Known Subclasses:
JDFCMYKColor,JDFIntegerList,JDFLabColor,JDFMatrix,JDFNumberList,JDFRectangle,JDFRGBColor,JDFShape,JDFTransferFunction,JDFXYPair
This abstract class is the representation of a number list (Integer and Double object). Intern these objects are collected in a vector and there are several methods to provide an access to the
data.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested 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
ConstructorsConstructorDescriptionconstructs an empty number listJDFNumList(double[] array) constructor - constructs a number list with the given size and sets all values set to 0.0 DoubleJDFNumList(int size) constructor - constructs a number list with the given size and sets all values set to 0.0 DoubleJDFNumList(int[] array) constructor - constructs a number list with the given size and sets all values set to 0.0 DoubleJDFNumList(String sl) constructor - constructs a number list with the given String; if the sub class is of type JDFIntegerList all object will be Integer in all other cases the object will be a DoubleJDFNumList(Vector v) Deprecated.use typesafe constructorsJDFNumList(JDFNumList nl) constructor - constructs a number list with a given JDFNumList -
Method Summary
Modifier and TypeMethodDescriptionabs()modify numlist to absolute valuesclone()booleanreturn true if this contains at least one element from lbooleanreturn true if this contains all elements from lDeprecated.use clone()doubledoubleAt(int i) getElementAt - returns the element at the ith positionelementAt(int i) getElementAt - returns the element at the ith positionbooleanequals - compares two JDFNumList elementsgetDouble(int i) double[]get the list of values as doublesget the list of values as doublesint[]getIntArray - returns this integer list as an int arrayDeprecated.060418 - use toStringgetString(int precision) getString - returns the JDFNumList as a StringinthashCode()hashCode complements equals() to fulfill the equals/hashCode contractintintAt(int i) getElementAt - returns the element at the ith positionabstract booleanisValid()isValid - true if all instances are Double or Integer typesbooleanisValidString(String st) isValidString - true if all instances are Double or Integer typesbooleanmatches(JDFNumList other, double delta) are all values within +/- delta?doublemax()return the absolute norm (sqrt of sum of values)doublemin()return the absolute norm (sqrt of sum of values)doublenorm()return the absolute norm (sqrt of sum of values)voidremoveElementAt(int i) removeElementAt - removes the element at the given positionbooleanreplaceElementAt(Object obj, int i) replaceElementAt - replaces the element at the given position with the given objectscale(double factor) scale all values of this by factorscale(double factor, int precision) scale all values of this by factorscale all values of this to points from centimetersscaleFromCM(int precision) scale all values of this to points from centimetersscale all values of this to points from millimetersscaleFromMM(int precision) scale all values of this to points from millimetersscale all values of this to points from centimetersscaleToCM(int precision) scale all values of this to points from centimetersscale all values of this to points from millimetersscaleToMM(int precision) scale all values of this to points from millimetersvoidset(int pos, double d) sets this to the value specified in stringsetX(int pos, double d) shift(double x) return the absolute norm (sqrt of sum of values)voidsort()subtract l from this,toString()toString - returns the JDFNumList as a Stringvoidunify()ensure that each instance exists only oncedoublevolume()return the n dimensional volume (product of all values)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, 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
-
JDFNumList
public JDFNumList()constructs an empty number list -
JDFNumList
public JDFNumList(int size) constructor - constructs a number list with the given size and sets all values set to 0.0 Double- Parameters:
size- the given size
-
JDFNumList
public JDFNumList(int[] array) constructor - constructs a number list with the given size and sets all values set to 0.0 Double- Parameters:
size- the given size
-
JDFNumList
public JDFNumList(double[] array) constructor - constructs a number list with the given size and sets all values set to 0.0 Double- Parameters:
size- the given size
-
JDFNumList
Deprecated.use typesafe constructorsconstructor - constructs a number list with the given vector- Parameters:
v- a vector with number list objects- Throws:
DataFormatException- - if the Vector has not a valid format
-
JDFNumList
constructor - constructs a number list with the given String; if the sub class is of type JDFIntegerList all object will be Integer in all other cases the object will be a Double- Parameters:
sl- the given String- Throws:
DataFormatException- - if the String has not a valid format
-
JDFNumList
constructor - constructs a number list with a given JDFNumList- Parameters:
nl- the given number list- Throws:
DataFormatException- - if the String has not a valid format
-
-
Method Details
-
set
public void set(int pos, double d) - Parameters:
pos-d-
-
setX
- Parameters:
pos-d-
-
setString
sets this to the value specified in string- Parameters:
string-- Throws:
DataFormatException
-
getString
Deprecated.060418 - use toStringgetString - returns all values whitespace separated in a String- Returns:
- String
-
getDoubleList
public double[] getDoubleList()get the list of values as doubles- Returns:
-
getDoubleVector
get the list of values as doubles- Returns:
-
toString
toString - returns the JDFNumList as a String -
getString
getString - returns the JDFNumList as a String- Parameters:
precision- # of digits to print- Returns:
- String - the JDFNumList as a String
-
equals
equals - compares two JDFNumList elements -
hashCode
public int hashCode()hashCode complements equals() to fulfill the equals/hashCode contract -
elementAt
getElementAt - returns the element at the ith position -
doubleAt
public double doubleAt(int i) getElementAt - returns the element at the ith position- Parameters:
i- the index- Returns:
- double - the double value given position, 0.0 if out of range
-
intAt
public int intAt(int i) getElementAt - returns the element at the ith position- Parameters:
i- the index- Returns:
- double - the double value given position, 0.0 if out of range
-
copyNumList
Deprecated.use clone()copyNumList - returns a clone of the numList vector- Returns:
- Vector - the clone of the numList vector
-
removeElementAt
public void removeElementAt(int i) removeElementAt - removes the element at the given position- Overrides:
removeElementAtin classVector<Object>- Parameters:
i- the position from where to remove the element
-
replaceElementAt
replaceElementAt - replaces the element at the given position with the given object- Parameters:
obj- the objecti- the given position- Returns:
- boolean - true if successful otherwise false
-
isValid
isValid - true if all instances are Double or Integer types- Returns:
- boolean - true if all instances are Double or Integer types
- Throws:
DataFormatException
-
isValidString
isValidString - true if all instances are Double or Integer types- Parameters:
st- the string to check- Returns:
- boolean - true if all instances are Double or Integer types
-
scaleFromMM
scale all values of this to points from millimeters- Returns:
-
scaleFromMM
scale all values of this to points from millimeters- Returns:
-
scaleFromCM
scale all values of this to points from centimeters- Returns:
-
scaleFromCM
scale all values of this to points from centimeters- Returns:
-
scaleToMM
scale all values of this to points from millimeters- Returns:
-
scaleToMM
scale all values of this to points from millimeters- Returns:
-
scaleToCM
scale all values of this to points from centimeters- Returns:
-
scaleToCM
scale all values of this to points from centimeters- Returns:
-
scale
scale all values of this by factor- Parameters:
factor-- Returns:
-
scale
scale all values of this by factor- Parameters:
factor-- Returns:
-
abs
modify numlist to absolute values- Returns:
- See Also:
-
clone
-
matches
are all values within +/- delta?- Parameters:
other-delta-- Returns:
- See Also:
-
subtract
subtract l from this,- Parameters:
l- the list to subtract from this- Throws:
IllegalArgumentException- if sizes don't match
-
unify
public void unify()ensure that each instance exists only once -
getIntArray
public int[] getIntArray()getIntArray - returns this integer list as an int array- Returns:
- int[] - the int array
-
getDouble
- Parameters:
i-- Returns:
- the Double object
-
sort
public void sort() -
contains
return true if this contains at least one element from l- Parameters:
l- the list to check for- Returns:
-
norm
public double norm()return the absolute norm (sqrt of sum of values)- Returns:
-
min
public double min()return the absolute norm (sqrt of sum of values)- Returns:
-
shift
return the absolute norm (sqrt of sum of values)- Returns:
-
max
public double max()return the absolute norm (sqrt of sum of values)- Returns:
-
volume
public double volume()return the n dimensional volume (product of all values)- Returns:
-
containsAll
return true if this contains all elements from l- Parameters:
l- the list to check for- Returns:
-