fr.jussieu.gla.wasa.core
Class ErrorMixer

java.lang.Object
  |
  +--fr.jussieu.gla.wasa.core.ErrorMixer

public class ErrorMixer
extends java.lang.Object

Customizable strategy for comparating two sets of scores issued from Constraint's calculations. Developers may subclass ErrorMixer to provide their own proble-dependant error calculation strategies.

Version:
$Revision: 1.4 $ $Date: 2002/04/05 16:31:45 $

Constructor Summary
ErrorMixer()
           
 
Method Summary
 int compare(float[] first, float[] second)
          Manipulates Error scores.
 boolean isUsuable(float f)
          Tests if the given parameter is recognized as a valid value for an Error score.
 double sum(double sum, float[] errors)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorMixer

public ErrorMixer()
Method Detail

isUsuable

public final boolean isUsuable(float f)
Tests if the given parameter is recognized as a valid value for an Error score.
Parameters:
f - The float to test.
Returns:
true if it represents a valid Error score, false otherwise.

compare

public int compare(float[] first,
                   float[] second)
Manipulates Error scores. The default behavior is to sum everything.

The default behavior is that the highest sum is the best. This method could be overriden in order to provide custom evaluation (e.g. : consider peak values, or rescale logarithmically, etc). The order of the errors in the array should be considered as meaningless.

Warning : developers implementing their own ErrorMixer should be aware that Error scores may contain "unusuable" value equals to Float.NaN constant. A check should be performed on any float coming from input parameters with the isUsuable( float ) instance method.

Parameters:
first - An array of scores. A value of null means that the Constraint which calculated the score did not affect the Variable.
second - Same meaning as first.
Returns:
0 if two arrays express the same overall score, < 0 if second array is better, > 0 if first score array is better.

sum

public double sum(double sum,
                  float[] errors)