All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class librarian.LeaTranslator

java.lang.Object
   |
   +----librarian.LeaTranslator

public class LeaTranslator
extends Object
implements constants

Variable Index

 o currentLineType
The type of the last line can be found here
 o currentMove
The last successfully read move can be found here
 o EMPTY
A constant indicating that an empty line has been read
 o EOF
A constant indicating that the end of the file has been reached
 o MOVE
A constant indicating that a move has been successfully read

Constructor Index

 o LeaTranslator(String)
Readies the translator for use by reading the keywords from a file found at a URL supplied as a string.

Method Index

 o lookupTypecode(char)
Converts one of the letters R, P, L, H, I, C, A into the corresponding internal code for an object subtype returned.
 o nextItem()
Reads the next token, establishes and returns its type and wraps it into an object which is stored at
 o nextLine()
Reads the next line and tries to convert it to a
 o setStream(Reader)
Initialization for reading a LEA program from a given stream of characters

Variables

 o currentMove
 public EuMove currentMove
The last successfully read move can be found here

 o currentLineType
 public int currentLineType
The type of the last line can be found here

 o EMPTY
 public static final int EMPTY
A constant indicating that an empty line has been read

 o MOVE
 public static final int MOVE
A constant indicating that a move has been successfully read

 o EOF
 public static final int EOF
A constant indicating that the end of the file has been reached

Constructors

 o 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

Methods

 o setStream
 public void setStream(Reader inputs)
Initialization for reading a LEA program from a given stream of characters

Parameters:
inputs - the character stream
 o 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
 o 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
 o 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