org.jactr.core.utils.similarity
Class DefaultSimilarityHandler

java.lang.Object
  extended by org.jactr.core.utils.similarity.DefaultSimilarityHandler
All Implemented Interfaces:
SimilarityHandler

public class DefaultSimilarityHandler
extends java.lang.Object
implements SimilarityHandler

The DefaultSimilarityHandler handles basic similarity computations and permits the attaching of custom handlers

Author:
harrison

Constructor Summary
DefaultSimilarityHandler()
          Constructor for the DefaultSimilarityHandler object
 
Method Summary
 void addHandler(SimilarityHandler sm)
          Adds a feature to the Handler attribute of the DefaultSimilarityHandler object
 double computeSimilarity(java.lang.Object one, java.lang.Object two, double maxDiff, double maxSim)
          compute the similarty between one and two scaled to fit maxDiff and maxSim
 double getSimilarity(java.lang.Object one, java.lang.Object two, double maxDiff, double maxSim)
          Gets the similarity attribute of the DefaultSimilarityHandler object
 boolean handles(java.lang.Object one, java.lang.Object two)
          can this handler compute a similarity for these two chunks
 void removeHandler(SimilarityHandler sm)
          Description of the Method
 void setSimilarity(IChunk one, IChunk two, double sim)
          Sets the similarity attribute of the DefaultSimilarityHandler class
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSimilarityHandler

public DefaultSimilarityHandler()
Constructor for the DefaultSimilarityHandler object

Method Detail

addHandler

public void addHandler(SimilarityHandler sm)
Adds a feature to the Handler attribute of the DefaultSimilarityHandler object

Parameters:
sm - The feature to be added to the Handler attribute

removeHandler

public void removeHandler(SimilarityHandler sm)
Description of the Method

Parameters:
sm - Description of the Parameter

getSimilarity

public double getSimilarity(java.lang.Object one,
                            java.lang.Object two,
                            double maxDiff,
                            double maxSim)
Gets the similarity attribute of the DefaultSimilarityHandler object

Parameters:
one - Description of the Parameter
two - Description of the Parameter
maxDiff - Description of the Parameter
maxSim - Description of the Parameter
Returns:
The similarity value

handles

public boolean handles(java.lang.Object one,
                       java.lang.Object two)
can this handler compute a similarity for these two chunks

Specified by:
handles in interface SimilarityHandler
Parameters:
one - Description of the Parameter
two - Description of the Parameter
Returns:
true if it can compute the sim

computeSimilarity

public double computeSimilarity(java.lang.Object one,
                                java.lang.Object two,
                                double maxDiff,
                                double maxSim)
compute the similarty between one and two scaled to fit maxDiff and maxSim

Specified by:
computeSimilarity in interface SimilarityHandler
Parameters:
one - Description of the Parameter
two - Description of the Parameter
maxDiff - Description of the Parameter
maxSim - Description of the Parameter
Returns:
maxSim if they are equal maxDiff if not

setSimilarity

public void setSimilarity(IChunk one,
                          IChunk two,
                          double sim)
Sets the similarity attribute of the DefaultSimilarityHandler class

Parameters:
one - The new similarity value
two - The new similarity value
sim - The new similarity value