Package org.cip4.jdflib.datatypes
Class JDFTransferFunction
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector<Object>
org.cip4.jdflib.datatypes.JDFNumList
org.cip4.jdflib.datatypes.JDFTransferFunction
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,JDFBaseDataTypes
This class is a representation of a whitespace separated list of numbers representing a set of XY coordinates of a transfer function. The total number of x y values must be even because of the
pairs.
- 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
FieldsFields 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 a xy pair with all values set to 0.0 Doubleconstructs a number list with the given string the number of tokens must be evenDeprecated.use typesafe constructorsconstructs a number list with the given number listcopy constructor
constructs a number list with the given transfer function -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double x, double y) add - adds a x and a y coordinate to the vectorvoidadd - adds a x and a y coordinate to the vectorbooleanvoidadd - adds a x and a y coordinate to the vectorvoidadd - adds a complete transfer function to the vectorvoidadd - adds a xy coordinate to the vectorbooleanaddAll(Collection<? extends Object> c) voidclear()static JDFTransferFunctionfactory for JDFTransferFunction that silently returns null in case of illegal stringsdoublegetFastValue(double x) get the Y value at x-value x - we interpolate linearly from a cachestatic JDFTransferFunctiongetUnit()doublegetValue(double x) get the Y value at x-value x - we interpolate linearlydoublegetX(int index) get the x value at index note that each index consumes 2 elements (the x and y value)get the min and max value of XdoublegetY(int index) get the Y value at index ibooleanisUnit()isUnit - true if we are 0 0 1 1booleanisValid()isValid - true if the size of the vector is even and all instances are Double typesvoidmultiplies a complete transfer function to the vector only useful for 0-1 ranged transfer functionsstatic JDFTransferFunctionmultiply(JDFTransferFunction tf1, JDFTransferFunction tf2) returns the multiplied tf - in case one of thr arguments is null or unit, the other argument is returned unmodifiedintvoidvoidsets a vector of y coordinates with a common distance between pointsMethods inherited from class org.cip4.jdflib.datatypes.JDFNumList
abs, clone, contains, containsAll, copyNumList, doubleAt, elementAt, equals, getDouble, getDoubleList, getDoubleVector, getIntArray, getString, getString, hashCode, 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, addAll, addElement, capacity, 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
-
Field Details
-
UNIT
- See Also:
-
-
Constructor Details
-
JDFTransferFunction
public JDFTransferFunction()constructs a xy pair with all values set to 0.0 Double -
JDFTransferFunction
constructs a number list with the given string the number of tokens must be even- Parameters:
s- the given String in number list format- Throws:
DataFormatException- - if the String has not a valid format
-
JDFTransferFunction
Deprecated.use typesafe constructorsconstructs a number list with the given vector the number of elements must be even- Parameters:
v- the number list as a vector- Throws:
DataFormatException- - if the Vector has not a valid format
-
JDFTransferFunction
constructs a number list with the given number list- Parameters:
nl- the given number list- Throws:
DataFormatException- - if the String has not a valid format
-
JDFTransferFunction
copy constructor
constructs a number list with the given transfer function- Parameters:
tf- the given number list- Throws:
DataFormatException- - if the String has not a valid format
-
-
Method Details
-
getUnit
-
createTransferFunction
factory for JDFTransferFunction that silently returns null in case of illegal strings- Parameters:
s- the string to parse- Returns:
- the JDFTransferFunction, null if s is not compatible
-
isValid
isValid - true if the size of the vector is even 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
-
isUnit
public boolean isUnit()isUnit - true if we are 0 0 1 1 -
add
add - adds a xy coordinate to the vector- Parameters:
xy- the xy coordinate to add
-
add
add - adds a x and a y coordinate to the vector- Parameters:
x- the x coordinate to addy- the y coordinate to add
-
add
public void add(double x, double y) add - adds a x and a y coordinate to the vector- Parameters:
x- the x coordinate to addy- the y coordinate to add
-
set
sets a vector of y coordinates with a common distance between points- Parameters:
x0-dx-v-
-
getX
public double getX(int index) get the x value at index note that each index consumes 2 elements (the x and y value)- Parameters:
index-- Returns:
-
getXRange
get the min and max value of X- Parameters:
index-- Returns:
-
getY
public double getY(int index) get the Y value at index i- Parameters:
index-- Returns:
-
getFastValue
public double getFastValue(double x) get the Y value at x-value x - we interpolate linearly from a cache- Parameters:
index-- Returns:
-
getValue
public double getValue(double x) get the Y value at x-value x - we interpolate linearly- Parameters:
index-- Returns:
-
numPoints
public int numPoints()- Returns:
- the number of points
-
add
add - adds a x and a y coordinate to the vector- Parameters:
s- a string with the x and y coordinate to add- Throws:
DataFormatException- - if the String has not a valid format
-
add
add - adds a complete transfer function to the vector- Parameters:
tf- the given transfer function to add
-
add
-
addAll
-
clear
public void clear() -
resetCache
public void resetCache() -
multiply
returns the multiplied tf - in case one of thr arguments is null or unit, the other argument is returned unmodified- Parameters:
tf1-tf2-- Returns:
-
multiply
multiplies a complete transfer function to the vector only useful for 0-1 ranged transfer functions- Parameters:
tf- the given transfer function to add
-