Instances are immutable, but instances of subclasses may not be.
#ThreadSafe#
| Modifier and Type | Field and Description |
|---|---|
| public static final CharSet | ASCII_ALPHA
A CharSet defining ASCII alphabetic characters "a-zA-Z". |
| public static final CharSet | ASCII_ALPHA_LOWER
A CharSet defining ASCII alphabetic characters "a-z". |
| public static final CharSet | ASCII_ALPHA_UPPER
A CharSet defining ASCII alphabetic characters "A-Z". |
| public static final CharSet | ASCII_NUMERIC
A CharSet defining ASCII alphabetic characters "0-9". |
| protected static final Map | COMMON
A Map of the common cases used in the factory. |
| public static final CharSet | EMPTY
A CharSet defining no characters. |
| private static final long | serialVersionUID
Required for serialization support. |
| private final Set | set
The set of CharRange objects. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public boolean | |
| public boolean | Returns: true if equalthe object to compare to obj)Overrides java. Compares two |
| pack-priv CharRange[] | Returns: an array of immutable CharRange objectsGets the internal set as an array of CharRange objects. |
| public static CharSet | Returns: a CharSet instanceStrings to merge into the set, may be null setStrs)Factory method to create a new CharSet using a special syntax. |
| public int | Returns: a suitable hash codeOverrides java. Gets a hash code compatible with the equals method. |
| public String | Returns: string representation of the setOverrides java. Gets a string representation of the set. |
| ASCII_ALPHA | back to summary |
|---|---|
| public static final CharSet ASCII_ALPHA A CharSet defining ASCII alphabetic characters "a-zA-Z".
| |
| ASCII_ALPHA_LOWER | back to summary |
|---|---|
| public static final CharSet ASCII_ALPHA_LOWER A CharSet defining ASCII alphabetic characters "a-z".
| |
| ASCII_ALPHA_UPPER | back to summary |
|---|---|
| public static final CharSet ASCII_ALPHA_UPPER A CharSet defining ASCII alphabetic characters "A-Z".
| |
| ASCII_NUMERIC | back to summary |
|---|---|
| public static final CharSet ASCII_NUMERIC A CharSet defining ASCII alphabetic characters "0-9".
| |
| COMMON | back to summary |
|---|---|
| protected static final Map<String, CharSet> COMMON A Map of the common cases used in the factory. Subclasses can add more common patterns if desired
| |
| EMPTY | back to summary |
|---|---|
| public static final CharSet EMPTY A CharSet defining no characters.
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Required for serialization support. Lang version 2.0.
| |
| set | back to summary |
|---|---|
| private final Set<CharRange> set The set of CharRange objects. | |
| CharSet | back to summary |
|---|---|
| protected CharSet(final String... set) Constructs a new CharSet using the set syntax. Each string is merged in with the set.
| |
| add | back to summary |
|---|---|
| protected void add(final String str) Add a set definition string to the
| |
| contains | back to summary |
|---|---|
| public boolean contains(final char ch) Does the
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Compares two The two sets | |
| getCharRanges | back to summary |
|---|---|
| pack-priv CharRange[] getCharRanges() Gets the internal set as an array of CharRange objects.
| |
| getInstance | back to summary |
|---|---|
| public static CharSet getInstance(final String... setStrs) Factory method to create a new CharSet using a special syntax.
The matching order is:
Matching works left to right. Once a match is found the search starts again from the next character. If the same range is defined twice using the same syntax, only one range will be kept. Thus, "a-ca-c" creates only one range of "a-c". If the start and end of a range are in the wrong order, they are reversed. Thus "a-e" is the same as "e-a". As a result, "a-ee-a" would create only one range, as the "a-e" and "e-a" are the same. The set of characters represented is the union of the specified ranges. There are two ways to add a literal negation character (
Examples using the negation character:
CharSet.getInstance("^a-c").contains('a') = false
CharSet.getInstance("^a-c").contains('d') = true
CharSet.getInstance("^^a-c").contains('a') = true // (only '^' is negated)
CharSet.getInstance("^^a-c").contains('^') = false
CharSet.getInstance("^a-cd-f").contains('d') = true
CharSet.getInstance("a-c^").contains('^') = true
CharSet.getInstance("^", "a-c").contains('^') = true
All CharSet objects returned by this method will be immutable. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Gets a hash code compatible with the equals method.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Gets a string representation of the set. | |