All Packages Class Hierarchy This Package Previous Next Index
Class librarian.LeaTranslator
java.lang.Object
|
+----librarian.LeaTranslator
- public class LeaTranslator
- extends Object
- implements constants
-
currentLineType
- The type of the last line can be found here
-
currentMove
- The last successfully read move can be found here
-
EMPTY
- A constant indicating that an empty line has been read
-
EOF
- A constant indicating that the end of the file has been reached
-
MOVE
- A constant indicating that a move has been successfully read
-
LeaTranslator(String)
- Readies the translator for use by reading the keywords from a
file found at a URL supplied as a string.
-
lookupTypecode(char)
- Converts one of the letters R, P, L, H, I, C, A into the
corresponding internal code for an object subtype
returned.
-
nextItem()
- Reads the next token, establishes and returns its type and wraps
it into an object which is stored at
-
nextLine()
- Reads the next line and tries to convert it to a
-
setStream(Reader)
- Initialization for reading a LEA program from a given stream of
characters
currentMove
public EuMove currentMove
- The last successfully read move can be found here
currentLineType
public int currentLineType
- The type of the last line can be found here
EMPTY
public static final int EMPTY
- A constant indicating that an empty line has been read
MOVE
public static final int MOVE
- A constant indicating that a move has been successfully read
EOF
public static final int EOF
- A constant indicating that the end of the file has been reached
LeaTranslator
public LeaTranslator(String dataUrl) throws LeaInternalException
- Readies the translator for use by reading the keywords from a
file found at a URL supplied as a string. The file is expected to
contain one keyword per line, starting with the beacons and
ending with the LEA commands. the two are separated by a line
containing the word 'END_BEACON'
- Parameters:
- dataUrl - the place to find the keywords
setStream
public void setStream(Reader inputs)
- Initialization for reading a LEA program from a given stream of
characters
- Parameters:
- inputs - the character stream
nextItem
public int nextItem() throws LibrarianException, LeaSyntaxException
- Reads the next token, establishes and returns its type and wraps
it into an object which is stored at @see currentFind. the type
is also stored at @see currentType for internal use
- Returns:
- one of @see OBJECT, @see COMMAND, @see BEACON, @see
ARGUMENT ,@see EOL
- Throws: LibrarianException,
- LeaSyntaxException
nextLine
public int nextLine() throws LeaSyntaxException, LeaInternalException, LibrarianException
- Reads the next line and tries to convert it to a @see EuMove.
Throws @LeaSyntaxException if not successful, unless the line
contains only whitespace and comment. In this case, null is
returned.
- Returns:
- one of @see EMPTY, @see MOVE, @see EOF
- Throws: LibrarianException,
- LeaSyntaxException, LeaInternalException
lookupTypecode
public int lookupTypecode(char c)
- Converts one of the letters R, P, L, H, I, C, A into the
corresponding internal code for an object subtype
returned.
- Returns:
- one of $see A_RADIUS, @see A_POINT, @see LINE, @see
A_HALF, @see AN_INTERVAL @see A_CIRCLE, @see AN_ARC; or
zero if the letter is not one of those listed above
All Packages Class Hierarchy This Package Previous Next Index