|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.umist.co.brailletrans.Language256
A Java implementation of the UMIST, Manchester text to Braille and Braille
to text system, designed to work with 256-character extended-ASCII ANSI sets.
This functions identically to LanguageInteger
, but not as fast.
Its sole advantage is that its code is easier to understand.
Copyright 1999, 2004 Alasdair King. This program is free software under the terms of the GNU General Public License.
Field Summary | |
static java.lang.String |
DATAFILE_EXTENSION
Indicates the text-only human-editable language rules tables format on disk. |
static java.lang.String |
FILENAME_EXTENSION
Indicates language rules tables (data files) on disk, suitable for loading into the Language256 class and performing translation. |
static double |
MAX_COMPRESS
The maximum ratio of input to output arrays after translation - 1:MAX_COMPRESS. |
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 | |
Language256(java.lang.String filename)
Loads a Language256 object from disk by loading and parsing a legacy data file. |
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[] 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final double MAX_COMPRESS
public static final java.lang.String FILENAME_EXTENSION
Language256
class and performing translation.
public static final java.lang.String DATAFILE_EXTENSION
MakeLegacy
Constructor Detail |
public Language256(java.lang.String filename) throws java.io.IOException, java.io.FileNotFoundException
filename
- Full path and name of language rules table to load according
to local filesystem.Method Detail |
public int getState()
Language
getState
in interface Language
int
state of the virtual machine, in the
range 1 to numberStates
.public int getPermittedStates()
Language
getPermittedStates
in interface Language
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
.public int[] translate(int[] toConvert)
Language
translate
in interface Language
toConvert
- int[]
holding characters to translate.
int[]
holding the output text, characters now translated.public java.lang.String translate(java.lang.String toConvert)
Language
translate
in interface Language
toConvert
- String
holding characters to translate.
String
holding the output text, characters now translated.public boolean setState(int newState)
Language
setState
in interface Language
newState
- An int
containing the new state for the machine to take.
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |