de.folt.fuzzy
Class FuzzyStringHashtable<T>

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.fuzzy.FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
          extended by de.folt.fuzzy.FuzzyStringHashtable<T>
All Implemented Interfaces:
java.io.Serializable

public class FuzzyStringHashtable<T>
extends FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>

A fuzzy string class where the strings are stored in a hash table which uses the length of the string as a key. The element stored (value) is a FuzzyDataStructureElement>.
The search uses Levenshtein similarity to determine the strings which match.

Author:
klemens
See Also:
Serialized Form

Constructor Summary
FuzzyStringHashtable()
           
 
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()
           
 FuzzyDataStructureElement<java.lang.String,T> getRoot()
           
 boolean insertFuzzyNode(FuzzyDataStructureElement<java.lang.String,T> fuzzyNodeToAdd)
          insertFuzzyNode inserts a Fuzzy node into the tree; if called for the first time the root is set to the fuzzyNodeToAdd
 java.util.Vector<FuzzyStringHashtableResult<T>> search(FuzzyDataStructureElement<java.lang.String,T> fuzzyCompareKey, int similarity)
          search searches for FuzzyNodes matching 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

FuzzyStringHashtable

public FuzzyStringHashtable()
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<java.lang.String,T,FuzzyStringHashtableResult<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<java.lang.String,T,FuzzyStringHashtableResult<T>>
Returns:
formatted fuzzy tree as string

getNODESMATCHED

public int getNODESMATCHED()
Specified by:
getNODESMATCHED in class FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
Returns:
the nODESMATCHED

getNODESPUSHED

public int getNODESPUSHED()
Specified by:
getNODESPUSHED in class FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
Returns:
the nODESPUSHED

getNODESSEARCHED

public int getNODESSEARCHED()
Specified by:
getNODESSEARCHED in class FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
Returns:
the nODESSEARCHED

getRoot

public FuzzyDataStructureElement<java.lang.String,T> getRoot()
Specified by:
getRoot in class FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
Returns:
the root - the root node of the Fuzzy Tree

insertFuzzyNode

public boolean insertFuzzyNode(FuzzyDataStructureElement<java.lang.String,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<java.lang.String,T,FuzzyStringHashtableResult<T>>
Parameters:
fuzzyNodeToAdd - fuzzy node to insert
Returns:
true for success, false for failure

search

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

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

setNODESMATCHED

public void setNODESMATCHED(int nodesmatched)
Specified by:
setNODESMATCHED in class FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
Parameters:
nodesmatched - the nODESMATCHED to set

setNODESPUSHED

public void setNODESPUSHED(int nodespushed)
Specified by:
setNODESPUSHED in class FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
Parameters:
nodespushed - the nODESPUSHED to set

setNODESSEARCHED

public void setNODESSEARCHED(int nodessearched)
Specified by:
setNODESSEARCHED in class FuzzyDataStructure<java.lang.String,T,FuzzyStringHashtableResult<T>>
Parameters:
nodessearched - the nODESSEARCHED to set