protected static class DefaultLineWrapper.TextSegment extends Object
text. It acts as an event when
iterating the text. It is classified by a type
and caches a potential hyphenation for performance reasons.| Modifier and Type | Field and Description |
|---|---|
private int |
endIndex |
private Hyphenation |
hyphenatedWord |
private Hyphenator |
hyphenator |
private int |
startIndex |
private String |
text |
private DefaultLineWrapper.TextSegmentType |
type |
| Modifier | Constructor and Description |
|---|---|
protected |
TextSegment(String text,
Hyphenator hyphenator)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getEndIndex()
This method gets the index immediately after the last character of this
DefaultLineWrapper.TextSegment. |
Hyphenation |
getHyphenatedWord()
This method gets the
Hyphenation if this DefaultLineWrapper.TextSegment has the type
DefaultLineWrapper.TextSegmentType.WORD. |
int |
getLength()
This method gets the length of this
DefaultLineWrapper.TextSegment. |
int |
getStartIndex()
This method gets the start index of this
DefaultLineWrapper.TextSegment. |
String |
getText()
This method gets the full text containing this segment.
|
DefaultLineWrapper.TextSegmentType |
getType()
This method determines if this
DefaultLineWrapper.TextSegment represents a word. |
void |
initialize(int start,
int end,
DefaultLineWrapper.TextSegmentType textType)
This method resets and initializes this object.
|
String |
toString() |
private final String text
private final Hyphenator hyphenator
private int startIndex
private int endIndex
private DefaultLineWrapper.TextSegmentType type
private Hyphenation hyphenatedWord
protected TextSegment(String text, Hyphenator hyphenator)
text - is the getText().hyphenator - is the Hyphenation used for getHyphenatedWord().public int getLength()
DefaultLineWrapper.TextSegment.endIndex - startIndex.public void initialize(int start,
int end,
DefaultLineWrapper.TextSegmentType textType)
start - is the start-index.end - is the end-index.textType - is the type.public int getStartIndex()
DefaultLineWrapper.TextSegment.DefaultLineWrapper.TextSegment.public int getEndIndex()
DefaultLineWrapper.TextSegment.DefaultLineWrapper.TextSegment.public String getText()
public DefaultLineWrapper.TextSegmentType getType()
DefaultLineWrapper.TextSegment represents a word.true if segment is word, false otherwise (special characters, etc.)getHyphenatedWord()public Hyphenation getHyphenatedWord()
Hyphenation if this DefaultLineWrapper.TextSegment has the type
DefaultLineWrapper.TextSegmentType.WORD. The Hyphenation will be build lazy on the first call of this
method.Hyphenation or null if this is no word.Copyright © 2001–2016 mmm-Team. All rights reserved.