cdx.scorebot.scoring.logic
Interface LogicCodeEvaluatable

All Superinterfaces:
LogicCode
All Known Subinterfaces:
ExpressionType, PrimaryExpressionType
All Known Implementing Classes:
AdditiveExpression, Assignment, ConditionalAndExpression, ConditionalOrExpression, ConditionalXorExpression, EqualityExpression, Expression, ExpressionLeftAssociative, Identifier, Literal, Method, MultiplicativeExpression, PrimaryExpression, RelationalExpression, TestConfigValue, TestResultValue, UnaryExpression

public interface LogicCodeEvaluatable
extends LogicCode

Defines the framework for evaluating code into a literal value. It can be evaluated to a Literal type at compile-time and a Literal value at run-time.

Author:
David Underhill

Method Summary
 Literal evaluateLogic(Context context)
          evaluate this logic code in the specified context
 LiteralType evaluateTypeOnly(java.util.HashMap<java.lang.String,LiteralType> varTypes, java.util.HashMap<java.lang.String,TestData> testsInfo)
          returns the kind of literal this evaluates to
 

Method Detail

evaluateLogic

Literal evaluateLogic(Context context)
                      throws LogicException
evaluate this logic code in the specified context

Parameters:
context - contains the current context of the logic processor
Returns:
the value this logic evaluates to
Throws:
LogicException - thrown if an exception occurs while processing the logic

evaluateTypeOnly

LiteralType evaluateTypeOnly(java.util.HashMap<java.lang.String,LiteralType> varTypes,
                             java.util.HashMap<java.lang.String,TestData> testsInfo)
                             throws LogicException
returns the kind of literal this evaluates to

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
Returns:
the LiteralType this evaluates to
Throws:
LogicException - thrown if there is a problem with type which prevents this from being evaluated