|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.hu.cs.titokone.Application
This class represents a compiled TTK-91-application. It also contains information about what has gotten printed during its running and what it should be reading as various inputs during its run.
Field Summary | |
private MemoryLine[] |
code
This array contains the code to the application; one command per line. |
private java.lang.String |
crt
Stdout and crt store the outputs of this application. |
static java.lang.String |
DELIMITERS
This field lists the delimiters accepted as any-combination delimitation markup in a string intended for either keyboard or stdin input. |
private MemoryLine[] |
initialData
This array contains the initial data area of the application, determined at compile time by DS and DC pseudocommands. |
private int[] |
kbdcontent
Stdincontent and kbdcontent store the possible preset input of this application, and stdinpointer and kbdpointer point to the position that should be read next. |
private int |
kbdpointer
|
private int[] |
stdincontent
Stdincontent and kbdcontent store the possible preset input of this application, and stdinpointer and kbdpointer point to the position that should be read next. |
private int |
stdinpointer
|
private java.lang.String |
stdout
Stdout and crt store the outputs of this application. |
private SymbolTable |
symbols
This field stores the local symbol table of the application. |
Constructor Summary | |
Application(MemoryLine[] code,
MemoryLine[] data,
SymbolTable symbols)
This constructor sets up a new Application. |
Method Summary | |
static boolean |
checkInput(java.lang.String input)
This method checks whether input would be a valid string to give to setKbd or setStdIn. |
MemoryLine[] |
getCode()
This method returns the (initial) code area of the application. |
MemoryLine[] |
getInitialData()
This method returns the initial data area of the application with its contents. |
SymbolTable |
getSymbolTable()
This method returns the symbol table containing the application's local symbols. |
java.lang.String |
readCrt()
This method returns what was printed to the screen during the running of this application, and clears the buffer. |
int |
readNextFromKbd()
This method reads the next line from a keyboard "buffer" set up before by setKbd(). |
int |
readNextFromStdIn()
This method reads the next line from a file read "buffer" set up before by setStdIn(). |
java.lang.String |
readStdOut()
This method returns what was written to a file during the running of this application, and clears the buffer. |
void |
setKbd(java.lang.String input)
This method can be used to set in advance what values any keyboard reads should return. |
void |
setStdIn(java.lang.String input)
This method can be used to set in advance what values any file reads should return. |
void |
writeToCrt(int line)
This method stores one more line to the CRT ("screen") memory of the application. |
void |
writeToStdOut(int line)
This method stores one more line to the StdOut ("file") memory of the application. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DELIMITERS
private MemoryLine[] code
private MemoryLine[] initialData
private SymbolTable symbols
private java.lang.String stdout
private java.lang.String crt
private int[] stdincontent
private int[] kbdcontent
private int stdinpointer
private int kbdpointer
Constructor Detail |
public Application(MemoryLine[] code, MemoryLine[] data, SymbolTable symbols)
code
- An array containing the compiled code as MemoryLines.
The MemoryLines represent both the integer and the symbolic form
of the commands. Including the symbolic form is optional. This
value may be null or of length 0 in the unlikely case that there
is no code area.data
- An array containing the initial data area and its
contents as MemoryLines. The MemoryLines represent both the
integer and the symbolic form of commands, but especially in
the case of data, including the symbolic form is
optional. This value may be null or of length 0 if there is no
data area.symbols
- An instance of SymbolTable, containing the
symbol table for this application. This value can be null if
there are no local symbols available. (Locally, an empty
symboltable is created.)Method Detail |
public MemoryLine[] getCode()
public MemoryLine[] getInitialData()
public SymbolTable getSymbolTable()
public void writeToCrt(int line)
line
- A new line to "write to the screen".public void writeToStdOut(int line)
line
- A new line to "write to the file".public int readNextFromKbd() throws TTK91NoKbdData
TTK91NoKbdData
- If there is no more keyboard data
available in the buffer. The caller may then decide to get
their keyboard data via other routes, eg. the user.public int readNextFromStdIn() throws TTK91NoStdInData
TTK91NoStdInData
- If there is no more file read data
available in the buffer. The caller may then decide to get their
data via other routes, eg. by reading from some actual file.public static boolean checkInput(java.lang.String input)
input
- The string to check.
public java.lang.String readStdOut()
readStdOut
in interface TTK91Application
public java.lang.String readCrt()
readCrt
in interface TTK91Application
public void setKbd(java.lang.String input)
setKbd
in interface TTK91Application
input
- What (integers) the application should "read from the
keyboard" during its run, delimited by '\n', '\r', '\r\n', '\f',
'\t', ' ', ',', '.', ':', ';' or any length combination
thereof.
java.lang.IllegalArgumentException
- If the input string is not valid.public void setStdIn(java.lang.String input)
setStdIn
in interface TTK91Application
input
- What (integers) the application should "read from
a file" during its run, delimited by '\n', '\r', '\r\n', '\t', '\f',
' ', ',', '.', ':', ';' or any-length combination thereof.
java.lang.IllegalArgumentException
- If the input string is not valid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |