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

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

public class Interval
extends java.lang.Object
implements LocalSimilarityFunction

This function returns the similarity of two number inside an interval. sim(x,y)=1-(|x-y|/interval) Now it works with Number values.


Constructor Summary
Interval(double interval)
          Constructor.
 
Method Summary
 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

Interval

public Interval(double interval)
Constructor.

Method Detail

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 - Number
o2 - Number
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