|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jtr.transliterate.CharacterList
Holds an ordered list of characters and character ranges. This is the basic data structure for finding transliterations to perform.
Usage:
This class is normally created and populated directly from the
CharacterParser
class. CharacterList objects are immutable, so
no additional patterns can be added once the object has been constructed.
This allows CharacterList objects to be used by multiple threads
simultaneously.
Once a character list has been created, it will normally be passed
into a CharacterReplacer
constructor for processing. However,
character lists may also be cached, since they hold no state information
during the parsing itself. This would remove compile-time costs of creating
the list when performance is critical.
Constructor Summary | |
CharacterList()
Creates an empty CharacterList |
|
CharacterList(java.util.List cCharList)
Creates new CharacterList, using the given list of ListEntry
objects. |
Method Summary | |
int |
findCharAtPosition(int nPosition,
boolean bDeleteUnreplaceables)
Finds the character corresponding to the given position in the list. |
int |
getMatch(char nChar,
boolean bComplement)
Determines whether a given character exists in the list. |
int |
size()
Determines the total number of characters in the list—not just the number of entries in the underlying array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CharacterList()
public CharacterList(java.util.List cCharList)
ListEntry
objects.cCharList
- a List
of ListEntry
objects to
be stored in the arrayNullPointerException
- if cCharList is nullMethod Detail |
public int getMatch(char nChar, boolean bComplement)
nChar
- the character to be matchedbComplement
- determines behaviour when the COMPLEMENT_MASK flag
is set—if false, the list is scanned normally, otherwise the
complement of the list is usedpublic int findCharAtPosition(int nPosition, boolean bDeleteUnreplaceables)
nPosition
- the position where the resulting character should be
found in the listbDeleteUnreplaceables
- determines behaviour when the
DELETE_UNREPLACEABLES_MASK is set—if false, the last character
in the list will be returned, otherwise -1 is returnedpublic int size()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |