jcolibri.method.retrieve.NNretrieval.similarity.local
Class Threshold

java.lang.Object
  extended by jcolibri.method.retrieve.NNretrieval.similarity.local.Threshold
All Implemented Interfaces:
LocalSimilarityFunction

public class Threshold
extends java.lang.Object
implements LocalSimilarityFunction

This function returns 1 if the difference between two numbers is less than a threshold, 0 in the other case.


Constructor Summary
Threshold(double threshold)
          Constructor.
 
Method Summary
 int compare(int x, int y)
          Applies the similarity function.
 double compute(java.lang.Object o1, java.lang.Object o2)
          Applies the similarity function.
 boolean isApplicable(java.lang.Object o1, java.lang.Object o2)
          Applicable to Integer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Threshold

public Threshold(double threshold)
Constructor.

Method Detail

compare

public int compare(int x,
                   int y)
Applies the similarity function.


compute

public double compute(java.lang.Object o1,
                      java.lang.Object o2)
               throws NoApplicableSimilarityFunctionException
Applies the similarity function.

Specified by:
compute in interface LocalSimilarityFunction
Parameters:
o1 - Integer
o2 - Integer
Returns:
result of apply the similarity function.
Throws:
NoApplicableSimilarityFunctionException

isApplicable

public boolean isApplicable(java.lang.Object o1,
                            java.lang.Object o2)
Applicable to Integer

Specified by:
isApplicable in interface LocalSimilarityFunction

GAIA - Group for Artificial Intelligence Applications
http://gaia.fdi.ucm.es