civquest.parser.condition
Class ComplexConditionParser

java.lang.Object
  extended bycivquest.parser.condition.ConditionParser
      extended bycivquest.parser.condition.ComplexConditionParser

public class ComplexConditionParser
extends ConditionParser

A ComplexConditionParser can parse condition expressions with an arbitrary number of variables. This flexibility comes at the cost of a slightly slower evaluation process.


Field Summary
protected  java.util.Hashtable env
           
 
Fields inherited from class civquest.parser.condition.ConditionParser
current, err, expr, OP_AND, OP_EQ, OP_GE, OP_GT, OP_LE, OP_LT, OP_OR, tokenizer, tree
 
Constructor Summary
ComplexConditionParser(java.lang.String expr)
           
 
Method Summary
 void bind(java.lang.String name, int val)
          Binds a value to a variable name.
 int getBinding(java.lang.String name)
          Gets the value for a bound variable.
 
Methods inherited from class civquest.parser.condition.ConditionParser
error, eval, next, parseCompoundExpr, parseExpr, parseLogicOperator, parseOperand, parseRelativeOperator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

protected java.util.Hashtable env
Constructor Detail

ComplexConditionParser

public ComplexConditionParser(java.lang.String expr)
Method Detail

bind

public void bind(java.lang.String name,
                 int val)
Description copied from class: ConditionParser
Binds a value to a variable name. Note that a concrete ConditionParser may have other preferred means for this.

Specified by:
bind in class ConditionParser
Parameters:
name - The name of the variable to be bound
val - The value to bind to the name

getBinding

public int getBinding(java.lang.String name)
Description copied from class: ConditionParser
Gets the value for a bound variable. Note that a concrete ConditionParser may have other preferred means for this.

Specified by:
getBinding in class ConditionParser
Parameters:
name - The name of the variable
Returns:
the current value for the variable