de.hpi.fgis.dude.similarityfunction.contentbased.impl
Class RelativeNumberDiffFunction

java.lang.Object
  extended by de.hpi.fgis.dude.similarityfunction.AbstractSimilarityFunction
      extended by de.hpi.fgis.dude.similarityfunction.contentbased.ContentBasedSimilarityFunction<RelativeNumberDiffFunction>
          extended by de.hpi.fgis.dude.similarityfunction.contentbased.impl.RelativeNumberDiffFunction
All Implemented Interfaces:
SimilarityFunction, AutoJsonable
Direct Known Subclasses:
AbsoluteNumberDiffFunction

public class RelativeNumberDiffFunction
extends ContentBasedSimilarityFunction<RelativeNumberDiffFunction>

This SimilarityFunction implementation checks the relative variation of the numbers of two DuDeObject attributes. The maximum allowed variation is defined by percentage (of the higher of the two value).

Author:
David Sonnabend, Arvid Heise

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.hpi.fgis.dude.similarityfunction.SimilarityFunction
SimilarityFunction.SimilarityValidationState
 
Field Summary
static double DEFAULT_MAX_TOLERANCE_FACTOR
          The default maximum tolerance factor that is used, if no other factor is set.
protected static double DOUBLE_EQUALITY_EPSILON
          The allowed variation of two doubles, so that the two values are regarded as equal.
protected  double maxToleranceFactor
          The maximum percentage of allowed absolute variation.
 
Constructor Summary
protected RelativeNumberDiffFunction()
          Internal constructor for Jsonable deserialization.
  RelativeNumberDiffFunction(double maxToleranceFactor, int attrIndex, String... defaultAttr)
          The constructor initializes the RelativeNumberDiffFunction.
  RelativeNumberDiffFunction(double maxToleranceFactor, String... defaultAttr)
          The constructor initializes the RelativeNumberDiffFunction.
  RelativeNumberDiffFunction(int attrIndex, String... defaultAttr)
          The constructor initializes the RelativeNumberDiffFunction.
  RelativeNumberDiffFunction(String... defaultAttr)
          The constructor initializes the RelativeNumberDiffFunction.
 
Method Summary
protected  double compareAtomicValues(JsonAtomic value1, JsonAtomic value2)
          Calculates the similarity of the two passed JsonAtomics.
 boolean equals(Object obj)
           
protected  double getMaxAllowedVariation(double value1, double value2)
          Gets the maximum allowed variation based on the maxToleranceFactor.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class de.hpi.fgis.dude.similarityfunction.contentbased.ContentBasedSimilarityFunction
addAttribute, calculateSimilarity, calculateSimilarity, getAttribute, ignoreCapitalization, ignoringCapitalizationEnabled, setCompareArrayArrayStrategy, setCompareArrayAtomicStrategy, setCompareArrayRecordStrategy, setCompareRecordAtomicStrategy, setCompareRecordRecordStrategy
 
Methods inherited from class de.hpi.fgis.dude.similarityfunction.AbstractSimilarityFunction
getLastValidationState, getSimilarity, setValidationState
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MAX_TOLERANCE_FACTOR

public static final double DEFAULT_MAX_TOLERANCE_FACTOR
The default maximum tolerance factor that is used, if no other factor is set.

See Also:
Constant Field Values

maxToleranceFactor

protected double maxToleranceFactor
The maximum percentage of allowed absolute variation.


DOUBLE_EQUALITY_EPSILON

protected static final double DOUBLE_EQUALITY_EPSILON
The allowed variation of two doubles, so that the two values are regarded as equal.

See Also:
Constant Field Values
Constructor Detail

RelativeNumberDiffFunction

protected RelativeNumberDiffFunction()
Internal constructor for Jsonable deserialization.


RelativeNumberDiffFunction

public RelativeNumberDiffFunction(String... defaultAttr)
The constructor initializes the RelativeNumberDiffFunction.

Parameters:
defaultAttr - The default attribute.

RelativeNumberDiffFunction

public RelativeNumberDiffFunction(int attrIndex,
                                  String... defaultAttr)
The constructor initializes the RelativeNumberDiffFunction.

Parameters:
attrIndex - The index of the default attribute. This parameter is used to select specific values of an array.
defaultAttr - The default attribute.

RelativeNumberDiffFunction

public RelativeNumberDiffFunction(double maxToleranceFactor,
                                  String... defaultAttr)
The constructor initializes the RelativeNumberDiffFunction.

Parameters:
maxToleranceFactor - The percentage of maximum allowed variation.
defaultAttr - The default attribute.

RelativeNumberDiffFunction

public RelativeNumberDiffFunction(double maxToleranceFactor,
                                  int attrIndex,
                                  String... defaultAttr)
The constructor initializes the RelativeNumberDiffFunction.

Parameters:
maxToleranceFactor - The percentage of maximum allowed variation.
attrIndex - The index of the default attribute. This parameter is used to select specific values of an array.
defaultAttr - The default attribute.
Method Detail

compareAtomicValues

protected double compareAtomicValues(JsonAtomic value1,
                                     JsonAtomic value2)
Description copied from class: ContentBasedSimilarityFunction
Calculates the similarity of the two passed JsonAtomics.

Specified by:
compareAtomicValues in class ContentBasedSimilarityFunction<RelativeNumberDiffFunction>
Parameters:
value1 - The first atomic value.
value2 - The second atomic value.
Returns:
The similarity of the two passed values.

equals

public boolean equals(Object obj)
Overrides:
equals in class ContentBasedSimilarityFunction<RelativeNumberDiffFunction>

getMaxAllowedVariation

protected double getMaxAllowedVariation(double value1,
                                        double value2)
Gets the maximum allowed variation based on the maxToleranceFactor.

Parameters:
value1 - The first value.
value2 - The second value.
Returns:
The absolute value of maximum allowed variation.

hashCode

public int hashCode()
Overrides:
hashCode in class ContentBasedSimilarityFunction<RelativeNumberDiffFunction>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.