net.sf.myra.antree.representation
Class Node

java.lang.Object
  extended by net.sf.myra.antree.representation.Node
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
InternalNode, LeafNode

public abstract class Node
extends java.lang.Object
implements java.lang.Cloneable

Version:
$Revision: 2320 $ $Date:: 2011-01-25 13:06:10#$
Author:
Fernando Esteban Barril Otero

Field Summary
static int INITIAL_LEVEL
          The first level of the tree (the level of the root node).
 
Constructor Summary
Node(int level, net.sf.myra.datamining.data.Attribute attribute)
          Creates a new node.
Node(int level, net.sf.myra.datamining.data.Attribute attribute, Branch[] branches)
          Creates a new node.
 
Method Summary
 Node clone()
           
 boolean equals(java.lang.Object o)
           
 net.sf.myra.datamining.data.Attribute getAttribute()
          Returns the attribute that this node represents.
 Branch getBranch(double value)
          Returns the branch that corresponds to the specified value.
 Branch getBranch(int index)
          Returns the branch given the specified index.
 Branch getBranch(Node node)
          Returns the branch that leads to the specified node.
 Branch[] getBranches()
          Returns the branches originating from this node.
 int getLevel()
          Returns the level of this node.
 Node getParent()
          Returns the parent node of this node.
abstract  net.sf.myra.datamining.data.Label getPrediction()
          Returns the label predicted by the node.
 int hashCode()
           
 boolean isLeaf()
          Indicates if this node is a leaf node or not.
abstract  java.lang.String label()
          Returns a label representation of this node.
 void setLevel(int level)
          Sets the level of this node.
abstract  void setPrediction(net.sf.myra.datamining.data.Label prediction)
          Sets the prediction of the node.
 java.lang.String toString()
           
 boolean validate()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_LEVEL

public static final int INITIAL_LEVEL
The first level of the tree (the level of the root node).

See Also:
Constant Field Values
Constructor Detail

Node

public Node(int level,
            net.sf.myra.datamining.data.Attribute attribute)
Creates a new node.

Parameters:
level - the level of the node.
attribute - the attribute that this node represents.

Node

public Node(int level,
            net.sf.myra.datamining.data.Attribute attribute,
            Branch[] branches)
Creates a new node.

Parameters:
level - the level of the node.
attribute - the attribute represented by the node.
branches - the branches originating from this node.
Method Detail

getLevel

public int getLevel()
Returns the level of this node.

Returns:
the level of this node.

setLevel

public void setLevel(int level)
Sets the level of this node.

Parameters:
level - the level to set.

getAttribute

public net.sf.myra.datamining.data.Attribute getAttribute()
Returns the attribute that this node represents.

Returns:
the attribute that this node represents.

getParent

public Node getParent()
Returns the parent node of this node.

Returns:
the parent node of this node.

getBranch

public Branch getBranch(int index)
Returns the branch given the specified index.

Parameters:
index - the index of the branch.
Returns:
the branch given the specified index.

getBranch

public Branch getBranch(Node node)
Returns the branch that leads to the specified node.

Parameters:
node -
Returns:
the branch that leads to the specified node.

getBranch

public Branch getBranch(double value)
Returns the branch that corresponds to the specified value.

Parameters:
value - the value to test.
Returns:
the branch that corresponds to the specified value.

getBranches

public Branch[] getBranches()
Returns the branches originating from this node.

Returns:
the branches originating from this node.

isLeaf

public final boolean isLeaf()
Indicates if this node is a leaf node or not. If the node is a leaf node, it is safe to call the {getPrediction() method.

Returns:
true if this node is a leaf node; false otherwise.
See Also:
getPrediction()

label

public abstract java.lang.String label()
Returns a label representation of this node.

Returns:
a label representation of this node.

getPrediction

public abstract net.sf.myra.datamining.data.Label getPrediction()
Returns the label predicted by the node.

Returns:
the label predicted by the node.

setPrediction

public abstract void setPrediction(net.sf.myra.datamining.data.Label prediction)
Sets the prediction of the node.

Parameters:
prediction - the prediction to set.

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

public Node clone()
Overrides:
clone in class java.lang.Object

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

validate

public boolean validate()


Copyright © 2013. All Rights Reserved.