| xtc.parser.Element xtc.parser.Terminal xtc.parser.CharTerminal xtc.parser.CharClass
CharClass | public class CharClass extends CharTerminal (Code) | | A character class terminal.
Note that
CharClass.equals(Object) only determines whether the
two character class terminals have the same structure (that is, are
both exclusive or non-exclusive and have the same list of character
ranges), but does not determine whether the two character class
terminals recognize the same characters.
author: Robert Grimm version: $Revision: 1.1 $ |
Inner Class :public static class Parser | |
Field Summary | |
public boolean | exclusive The flag for whether the character class is exclusive. | public List | ranges The list of character ranges. |
Constructor Summary | |
public | CharClass(List ranges) Create a new, non-exclusive character class. | public | CharClass(boolean exclusive, List ranges) Create a new character class. | public | CharClass(char c) Create a new, non-exclusive character class for the specified
character. | public | CharClass(String s) Create a new, non-exclusive character class based on the supplied
character class specification. |
exclusive | public boolean exclusive(Code) | | The flag for whether the character class is exclusive.
|
ranges | public List ranges(Code) | | The list of character ranges. Note that, strictly speaking, this
should be a set of disjoint character ranges. However, it is
implemented as a list so that a character class can be printed as
it was specified.
|
CharClass | public CharClass(List ranges)(Code) | | Create a new, non-exclusive character class.
Parameters: ranges - The list of character ranges. |
CharClass | public CharClass(boolean exclusive, List ranges)(Code) | | Create a new character class.
Parameters: exclusive - The exclusive flag. Parameters: ranges - The list of character ranges. |
CharClass | public CharClass(char c)(Code) | | Create a new, non-exclusive character class for the specified
character.
Parameters: c - The character. |
CharClass | public CharClass(String s)(Code) | | Create a new, non-exclusive character class based on the supplied
character class specification. Note that the character class
specification must not include the leading '[ ' and
trailing '] ' characters.
Parameters: s - The character class specification. |
count | public int count()(Code) | | Determine the number of characters covered by this character
class. Note that for exclusive character classes this method
returns the number of excluded characters.
The number of characters for this character class. |
hashCode | public int hashCode()(Code) | | |
normalize | public CharClass normalize()(Code) | | Normalize this character class. This method sorts the list of
character ranges by each range's first character and combines
adjacent or overlapping ranges. However, it does not turn
exclusive character classes into non-exclusive ones (as that
conversion might negatively impact recognition performance).
This character class. |
overlaps | public boolean overlaps(CharClass klass)(Code) | | Determine whether this character class overlaps the specified
character class. Two character classes overlap if they have
common characters, though they need not necessarily be the same.
Note that the result of this method is only well-defined if both
character classes are non-exclusive.
Parameters: klass - The other character class. true if the two character classes overlap. |
Methods inherited from xtc.parser.Element | abstract public Tag tag()(Code)(Java Doc)
|
|
|