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(..)


Variable Index

 o ruleTable

Constructor Index

 o Rules()

Method Index

 o addRule(String, Action)
This method adds a new boolean-sequence / action pair to the rules Hashtable.
 o lookUp(BooleanTuple)
This method looks up, in ruleTable, the action that corresponds to the BooleanTuple passed in.

Variables

 o ruleTable
 private Hashtable ruleTable

Constructors

 o Rules
 public Rules()

Methods

 o 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.

 o 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