|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jtr.transliterate.CharacterParser
Simple parser for characters and character ranges.
Usage:
Either:
CharacterReplacer
constructors with String arguments
for the search and replacement lists—these will call this class
as necessary, orCharacterList
classes
required for your pattern matches, then pass these on to a
CharacterReplacer
constructor. This allows CharacterList
objects to be cached if desired.Note:
CharacterParser objects are not thread safe. If thread safety is required, either externally synchronize any calls to a CharacterParser instance, or create new instances as required for each thread.
Field Summary | |
static int |
COMPLEMENT_MASK
Complement the search list. |
static int |
DELETE_UNREPLACEABLES_MASK
Delete any characters in the search list that don't have a corresponding character in the replacement list. |
static int |
SQUASH_DUPLICATES_MASK
Squash any replacement characters that occur more than once in succession during the transliteration process. |
Constructor Summary | |
CharacterParser()
Creates new CharacterParser |
Method Summary | |
CharacterList |
compilePattern(char[] aPattern)
The main compile routine, using a character array as the pattern to be compiled. |
CharacterList |
compilePattern(java.lang.String aPattern)
The main compile routine, using a String as the pattern to be compiled. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int COMPLEMENT_MASK
public static final int DELETE_UNREPLACEABLES_MASK
public static final int SQUASH_DUPLICATES_MASK
Constructor Detail |
public CharacterParser()
Method Detail |
public CharacterList compilePattern(java.lang.String aPattern) throws CharacterParseException
aPattern
- the pattern to be compiled by the compilerCharacterList
object containing the compiled patternCharacterParseException
- something went wrong during the parse
of the patternNullPointerException
- aPattern is null
public CharacterList compilePattern(char[] aPattern) throws CharacterParseException
The main compile routine, using a character array as the pattern to be compiled. The method performs a one character lookahead, to determine when it sees a character range, and whether it is a real range, or just a lone hyphen.
aPattern
- the pattern to be compiled by the compilerCharacterList
object containing the compiled patternCharacterParseException
- something went wrong during the parse
of the patternNullPointerException
- aPattern is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |