cdx.scorebot.scoring.logic
Class VoidMethod

java.lang.Object
  extended by cdx.scorebot.scoring.logic.GenericMethod
      extended by cdx.scorebot.scoring.logic.VoidMethod
All Implemented Interfaces:
LogicCode, LogicCodeExecutable, StatementType

public class VoidMethod
extends GenericMethod
implements LogicCodeExecutable, StatementType

evaluates an void method call (this is called a "procedure")

Author:
David Underhill

Constructor Summary
VoidMethod(Identifier methodName, Arguments args)
          instantiate an void method call
 
Method Summary
 void executeLogic(Context context)
          execute the method called in the specified context
static java.lang.String[] getVoidMethods()
          gets an array with all void method names
 void validateTypes(java.util.HashMap<java.lang.String,LiteralType> varTypes, java.util.HashMap<java.lang.String,TestData> testsInfo)
          Attempts to validate the type-correctness of all constituent LogicCodeEvaluatable logic code.
 
Methods inherited from class cdx.scorebot.scoring.logic.GenericMethod
getArgs, getMethodName, throwIAE
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VoidMethod

public VoidMethod(Identifier methodName,
                  Arguments args)
instantiate an void method call

Parameters:
methodName - the name of the method
args - the args passed to the method, if any
Method Detail

executeLogic

public void executeLogic(Context context)
                  throws LogicException
execute the method called in the specified context

Specified by:
executeLogic in interface LogicCodeExecutable
Parameters:
context - contains the current context of the logic processor
Throws:
UndefinedMethodException - thrown if the specified method name does not reference a method which exists
IllegalMethodArgsException - thrown if the specified method name exists but the args don't meet expectations
LogicException - thrown if an exception occurs while processing the logic

validateTypes

public void validateTypes(java.util.HashMap<java.lang.String,LiteralType> varTypes,
                          java.util.HashMap<java.lang.String,TestData> testsInfo)
                   throws LogicException
Description copied from interface: LogicCodeExecutable
Attempts to validate the type-correctness of all constituent LogicCodeEvaluatable logic code. An exception is thrown if there is some type-check failure.

Specified by:
validateTypes in interface LogicCodeExecutable
Parameters:
varTypes - contains the type of value stored by each variable (variables names are keys)
testsInfo - information about each test item keyed on test item names this logic may hold
Throws:
LogicException - thrown if an exception if an invalid test, test result, or test option is found

getVoidMethods

public static java.lang.String[] getVoidMethods()
gets an array with all void method names