uk.ac.umist.co.brailletrans
Interface Language

All Known Implementing Classes:
Language256, LanguageInteger, LanguageUnicode

public interface Language

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

Classes implementing Language 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 Language 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 Language data file for this Language, imported when the Language 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 Language 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

public 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

public 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

public 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

public 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

public 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

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

See Also:
Constant Field Values

LEFT_FOCUS_DELIMITER

public 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

public 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

public 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

public 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

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

See Also:
Constant Field Values

FILENAME_EXTENSION

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

See Also:
Constant Field Values

FILE_EXTENSION_DELIMITER

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

See Also:
Constant Field Values

DATAFILE_EXTENSION

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

See Also:
Constant Field Values
Method Detail

setState

public 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

public 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

public 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

public 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

public 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.