org.gbif.datatester.tests
Interface ExternalProbabilityTest


public interface ExternalProbabilityTest

Interface to enable interaction between a ProbabilityProxyTest and another test external to the framework. Only two methods need to be implemented like in the example below:


 public class MyExternalTest implements ExternalBooleanTest {

   // Constructor should not require any parameters
   public MyExternalTest() throws TestInitializationException {

   public DataType[] getParametersDataTypes() {

       // Specify number of parameters with expected data types
       return new DataType[] { DataType.STRING, DataType.DOUBLE... };
   } 

   public Double getProbability( List parameters ) throws TestProcessingException {

       // Get parameters in expected order
       String param1 = (String)parameters.get( 0 );
       Double param2 = (Double)parameters.get( 1 );
       ...

       // Perform some test, usually based on some model
       if ( my_model_has_data_for_the_parameters ) {

           return new Double( response_from_model ); // response should be between 0 and 1
       }
       else {

           return null;
       }
   }
 }
 

Version:
$Revision: 1.1 $
Author:
Renato De Giovanni ( renato at cria . org . br )

Method Summary
 DataType[] getParametersDataTypes()
          Returns an array where each element indicates the data type of the corresponding parameter.
 java.lang.Double getProbability(java.util.List parameters)
          Returns a probability value for the given parameters.
 

Method Detail

getParametersDataTypes

DataType[] getParametersDataTypes()

Returns an array where each element indicates the data type of the corresponding parameter.

Returns:
array of data types for each accepted parameter.

getProbability

java.lang.Double getProbability(java.util.List parameters)
                                throws TestProcessingException

Returns a probability value for the given parameters. For now, it is assumed that people should implicitly know which parameters need to be passed to this method according to each individual implementation.

Parameters:
parameters - List with parameter values.
Returns:
Probability value between 0 and 1, or null.
Throws:
TestProcessingException