pt.tumba.cluster
Class Hierarchy

java.lang.Object
  extended by pt.tumba.cluster.Hierarchy

public class Hierarchy
extends java.lang.Object

This class represents a node in the subsumption hierarchy

Author:
bmartins

Field Summary
private  java.util.Map children
          The list of children in this node
private  java.lang.String key
          The term defining this node
private  java.util.Map objects
          The list of all the terms in the hierarchy, used for sorting
private static java.util.Random rand
          Random number generator, used by the quick sort algorithm
 
Constructor Summary
Hierarchy(java.lang.String key, java.util.Map objects)
          Constructor for the Node object
 
Method Summary
 Hierarchy addChild(java.lang.String key)
          Adds a feature to the Child attribute of the Node object
 Hierarchy addChildRecursive(Hierarchy node)
          Adds a node to all the children of the Node object
private static java.util.List exchangePos(java.util.List v, int p1, int p2)
          Exchange two values in a list
 Hierarchy getChild(java.lang.String key)
          Gets the node attribute of the Node object
 java.lang.String getKey()
           
 boolean hasChild(java.lang.String term)
          Description of the Method
 boolean hasChildRecursive(java.lang.String term)
          Description of the Method
 java.util.List orderedObjects()
          Description of the Method
 void removeChild(java.lang.String term)
          Description of the Method
 void removeChildRecursive(java.lang.String term)
          Description of the Method
 java.util.List terms()
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rand

private static java.util.Random rand
Random number generator, used by the quick sort algorithm


children

private java.util.Map children
The list of children in this node


key

private java.lang.String key
The term defining this node


objects

private java.util.Map objects
The list of all the terms in the hierarchy, used for sorting

Constructor Detail

Hierarchy

Hierarchy(java.lang.String key,
          java.util.Map objects)
Constructor for the Node object

Parameters:
term - The term defining the node
terms - The list of all the terms in the hierarchy, used for sorting
Method Detail

exchangePos

private static java.util.List exchangePos(java.util.List v,
                                          int p1,
                                          int p2)
Exchange two values in a list

Parameters:
v - The original list
p1 - The index of the first element
p2 - The index of the second element
Returns:
The list with the two elements exchanged

addChildRecursive

public Hierarchy addChildRecursive(Hierarchy node)
Adds a node to all the children of the Node object

Parameters:
node - The feature to be added to the Child attribute
Returns:
Description of the Return Value

addChild

public Hierarchy addChild(java.lang.String key)
Adds a feature to the Child attribute of the Node object

Parameters:
term - The feature to be added to the Child attribute
Returns:
Description of the Return Value

getChild

public Hierarchy getChild(java.lang.String key)
Gets the node attribute of the Node object

Parameters:
term - Description of the Parameter
Returns:
The node value

hasChild

public boolean hasChild(java.lang.String term)
Description of the Method

Parameters:
term - Description of the Parameter
Returns:
Description of the Return Value

hasChildRecursive

public boolean hasChildRecursive(java.lang.String term)
Description of the Method

Parameters:
term - Description of the Parameter
Returns:
Description of the Return Value

orderedObjects

public java.util.List orderedObjects()
Description of the Method

Returns:
Description of the Return Value

removeChild

public void removeChild(java.lang.String term)
Description of the Method

Parameters:
term - Description of the Parameter

removeChildRecursive

public void removeChildRecursive(java.lang.String term)
Description of the Method

Parameters:
term - Description of the Parameter

terms

public java.util.List terms()
Description of the Method

Returns:
Description of the Return Value

getKey

public java.lang.String getKey()