All Packages Class Hierarchy This Package Previous Next Index
Class logic.Rules
java.lang.Object
|
+----logic.Rules
- public class Rules
- extends Object
This class encapsulates the notion of a set of rules that
match a sequence of booleans with an action.
The underlying container of these match-ups is a Hashtable.
The Rules class provides an interface to this underlying
data structure with addRule(..) and lookUp(..)
-
ruleTable
-
-
Rules()
-
-
addRule(String, Action)
-
This method adds a new boolean-sequence / action pair
to the rules Hashtable.
-
lookUp(BooleanTuple)
- This method looks up, in ruleTable,
the action that corresponds to the BooleanTuple
passed in.
ruleTable
private Hashtable ruleTable
Rules
public Rules()
addRule
public void addRule(String boolStr,
Action action) throws NestingTooDeepException
- This method adds a new boolean-sequence / action pair
to the rules Hashtable. It first converts the String boolStr,
which is a string of T's and F's, to a BooleanTuple, then
it loads this BooleanTuple as a key in ruleTable, matched
with the action argument passed in.
lookUp
public Action lookUp(BooleanTuple bt) throws RuleNotFoundException
- This method looks up, in ruleTable,
the action that corresponds to the BooleanTuple
passed in.
All Packages Class Hierarchy This Package Previous Next Index