yakscript
Class Action

java.lang.Object
  |
  +--yakscript.Action
Direct Known Subclasses:
Blank, Debug, Exit, Goto, Load, Nop, Pause, Play, Resume, Select, Set

public abstract class Action
extends java.lang.Object

Abstract base class extended by all YakScript actions


Field Summary
protected  java.util.StringTokenizer arguments
          Arguments passed to action
protected  boolean condition
          Whether action will be executed
 
Constructor Summary
Action()
           
 
Method Summary
abstract  boolean exec(YakScript yakScript)
          Executes this action
Override this to actually provide the functionality of your action
abstract  java.lang.String getKeyword()
          Return the keyword of this action
 boolean isCondition()
          Test the condition in this action
 boolean isFinal()
          Whether execution of the current action should stop after this command Returns false by default, override this and return true if the action permanently goes to a new state (eg.
 boolean isInitial()
          Whether the initial action should be executed after this command
Returns false by default, override this and return true if your keyword causes a switch to a new FrameState, eg.
 void setArguments(java.util.StringTokenizer _arguments)
          Set the arguments for this action and verify their contents
Override this if you need to perform syntax checking on the arguments passed to your action
 void setCondition(java.lang.String condString, java.util.Hashtable variables)
          Set the condition for this action and verify its syntax
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arguments

protected java.util.StringTokenizer arguments
Arguments passed to action

condition

protected boolean condition
Whether action will be executed
Constructor Detail

Action

public Action()
Method Detail

getKeyword

public abstract java.lang.String getKeyword()
Return the keyword of this action
Returns:
Keyword string

exec

public abstract boolean exec(YakScript yakScript)
Executes this action
Override this to actually provide the functionality of your action
Parameters:
yakScript - Currently executing instance of YakScript
Returns:
Whether command execution was successful

isCondition

public boolean isCondition()
Test the condition in this action
Parameters:
condition - Condition to be tested
Returns:
true if condition matches or is null

isInitial

public boolean isInitial()
Whether the initial action should be executed after this command
Returns false by default, override this and return true if your keyword causes a switch to a new FrameState, eg. Goto, Sub
Returns:
true if frame.init should be executed

isFinal

public boolean isFinal()
Whether execution of the current action should stop after this command Returns false by default, override this and return true if the action permanently goes to a new state (eg. Goto, Load, Exit but not Sub)
Returns:
true if execution of current action should stop

setArguments

public void setArguments(java.util.StringTokenizer _arguments)
                  throws SyntaxErrorException
Set the arguments for this action and verify their contents
Override this if you need to perform syntax checking on the arguments passed to your action
Parameters:
args - Arguments to pass
Throws:
SyntaxErrorException - Thrown if the arguments are syntactically invalid for this action

setCondition

public void setCondition(java.lang.String condString,
                         java.util.Hashtable variables)
                  throws SyntaxErrorException,
                         UndefinedVariableException
Set the condition for this action and verify its syntax
Parameters:
condition - Condition string
Throws:
SyntaxErrorException - Thrown if condition is formatted incorrectly or contains an unknown operator