civquest.parser.condition
Class SimpleConditionParser
java.lang.Object
civquest.parser.condition.ConditionParser
civquest.parser.condition.SimpleConditionParser
- public class SimpleConditionParser
- extends ConditionParser
A SimpleConditionParser can parse condition expressons with
a maximum of two variables, h and t. This reduced flexibility
leads to a faster evaluation process.
Note: To bind variables, please use the setH/setT
methods, and to access their values, use getT/getH. This for higher
efficiency.
Field Summary |
protected int |
h
|
protected int |
t
|
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 |
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. |
int |
getH()
|
int |
getT()
|
void |
setH(int i)
|
void |
setT(int i)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
h
protected int h
t
protected int t
SimpleConditionParser
public SimpleConditionParser(java.lang.String expr)
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 boundval
- 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
getH
public int getH()
getT
public int getT()
setH
public void setH(int i)
setT
public void setT(int i)