gov.sandia.cognition.learning.algorithm.clustering.hierarchy
Class BinaryClusterHierarchyNode<DataType,ClusterType extends Cluster<DataType>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.algorithm.clustering.hierarchy.AbstractClusterHierarchyNode<DataType,ClusterType>
          extended by gov.sandia.cognition.learning.algorithm.clustering.hierarchy.BinaryClusterHierarchyNode<DataType,ClusterType>
Type Parameters:
DataType - The type of the data in the cluster.
ClusterType - The type of cluster contained in the hierarchy node.
All Implemented Interfaces:
Cluster<DataType>, ClusterHierarchyNode<DataType,ClusterType>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
AgglomerativeClusterer.HierarchyNode

public class BinaryClusterHierarchyNode<DataType,ClusterType extends Cluster<DataType>>
extends AbstractClusterHierarchyNode<DataType,ClusterType>

Implements a binary cluster hierarchy node. It can support two children.

Since:
2.1
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
protected  ClusterHierarchyNode<DataType,ClusterType> firstChild
          The first child node.
protected  ClusterHierarchyNode<DataType,ClusterType> secondChild
          The second child node.
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.clustering.hierarchy.AbstractClusterHierarchyNode
cluster
 
Constructor Summary
BinaryClusterHierarchyNode()
          Creates a new BinaryClusterHierarchyNode.
BinaryClusterHierarchyNode(ClusterType cluster)
          Creates a new BinaryClusterHierarchyNode.
BinaryClusterHierarchyNode(ClusterType cluster, ClusterHierarchyNode<DataType,ClusterType> firstChild, ClusterHierarchyNode<DataType,ClusterType> secondChild)
          Creates a new BinaryClusterHierarchyNode.
 
Method Summary
 List<ClusterHierarchyNode<DataType,ClusterType>> getChildren()
          Gets the children of this node.
 ClusterHierarchyNode<DataType,ClusterType> getFirstChild()
          Gets the first child node, if there is one.
 ClusterHierarchyNode<DataType,ClusterType> getSecondChild()
          Gets the second child node, if there is one.
 boolean hasChildren()
          True if this node has any children.
 void setFirstChild(ClusterHierarchyNode<DataType,ClusterType> firstChild)
          Sets the first child node.
 void setSecondChild(ClusterHierarchyNode<DataType,ClusterType> secondChild)
          Sets the second child node.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.clustering.hierarchy.AbstractClusterHierarchyNode
getCluster, getMembers, setCluster
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

firstChild

protected ClusterHierarchyNode<DataType,ClusterType extends Cluster<DataType>> firstChild
The first child node.


secondChild

protected ClusterHierarchyNode<DataType,ClusterType extends Cluster<DataType>> secondChild
The second child node.

Constructor Detail

BinaryClusterHierarchyNode

public BinaryClusterHierarchyNode()
Creates a new BinaryClusterHierarchyNode.


BinaryClusterHierarchyNode

public BinaryClusterHierarchyNode(ClusterType cluster)
Creates a new BinaryClusterHierarchyNode.

Parameters:
cluster - The cluster associated with this node.

BinaryClusterHierarchyNode

public BinaryClusterHierarchyNode(ClusterType cluster,
                                  ClusterHierarchyNode<DataType,ClusterType> firstChild,
                                  ClusterHierarchyNode<DataType,ClusterType> secondChild)
Creates a new BinaryClusterHierarchyNode.

Parameters:
cluster - The cluster associated with this node.
firstChild - The first child node.
secondChild - The second child node.
Method Detail

hasChildren

public boolean hasChildren()
Description copied from interface: ClusterHierarchyNode
True if this node has any children.

Specified by:
hasChildren in interface ClusterHierarchyNode<DataType,ClusterType extends Cluster<DataType>>
Overrides:
hasChildren in class AbstractClusterHierarchyNode<DataType,ClusterType extends Cluster<DataType>>
Returns:
True if this node has any children.

getChildren

public List<ClusterHierarchyNode<DataType,ClusterType>> getChildren()
Description copied from interface: ClusterHierarchyNode
Gets the children of this node. May be null if there are no children.

Returns:
The children of this node.

getFirstChild

public ClusterHierarchyNode<DataType,ClusterType> getFirstChild()
Gets the first child node, if there is one. Otherwise, null is returned.

Returns:
The first child node.

setFirstChild

public void setFirstChild(ClusterHierarchyNode<DataType,ClusterType> firstChild)
Sets the first child node.

Parameters:
firstChild - The first child node.

getSecondChild

public ClusterHierarchyNode<DataType,ClusterType> getSecondChild()
Gets the second child node, if there is one. Otherwise, null is returned.

Returns:
The second child node.

setSecondChild

public void setSecondChild(ClusterHierarchyNode<DataType,ClusterType> secondChild)
Sets the second child node.

Parameters:
secondChild - The second child node.