org.jscience.linguistics.braille
Interface BrailleLanguage

All Known Implementing Classes:
BrailleLanguageUnicode

public interface BrailleLanguage

The interface defining Java text/Braille translation classes that implement the UMIST, Manchester, UK translation algorithm.

Classes implementing BrailleLanguage should use the same global constants for the language information.

Copyright 1999, 2004 Alasdair King. This program is free software under the terms of the GNU General Public License.

See Also:
"Blenkhorn, P. A System for Converting Braille into Print, IEEE Transactions on Rehabilitation Engineering, Vol 3, No 2, June 1995.", A platform-independent Braille translator

Field Summary
static java.lang.String DATAFILE_EXTENSION
          The filename extension, including the dot, that indicates the BrailleLanguage definition tables in their editable human-readable plain text form for this language.
static char FILE_EXTENSION_DELIMITER
          Used to delimit the filename extension from the main filename body.
static java.lang.String FILENAME_EXTENSION
          The filename extension that indicates the BrailleLanguage data file for this BrailleLanguage, imported when the BrailleLanguage is instantiated.
static char LEFT_FOCUS_DELIMITER
          The ASCII/Unicode character used to denote the end of the left context and the start of the focus in a translation rule.
static char RIGHT_FOCUS_DELIMITER
          The ASCII/Unicode character used to denote the end of the focus and the start of the right context in a translation rule.
static int RULE_BUFFER
          The maximum size of a single translation rule in characters.
static char RULE_CONTENT_DELIMITER
          The value used to denote the end of the output in a translation rule - only for legacy 256-character-set languages.
static char RULE_OUTPUT_DELIMITER
          The ASCII/Unicode character used to denote the end of the right context and the start of the rule output in a translation rule.
static int SPACE_FLAG
          Defines the value of the bit that must be set to indicate a whitespace character.
static char TABLE_DELIMITER
          Character denoting the end of the list of translation rules in a language rules table in a 256-character BrailleLanguage system.
static int WILDCARD_FLAG
          Defines the value of the bit that must be set to indicate a wildcard character in any language.
static int WILDCARD_NONE
          Information for a wildcard definition - wildcards of type WILDCARD_NONE must must match zero or more of its type in the input text.
static int WILDCARD_ONE
          Information for a wildcard definition - wildcards of type WILDCARD_NONE must must match exactly one its type in the input text.
static int WILDCARD_SEVERAL
          Information for a wildcard definition - wildcards of type WILDCARD_NONE must may match one or more of its type in the input text.
 
Method Summary
 int getPermittedStates()
          Returns the states permitted in this language.
 int getState()
          Returns the current state of the virtual machine.
 boolean setState(int state)
          Sets the state of the finite state machine performing the translation, and therefore controls the type of translation performed, depending on the translation language selected.
 int[] translate(int[] toConvert)
          Performs translation from text to Braille or from Braille to text, depending on language and state.
 java.lang.String translate(java.lang.String toConvert)
          Performs translation from text to Braille or from Braille to text, depending on language and state.
 

Field Detail

WILDCARD_FLAG

static final int WILDCARD_FLAG
Defines the value of the bit that must be set to indicate a wildcard character in any language.

See Also:
Constant Field Values

SPACE_FLAG

static final int SPACE_FLAG
Defines the value of the bit that must be set to indicate a whitespace character.

See Also:
Constant Field Values

WILDCARD_NONE

static final int WILDCARD_NONE
Information for a wildcard definition - wildcards of type WILDCARD_NONE must must match zero or more of its type in the input text.

See Also:
Constant Field Values

WILDCARD_ONE

static final int WILDCARD_ONE
Information for a wildcard definition - wildcards of type WILDCARD_NONE must must match exactly one its type in the input text.

See Also:
Constant Field Values

WILDCARD_SEVERAL

static final int WILDCARD_SEVERAL
Information for a wildcard definition - wildcards of type WILDCARD_NONE must may match one or more of its type in the input text.

See Also:
Constant Field Values

RULE_BUFFER

static final int RULE_BUFFER
The maximum size of a single translation rule in characters.

See Also:
Constant Field Values

LEFT_FOCUS_DELIMITER

static final char LEFT_FOCUS_DELIMITER
The ASCII/Unicode character used to denote the end of the left context and the start of the focus in a translation rule.

See Also:
Constant Field Values

RIGHT_FOCUS_DELIMITER

static final char RIGHT_FOCUS_DELIMITER
The ASCII/Unicode character used to denote the end of the focus and the start of the right context in a translation rule.

See Also:
Constant Field Values

RULE_OUTPUT_DELIMITER

static final char RULE_OUTPUT_DELIMITER
The ASCII/Unicode character used to denote the end of the right context and the start of the rule output in a translation rule.

See Also:
Constant Field Values

RULE_CONTENT_DELIMITER

static final char RULE_CONTENT_DELIMITER
The value used to denote the end of the output in a translation rule - only for legacy 256-character-set languages.

See Also:
Constant Field Values

TABLE_DELIMITER

static final char TABLE_DELIMITER
Character denoting the end of the list of translation rules in a language rules table in a 256-character BrailleLanguage system.

See Also:
Constant Field Values

FILENAME_EXTENSION

static final java.lang.String FILENAME_EXTENSION
The filename extension that indicates the BrailleLanguage data file for this BrailleLanguage, imported when the BrailleLanguage is instantiated.

See Also:
Constant Field Values

FILE_EXTENSION_DELIMITER

static final char FILE_EXTENSION_DELIMITER
Used to delimit the filename extension from the main filename body.

See Also:
Constant Field Values

DATAFILE_EXTENSION

static final java.lang.String DATAFILE_EXTENSION
The filename extension, including the dot, that indicates the BrailleLanguage definition tables in their editable human-readable plain text form for this language.

See Also:
Constant Field Values
Method Detail

setState

boolean setState(int state)
Sets the state of the finite state machine performing the translation, and therefore controls the type of translation performed, depending on the translation language selected.

Parameters:
state - An int containing the new state for the machine to take.
Returns:
A boolean indicating whether setting the state was successful. It will fail if the new state requested is outside the limits of states for the language being used.

getPermittedStates

int getPermittedStates()
Returns the states permitted in this language. This will vary from one language to the next.

Returns:
An int, the number of states defined for the language and hence the number of permitted states. The state can be any integer from 1 to numberStates.

getState

int getState()
Returns the current state of the virtual machine.

Returns:
The current int state of the virtual machine, in the range 1 to numberStates.

translate

java.lang.String translate(java.lang.String toConvert)
Performs translation from text to Braille or from Braille to text, depending on language and state.

Parameters:
toConvert - String holding characters to translate.
Returns:
A String holding the output text, characters now translated.

translate

int[] translate(int[] toConvert)
Performs translation from text to Braille or from Braille to text, depending on language and state.

Parameters:
toConvert - int[] holding characters to translate.
Returns:
int[] holding the output text, characters now translated.