Package org.daisy.dotify.translator
Class DefaultMarkerProcessor
- java.lang.Object
-
- org.daisy.dotify.translator.DefaultMarkerProcessor
-
public class DefaultMarkerProcessor extends Object
Provides a default marker processor implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultMarkerProcessor.Builder
Provides a builder for the marker processor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
processAttributes(TextAttribute atts, String... text)
Processes the input text and attributes into a text containing markers at the appropriate positions.String[]
processAttributesRetain(AttributeWithContext atts, List<String> text)
Processes the input text chunks and attributes into a text containing markers at the appropriate positions while retaining the text partition as specified by the input array.String[]
processAttributesRetain(TextAttribute atts, String[] text)
Processes the input text chunks and attributes into a text containing markers at the appropriate positions while retaining the text partition as specified by the input array.static TextAttribute
toTextAttribute(AttributeWithContext c, List<String> texts)
-
-
-
Method Detail
-
processAttributes
public String processAttributes(TextAttribute atts, String... text)
Processes the input text and attributes into a text containing markers at the appropriate positions. The length of the text(s) must match the text attributes specified width.- Parameters:
atts
- the text attributes that apply to the text.text
- the text(s) to process- Returns:
- returns a string with markers
- Throws:
IllegalArgumentException
- if the specified attributes does not match the text.
-
processAttributesRetain
public String[] processAttributesRetain(TextAttribute atts, String[] text)
Processes the input text chunks and attributes into a text containing markers at the appropriate positions while retaining the text partition as specified by the input array. The length of the texts must match the text attributes specified width.- Parameters:
text
- the texts to processatts
- the text attributes that apply to the text.- Returns:
- returns an array of strings with markers
- Throws:
IllegalArgumentException
- if the specified attributes does not match the text.
-
processAttributesRetain
public String[] processAttributesRetain(AttributeWithContext atts, List<String> text)
Processes the input text chunks and attributes into a text containing markers at the appropriate positions while retaining the text partition as specified by the input array. The length of the texts must match the text attributes specified width.- Parameters:
text
- the texts to processatts
- the text attributes that apply to the text.- Returns:
- returns an array of strings with markers
- Throws:
IllegalArgumentException
- if the specified attributes does not match the text.
-
toTextAttribute
public static TextAttribute toTextAttribute(AttributeWithContext c, List<String> texts)
-
-