de.folt.fuzzy
Class LanguagePartitionedFuzzyNodeTree<T>

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.fuzzy.LanguagePartitionedFuzzyNodeTree<T>
All Implemented Interfaces:
java.io.Serializable

public class LanguagePartitionedFuzzyNodeTree<T>
extends java.util.Observable
implements java.io.Serializable

This class extends the class StringFuzzyNodeTree by adding an additional layer to the structure of the underlying tree.
For each language resulting from a MonoLingualObject a separate StringFuzzyTree is generated and stored in a ObservableHashtable.

  Structure:
  [de] [en] [fr]           ....        [es] .... [it] (a hash table)
   |                                     |
   |                                    references the corresponding StringFuzzyTree for language es   
   |                          
   references the corresponding StringFuzzyTreefor language de 
   | (this references the StringFuzzyTree level)
  [0] [1] [2]           ....        [i] .... [n] (a hash table)
   |                                 |
   references the root fuzzy node    references the root fuzzy node 
   with key sum 0                    with key sum i
  
  

Author:
klemens
See Also:
Serialized Form

Constructor Summary
LanguagePartitionedFuzzyNodeTree()
           
 
Method Summary
 boolean checkFuzzyNodeSearchThreadStatus()
          checkFuzzyNodeSearchThreadStatus checks if a multi thread fuzzy node search has finished.
 int countNodes()
          countNodes count all the nodes in the tree
 java.lang.String format()
          format return a formated partitioned fuzzy tree based on the fuzzy nodes
 StringPartitionedFuzzyNodeTree<T> getFuzzyNodeTree(java.lang.String language)
          getRoot returns a specific fuzzy Node tree
 int getIMaxIndex()
           
 java.util.Hashtable<java.lang.String,StringPartitionedFuzzyNodeTree<T>> getLanguageNodeTrees()
           
 int getNODESMATCHED()
           
 int getNODESPUSHED()
           
 int getNODESSEARCHED()
           
 boolean insertFuzzyNode(StringFuzzyNode<T> fuzzyNodeToAdd, java.lang.String language)
          insertFuzzyNode inserts a Fuzzy node into a partitioned fuzzy node tree;
 boolean pushToFuzzyNodeSearchThread(FuzzyNode<java.lang.String,T> searchNode, FuzzyNode<java.lang.String,T> fuzzyCompareKey, int similarity)
          pushToFuzzyNodeSearchThread if there a threads given the processor number available runs a search in a new thread
 java.util.Vector<FuzzyNodeSearchResult<java.lang.String,T>> search(StringFuzzyNode<T> fuzzyCompareKey, int similarity, java.lang.String language)
          search returns all a FuzzyNodeSearchResult of all matching FuzzyNodes
 
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

LanguagePartitionedFuzzyNodeTree

public LanguagePartitionedFuzzyNodeTree()
Method Detail

checkFuzzyNodeSearchThreadStatus

public boolean checkFuzzyNodeSearchThreadStatus()
checkFuzzyNodeSearchThreadStatus checks if a multi thread fuzzy node search has finished. If yes copies result to threadFuzzyNodeSearchResult and gives thread free for other usage

Returns:
true if all threads are finished otherwise false

countNodes

public int countNodes()
countNodes count all the nodes in the tree

Returns:
the nodes in the tree

format

public java.lang.String format()
format return a formated partitioned fuzzy tree based on the fuzzy nodes

Returns:
formatted partitioned fuzzy tree as string

getFuzzyNodeTree

public StringPartitionedFuzzyNodeTree<T> getFuzzyNodeTree(java.lang.String language)
getRoot returns a specific fuzzy Node tree

Parameters:
language - the language of the partitioned FuzzyTree to return
Returns:
the language partitioned fuzzy node tree corresponding to the KEYSUM of the fuzzy node of this tree

getIMaxIndex

public int getIMaxIndex()
Returns:
the iMaxIndex -highest KEYSUm currently in the partitioned Fuzzy Node Tree

getLanguageNodeTrees

public java.util.Hashtable<java.lang.String,StringPartitionedFuzzyNodeTree<T>> getLanguageNodeTrees()
Returns:
the languageNodeTrees

getNODESMATCHED

public int getNODESMATCHED()
Returns:
the nODESMATCHED

getNODESPUSHED

public int getNODESPUSHED()
Returns:
the nODESPUSHED

getNODESSEARCHED

public int getNODESSEARCHED()
Returns:
the nODESSEARCHED

insertFuzzyNode

public boolean insertFuzzyNode(StringFuzzyNode<T> fuzzyNodeToAdd,
                               java.lang.String language)
insertFuzzyNode inserts a Fuzzy node into a partitioned fuzzy node tree;

Parameters:
fuzzyNodeToAdd - fuzzy node to insert
language - language of the node
Returns:
true for success, false for failure

pushToFuzzyNodeSearchThread

public boolean pushToFuzzyNodeSearchThread(FuzzyNode<java.lang.String,T> searchNode,
                                           FuzzyNode<java.lang.String,T> fuzzyCompareKey,
                                           int similarity)
pushToFuzzyNodeSearchThread if there a threads given the processor number available runs a search in a new thread

Parameters:
searchNode - the node to start search with
fuzzyCompareKey - the key to compare against
similarity - the similarity used for the search
Returns:
true if the search is done in a thread otherwise false

search

public java.util.Vector<FuzzyNodeSearchResult<java.lang.String,T>> search(StringFuzzyNode<T> fuzzyCompareKey,
                                                                          int similarity,
                                                                          java.lang.String language)
search returns all a FuzzyNodeSearchResult of all matching FuzzyNodes

Parameters:
fuzzyCompareKey - the fuzzy node to search for with similarity
similarity - the similarity to search for
language - language for the search
Returns:
a vector of FuzzyNodeSearchResult