de.folt.fuzzy
Class FuzzyNodeTree<K,T>

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.fuzzy.FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
          extended by de.folt.fuzzy.FuzzyNodeTree<K,T>
All Implemented Interfaces:
java.io.Serializable

public class FuzzyNodeTree<K,T>
extends FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
implements java.io.Serializable

This class implements a tree based on fuzzy nodes. The main fuzzy node is the root node where all further nodes are added too.

        root (fuzzy node)
             |
    ------------------
    lefts son    right son
 
Pattern: Composite

Author:
klemens
See Also:
Serialized Form

Constructor Summary
FuzzyNodeTree()
           
 
Method Summary
 int countNodes()
          countNodes count all the nodes in the tree (includes the root node!)
 java.lang.String format()
          format return a formated fuzzy tree based on the fuzzy nodes
 int getNODESMATCHED()
           
 int getNODESPUSHED()
           
 int getNODESSEARCHED()
           
 FuzzyNode<K,T> getRoot()
           
 boolean insertFuzzyNode(FuzzyDataStructureElement<K,T> fuzzyNodeToAdd)
          insertFuzzyNode inserts a Fuzzy node into the tree; if called for the first time the root is set to the fuzzyNodeToAdd
 boolean insertFuzzyNode(FuzzyNode<K,T> fuzzyNodeToAdd)
           
 boolean removeValue(FuzzyNode<K,T> fuzzyCompareKey)
          removeValue removes a value from the value list of the values of the tree based on a key.
 java.util.Vector<FuzzyNodeSearchResult<K,T>> search(FuzzyDataStructureElement<K,T> fuzzyCompareKey, int similarity)
          search searches for FuzzyNodes matching similarity
 java.util.Vector<FuzzyNodeSearchResult<K,T>> search(FuzzyNode<K,T> fuzzyCompareKey, int similarity)
           
 void setNODESMATCHED(int nodesmatched)
           
 void setNODESPUSHED(int nodespushed)
           
 void setNODESSEARCHED(int nodessearched)
           
 
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
 

Constructor Detail

FuzzyNodeTree

public FuzzyNodeTree()
Method Detail

countNodes

public int countNodes()
Description copied from class: FuzzyDataStructure
countNodes count all the nodes in the tree (includes the root node!)

Specified by:
countNodes in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Returns:
the nodes in the tree

format

public java.lang.String format()
Description copied from class: FuzzyDataStructure
format return a formated fuzzy tree based on the fuzzy nodes

Specified by:
format in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Returns:
formatted fuzzy tree as string

getNODESMATCHED

public int getNODESMATCHED()
Specified by:
getNODESMATCHED in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Returns:
the nODESMATCHED

getNODESPUSHED

public int getNODESPUSHED()
Specified by:
getNODESPUSHED in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Returns:
the nODESPUSHED

getNODESSEARCHED

public int getNODESSEARCHED()
Specified by:
getNODESSEARCHED in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Returns:
the nODESSEARCHED

getRoot

public FuzzyNode<K,T> getRoot()
Specified by:
getRoot in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Returns:
the root - the root node of the Fuzzy Tree

insertFuzzyNode

public boolean insertFuzzyNode(FuzzyDataStructureElement<K,T> fuzzyNodeToAdd)
Description copied from class: FuzzyDataStructure
insertFuzzyNode inserts a Fuzzy node into the tree; if called for the first time the root is set to the fuzzyNodeToAdd

Specified by:
insertFuzzyNode in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Parameters:
fuzzyNodeToAdd - fuzzy node to insert
Returns:
true for success, false for failure

insertFuzzyNode

public boolean insertFuzzyNode(FuzzyNode<K,T> fuzzyNodeToAdd)

search

public java.util.Vector<FuzzyNodeSearchResult<K,T>> search(FuzzyDataStructureElement<K,T> fuzzyCompareKey,
                                                           int similarity)
Description copied from class: FuzzyDataStructure
search searches for FuzzyNodes matching similarity

Specified by:
search in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Parameters:
fuzzyCompareKey - the fuzzy node to search for
similarity - the similarity for the nodes to search
Returns:
a vector of FuzzyNodeSearchResult's

search

public java.util.Vector<FuzzyNodeSearchResult<K,T>> search(FuzzyNode<K,T> fuzzyCompareKey,
                                                           int similarity)

setNODESMATCHED

public void setNODESMATCHED(int nodesmatched)
Specified by:
setNODESMATCHED in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Parameters:
nodesmatched - the nODESMATCHED to set

setNODESPUSHED

public void setNODESPUSHED(int nodespushed)
Specified by:
setNODESPUSHED in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Parameters:
nodespushed - the nODESPUSHED to set

setNODESSEARCHED

public void setNODESSEARCHED(int nodessearched)
Specified by:
setNODESSEARCHED in class FuzzyDataStructure<K,T,FuzzyNodeSearchResult<K,T>>
Parameters:
nodessearched - the nODESSEARCHED to set

removeValue

public boolean removeValue(FuzzyNode<K,T> fuzzyCompareKey)
removeValue removes a value from the value list of the values of the tree based on a key. The values of the key are the objects to remove from the list

Parameters:
fuzzyCompareKey - the key containing the value to remove
Returns:
true when successfully removed, otherwise false