de.dfki.mycbr.core.similarity
Class Taxonomy

java.lang.Object
  extended by java.util.Observable
      extended by de.dfki.mycbr.core.similarity.Taxonomy
All Implemented Interfaces:
java.util.Observer

public class Taxonomy
extends java.util.Observable
implements java.util.Observer

Represents the data structure used for taxonomy similarity functions. Each symbol known for a given SymbolDescription represents one node in the tree. The SymbolDescription is the root. We associate to each node a similarity which tells how similar the direct children of that symbol are. By default all of the symbols are direct children of the root. The default similarity for the root node is 0.00. Leaves have similarity 1.00 by default

Author:
myCBR Team

Method Summary
 java.util.List<TaxonomyNode> getChildren(TaxonomyNode node)
          Returns the children of the given node.
 java.util.List<TaxonomyNode> getLeaves()
           
 TaxonomyNode getParent(TaxonomyNode currentNode)
          Returns the parent node of the given node.
 java.util.HashMap<TaxonomyNode,TaxonomyNode> getParentMap()
           
 Similarity getSimilarity(TaxonomyNode obj)
          Returns the Similarity object that corresponds to obj.
 java.util.HashMap<TaxonomyNode,Similarity> getSimilarityMap()
           
 TaxonomyNode getTopSymbol()
          Gets the top symbol of this taxonomy
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSimilarity

public Similarity getSimilarity(TaxonomyNode obj)
Returns the Similarity object that corresponds to obj. In this taxonomy, each symbol attribute is represented by a node which also contains a Similarity object. This similarity specifies how similar the leaves of this node are. obj might also be of type SymbolDesc since the top node of the taxonomy is the symbol description.

Parameters:
obj - the object for which the similarity is returned
Returns:
the similarity corresponding to obj

getTopSymbol

public TaxonomyNode getTopSymbol()
Gets the top symbol of this taxonomy

Returns:
the top symbol of this taxonomy

getParent

public TaxonomyNode getParent(TaxonomyNode currentNode)
Returns the parent node of the given node. Returns null if the given node is not a node of this taxonomy or if it is the root.

Parameters:
currentNode - the node whose parent should be returned
Returns:
the parent of the given node if there is one, null otherwise

getChildren

public java.util.List<TaxonomyNode> getChildren(TaxonomyNode node)
Returns the children of the given node. A node is either topSymbol or a symbolAttribute

Parameters:
node - the node whose children should be returned
Returns:
the children of the given node, empty list if there are none

getSimilarityMap

public java.util.HashMap<TaxonomyNode,Similarity> getSimilarityMap()

getParentMap

public java.util.HashMap<TaxonomyNode,TaxonomyNode> getParentMap()

getLeaves

public java.util.List<TaxonomyNode> getLeaves()

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer