cdx.scorebot.scoring.logic
Class Block

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

public class Block
extends java.lang.Object
implements LogicCodeExecutable, StatementType

stores sets of block statements enclosed within { and }

Author:
David Underhill

Constructor Summary
Block()
           
 
Method Summary
 void addBlockStatement(BlockStatementType blockStatementType)
          adds a block statement to this block
 void executeLogic(Context context)
          execute all block statements in this block
 java.util.Vector<BlockStatementType> getBlockStatements()
          gets get block statements
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Block

public Block()
Method Detail

addBlockStatement

public void addBlockStatement(BlockStatementType blockStatementType)
adds a block statement to this block

Parameters:
blockStatementType - block statement to add

executeLogic

public void executeLogic(Context context)
                  throws LogicException
execute all block statements in this block

Specified by:
executeLogic in interface LogicCodeExecutable
Parameters:
context - contains the current context of the logic processor
Throws:
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

getBlockStatements

public java.util.Vector<BlockStatementType> getBlockStatements()
gets get block statements