Package jflex
Class IntCharSet
- java.lang.Object
-
- jflex.IntCharSet
-
public final class IntCharSet extends java.lang.Object
CharSet implemented with intervals[fixme: optimizations possible]
- Version:
- JFlex 1.7.0
-
-
Constructor Summary
Constructors Constructor Description IntCharSet()
Constructor for IntCharSet.IntCharSet(int c)
Constructor for IntCharSet.IntCharSet(java.util.List<Interval> chars)
Constructor for IntCharSet.IntCharSet(Interval interval)
Constructor for IntCharSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int c)
add.IntCharSet
add(IntCharSet set)
add.void
add(Interval interval)
add.IntCharSet
and(IntCharSet set)
Intersects two sets.boolean
contains(int singleChar)
contains.boolean
containsElements()
Returns whether the set contains elements.IntCharSet
copy()
Return a (deep) copy of this char setboolean
equals(java.lang.Object o)
IntCharSet
getCaseless(UnicodeProperties unicodeProperties)
Create a caseless version of this charset.java.util.List<Interval>
getIntervals()
Returns the intervals.Interval
getNext()
Returns the next interval.private int
indexOf(int c)
returns the index of the interval that contains the character c, -1 if there is no such intervalprivate int
max(int a, int b)
private int
min(int a, int b)
int
numIntervals()
Returns the number of Intervals.void
sub(IntCharSet set)
Returns the relative complement of this set relative to the provided set.java.lang.String
toString()
Make a string representation of this char set.
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
intervals
private java.util.List<Interval> intervals
-
pos
private int pos
-
-
Constructor Detail
-
IntCharSet
public IntCharSet()
Constructor for IntCharSet.
-
IntCharSet
public IntCharSet(int c)
Constructor for IntCharSet.- Parameters:
c
- a int.
-
IntCharSet
public IntCharSet(Interval interval)
Constructor for IntCharSet.- Parameters:
interval
- aInterval
object.
-
IntCharSet
public IntCharSet(java.util.List<Interval> chars)
Constructor for IntCharSet.- Parameters:
chars
- aList
object.
-
-
Method Detail
-
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
public IntCharSet add(IntCharSet set)
add.- Parameters:
set
- aIntCharSet
object.- Returns:
- a
IntCharSet
object.
-
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
public boolean equals(java.lang.Object o)
o instanceof Interval
- Overrides:
equals
in classjava.lang.Object
-
min
private int min(int a, int b)
-
max
private int max(int a, int b)
-
and
public IntCharSet and(IntCharSet set)
Intersects two sets.- Parameters:
set
- aIntCharSet
object.- Returns:
- the
IntCharSet
common to the two sets.
-
sub
public void sub(IntCharSet set)
Returns the relative complement of this set relative to the provided set.- Parameters:
set
- aIntCharSet
to 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
public java.util.List<Interval> getIntervals()
Returns the intervals.- Returns:
- a
List
object.
-
getCaseless
public IntCharSet getCaseless(UnicodeProperties unicodeProperties)
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
public java.lang.String toString()
Make a string representation of this char set.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representing this char set.
-
copy
public IntCharSet copy()
Return a (deep) copy of this char set- Returns:
- the copy
-
-