messif.objects.util.impl
Class ArithmeticFunctionToken

java.lang.Object
  extended by messif.objects.util.impl.ArithmeticFunctionToken
All Implemented Interfaces:
java.io.Serializable, PatternToken

public class ArithmeticFunctionToken
extends java.lang.Object
implements PatternToken

This is class for arithmethic functions, like "log", for aggregation function evaluator.

See Also:
Serialized Form

Nested Class Summary
protected static class ArithmeticFunctionToken.FunctionType
          Function type
 
Field Summary
protected  ArithmeticFunctionToken.FunctionType function
          Function type
protected  PatternToken operand
          Operand
 
Constructor Summary
ArithmeticFunctionToken(java.lang.String functionString, PatternToken operand)
          Currently, this class recognizes only the "log" function, which is "ln" in fact.
 
Method Summary
 float evaluate(float[] subdistances)
          Apply the arithmetic function on the argument evaluated on the passed subdistances.
static boolean isFunctionString(java.lang.String functionString)
          This static method should be in compliance with types recognized by consructor - LOG (for ln), LOG10 (for log_10).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

function

protected final ArithmeticFunctionToken.FunctionType function
Function type


operand

protected final PatternToken operand
Operand

Constructor Detail

ArithmeticFunctionToken

public ArithmeticFunctionToken(java.lang.String functionString,
                               PatternToken operand)
                        throws java.lang.IllegalArgumentException
Currently, this class recognizes only the "log" function, which is "ln" in fact.

Parameters:
functionString - string to be parsed
operand - already created token
Throws:
java.lang.IllegalArgumentException
Method Detail

isFunctionString

public static boolean isFunctionString(java.lang.String functionString)
This static method should be in compliance with types recognized by consructor - LOG (for ln), LOG10 (for log_10).

Parameters:
functionString - string to check
Returns:
true, if this string is recognized as some arithmetic function

evaluate

public final float evaluate(float[] subdistances)
Apply the arithmetic function on the argument evaluated on the passed subdistances.

Specified by:
evaluate in interface PatternToken
Parameters:
subdistances - specific subdistances for the two meta objects compared
Returns:
result of the arithmetic function application to the argument evaluation

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object