|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cip4.jdflib.datatypes.JDFRange
org.cip4.jdflib.datatypes.JDFIntegerRange
public class JDFIntegerRange
This class represents an integer range (JDFIntegerRange). It is a pair of 2 integer values separated by a tilde "~", for example "123 ~ 145" negative values are treated differently depending on the value of m_defaultXDef @see getDefaultDef
| Nested Class Summary |
|---|
| 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 | |
|---|---|
JDFIntegerRange()
constructs an empty integer range |
|
JDFIntegerRange(int x)
constructs an integer range with the given int (both values are equal) |
|
JDFIntegerRange(int xmin,
int xmax)
constructs an integer range with the given int values |
|
JDFIntegerRange(int xmin,
int xmax,
int xdef)
constructs an integer range with the given int values |
|
JDFIntegerRange(JDFIntegerRange ir)
constructs an integer range with a given JDFIntegerRange |
|
JDFIntegerRange(String s)
constructs an integer range with the given string |
|
JDFIntegerRange(String s,
int xdef)
constructs an integer range with the given string |
|
| Method Summary | |
|---|---|
boolean |
append(int x)
append - appends a value to this range, returns true if possible returns false if the element is not the next element in the list, it only appends on the right side of the range. |
static JDFIntegerRange |
createIntegerRange(String s)
factory for JDFIntegerRange that silently returns null in case of illegal strings |
boolean |
equals(Object other)
equals - returns true if both JDFIntegerRange are equal otherwise false |
int |
getDef()
getDef - gets xDef, the default value which is used for negative numbers |
static int |
getDefaultDef()
getDefaultDef - gets the preset for xDef, which will be used when constructing an IntegerRange the value represents the index that is one past the end of the list if xdef==0 (the default), the neg numbers themselves are used |
int |
getElement(int i)
Element - value of the ith element in the range. |
int |
getElementCount()
getElementCount - returns the number of elements in this range, on the C++ side of the JDF library this method is called NElements if any if any range cannot be resolved due to an unknown negative value without a known default, -1 is returned |
JDFIntegerList |
getIntegerList()
getIntegerList - returns the integer range as an integer list for example an integer range of "5~9" will be returned as "5 6 7 8 9" |
static JDFIntegerRange |
getIntegerRange(String range)
create a JDFIntegerRange from a string - return null if no go |
int |
getLeft()
getLeft - returns the left int object |
protected Object |
getLeftObject()
|
int |
getLowerValue()
getLowerValue - returns the lower value of the bounds for example 4~6 return 4, 7~5 return 5 |
int |
getRight()
getRight - returns the right int object |
protected Object |
getRightObject()
|
int |
getUpperValue()
getUpperValue - returns the upper value of the bounds for example 4~6 return 6, 7~5 return 7 |
int |
hashCode()
hashCode complements equals() to fulfill the equals/hashCode contract |
protected void |
init(int xmin,
int xmax,
int xdef)
Initialization |
protected boolean |
inObjectRange(Object other)
|
boolean |
inRange(int x)
inRange - returns true if (lower value >= x <= upper value) |
boolean |
isPartOfRange(JDFRange r)
isPartOfRange - is range 'r' within this range? |
boolean |
isValid(String s)
isValid - validate the given String |
void |
scale(int f)
scale - scales both values but NOT the default |
void |
setDef(int xdef)
setDef - sets xDef, the default value which is used for negative numbers the value represents the index that is one past the end of the list if xdef==0 (the default), the neg numbers themselves are used |
static void |
setDefaultDef(int xdef)
setDefaultDef - sets the preset for xDef, which will be used when constructing an IntegerRange the value represents the index that is one past the end of the list if xdef==0 (the default), the neg numbers themselves are used |
void |
setLeft(int x)
setLeft - sets the left int object |
void |
setLowerValue(int x)
setLowerValue - sets the lower value of the bounds |
void |
setRight(int x)
setRight - sets the right int object |
void |
setUpperValue(int x)
setUpperValue - sets the upper value of the bounds |
String |
toString()
toString |
| Methods inherited from class org.cip4.jdflib.datatypes.JDFRange |
|---|
getString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JDFIntegerRange()
public JDFIntegerRange(int x)
x - the given min and max value
public JDFIntegerRange(int xmin,
int xmax)
xmin - the given min valuexmax - the given max value
public JDFIntegerRange(int xmin,
int xmax,
int xdef)
xmin - the given min valuexmax - the given max valuexdef - number of itemspublic JDFIntegerRange(JDFIntegerRange ir)
ir - the given JDFIntegerRange
public JDFIntegerRange(String s)
throws DataFormatException
s - the given string
DataFormatException - - if the String has not a valid format
public JDFIntegerRange(String s,
int xdef)
throws DataFormatException
s - the given stringxdef - value which is used for negative numbers the value that -1 will represent in this range
DataFormatException - - if the String has not a valid format| Method Detail |
|---|
public static JDFIntegerRange createIntegerRange(String s)
s - the string to parse
public static JDFIntegerRange getIntegerRange(String range)
range -
protected void init(int xmin,
int xmax,
int xdef)
public String toString()
toString in class Objectpublic boolean isValid(String s)
s - the given string
public boolean equals(Object other)
equals in class JDFRangeother - Object to compare
public int hashCode()
hashCode in class JDFRangepublic int getLeft()
public void setLeft(int x)
x - the left int objectpublic int getRight()
public void scale(int f)
f - the scaling factorpublic void setRight(int x)
x - the right int objectpublic int getLowerValue()
public void setLowerValue(int x)
x - the new lower value of the rangepublic int getUpperValue()
public void setUpperValue(int x)
x - the new upper value of the rangepublic boolean inRange(int x)
x - comparison value
public boolean isPartOfRange(JDFRange r)
isPartOfRange in class JDFRanger - the range to test
public int getElementCount()
public boolean append(int x)
"3˜5" append(6) -> "3˜6" "5" append(6) -> "5˜6" "5" append(7) -> "5 7" "5˜9" append(6) -> "5˜9 6" "7˜5" append(4) -> "7˜4"
x - the new value
public int getElement(int i)
throws NoSuchElementException
i - the position, if it is a negativ value start counting from the right side +1
NoSuchElementException - - if the index is out of rangepublic void setDef(int xdef)
xdef - the value that will represent negative values in this rangepublic static void setDefaultDef(int xdef)
xdef - - (int)1 above the value that -1 will represent in this range i.e. the value that -0, were it possible to specify, would representpublic static int getDefaultDef()
public int getDef()
public JDFIntegerList getIntegerList()
protected Object getRightObject()
getRightObject in class JDFRangeprotected Object getLeftObject()
getLeftObject in class JDFRangeprotected boolean inObjectRange(Object other)
inObjectRange in class JDFRange
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||