Package org.parboiled.support
Class Characters
java.lang.Object
org.parboiled.support.Characters
An immutable, set-like aggregation of (relatively few) characters that allows for an inverted semantic
("all chars except these few").
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Characters
The Characters set including all character.static final Characters
The empty Characters set -
Method Summary
Modifier and TypeMethodDescriptionadd
(char c) Adds the given character to the set.add
(Characters other) Returns a new Characters object containing all the characters of this instance plus all characters of the given instance.static Characters
allBut
(char c) Creates a new Characters instance containing all characters minus the given one.static Characters
allBut
(char... chars) Creates a new Characters instance containing all characters minus the given ones.static Characters
Creates a new Characters instance containing all characters minus the given ones.boolean
contains
(char c) Determines whether this instance contains the given character.boolean
char[]
getChars()
Returns the characters in this set, if it is additive.int
hashCode()
boolean
static Characters
of
(char c) Creates a new Characters instance containing only the given char.static Characters
of
(char... chars) Creates a new Characters instance containing only the given chars.static Characters
Creates a new Characters instance containing only the given chars.remove
(char c) Removes the given character from the set.remove
(Characters other) Returns a new Characters object containing all the characters of this instance minus all characters of the given instance.toString()
-
Field Details
-
NONE
The empty Characters set -
ALL
The Characters set including all character.
-
-
Method Details
-
isSubtractive
public boolean isSubtractive()- Returns:
- true if the set is subtractive
-
getChars
public char[] getChars()Returns the characters in this set, if it is additive. If the set is subtractive the method returns the characters not in the set.- Returns:
- the characters
-
add
Adds the given character to the set.- Parameters:
c
- the character to add- Returns:
- a new Characters object
-
remove
Removes the given character from the set.- Parameters:
c
- the character to remove- Returns:
- a new Characters object
-
contains
public boolean contains(char c) Determines whether this instance contains the given character.- Parameters:
c
- the character to check for- Returns:
- true if this instance contains c
-
add
Returns a new Characters object containing all the characters of this instance plus all characters of the given instance.- Parameters:
other
- the other Characters to add- Returns:
- a new Characters object
-
remove
Returns a new Characters object containing all the characters of this instance minus all characters of the given instance.- Parameters:
other
- the other Characters to remove- Returns:
- a new Characters object
-
toString
-
equals
-
hashCode
public int hashCode() -
of
Creates a new Characters instance containing only the given char.- Parameters:
c
- the char- Returns:
- a new Characters object
-
of
Creates a new Characters instance containing only the given chars.- Parameters:
chars
- the chars- Returns:
- a new Characters object
-
of
Creates a new Characters instance containing only the given chars.- Parameters:
chars
- the chars- Returns:
- a new Characters object
-
allBut
Creates a new Characters instance containing all characters minus the given one.- Parameters:
c
- the char to NOT include- Returns:
- a new Characters object
-
allBut
Creates a new Characters instance containing all characters minus the given ones.- Parameters:
chars
- the chars to NOT include- Returns:
- a new Characters object
-
allBut
Creates a new Characters instance containing all characters minus the given ones.- Parameters:
chars
- the chars to NOT include- Returns:
- a new Characters object
-