uk.ac.umist.co.brailletrans
Class LanguageInteger
java.lang.Object
|
+--uk.ac.umist.co.brailletrans.LanguageInteger
- All Implemented Interfaces:
- Language
- public class LanguageInteger
- extends java.lang.Object
- implements Language
Language class based on the C implementation BrailleTrans by Paul Blenkhorn.
Field Summary |
static java.lang.String |
DATAFILE_EXTENSION
Filename extension, including stop/period, for language editable data files |
static java.lang.String |
FILENAME_EXTENSION
Filename extension, including full stop / period, for language machine files |
Fields inherited from interface uk.ac.umist.co.brailletrans.Language |
FILE_EXTENSION_DELIMITER, LEFT_FOCUS_DELIMITER, RIGHT_FOCUS_DELIMITER, RULE_BUFFER, RULE_CONTENT_DELIMITER, RULE_OUTPUT_DELIMITER, SPACE_FLAG, TABLE_DELIMITER, WILDCARD_FLAG, WILDCARD_NONE, WILDCARD_ONE, WILDCARD_SEVERAL |
Constructor Summary |
LanguageInteger(java.lang.String filename)
Loads a LanguageInteger object from disk. |
Method Summary |
int |
getPermittedStates()
Returns the states permitted in this language. |
int |
getState()
Returns the current state of the virtual machine. |
boolean |
setState(int newState)
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[] input_txt)
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FILENAME_EXTENSION
public static final java.lang.String FILENAME_EXTENSION
- Filename extension, including full stop / period, for language machine files
DATAFILE_EXTENSION
public static final java.lang.String DATAFILE_EXTENSION
- Filename extension, including stop/period, for language editable data files
LanguageInteger
public LanguageInteger(java.lang.String filename)
throws java.io.IOException,
java.io.FileNotFoundException,
LanguageLegacyDatafileFormatException
- Loads a LanguageInteger object from disk.
- Parameters:
languageName
- Full path and name of serialized Java object as file to load.
translate
public int[] translate(int[] input_txt)
- Description copied from interface:
Language
- Performs translation from text to Braille or from Braille to text, depending
on language and state.
- Specified by:
translate
in interface Language
- Following copied from interface:
uk.ac.umist.co.brailletrans.Language
- Parameters:
toConvert
- int[]
holding characters to translate.- Returns:
- toReturn
int[]
holding characters now translated.
translate
public java.lang.String translate(java.lang.String toConvert)
- Description copied from interface:
Language
- Performs translation from text to Braille or from Braille to text, depending
on language and state.
- Specified by:
translate
in interface Language
- Following copied from interface:
uk.ac.umist.co.brailletrans.Language
- Parameters:
toConvert
- String
holding characters to translate.- Returns:
- toReturn
String
holding characters now translated.
getState
public int getState()
- Description copied from interface:
Language
- Returns the current state of the virtual machine.
- Specified by:
getState
in interface Language
- Following copied from interface:
uk.ac.umist.co.brailletrans.Language
- Returns:
- state The current
int
state of the virtual machine.
getPermittedStates
public int getPermittedStates()
- Description copied from interface:
Language
- Returns the states permitted in this language. This will vary from one
language to the next.
- Specified by:
getPermittedStates
in interface Language
- Following copied from interface:
uk.ac.umist.co.brailletrans.Language
- Returns:
- numberStates 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.
setState
public boolean setState(int newState)
- Description copied from interface:
Language
- 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.
- Specified by:
setState
in interface Language
- Following copied from interface:
uk.ac.umist.co.brailletrans.Language
- Parameters:
state
- An int
containing the new state for the machine to take.- Returns:
- okay 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.