org.millscript.millscript.action
Class Action

java.lang.Object
  extended by org.millscript.millscript.action.Action
All Implemented Interfaces:
org.millscript.commons.alert.AlertOrigin
Direct Known Subclasses:
AndAbsentAction, AndAction, ApplyAction, ApplyUpdaterAction, AssignAction, BinaryOpAction, BlockAction, CheckAction, CheckNoneAction, CommaAction, ConstAction, ExplodeAction, ForAction, ForConditionAction, If2Action, If3Action, InitAction, ListAction, MakeClosureAction, MemoAction, MethodAction, MethodOverrideAction, NoneAction, NotAction, OrAbsentAction, OrAction, PushAction, RelationalOperationChainAction, SkipAction, SpiceClassAction, SpiceClassInitAction, SwitchAction, UnaryOpAction, VarAction, WhileAction, XMLAction

public abstract class Action
extends java.lang.Object
implements org.millscript.commons.alert.AlertOrigin

This class represents the base class of all actions in MillScript. As such all actions must extend this class, or one of it's sub-classes. An action is the result of compiling an expression and is the final stage of compilation.

See Also:
Expr, Syntax

Constructor Summary
Action()
           
 
Method Summary
 void act(Machine mc)
          This method wraps action, to perform general purpose exception handling.
 java.lang.Object act1(Machine mc)
          Returns the last object pushed onto the stack, after performing this action.
abstract  void action(Machine mc)
          Performs this action, on the specified machine.
 int getLineNumber()
           
 java.lang.String getOrigin()
           
 boolean predAct(Machine mc)
          Returns the boolean value of the last object pushed onto the stack, after performing this action.
 void setContext(java.lang.String fname, int ln)
           
 void setLineNumber(int n)
           
 void setOrigin(java.lang.String o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Action

public Action()
Method Detail

act

public final void act(Machine mc)
This method wraps action, to perform general purpose exception handling. Generally this method would be called to perform an action, rather than action directly.

Parameters:
mc - the machine to perform this action on

act1

public final java.lang.Object act1(Machine mc)
Returns the last object pushed onto the stack, after performing this action. This is the equivalent of performing the act method and poping a result off the machine's stack.

Parameters:
mc - the machine to perform this action on
Returns:
the object poped off the machines stack after performing this action

action

public abstract void action(Machine mc)
Performs this action, on the specified machine. This method must be implemented in sub-classes to perform the required actions.

Parameters:
mc - the machine to perform this action on

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface org.millscript.commons.alert.AlertOrigin
See Also:
AlertOrigin.getLineNumber()

getOrigin

public java.lang.String getOrigin()
Specified by:
getOrigin in interface org.millscript.commons.alert.AlertOrigin
See Also:
AlertOrigin.getOrigin()

predAct

public final boolean predAct(Machine mc)
Returns the boolean value of the last object pushed onto the stack, after performing this action. This is roughly equivalent to the act1 method, but it requires that the last value on the stack is a Boolean.

Parameters:
mc - the machine to perform this action on
Returns:
the boolean value of the last object on the stack

setContext

public final void setContext(java.lang.String fname,
                             int ln)
Specified by:
setContext in interface org.millscript.commons.alert.AlertOrigin
See Also:
AlertOrigin.setContext(java.lang.String, int)

setLineNumber

public void setLineNumber(int n)
Specified by:
setLineNumber in interface org.millscript.commons.alert.AlertOrigin
See Also:
AlertOrigin.setLineNumber(int)

setOrigin

public void setOrigin(java.lang.String o)
Specified by:
setOrigin in interface org.millscript.commons.alert.AlertOrigin
See Also:
AlertOrigin.setOrigin(java.lang.String)


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.