| 
Fido Alpha 3.2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--fido.util.BooleanTree
This class represents a boolean expression. Example expression: (A = B) & ((C != D) | (E = F)). The BooleanTree contains two types of nodes: BooleanNode and any BooleanTreeNode as a leaf node. The a subclass of BooleanNode, either BooleanAndNode or BooleanOrNode, will join two subtrees by specifying both must be successful (AND), or either one may be successful (OR).
A sample usage would be:
BooleanTree()
 bt.addLeafNode()
 bt.addBooleanAndNode()
 bt.addLeafNode()
 getRootNode() which will validate the
 tree is correct, and return a BooleanTreeNode, which can be used to traverse the
 tree.
 Parenthesis are handled by two calls startGroup() and endGroup().
| Constructor Summary | |
BooleanTree()
Construct an empty BooleanTree.  | 
|
| Method Summary | |
 void | 
addBooleanAndNode()
Creates a BooleanAndNode to be inserted into the tree.  | 
 void | 
addBooleanOrNode()
Creates a BooleanOrNode to be inserted into the tree.  | 
 void | 
addLeafNode(BooleanTreeNode node)
Add a leaf node to the tree.  | 
 void | 
endGroup()
Closes a currently open parenthesis group.  | 
 BooleanTreeNode | 
getRootNode()
After filling the BooleanTree, this call will validate the tree is correct using the validateTree() call, then return
 the root node of the tree for traversal. | 
 void | 
startGroup()
Starts a new parenthesis group.  | 
 void | 
validateTree()
Used to validate the tree is properly formed: All parenthesis are closed The last boolean node contains a right branch.  | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public BooleanTree()
| Method Detail | 
public BooleanTreeNode getRootNode()
                            throws BooleanSyntaxException
validateTree() call, then return
 the root node of the tree for traversal.
BooleanSyntaxExceptionvalidateTree()
public void addLeafNode(BooleanTreeNode node)
                 throws BooleanSyntaxException
node - any Object that implements BooleanTreeNode
BooleanSyntaxException - Thrown when adding a leaf node immediately
                                   after adding a previous leaf node.  A leaf node
                                   must be the first node, or added after a
                                   BooleanNode.BooleanTreeNode
public void addBooleanAndNode()
                       throws BooleanSyntaxException
BooleanSyntaxException - Thrown when no nodes are present in the
                                   tree.  A subclas of BooleanNode cannot be the first
                                   node in the tree.  For example, the following
                                   expression is invalid: & (A = C)BooleanAndNode
public void addBooleanOrNode()
                      throws BooleanSyntaxException
BooleanSyntaxException - Thrown when no nodes are present in the
                                   tree.  A subclas of BooleanNode cannot be the first
                                   node in the tree.  For example, the following
                                   expression is invalid: & (A = C)BooleanOrNodepublic void startGroup()
public void endGroup()
              throws BooleanSyntaxException
BooleanSyntaxException - Thrown if no parenthese groups are open
                                   or if a boolean node is the last node in
                                   the group.
public void validateTree()
                  throws BooleanSyntaxException
BooleanSyntaxException
 is thrown.
BooleanSyntaxException - Thrown if an error in the tree is found.
                                   See list above.
  | 
Fido Alpha 3.2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||