Package org.daisy.dotify.api.translator
Class TranslatorMode
- java.lang.Object
-
- org.daisy.dotify.api.translator.TranslatorMode
-
- All Implemented Interfaces:
FactoryProperties
public final class TranslatorMode extends Object implements FactoryProperties
Provides information about a translator mode. This information could, for example, be used to find a translator that matches a given specification. The specification could be based on some translator mode properties or on its identifier.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TranslatorMode.Builder
Provides a translator mode builder.static class
TranslatorMode.DotsPerCell
Provides a definition of the number of dots in a braille cell.-
Nested classes/interfaces inherited from interface org.daisy.dotify.api.factory.FactoryProperties
FactoryProperties.ComparatorBuilder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Double>
getContractionGrade()
Gets the contraction grade, if set.String
getDescription()
Gets the description for this FactoryString
getDisplayName()
Gets the display name for this FactoryOptional<TranslatorMode.DotsPerCell>
getDotsPerCell()
Gets the number of dots per cell, if set.String
getIdentifier()
Gets the identifier for this FactoryOptional<TranslatorType>
getType()
Gets the mode type, if set.static TranslatorMode
parse(String str)
Parses the string as a translator mode.String
toString()
static TranslatorMode
withGrade(double grade)
Creates a new mode with the specified translation gradestatic TranslatorMode
withType(TranslatorType type)
Creates a new mode with the specified type.
-
-
-
Method Detail
-
parse
public static TranslatorMode parse(String str)
Parses the string as a translator mode.- Parameters:
str
- the input string- Returns:
- a translator mode
- Throws:
IllegalArgumentException
- if parsing fails
-
withType
public static TranslatorMode withType(TranslatorType type)
Creates a new mode with the specified type.- Parameters:
type
- the type- Returns:
- a new instance
-
withGrade
public static TranslatorMode withGrade(double grade)
Creates a new mode with the specified translation grade- Parameters:
grade
- the translation grade- Returns:
- a new instance
-
getContractionGrade
public Optional<Double> getContractionGrade()
Gets the contraction grade, if set.- Returns:
- the contraction grade.
-
getType
public Optional<TranslatorType> getType()
Gets the mode type, if set.- Returns:
- the type of mode
-
getDotsPerCell
public Optional<TranslatorMode.DotsPerCell> getDotsPerCell()
Gets the number of dots per cell, if set.- Returns:
- the dots per cell
-
getIdentifier
public String getIdentifier()
Description copied from interface:FactoryProperties
Gets the identifier for this Factory- Specified by:
getIdentifier
in interfaceFactoryProperties
- Returns:
- returns the identifier for this Factory
-
getDisplayName
public String getDisplayName()
Description copied from interface:FactoryProperties
Gets the display name for this Factory- Specified by:
getDisplayName
in interfaceFactoryProperties
- Returns:
- returns the display name for this Factory
-
getDescription
public String getDescription()
Description copied from interface:FactoryProperties
Gets the description for this Factory- Specified by:
getDescription
in interfaceFactoryProperties
- Returns:
- returns the description for this Factory
-
-