Package jflex
Class IntCharSet
java.lang.Object
jflex.IntCharSet
CharSet implemented with intervals
[fixme: optimizations possible]
- Version:
- JFlex 1.7.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for IntCharSet.IntCharSet(int c) Constructor for IntCharSet.IntCharSet(List<Interval> chars) Constructor for IntCharSet.IntCharSet(Interval interval) Constructor for IntCharSet. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int c) add.add(IntCharSet set) add.voidadd.and(IntCharSet set) Intersects two sets.booleancontains(int singleChar) contains.booleanReturns whether the set contains elements.copy()Return a (deep) copy of this char setbooleangetCaseless(UnicodeProperties unicodeProperties) Create a caseless version of this charset.Returns the intervals.getNext()Returns the next interval.private intindexOf(int c) returns the index of the interval that contains the character c, -1 if there is no such intervalprivate intmax(int a, int b) private intmin(int a, int b) intReturns the number of Intervals.voidsub(IntCharSet set) Returns the relative complement of this set relative to the provided set.toString()Make a string representation of this char set.
-
Field Details
-
DEBUG
private static final boolean DEBUG- See Also:
-
intervals
-
pos
private int pos
-
-
Constructor Details
-
IntCharSet
public IntCharSet()Constructor for IntCharSet. -
IntCharSet
public IntCharSet(int c) Constructor for IntCharSet.- Parameters:
c- a int.
-
IntCharSet
Constructor for IntCharSet.- Parameters:
interval- aIntervalobject.
-
IntCharSet
Constructor for IntCharSet.- Parameters:
chars- aListobject.
-
-
Method Details
-
indexOf
private int indexOf(int c) returns the index of the interval that contains the character c, -1 if there is no such interval- Parameters:
c- the character- Returns:
- the index of the enclosing interval, -1 if no such interval
-
add
add.- Parameters:
set- aIntCharSetobject.- Returns:
- a
IntCharSetobject.
-
add
add.- Parameters:
interval- aIntervalobject.
-
add
public void add(int c) add.- Parameters:
c- a int.
-
contains
public boolean contains(int singleChar) contains.- Parameters:
singleChar- a int.- Returns:
- a boolean.
-
equals
o instanceof Interval
-
min
private int min(int a, int b) -
max
private int max(int a, int b) -
and
Intersects two sets.- Parameters:
set- aIntCharSetobject.- Returns:
- the
IntCharSetcommon to the two sets.
-
sub
Returns the relative complement of this set relative to the provided set.- Parameters:
set- aIntCharSetto substract from this set.
-
containsElements
public boolean containsElements()Returns whether the set contains elements.- Returns:
- Whether the set is non-empty.
-
numIntervals
public int numIntervals()Returns the number of Intervals.- Returns:
- number of intervals.
-
getIntervals
Returns the intervals.- Returns:
- a
Listobject.
-
getNext
Returns the next interval.- Returns:
- the next
Interval.
-
getCaseless
Create a caseless version of this charset.The caseless version contains all characters of this char set, and additionally all lower/upper/title case variants of the characters in this set.
- Parameters:
unicodeProperties- The Unicode Properties to use when generating caseless equivalence classes.- Returns:
- a caseless copy of this set
-
toString
Make a string representation of this char set. -
copy
Return a (deep) copy of this char set- Returns:
- the copy
-