|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectau.id.pbw.hyfo.hyph.AlphabetBuilder
public class AlphabetBuilder
This class builds and returns Alphabet
objects. The materials for an
Alphabet
are constructed progressively by calls to add_class
, an optional call to add_break_minima
and an optional call to add_hyphen_char
.
When all materials have been provided, a call to get_alphabet
returns the corresponding Alphabet
, and resets the
AlphabetBuilder
for use in building a new Alphabet
.
This class is not thread-safe.
Field Summary | |
---|---|
static int |
DEFAULT_ALPHABET_SIZE
The default number of character classes in an alphabet. |
static int |
DEFAULT_HYPHEN_CHAR
The default hyphen for this alphabet. |
static int |
ETX
The ETX is used as an end-of-word marker in patterns. |
static int |
ETX_CLASS
The character class of ETX is 1 |
static Integer |
ETX_CLASS_INTEGER
ETX_CLASS as an Integer |
protected boolean |
requires_codepoints
Are any alphabet characters outside the BMP; that is, does the alphabet require the use of codepoints rather than characters. |
static int |
STX
The STX is used as a start-of-word marker in patterns. |
static int |
STX_CLASS
The character class of STX is 0 |
static Integer |
STX_CLASS_INTEGER
STX_CLASS as an Integer |
Constructor Summary | |
---|---|
AlphabetBuilder()
Creates a new instance of AlphabetBuilder for an Alphabet with the default number of classes. |
|
AlphabetBuilder(int size)
Creates a new instance of AlphabetBuilder for an alphabet with the given number of character classes. |
Method Summary | |
---|---|
void |
add_break_minima(BreakMinima minima)
Adds a BreakMinima for this
alphabet. |
void |
add_class(String str)
Adds a character class for the Alphabet. |
void |
add_hyphen_char(int hyphen_codept)
Adds the canonical hyphen character for this alphabet. |
Alphabet |
get_alphabet()
Returns the Alphabet constructed from the character
classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STX
public static final int STX_CLASS
public static final Integer STX_CLASS_INTEGER
public static final int ETX
public static final int ETX_CLASS
public static final Integer ETX_CLASS_INTEGER
public static final int DEFAULT_ALPHABET_SIZE
public static final int DEFAULT_HYPHEN_CHAR
protected boolean requires_codepoints
Constructor Detail |
---|
public AlphabetBuilder()
public AlphabetBuilder(int size)
size
- the number of character classes in the alphabet.Method Detail |
---|
public void add_break_minima(BreakMinima minima)
BreakMinima
for this
alphabet. Only one is required. Subsequent attempts will be logged and
otherwise ignored.
minima
- the BreakMinima
for the alphabet.public void add_hyphen_char(int hyphen_codept)
hyphen_codept
- the hyphen character as a codepoint.public void add_class(String str) throws HyphenationException
String
comprised of at least one character. The first or only
character is the canonical character; any subsequent characters are
treated as equivalents to the canonical character. Only canonical characters
may appear in hyphenation patterns.All characters are converted to codepoints for use in hyphenation.
str
- the character(s) comprising the class. The first or only
character is the canonical character, and any subsequent characters are
equivalents.
HyphenationException
- if the argument string
is empty, or if this builder has been invalidated.public Alphabet get_alphabet() throws HyphenationException
Alphabet
constructed from the character
classes.
Alphabet
constructed from the classes.
HyphenationException
- if this builder has
been invalidated.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |