|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.text.CharSet
An object representing a set of characters. (This is a "set" in the mathematical sense: an unduplicated list of characters on which set operations such as union and intersection can be performed.) The set information is stored in compressed, optimized form: The object contains a String with an even number of characters. Each pair of characters represents a range of characters contained in the set (a pair of the same character represents a single character). The characters are sorted in increasing order.
Nested Class Summary | |
class |
CharSet.Enumeration
An Enumeration that can be used to extract the character ranges from a CharSet one at a time |
Field Summary | |
private static String[][] |
categoryMap
Table used with charSetFromCategory. |
private String |
chars
The structure containing the set information. |
private static Hashtable |
expressionCache
A cache which is used to speed up parseString() whenever it is used to parse a description that has been parsed before |
Constructor Summary | |
|
CharSet()
Creates an empty CharSet. |
|
CharSet(char c)
Creates a CharSet containing a single character. |
|
CharSet(char lo,
char hi)
Creates a CharSet containing a range of characters. |
private |
CharSet(String chars)
Creates a CharSet, initializing it from the internal storage of another CharSet (this function performs no error checking on "chars", so if it's malformed, undefined behavior will result) |
Method Summary | |
private static CharSet |
charSetForCategory(String category)
Creates a CharSet containing all the characters in a particular Unicode category. |
Object |
clone()
Creates a new CharSet that is equal to this one |
CharSet |
complement()
Returns a CharSet containing all the characters which are not in "this" |
boolean |
contains(char c)
Returns true if this CharSet contains the specified character |
CharSet |
difference(CharSet that)
Returns a CharSet containing all the characters in "this" that aren't also in "that" |
private StringBuffer |
doComplement()
The internal implementation function for the complement routines |
private StringBuffer |
doIntersection(String c2)
The internal implementation of the two intersection functions |
private static CharSet |
doParseString(String s)
This function is used by parseString() to actually parse the string |
private StringBuffer |
doUnion(String c2)
The actual implementation of the union functions |
boolean |
empty()
Returns true if this CharSet contains no characters |
boolean |
equals(Object that)
Returns true if "that" is another instance of CharSet containing the exact same characters as this one |
CharSet.Enumeration |
getChars()
Returns an Enumeration that will return the ranges of characters contained in this CharSet one at a time |
String |
getRanges()
Returns a String representing the contents of this CharSet in the same form in which they're stored internally: as pairs of characters representing the start and end points of ranges |
private void |
internalComplement()
Complements "this". |
private void |
internalDifference(CharSet that)
Removes from "this" all the characters that are also in "that" |
private void |
internalIntersection(CharSet that)
Removes from this CharSet any characters that aren't also in "that" |
private void |
internalUnion(CharSet that)
Adds the characters in "that" to this CharSet |
CharSet |
intersection(CharSet that)
Returns the intersection of two CharSets. |
static CharSet |
parseString(String s)
Builds a CharSet based on a textual description. |
static Hashtable |
releaseExpressionCache()
Returns a copy of CharSet's expression cache and sets CharSet's expression cache to empty. |
String |
toString()
Returns a textual representation of this CharSet. |
CharSet |
union(CharSet that)
Returns a CharSet representing the union of two CharSets. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private String chars
private static Hashtable expressionCache
private static final String[][] categoryMap
Constructor Detail |
public CharSet()
public CharSet(char c)
c
- The character to put into the CharSetpublic CharSet(char lo, char hi)
lo
- The lowest-numbered character to include in the rangehi
- The highest-numbered character to include in the rangeprivate CharSet(String chars)
Method Detail |
public static CharSet parseString(String s)
RuleBasedBreakIterator
private static CharSet doParseString(String s)
private static CharSet charSetForCategory(String category)
public static Hashtable releaseExpressionCache()
public CharSet union(CharSet that)
private void internalUnion(CharSet that)
private StringBuffer doUnion(String c2)
public CharSet intersection(CharSet that)
private void internalIntersection(CharSet that)
private StringBuffer doIntersection(String c2)
public CharSet difference(CharSet that)
private void internalDifference(CharSet that)
public CharSet complement()
private void internalComplement()
private StringBuffer doComplement()
public boolean contains(char c)
c
- The character we're testing for set membershippublic boolean equals(Object that)
equals
in class Object
that
- the reference object with which to compare.
true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
Hashtable
public Object clone()
clone
in class Object
Cloneable
public boolean empty()
public String toString()
toString
in class Object
public String getRanges()
public CharSet.Enumeration getChars()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |