rdr.methods
Class NTreeNode

java.lang.Object
  extended by rdr.core.Node
      extended by rdr.methods.NTreeNode
All Implemented Interfaces:
java.io.Serializable

public class NTreeNode
extends Node
implements java.io.Serializable

A node object for an n-tree. Used by MCRDR

Author:
Ivan Bindoff
See Also:
Serialized Form

Field Summary
 
Fields inherited from class rdr.core.Node
classification, id, rule
 
Constructor Summary
NTreeNode()
          Constructor.
NTreeNode(Rule rule, Classification classification, common.datastructures.MyFastVector<NTreeNode> children, NTreeNode parent, common.datastructures.MyFastVector<Case> cornerstones)
          Constructor Builds a node to the specifications provided
NTreeNode(Rule rule, Classification classification, NTreeNode parent, common.datastructures.MyFastVector<Case> cornerstones)
          Constructor Builds a node to the specifications provided.
 
Method Summary
 void addChild(NTreeNode child)
          Add a child to this node
 boolean childSatisfied(Case c)
          Determine if there is a child satisfied by case c
 common.datastructures.MyFastVector<Condition> getAllParentConditions(common.datastructures.MyFastVector<Condition> conds)
          Get all the conditions of node and all its parents back to the root Is recursive.
 common.datastructures.MyFastVector<NTreeNode> getChildren()
           
 common.datastructures.MyFastVector<Case> getCornerstones()
           
 int getDepth()
          Finds the depth of this node
 int getNumChildren()
           
 NTreeNode getParent()
           
 void insertCornerstone(Case c)
          Adds the case c to the list of cornerstones for this node only if it's not already in there.
 void setChildren(common.datastructures.MyFastVector<NTreeNode> children)
          Set the children
 void setCornerstones(common.datastructures.MyFastVector<Case> cornerstones)
          Sets the potential cornerstones
 void setParent(NTreeNode parent)
          Sets the parent node
 
Methods inherited from class rdr.core.Node
getClassification, getId, getRule, setClassification, setId, setRule, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NTreeNode

public NTreeNode()
Constructor. Builds a "default" (root) node.


NTreeNode

public NTreeNode(Rule rule,
                 Classification classification,
                 NTreeNode parent,
                 common.datastructures.MyFastVector<Case> cornerstones)
Constructor Builds a node to the specifications provided. With no children.

Parameters:
rule -
classification -
parent -
cornerstones -

NTreeNode

public NTreeNode(Rule rule,
                 Classification classification,
                 common.datastructures.MyFastVector<NTreeNode> children,
                 NTreeNode parent,
                 common.datastructures.MyFastVector<Case> cornerstones)
Constructor Builds a node to the specifications provided

Parameters:
rule -
classification -
children -
parent -
cornerstones -
Method Detail

getChildren

public common.datastructures.MyFastVector<NTreeNode> getChildren()
Returns:
this node's set of children

setChildren

public void setChildren(common.datastructures.MyFastVector<NTreeNode> children)
Set the children

Parameters:
children - the set of children

getCornerstones

public common.datastructures.MyFastVector<Case> getCornerstones()
Returns:
the set of cases which are potential cornerstones for this node

setCornerstones

public void setCornerstones(common.datastructures.MyFastVector<Case> cornerstones)
Sets the potential cornerstones

Parameters:
cornerstones - the set of cornerstones

insertCornerstone

public void insertCornerstone(Case c)
Adds the case c to the list of cornerstones for this node only if it's not already in there.

Parameters:
c -

getParent

public NTreeNode getParent()
Returns:
the parent node

setParent

public void setParent(NTreeNode parent)
Sets the parent node

Parameters:
parent -

childSatisfied

public boolean childSatisfied(Case c)
Determine if there is a child satisfied by case c

Parameters:
c -
Returns:
true is there is a child satisfied by c, or false otherwise

getAllParentConditions

public common.datastructures.MyFastVector<Condition> getAllParentConditions(common.datastructures.MyFastVector<Condition> conds)
Get all the conditions of node and all its parents back to the root Is recursive.

Parameters:
conds - set of conditions found so far
Returns:
set of conditions

addChild

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

Parameters:
child -

getDepth

public int getDepth()
Finds the depth of this node

Specified by:
getDepth in class Node
Returns:
depth

getNumChildren

public int getNumChildren()
Specified by:
getNumChildren in class Node
Returns:
the number of children this node has.