edu.indiana.iucbrf.casebase
Class Node

java.lang.Object
  extended by edu.indiana.iucbrf.casebase.Node

public class Node
extends java.lang.Object

This class defines a single node in a DTreeCaseBase.


Constructor Summary
protected Node()
           
  Node(java.util.ArrayList children, FeatureKey featureQuestioned, Range bounds)
          Creates new Node.
 
Method Summary
protected  void addCase(Case acase)
          It is assumed that this is a leaf, and the case does belong here.
 void addChild(Node child)
          Add a child to this node
 boolean doDescendantsHaveCases()
          Determine if any of the descendants of this node, or this node itself, have any cases.
 Node findLeaf(Problem p)
          Find the leaf of this (sub)tree corresponding to the given Problem object.
 java.util.ArrayList getAllDescendantCaseBases()
          Get references to the case bases of all descendants of this node.
 CaseBase getCaseBase()
          Obtain a reference to the case base object of this node.
 int getCBSizeOfSubtree()
          Get the size of the leaf case bases in the tree with this node at the root.
protected  boolean isInBounds(Feature value)
          Determine if the Feature value given is within the bounds of the partition of this node, for the feature questioned by this node's parent.
 boolean isLeaf()
          Determine if this node is a leaf node.
protected  boolean removeCase(Case acase)
          Remove a case from the decision tree.
 void setCaseBaseTo(CaseBase toAdd)
          The case base of this leaf node is set to toAdd
 java.lang.String toString(int depth)
          Convert this node (and its children) into a String representation.
 java.lang.String toVerboseString(int depth)
          Convert this node (and its children) into a verbose String representation, where each Case is shown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

protected Node()

Node

public Node(java.util.ArrayList children,
            FeatureKey featureQuestioned,
            Range bounds)
Creates new Node. If no children are yet known, then children should be null.

Method Detail

addChild

public void addChild(Node child)
Add a child to this node

Parameters:
child - The Node object that will be this node's child.

addCase

protected void addCase(Case acase)
It is assumed that this is a leaf, and the case does belong here. Top-level users should call DTreeCaseBase.addCase instead.


setCaseBaseTo

public void setCaseBaseTo(CaseBase toAdd)
The case base of this leaf node is set to toAdd

Parameters:
toAdd - The CaseBase that this node should have

getCaseBase

public CaseBase getCaseBase()
Obtain a reference to the case base object of this node.

Returns:
The case base, if this is a leaf, or null otherwise.

getAllDescendantCaseBases

public java.util.ArrayList getAllDescendantCaseBases()
Get references to the case bases of all descendants of this node. These are not copies, but rather are references to the actual case base objects.

Returns:
A ArrayList of CaseBase objects - all the descendant's case bases

doDescendantsHaveCases

public boolean doDescendantsHaveCases()
Determine if any of the descendants of this node, or this node itself, have any cases.


removeCase

protected boolean removeCase(Case acase)
Remove a case from the decision tree. It is assumed that this is a leaf. Top-level users should call DTreeCaseBase.removeCase instead.

Parameters:
acase - The case to be removed.

isLeaf

public boolean isLeaf()
Determine if this node is a leaf node.

Returns:
true if this node is a leaf node, false if this node is an inner node.

getCBSizeOfSubtree

public int getCBSizeOfSubtree()
Get the size of the leaf case bases in the tree with this node at the root.


isInBounds

protected boolean isInBounds(Feature value)
Determine if the Feature value given is within the bounds of the partition of this node, for the feature questioned by this node's parent. Checks ONLY the featureQuestioned by the parent, NOT the entire traversal down the decision tree.


findLeaf

public Node findLeaf(Problem p)
Find the leaf of this (sub)tree corresponding to the given Problem object.


toString

public java.lang.String toString(int depth)
Convert this node (and its children) into a String representation.


toVerboseString

public java.lang.String toVerboseString(int depth)
Convert this node (and its children) into a verbose String representation, where each Case is shown.