public class JDFIntegerRange extends JDFRange
JDFBaseDataTypes.EnumFitsValue
EPSILON, MAX_CMYK_COLOR, MAX_LAB_COLOR, MAX_MATRIX_DIMENSION, MAX_RECTANGLE_DIMENSION, MAX_RGB_COLOR, MAX_SHAPE_DIMENSION, MAX_XY_DIMENSION
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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
|
public JDFIntegerRange()
public JDFIntegerRange(int x)
x
- the given min and max valuepublic JDFIntegerRange(int xmin, int xmax)
xmin
- the given min valuexmax
- the given max valuepublic 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 JDFIntegerRangepublic JDFIntegerRange(String s) throws DataFormatException
s
- the given stringDataFormatException
- - if the String has not a valid formatpublic 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 rangeDataFormatException
- - if the String has not a valid formatpublic static JDFIntegerRange createIntegerRange(String s)
s
- the string to parsepublic static JDFIntegerRange getIntegerRange(String range)
range
- protected void init(int xmin, int xmax, int xdef)
public boolean isValid(String s)
s
- the given stringpublic boolean equals(Object other)
public int hashCode()
public 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 valuepublic boolean isPartOfRange(JDFRange r)
isPartOfRange
in class JDFRange
r
- the range to testpublic 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 valuepublic int getElement(int i) throws NoSuchElementException
i
- the position, if it is a negativ value start counting from the right side +1NoSuchElementException
- - 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 JDFRange
protected Object getLeftObject()
getLeftObject
in class JDFRange
protected boolean inObjectRange(Object other)
inObjectRange
in class JDFRange
Copyright © 2018. All rights reserved.