weka.associations.classification
Class CrNode

java.lang.Object
  extended by weka.associations.classification.CrNode
All Implemented Interfaces:
java.io.Serializable

public class CrNode
extends java.lang.Object
implements java.io.Serializable

Class for nodes in a CrTree. A CrTree(n-ary tree in child-sibling representation) can store classification association rules(CARs) and allows pruning and classification. Tree Structure described at: W. Li, J. Han, J.Pei: CMAR: Accurate and Efficient Classification Based on Multiple Class-Association Rules. In ICDM'01:369-376,2001. The CRrTree is implemented following the child-sibling reperesentation of n-ary trees. Therefore each node has a poinnter to its parent and one pointer to one of its children. Nodes having the same parent node are conneected in an doubly connected list (list of siblings). Each nodes stores an item of an rule's premise. The consequnce and additional information is stored in a FastVector. Therefore rules are stored as a path.

Version:
$Revision: 8108 $
Author:
Stefan Mutter
See Also:
Serialized Form

Constructor Summary
CrNode(int num, int value, int i)
          Constructor of a CrNode.
 
Method Summary
 void addContent(java.lang.Object data)
          Adds an element to the content FastVector of a node.
 boolean equals(int num, int value)
          Method that compares two nodes and returns true if their premise's items are the same.
 FastVector getContent()
          Gets the FastVector storing possibly a rule's consequence and additional measures
 int getHeight()
          Gets the height of a node in a CrTree
 CrNode getLastListSibling()
          Gets the previous node in the associated list.
 CrNode getLastSibling()
          Gets the previous sibling node.
 CrListElement getListSibling()
          Gets the CrListElement that the current node is pointing to
 CrNode getNextListSibling()
          Gets the next node in the associated list.
 CrNode getNextSibling()
          Gets the next sibling node in a CrTree
 int[] getPathInfo()
          Gets the item from a rule's premise that is stored in a CrNode.
 CrNode getTreeChild()
          Gets the child node
 CrNode getTreeParent()
          Gets the parent node of the actual node.
 void setHeight(int i)
          Sets the height of a node in a CrTree
 void setLastListSibling(CrNode input)
          Sets the pointer to the previous node in the associated list.
 void setLastSibling(CrNode input)
          Sets the pointer to the previous sibling node
 void setListSibling(CrListElement input)
          Sets the pointer to an element in the associated list.
 void setNewContent(FastVector input)
          Stores a rule's consequence and its measures in a FastVector
 void setNextListSibling(CrNode input)
          Sets the pointer to the next node in the associated list.
 void setNextSibling(CrNode input)
          Sets the pointer to the next sibling node
 void setTreeChild(CrNode input)
          Sets the pointer to a child node.
 void setTreeParent(CrNode input)
          Sets the pointer to a parent node
 java.lang.String toString()
          Method for printing CrNodes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CrNode

public CrNode(int num,
              int value,
              int i)
Constructor of a CrNode. Takes an attribute and an attribute value of an rule premise and the height of the node in the CrTree as arguments.

Parameters:
num - the attribute of a rule premise
value - the attribute value of a rule premise
i - the height of the node in the CrTree
Method Detail

setTreeChild

public void setTreeChild(CrNode input)
Sets the pointer to a child node.

Parameters:
input - the child node

setTreeParent

public void setTreeParent(CrNode input)
Sets the pointer to a parent node

Parameters:
input - the parent node

setNextSibling

public void setNextSibling(CrNode input)
Sets the pointer to the next sibling node

Parameters:
input - a sibling node

setLastSibling

public void setLastSibling(CrNode input)
Sets the pointer to the previous sibling node

Parameters:
input - a sibling node

setListSibling

public void setListSibling(CrListElement input)
Sets the pointer to an element in the associated list.

Parameters:
input - a list element out of the associated list

setNextListSibling

public void setNextListSibling(CrNode input)
Sets the pointer to the next node in the associated list.

Parameters:
input - a node

setLastListSibling

public void setLastListSibling(CrNode input)
Sets the pointer to the previous node in the associated list.

Parameters:
input - a node

getTreeChild

public CrNode getTreeChild()
Gets the child node

Returns:
the child node of the actual node or null if it is not existing

getTreeParent

public CrNode getTreeParent()
Gets the parent node of the actual node.

Returns:
the parent node or null if it is the root node

getListSibling

public CrListElement getListSibling()
Gets the CrListElement that the current node is pointing to

Returns:
a list element or null

getNextSibling

public CrNode getNextSibling()
Gets the next sibling node in a CrTree

Returns:
the next sibling node

getLastSibling

public CrNode getLastSibling()
Gets the previous sibling node.

Returns:
the previous sibling node

getNextListSibling

public CrNode getNextListSibling()
Gets the next node in the associated list.

Returns:
the next node in the associated list

getLastListSibling

public CrNode getLastListSibling()
Gets the previous node in the associated list.

Returns:
the previous node in the associated list

getPathInfo

public int[] getPathInfo()
Gets the item from a rule's premise that is stored in a CrNode. (An item is a attribute value pair stored in an int array with two elements [attributeNumber, attributeValue]).

Returns:
an integer array conating the attribute number and the attribute value

getContent

public FastVector getContent()
Gets the FastVector storing possibly a rule's consequence and additional measures

Returns:
a FastVector containing a rule's consequence and its measures

setNewContent

public void setNewContent(FastVector input)
Stores a rule's consequence and its measures in a FastVector

Parameters:
input - a FastVector containing a ruls' consequence

addContent

public void addContent(java.lang.Object data)
Adds an element to the content FastVector of a node. Theis FastVector stores a rule's consequence and addiational measures.

Parameters:
data - an Object that should be added to the FastVector

getHeight

public int getHeight()
Gets the height of a node in a CrTree

Returns:
the height

setHeight

public void setHeight(int i)
Sets the height of a node in a CrTree

Parameters:
i - the height

equals

public boolean equals(int num,
                      int value)
Method that compares two nodes and returns true if their premise's items are the same.

Parameters:
num - the attribute number
value - the attribute value
Returns:
true if the nodes store the same item, false otherwise

toString

public java.lang.String toString()
Method for printing CrNodes

Overrides:
toString in class java.lang.Object
Returns:
a string description of a CrNode