unsw.cse.framescript
Class Expr

java.lang.Object
  extended by unsw.cse.framescript.Term
      extended by unsw.cse.framescript.Subr
          extended by unsw.cse.framescript.Expr

public class Expr
extends Subr

Class that represents functions that are written in FrameScript.

Author:
mmcgill

Field Summary
 
Fields inherited from class unsw.cse.framescript.Subr
functor
 
Constructor Summary
Expr(Compound spec, Term expr)
          Creates a function from a specification and body.
 
Method Summary
 Term apply(Instance currentObject, Term[] args, StackFrame stackframe)
          This is the method that needs to be implemented for each subroutine.
 java.lang.String toString()
          Turns the Term into a string.
 
Methods inherited from class unsw.cse.framescript.Subr
check_alternatives, check_atom, check_boolean, check_compound, check_domain, check_exprlist, check_frame, check_generic, check_instance, check_integer, check_list, check_number, check_pattern, check_rdr, check_script, check_sequence, check_string, equals, eval, getCurrentDomain, getSlotName, hardCodeSlotNames, noEnclosingInstance, notDefined, notForNArgs, notImplemented
 
Methods inherited from class unsw.cse.framescript.Term
assign, asString, fullMatch, indents, mapVars, match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Expr

public Expr(Compound spec,
            Term expr)
     throws FSException
Creates a function from a specification and body.

Parameters:
spec - the specification of the function
expr - the body of the function
Throws:
FSException - if any invalid variable names are encountered or there is a conflict with any subroutines
Method Detail

apply

public Term apply(Instance currentObject,
                  Term[] args,
                  StackFrame stackframe)
           throws FSException
Description copied from class: Subr
This is the method that needs to be implemented for each subroutine.

Specified by:
apply in class Subr
Parameters:
currentObject - the enclosing instance frame
args - the arguments to the subroutine
stackframe - the StackFrame with the variable values
Returns:
the result of running the subroutine
Throws:
FSException - if there are problems running the subroutine

toString

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

Overrides:
toString in class Subr