|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.lowagie.text.pdf.hyphenation.TernaryTree
com.lowagie.text.pdf.hyphenation.HyphenationTree
This tree structure stores the hyphenation patterns in an efficient way for fast lookup. It provides the provides the method to hyphenate a word.
| Nested Class Summary |
| Nested classes inherited from class com.lowagie.text.pdf.hyphenation.TernaryTree |
TernaryTree.Iterator |
| Constructor Summary | |
HyphenationTree()
|
|
| Method Summary | |
void |
addClass(String chargroup)
Add a character class to the tree. |
void |
addException(String word,
ArrayList hyphenatedword)
Add an exception to the tree. |
void |
addPattern(String pattern,
String ivalue)
Add a pattern to the tree. |
String |
findPattern(String pat)
|
Hyphenation |
hyphenate(char[] w,
int offset,
int len,
int remainCharCount,
int pushCharCount)
Hyphenate word and return an array of hyphenation points. |
Hyphenation |
hyphenate(String word,
int remainCharCount,
int pushCharCount)
Hyphenate word and return a Hyphenation object. |
void |
loadSimplePatterns(InputStream stream)
|
void |
printStats()
|
| Methods inherited from class com.lowagie.text.pdf.hyphenation.TernaryTree |
balance, clone, find, find, insert, insert, keys, knows, size, strcmp, strcmp, strcpy, strlen, strlen, trimToSize |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HyphenationTree()
| Method Detail |
public void loadSimplePatterns(InputStream stream)
public String findPattern(String pat)
public Hyphenation hyphenate(String word,
int remainCharCount,
int pushCharCount)
word - the word to be hyphenatedremainCharCount - Minimum number of characters allowed
before the hyphenation point.pushCharCount - Minimum number of characters allowed after
the hyphenation point.
Hyphenation object representing
the hyphenated word or null if word is not hyphenated.
public Hyphenation hyphenate(char[] w,
int offset,
int len,
int remainCharCount,
int pushCharCount)
w - char array that contains the wordoffset - Offset to first character in wordlen - Length of wordremainCharCount - Minimum number of characters allowed
before the hyphenation point.pushCharCount - Minimum number of characters allowed after
the hyphenation point.
Hyphenation object representing
the hyphenated word or null if word is not hyphenated.public void addClass(String chargroup)
SimplePatternParser as callback to
add character classes. Character classes define the
valid word characters for hyphenation. If a word contains
a character not defined in any of the classes, it is not hyphenated.
It also defines a way to normalize the characters in order
to compare them with the stored patterns. Usually pattern
files use only lower case characters, in this case a class
for letter 'a', for example, should be defined as "aA", the first
character being the normalization char.
addClass in interface PatternConsumerchargroup - character group
public void addException(String word,
ArrayList hyphenatedword)
SimplePatternParser class as callback to
store the hyphenation exceptions.
addException in interface PatternConsumerword - normalized wordhyphenatedword - a vector of alternating strings and
hyphen objects.
public void addPattern(String pattern,
String ivalue)
SimplePatternParser class as callback to
add a pattern to the tree.
addPattern in interface PatternConsumerpattern - the hyphenation patternivalue - interletter weight values indicating the
desirability and priority of hyphenating at a given point
within the pattern. It should contain only digit characters.
(i.e. '0' to '9').public void printStats()
printStats in class TernaryTree
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||