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 CharactersThe Characters set including all character.static final CharactersThe 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 CharactersallBut(char c) Creates a new Characters instance containing all characters minus the given one.static CharactersallBut(char... chars) Creates a new Characters instance containing all characters minus the given ones.static CharactersCreates a new Characters instance containing all characters minus the given ones.booleancontains(char c) Determines whether this instance contains the given character.booleanchar[]getChars()Returns the characters in this set, if it is additive.inthashCode()booleanstatic Charactersof(char c) Creates a new Characters instance containing only the given char.static Charactersof(char... chars) Creates a new Characters instance containing only the given chars.static CharactersCreates 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
-
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
-