Class Style
- java.lang.Object
-
- org.daisy.dotify.formatter.impl.segment.Style
-
- All Implemented Interfaces:
FollowingText
,PrecedingText
,ResolvableText
,Segment
public class Style extends Object implements Segment
Provides a text style segment. This segment is a bit different than other segments in that it can contain other segments.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.daisy.dotify.formatter.impl.segment.Segment
Segment.SegmentType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
add(Segment segment)
Adds a segment to this style.String
getName()
Gets the name of this style.List<Segment>
getSegments()
Gets the segments in the scope of this style.Segment.SegmentType
getSegmentType()
boolean
isStatic()
Returns true if this item does not change.String
peek()
Peeks the value of this item.String
resolve()
Resolves the item.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.daisy.dotify.formatter.impl.segment.Segment
getLocale, shouldHyphenate, shouldMarkCapitalLetters
-
-
-
-
Constructor Detail
-
Style
public Style(String style)
Creates a new style segment with the specified name.- Parameters:
style
- the style name
-
-
Method Detail
-
getName
public String getName()
Gets the name of this style.- Returns:
- the name of this style
-
add
public int add(Segment segment)
Adds a segment to this style.- Parameters:
segment
- the segment to add- Returns:
- the index of segment inside the group
-
getSegments
public List<Segment> getSegments()
Gets the segments in the scope of this style.- Returns:
- a list of segments
-
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
-
-