public class JDFIntegerRangeList extends JDFRangeList
JDFBaseDataTypes.EnumFitsValue
rangeList
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 |
---|
JDFIntegerRangeList()
constructs an empty range list
|
JDFIntegerRangeList(int[] array)
constructs a JDFIntegerRangeList with the given array of ints
|
JDFIntegerRangeList(JDFIntegerRange ir)
constructs a JDFIntegerRangeList with the given JDFIntegerRange and sets xDef
|
JDFIntegerRangeList(JDFIntegerRangeList irl)
constructs a JDFIntegerRangeList with the given JDFIntegerRangeList and sets the number of items
|
JDFIntegerRangeList(String s)
constructs a JDFIntegerRangeList with the given string the default value for -1 is set to 0, i.e positive and
negative numbers are handled explicitly
|
JDFIntegerRangeList(String s,
int xdef)
constructs a JDFIntegerRangeList with the given String and sets the number of items
|
Modifier and Type | Method and Description |
---|---|
void |
append(int x)
append - appends an integer to the last IntegerRange of the IntegerRangelist if possible, examples if the last
range list element looks like:
"3˜5" append(6) -> "3˜6"
"5" append(6) -> "5˜6"
"5" append(7) -> "5 7"
"5 6" append(7) -> "5 ˜ 7"
"3˜7 5˜7" append(8) -> "3˜7 5˜8"
"3˜7 5˜9" append(8) -> "3˜7 5˜9 8"
"3˜7 5˜7" append(18) -> "3˜7 5˜7 18"
note that lists are not preserved.
|
void |
append(int xMin,
int xMax)
append - appends a new IntegerRange to the IntegerRangeList
|
void |
append(JDFIntegerRange r)
append - appends a new IntegerRange to the IntegerRangeList
|
static JDFIntegerRangeList |
createIntegerRangeList(String rangelist)
create a JDFIntegerRangeList from a string - return null if no go
|
JDFIntegerRangeList |
deepCopy()
deepCopy - a deep copy of this JDFIntegerRangeList
|
int |
getDef()
getDef - gets xDef, the default value which is used for negative numbers
|
int |
getElement(int i)
Element - value of the ith element in the range.
|
int |
getElementCount()
getElementCount - returns the number of elements in the list.
|
JDFIntegerList |
getIntegerList()
getIntegerList - returns this integer range list as a JDFIntegerList
|
static JDFIntegerRangeList |
getIntegerRangeList(String rangelist)
Deprecated.
use createIntegerRangeList
|
boolean |
inRange(int x)
inRange - returns true if the given int value is in one of the ranges of the range list
|
boolean |
isOrdered()
isOrdered - tests if 'this' is OrderedRangeList
|
boolean |
isOverlapping(JDFIntegerRange newRange,
JDFIntegerRange oldRange)
isOverlapping
|
boolean |
isUniqueOrdered()
isUniqueOrdered - tests if 'this' is UniqueOrdered RangeList
|
boolean |
isValid(String s)
isValid - validate the given String
|
void |
normalize(boolean bSort)
normalize this range by removing any consecutive entries and creating ranges instead
|
void |
setDef(int xdef)
setDef - sets xDef, the default value which is used for negative numbers
if xdef==0 (the default), the neg numbers themselves are used the value represents the index that is one past the end of the list |
void |
setString(String s)
setString - parse the given string and set the integer ranges
|
public JDFIntegerRangeList()
public JDFIntegerRangeList(String s) throws DataFormatException
s
- - the given stringDataFormatException
- - if the String has not a valid formatpublic JDFIntegerRangeList(String s, int xdef) throws DataFormatException
s
- - the given stringxdef
- - the default value thatDataFormatException
- - if the String has not a valid formatpublic JDFIntegerRangeList(JDFIntegerRangeList irl)
irl
- the given JDFIntegerRangeListpublic JDFIntegerRangeList(JDFIntegerRange ir)
ir
- the given JDFIntegerRangepublic JDFIntegerRangeList(int[] array)
array
- the given JDFIntegerRange@Deprecated public static JDFIntegerRangeList getIntegerRangeList(String rangelist)
rangelist
- public static JDFIntegerRangeList createIntegerRangeList(String rangelist)
rangelist
- public boolean inRange(int x)
x
- the given int value to comparepublic void setString(String s) throws DataFormatException
s
- the given stringDataFormatException
- - if the String has not a valid formatpublic boolean isValid(String s)
s
- the given stringpublic int getElementCount()
public int getElement(int i) throws NoSuchElementException
performace warning: don't loop over getElement for potentially large lists with many individual elements.
Prefer to call getIntegerList() and loop over the list.
i
- the position, if it is a negative value start counting from the right side +1NoSuchElementException
- - if the index is out of rangepublic void append(JDFIntegerRange r)
r
- the given JDFIntegerRangepublic void append(int xMin, int xMax)
xMin
- the left value of the new rangexMax
- the right value of the new rangepublic void append(int x)
"3˜5" append(6) -> "3˜6" "5" append(6) -> "5˜6" "5" append(7) -> "5 7" "5 6" append(7) -> "5 ˜ 7" "3˜7 5˜7" append(8) -> "3˜7 5˜8" "3˜7 5˜9" append(8) -> "3˜7 5˜9 8" "3˜7 5˜7" append(18) -> "3˜7 5˜7 18"note that lists are not preserved. If you want to guarantee individual entries use append(x,x);
x
- the given int xpublic JDFIntegerList getIntegerList()
public void setDef(int xdef)
xdef
- one above the value that -1 will represent in this range i.e. the value that -0, were it possible to
specify, would representpublic int getDef()
public boolean isOrdered()
isOrdered
in class JDFRangeList
public boolean isUniqueOrdered()
isUniqueOrdered
in class JDFRangeList
public JDFIntegerRangeList deepCopy() throws DataFormatException
DataFormatException
public boolean isOverlapping(JDFIntegerRange newRange, JDFIntegerRange oldRange)
newRange
- the range to check, if is overlapping one of the ranges in the list
x: x.upper < y.lower,
z: z.lower > y.upper,
one of these situation, means there is no overlapping
newRange
- oldRange
- the JDFRangeList removed from the RangeList, before check for overlap. If null, the oldRange is
ignoredpublic void normalize(boolean bSort)
bSort
- if true, sort the rangelist prior to normalizingCopyright © 2018. All rights reserved.