com.huguesjohnson.jail.jdt
Class DecisionTreeNode

java.lang.Object
  |
  +--com.huguesjohnson.jail.jdt.DecisionTreeNode
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class DecisionTreeNode
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

JdtDecisionTreeNode, representation for tree node

See Also:
Serialized Form

Field Summary
static int CHILD_LEFT
          left child index
static int CHILD_RIGHT
          right child index
static int OP_EQUAL
          not used in current project, but could be used for a more advanced project
static int OP_GREATER_THAN
          only operation used at present time
static int OP_LESS_THAN
          not used in current project, but could be used for a more advanced project
 
Constructor Summary
DecisionTreeNode()
          constructor, creates a node with no parent
DecisionTreeNode(DecisionTreeNode parent)
          constructor, creates node with a parent
 
Method Summary
 java.lang.Object clone()
          clone
 int getAttributeIndex()
          retrieves attribute index for current node
 DecisionTreeNode getChildNode(int direction)
          retrieves a child node
 java.lang.String getClassification()
          retreives classification of node
 int getCompareOperator()
          retrieves comparision operator for current node
 double getCompareValue()
          retrieves compare value for current node
 DecisionTreeNode getParentNode()
          retrieves the parent node
 boolean isLeaf()
          determines if node is a leaf node
 boolean isRoot()
          determines if node is a root node
 void setAttributeIndex(int attributeIndex)
          sets attribute index for node
 void setChildNode(int direction, DecisionTreeNode node)
          appends a child to the current node
 void setClassification(java.lang.String classification)
          sets classification for node
 void setCompareOperator(int operator)
          sets comparision operator for node
 void setCompareValue(double compareValue)
          sets compare value for node
 java.lang.String toString()
          returns a string representation of the node
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHILD_LEFT

public static final int CHILD_LEFT
left child index

CHILD_RIGHT

public static final int CHILD_RIGHT
right child index

OP_EQUAL

public static final int OP_EQUAL
not used in current project, but could be used for a more advanced project

OP_GREATER_THAN

public static final int OP_GREATER_THAN
only operation used at present time

OP_LESS_THAN

public static final int OP_LESS_THAN
not used in current project, but could be used for a more advanced project
Constructor Detail

DecisionTreeNode

public DecisionTreeNode()
constructor, creates a node with no parent

DecisionTreeNode

public DecisionTreeNode(DecisionTreeNode parent)
constructor, creates node with a parent
Parameters:
parent - parent node
Method Detail

clone

public java.lang.Object clone()
clone
Overrides:
clone in class java.lang.Object
Returns:
clone of object

isRoot

public boolean isRoot()
determines if node is a root node
Returns:
true if node is a root node (no parent)

isLeaf

public boolean isLeaf()
determines if node is a leaf node
Returns:
true if node is a leaf node (no no children)

setChildNode

public void setChildNode(int direction,
                         DecisionTreeNode node)
appends a child to the current node
Parameters:
direction - CHILD_LEFT or CHILD_RIGHT
node - the node to attach

getParentNode

public DecisionTreeNode getParentNode()
retrieves the parent node
Returns:
parent node

getChildNode

public DecisionTreeNode getChildNode(int direction)
retrieves a child node
Parameters:
direction - which child to retrieve
Returns:
tree node or null if no child exists

setClassification

public void setClassification(java.lang.String classification)
sets classification for node
Parameters:
classification - new classification for node

getClassification

public java.lang.String getClassification()
retreives classification of node
Returns:
classification of node

setAttributeIndex

public void setAttributeIndex(int attributeIndex)
sets attribute index for node
Parameters:
attributeIndex - new attribute index for node

getAttributeIndex

public int getAttributeIndex()
retrieves attribute index for current node
Returns:
attribute index

setCompareValue

public void setCompareValue(double compareValue)
sets compare value for node
Parameters:
compareValue - new compare value for node

getCompareValue

public double getCompareValue()
retrieves compare value for current node
Returns:
compare value

setCompareOperator

public void setCompareOperator(int operator)
sets comparision operator for node
Parameters:
operator - new comparision operator for node

getCompareOperator

public int getCompareOperator()
retrieves comparision operator for current node
Returns:
compare operator

toString

public java.lang.String toString()
returns a string representation of the node
Overrides:
toString in class java.lang.Object
Returns:
representation of node