|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrlgamekit.interpreter.Functions
public class Functions
A function collection for the interpreted language. Subclass this to add new functions for your project. The method names of this class (or subclass) must match the command names from the scripting language to be interpreted.
| Field Summary | |
|---|---|
protected int |
currentLine
Keep track of current line in script, to report errors on a per-line basis. |
protected java.util.HashMap<java.lang.String,java.lang.String> |
symbols
Symbol table. |
protected Tokenizer |
tokenizer
Helper to turn a line of parameters into a list of tokens |
| Constructor Summary | |
|---|---|
Functions()
|
|
| Method Summary | |
|---|---|
void |
add(java.lang.String line)
Example: Add numeric token values and set result to a variable |
void |
append(java.lang.String line)
Example: Append token values to a variable |
void |
div(java.lang.String line)
Example: Divide numeric token values and set result to a variable |
void |
echo(java.lang.String line)
Example: Echo some values to the standard output channel |
void |
mul(java.lang.String line)
Example: Multiply numeric token values and set result to a variable |
protected void |
reportError(java.lang.String message)
Report an error. |
void |
set(java.lang.String line)
Example: Set a variable to a value |
void |
sub(java.lang.String line)
Example: Subtract numeric token values and set result to a variable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Tokenizer tokenizer
protected java.util.HashMap<java.lang.String,java.lang.String> symbols
protected int currentLine
| Constructor Detail |
|---|
public Functions()
| Method Detail |
|---|
public void set(java.lang.String line)
line - The line from the script with the variable name and valuepublic void append(java.lang.String line)
line - The line from the scriptpublic void add(java.lang.String line)
line - The line from the scriptpublic void sub(java.lang.String line)
line - The line from the scriptpublic void mul(java.lang.String line)
line - The line from the scriptpublic void div(java.lang.String line)
line - The line from the scriptpublic void echo(java.lang.String line)
line - The line from the scriptprotected void reportError(java.lang.String message)
message - The message to report.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||