Class TextSegment
- java.lang.Object
-
- org.daisy.dotify.formatter.impl.segment.TextSegment
-
- All Implemented Interfaces:
FollowingText
,PrecedingText
,ResolvableText
,Segment
public class TextSegment extends Object implements Segment
TODO: Write java doc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.daisy.dotify.formatter.impl.segment.Segment
Segment.SegmentType
-
-
Constructor Summary
Constructors Constructor Description TextSegment(String chars, TextProperties tp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canMakeResult()
boolean
equals(Object obj)
Optional<String>
getLocale()
Segment.SegmentType
getSegmentType()
String
getText()
TextProperties
getTextProperties()
int
hashCode()
boolean
isStatic()
Returns true if this item does not change.BrailleTranslatorResult
newResult()
String
peek()
Peeks the value of this item.String
resolve()
Resolves the item.boolean
shouldHyphenate()
boolean
shouldMarkCapitalLetters()
void
storeResult(BrailleTranslatorResult template)
-
-
-
Constructor Detail
-
TextSegment
public TextSegment(String chars, TextProperties tp)
-
-
Method Detail
-
canMakeResult
public boolean canMakeResult()
-
newResult
public BrailleTranslatorResult newResult()
-
storeResult
public void storeResult(BrailleTranslatorResult template)
-
getText
public String getText()
-
getTextProperties
public TextProperties getTextProperties()
-
getSegmentType
public Segment.SegmentType getSegmentType()
- Specified by:
getSegmentType
in interfaceSegment
-
peek
public String peek()
Description copied from interface:ResolvableText
Peeks the value of this item. The returned string may be different from call to call.Note that after a call to
ResolvableText.resolve()
, this method should consistently return the same result.- Specified by:
peek
in interfaceFollowingText
- Specified by:
peek
in interfaceResolvableText
- Returns:
- the value, never null
-
resolve
public String resolve()
Description copied from interface:ResolvableText
Resolves the item. Once the value has been resolved, it cannot change between calls in the same context. This applies to bothResolvableText.peek()
andResolvableText.resolve()
.- Specified by:
resolve
in interfacePrecedingText
- Specified by:
resolve
in interfaceResolvableText
- Returns:
- the value, never null
-
isStatic
public boolean isStatic()
Description copied from interface:FollowingText
Returns true if this item does not change.- Specified by:
isStatic
in interfaceFollowingText
- Returns:
- true if this item is static, false otherwise
-
shouldHyphenate
public boolean shouldHyphenate()
- Specified by:
shouldHyphenate
in interfaceSegment
-
shouldMarkCapitalLetters
public boolean shouldMarkCapitalLetters()
- Specified by:
shouldMarkCapitalLetters
in interfaceSegment
-
-