messif.objects.util.impl
Class ThresholdFunctionSimpleEvaluator

java.lang.Object
  extended by messif.objects.util.AggregationFunction
      extended by messif.objects.util.impl.ThresholdFunctionSimpleEvaluator
All Implemented Interfaces:
java.io.Serializable

public class ThresholdFunctionSimpleEvaluator
extends AggregationFunction

Evaluator for basic arithmetic functions. Basic arithmetic operations (+, -, *, /) are supported as well as numeric constants (treated as floats).

See Also:
Serialized Form

Constructor Summary
ThresholdFunctionSimpleEvaluator(java.lang.String function)
          Creates a new instance of ThresholdFunctionSimpleEvaluator.
 
Method Summary
 float compute(float... distances)
          Computes the value of the aggregate distance from the provided sub-distances.
 java.lang.String[] getParameterNames()
          Returns the names of distance parameters (i.e. the descriptor names) for the AggregationFunction.compute(float...) function.
 java.lang.String toString()
          Returns a string representation of the encapsulated function.
 
Methods inherited from class messif.objects.util.AggregationFunction
getDistance, getDistance, getFactoryClass, getParameterMaximalDistance, setFactoryClass, valueOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThresholdFunctionSimpleEvaluator

public ThresholdFunctionSimpleEvaluator(java.lang.String function)
                                 throws java.lang.IllegalArgumentException
Creates a new instance of ThresholdFunctionSimpleEvaluator. The specified function is parsed and compiled. Basic arithmetic operations (+, -, *, /) are supported as well as numeric constants (float). Blank space is ignored and everything else is considered to be a variable.

Parameters:
function - the function string
Throws:
java.lang.IllegalArgumentException - if the specified function cannot be parsed
Method Detail

compute

public float compute(float... distances)
Description copied from class: AggregationFunction
Computes the value of the aggregate distance from the provided sub-distances. The distances array items must correspond with the parameter names as returned by AggregationFunction.getParameterNames().

Specified by:
compute in class AggregationFunction
Parameters:
distances - the distances in respective descriptors
Returns:
the aggregate distance

getParameterNames

public java.lang.String[] getParameterNames()
Description copied from class: AggregationFunction
Returns the names of distance parameters (i.e. the descriptor names) for the AggregationFunction.compute(float...) function.

Specified by:
getParameterNames in class AggregationFunction
Returns:
the list of parameter (descriptor) names of the AggregationFunction.compute(float...) function

toString

public java.lang.String toString()
Returns a string representation of the encapsulated function.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the encapsulated function