public class HyphenationImpl extends Object implements Hyphenation
Hyphenation
interface.Modifier and Type | Field and Description |
---|---|
private char |
hyphen |
private int[] |
hyphenationPoints |
private String |
word |
Constructor and Description |
---|
HyphenationImpl(String hyphenatedWord)
The constructor.
|
HyphenationImpl(String hyphenatedWord,
char hyphen)
The constructor.
|
HyphenationImpl(String word,
char hyphen,
int[] hyphenationPoints)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
char |
getHyphen() |
int |
getHyphenation(int hyphenationIndex)
This method gets the index of the given hyphenation-point.
|
int |
getHyphenationBefore(int offset)
This method gets the greatest
hyphenation position that is less to the given
offset . |
int |
getHyphenationCount()
This method gets the number of hyphenation-points in the word.
|
int[] |
getHyphenationPoints() |
String |
getWord()
This method gets the raw word to be hyphenated.
|
String |
toString()
The hyphenation of the according word (e.g.
|
private final String word
private final int[] hyphenationPoints
private final char hyphen
public HyphenationImpl(String word, char hyphen, int[] hyphenationPoints)
word
- is the word
.hyphen
- is the hyphen-character
.hyphenationPoints
- are the actual hyphenation-points
.public HyphenationImpl(String hyphenatedWord)
hyphenatedWord
- is the hyphenated word.public HyphenationImpl(String hyphenatedWord, char hyphen)
hyphenatedWord
- is the hyphenated word.hyphen
- is the hyphen-character
.public int getHyphenationCount()
Hyphenation
getHyphenationCount
in interface Hyphenation
0
for "I" or "egg" or 1
for "im-pact").public int getHyphenation(int hyphenationIndex)
Hyphenation
getHyphenation
in interface Hyphenation
hyphenationIndex
- is the index of the hyphenation-point in the range from 0
to
Hyphenation.getHyphenationCount()
- 1
.word
.public int getHyphenationBefore(int offset)
Hyphenation
hyphenation position
that is less to the given
offset
.getHyphenationBefore
in interface Hyphenation
offset
- is the offset in the word
where a hyphenation is desired.hyphenation position
just before the given offset
or -1
if
there is no such position.public int[] getHyphenationPoints()
public String getWord()
Hyphenation
getWord
in interface Hyphenation
public char getHyphen()
getHyphen
in interface Hyphenation
Hyphenator.getHyphen()
public String toString()
Hyphenation
toString
in interface Hyphenation
toString
in class Object
Copyright © 2001–2016 mmm-Team. All rights reserved.