public interface BrailleTranslatorResult
Modifier and Type | Field and Description |
---|---|
static String |
METRIC_FORCED_BREAK
Metric identifier representing the total number of forced breaks applied
on the instance up to this point.
|
static String |
METRIC_HYPHEN_COUNT
Metric identifier representing the total number of breaks applied at break
points inside words on the instance up to this point.
|
Modifier and Type | Method and Description |
---|---|
BrailleTranslatorResult |
copy()
Returns a copy of this result in the current state.
|
int |
countRemaining()
Returns the number of characters remaining in the result.
|
double |
getMetric(String metric)
Gets the value of a given metric.
|
String |
getTranslatedRemainder()
Gets the translated remainder, in other words the characters not
yet extracted with
nextTranslatedRow . |
boolean |
hasNext()
Returns true if there are characters remaining in the result, in other
words of there are characters not yet extracted with
nextTranslatedRow . |
default String |
nextTranslatedRow(int limit,
boolean force)
Gets the translated string preceding the row break, including a translated
hyphen at the end, if needed.
|
String |
nextTranslatedRow(int limit,
boolean force,
boolean wholeWordsOnly)
Gets the translated string preceding the row break, including a translated
hyphen at the end, if needed.
|
boolean |
supportsMetric(String metric)
Returns true if this result supports the given metric,
false otherwise.
|
static final String METRIC_FORCED_BREAK
static final String METRIC_HYPHEN_COUNT
default String nextTranslatedRow(int limit, boolean force)
limit
. If force
is not used, the result could be empty and no
characters removed from the buffer. A caller would typically set force
to
true when limit
is equal to the maximum number of available characters
on a row.limit
- specifies the maximum number of characters allowed in the resultforce
- specifies if the translator should force a break at the limit
if no natural break point is foundString nextTranslatedRow(int limit, boolean force, boolean wholeWordsOnly)
Gets the translated string preceding the row break, including a translated
hyphen at the end, if needed. The length of the translated text must not exceed the
specified limit
. If force
is not used, the result could be empty and no
characters removed from the buffer. A caller would typically set force
to
true when limit
is equal to the maximum number of available characters
on a row.
When wholeWordsOnly
is set to true, the row may not end on a break point
inside a word. However, when combined with force
, a row may end on such a break point
if the distance to the first word boundary is longer than the row and
there is a suitable break point inside the word.
limit
- specifies the maximum number of characters allowed in the resultforce
- specifies if the translator should force a break at the limit
if no natural break point is foundwholeWordsOnly
- specifies that the row may not end on a break point inside a word.String getTranslatedRemainder()
nextTranslatedRow
.int countRemaining()
getTranslatedRemainder
.boolean hasNext()
nextTranslatedRow
.boolean supportsMetric(String metric)
Returns true if this result supports the given metric, false otherwise.
Metrics specified by the API are included as static strings in this class, but additional ones may be offered by an implementation.
metric
- the metric identifierdouble getMetric(String metric)
Gets the value of a given metric.
Metrics specified by the API are included as static strings in
this interface, but additional ones may be offered by an implementation.
Note that an implementation is not required to support any metrics.
Metric support can be tested with supportsMetric
.
metric
- the metric identifierUnsupportedMetricException
- if the metric is not supportedBrailleTranslatorResult copy()
UnsupportedOperationException
- if the operation is not supported