org.kuali.student.common.messagebuilder.booleanmessage.ast
Class BinaryMessageTree

java.lang.Object
  extended by org.kuali.student.common.messagebuilder.booleanmessage.ast.BinaryMessageTree

public class BinaryMessageTree
extends Object


Constructor Summary
BinaryMessageTree()
          Constructor.
BinaryMessageTree(String language, Map<String,? extends BooleanMessage> messageMap)
          Constructor.
 
Method Summary
 BooleanNode buildTree(String booleanFunction)
          Builds the binary message tree from the booleanFunction.
 List<BooleanNode> getAllNodes()
          Gets all boolean nodes.
 BooleanNode getRoot()
          Gets the root boolean node.
 void traverseTreePostOrder(BooleanNode bnode, BooleanNode parent)
          This method walks the tree depth first, while setting node values with setNode().
 void traverseTreePostOrderDontSetNode(BooleanNode bnode, BooleanNode parent)
          This method walks the tree depth first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryMessageTree

public BinaryMessageTree()
Constructor.


BinaryMessageTree

public BinaryMessageTree(String language,
                         Map<String,? extends BooleanMessage> messageMap)
Constructor. Creates a new binary message tree for the in the specified language for the boolean message map.

Parameters:
messageLanguage - Language for the message
messageMap - map of boolean messages
Method Detail

buildTree

public BooleanNode buildTree(String booleanFunction)

Builds the binary message tree from the booleanFunction.

Order of boolean operation: ANDs before ORs and operations inside parentheses before anything else.

Example: A AND B OR C AND D evaluates to (A AND B) OR (C AND D).

Parameters:
booleanFunction: - Boolean expression
Returns:
Root boolean node

traverseTreePostOrder

public void traverseTreePostOrder(BooleanNode bnode,
                                  BooleanNode parent)
This method walks the tree depth first, while setting node values with setNode(). Setting a nodes parent and adding the node to the ArrayList for later. This method has to be called after buildTree.

Parameters:
bnode - Boolean node
parent - Parent boolean node

traverseTreePostOrderDontSetNode

public void traverseTreePostOrderDontSetNode(BooleanNode bnode,
                                             BooleanNode parent)
This method walks the tree depth first. Setting a nodes parent and adding the node to the ArrayList for later. This method has to be called after buildTree.

Parameters:
bnode - Boolean node
parent - Parent boolean node

getAllNodes

public List<BooleanNode> getAllNodes()
Gets all boolean nodes.

Returns:
All boolean nodes

getRoot

public BooleanNode getRoot()
Gets the root boolean node.

Returns:
Root boolean node


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.