|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.text.base.HyphenationState
public class HyphenationState
This class represents the current state of the hyphenation of a specific word.
Hyphenator.hyphenate(String, int, int)| Field Summary | |
|---|---|
private StringHasher |
hasher
The StringHasher to use. |
private int[][] |
hashes
The hashes of all substrings of normalizedWord. |
private char |
hyphen
|
private static int |
MIN_PATTERN_LENGTH
The minimum length of a pattern. |
private char[] |
normalizedWord
The normalized word. |
private int |
offset
The offset where to start hyphenation in word. |
private int[] |
rankings
The HyphenationPatternPosition.rankings |
private StringUtil |
stringUtil
The StringUtil to use. |
private String |
word
|
| Constructor Summary | |
|---|---|
HyphenationState(String word,
String normalizedWord,
char hyphen,
int maxPatternLength,
int offset,
StringHasher hasher,
StringUtil stringUtil)
The constructor. |
|
| Method Summary | |
|---|---|
void |
apply(HyphenationPattern pattern)
This is the heart of the hyphenation algorithm. |
private void |
apply(HyphenationPattern pattern,
int pos)
This method applies the pattern matching at the
given offset. |
private int[] |
getHashes(int length)
This method gets the hashes of all substrings of the normalized word that have the given
length. |
protected char[] |
getNormalizedWord()
This method gets the normalized word. |
String |
getWord()
This method gets the word to hyphenate. |
Hyphenation |
toHyphenation()
This method gets the Hyphenation from this state. |
protected int[] |
toHyphenationPoints()
This method creates the hyphenationPoints of a hyphenated word. |
String |
toString()
This method generates a string with the given word including
the ranked hyphenation points. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final int MIN_PATTERN_LENGTH
private final StringHasher hasher
StringHasher to use.
private final StringUtil stringUtil
StringUtil to use.
private final String word
getWord()private final char[] normalizedWord
private int[][] hashes
normalizedWord. The first index
indicates the substring-length - 2, the second is the offset in
normalizedWord.
private final int[] rankings
HyphenationPatternPosition.rankings
private final int offset
word.
private final char hyphen
Hyphenator.getHyphen()| Constructor Detail |
|---|
public HyphenationState(String word,
String normalizedWord,
char hyphen,
int maxPatternLength,
int offset,
StringHasher hasher,
StringUtil stringUtil)
word - is the word to hyphenate.normalizedWord - is the normalized word.hyphen - is the
hyphen.maxPatternLength - is the maximum length of
all patterns.offset - is the start-position in word. Typically 0.hasher - is the hash-algorithm. It should be
fast. The same StringHasher needs to be used for
HyphenationPattern.getWordPartHash().stringUtil - is the StringUtil to use.| Method Detail |
|---|
private int[] getHashes(int length)
normalized word that have the given
length.
length - is the length of the
substrings to get hashes for.
public void apply(HyphenationPattern pattern)
pattern is a substring of the
pattern - is the pattern to check and potentially apply.
private void apply(HyphenationPattern pattern,
int pos)
pattern matching at the
given offset.
pattern - is the matching pattern.pos - is the offset in the word to hyphenate.protected int[] toHyphenationPoints()
hyphenationPoints of a hyphenated word.
toHyphenation()public Hyphenation toHyphenation()
Hyphenation from this state.
Hyphenation.public String getWord()
protected char[] getNormalizedWord()
word
in normalized form (lower case) and surrounded by
HyphenationPattern.TERMINATOR.
public String toString()
word including
the ranked hyphenation points.
It is intended for debugging purposes.
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||