unsw.cse.framescript
Class ExprList

java.lang.Object
  extended by unsw.cse.framescript.Term
      extended by unsw.cse.framescript.ExprList

public class ExprList
extends Term

This class represents a series of expression that are evaluated in succession. It provides FrameScript with sequential evaluation.

Author:
mmcgill

Constructor Summary
ExprList(Term t)
          Creates a sequence with one expression.
ExprList(Term t, ExprList l)
          Creates an expression list where a given expression is followed by a list of expressions.
 
Method Summary
 java.lang.String asString(int indentLevel, boolean inPattern)
          Turns the Term into a string.
 boolean equals(Term t)
          Compares two Terms for equality.
 Term eval(Instance currentObject, StackFrame stackframe)
          Evaluates all of the expressions in the list and returns the result of evaluating the last element.
 Term mapVars(FSList vars)
          Maps atoms to variables from the list of variables.
 java.lang.String toString()
          Turns the Term into a string.
 
Methods inherited from class unsw.cse.framescript.Term
assign, fullMatch, indents, match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExprList

public ExprList(Term t)
Creates a sequence with one expression.

Parameters:
t - the expression

ExprList

public ExprList(Term t,
                ExprList l)
Creates an expression list where a given expression is followed by a list of expressions.

Parameters:
t - the leading expression
l - subsequent expressions
Method Detail

eval

public Term eval(Instance currentObject,
                 StackFrame stackframe)
          throws FSException
Evaluates all of the expressions in the list and returns the result of evaluating the last element.

Specified by:
eval in class Term
Parameters:
currentObject - the enclosing instance frame for the code being evaluated
stackframe - StackFrame that holds the values for any variables
Returns:
the result of the evaluation
Throws:
FSException - if any errors occur in performing the evaluation

equals

public boolean equals(Term t)
Description copied from class: Term
Compares two Terms for equality.

Specified by:
equals in class Term
Parameters:
t - Term to be compared to
Returns:
true if the Terms are equal, false otherwise

mapVars

public Term mapVars(FSList vars)
             throws SyntaxError
Description copied from class: Term
Maps atoms to variables from the list of variables.

Overrides:
mapVars in class Term
Parameters:
vars - a list of variables to be mapped
Returns:
a clone of the Term where all the variables have been mapped
Throws:
SyntaxError - if in performing the mapping it finds an invalid variable name

toString

public java.lang.String toString()
Description copied from class: Term
Turns the Term into a string.

Specified by:
toString in class Term

asString

public java.lang.String asString(int indentLevel,
                                 boolean inPattern)
Description copied from class: Term
Turns the Term into a string.

Overrides:
asString in class Term
Parameters:
indentLevel - indentation level to uses for any subsequent lines in the string
inPattern - whether or not to format the string as though it is inside a pattern
Returns:
a string representing the Term