Package jflex.core.unicode
Class IntCharSet
- java.lang.Object
-
- jflex.core.unicode.IntCharSet
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classIntCharSet.IntCharSetIteratorIterator for enumerating the elements of this IntCharSet
-
Constructor Summary
Constructors Constructor Description IntCharSet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int c)Adds a single character.voidadd(Interval interval)Adds a single interval to this IntCharSet.voidadd(IntCharSet set)Merges the given set into this one.static IntCharSetallChars()Creates the set of all characters.IntCharSetand(IntCharSet set)Intersects two sets.static IntCharSetcomplementOf(IntCharSet x)Returns the complement of the specified set x, that is, the set of all elements that are not contained in x.booleancontains(int singleChar)Returns whether this set contains a given character.booleancontains(IntCharSet other)Check whether this set contains a another set.booleancontainsElements()Returns whether the set contains elements.static IntCharSetcopyOf(IntCharSet intCharSet)Creates a IntCharSet from an existing IntCharSet.booleanequals(Object o)IntCharSetgetCaseless(UnicodeProperties unicodeProperties)Create a caseless version of this charset.List<Interval>getIntervals()Returns the intervals.inthashCode()Iterator<Interval>intervalIterator()IntCharSet.IntCharSetIteratoriterator()static IntCharSetnlChars()The set of new-line characters.intnumIntervals()Returns the number of intervals.static IntCharSetof(Interval interval)Creates a charset that contains only one interval.static IntCharSetof(Interval... intervals)Creates a charset that contains the given intervals.static IntCharSetofCharacter(int singleChar)Creates a char set that contains only the given character.static IntCharSetofCharacterRange(int start, int end)Creates a charset that contains only one interval, given by itsstartandendvalues.intsize()Computes the size of this set.voidsub(IntCharSet set)Returns the relative complement of this set relative to the provided set.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
of
public static IntCharSet of(Interval interval)
Creates a charset that contains only one interval.
-
of
public static IntCharSet of(Interval... intervals)
Creates a charset that contains the given intervals.- Parameters:
intervals- the intervals the new set should contains.- Returns:
- a new IntCharSet with the given intervals.
-
ofCharacterRange
public static IntCharSet ofCharacterRange(int start, int end)
Creates a charset that contains only one interval, given by itsstartandendvalues.
-
ofCharacter
public static IntCharSet ofCharacter(int singleChar)
Creates a char set that contains only the given character.
-
allChars
public static IntCharSet allChars()
Creates the set of all characters.- Returns:
- a new IntCharSet that contains all characters.
-
nlChars
public static IntCharSet nlChars()
The set of new-line characters.- Returns:
- a new IntCharSet that contains all characters that are considered a new-line char in Java.
-
add
public void add(IntCharSet set)
Merges the given set into this one.
-
add
public void add(Interval interval)
Adds a single interval to this IntCharSet.- Parameters:
interval- aIntervalobject.
-
add
public void add(int c)
Adds a single character.- Parameters:
c- Character to add.
-
contains
public boolean contains(int singleChar)
Returns whether this set contains a given character.- Parameters:
singleChar- a single character (int).- Returns:
- true iff singleChar is contained in the set.
-
contains
public boolean contains(IntCharSet other)
Check whether this set contains a another set.- Parameters:
other- an IntCharSet.- Returns:
- true iff all characters of
otherare contained in this set.
-
and
public IntCharSet and(IntCharSet set)
Intersects two sets.- Parameters:
set- aIntCharSetobject.- Returns:
- the
IntCharSetcommon to the two sets.
-
sub
public void sub(IntCharSet set)
Returns the relative complement of this set relative to the provided set.Assumes that
setis non-null, and contained in this IntCharSet.- Parameters:
set- aIntCharSetto substract from this set.
-
complementOf
public static IntCharSet complementOf(IntCharSet x)
Returns the complement of the specified set x, that is, the set of all elements that are not contained in x.- Parameters:
x- theIntCharSetto take the complement of.- Returns:
- the complement of x
-
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.
-
intervalIterator
public Iterator<Interval> intervalIterator()
- Returns:
- an iterator over the intervals in this set
-
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
-
copyOf
public static IntCharSet copyOf(IntCharSet intCharSet)
Creates a IntCharSet from an existing IntCharSet.- Returns:
- a (deep) copy of the char set.
-
size
public int size()
Computes the size of this set.- Returns:
- how many elements are contained in this set
-
iterator
public IntCharSet.IntCharSetIterator iterator()
-
-