added getContent and getContentType for all the ComputationalAgents

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@50916 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Gianpaolo Coro 2012-02-13 17:48:29 +00:00
parent 2f11df1ca0
commit f3febed58f
10 changed files with 44 additions and 39 deletions

View File

@ -28,6 +28,7 @@ public class DiscrepancyAnalysis extends DataAnalysis {
int numberofvectors;
float maxerror;
String maxdiscrepancyPoint;
private HashMap<String, String> output;
@Override
public HashMap<String, VarCouple> getInputParameters() {
@ -101,7 +102,7 @@ public class DiscrepancyAnalysis extends DataAnalysis {
analyzeCompareList(takePoints);
calcDiscrepancy();
HashMap<String, String> output = new HashMap<String, String>();
output = new HashMap<String, String>();
output.put("MEAN", "" + mean);
output.put("VARIANCE", "" + variance);
output.put("NUMBER_OF_ERRORS", "" + numberoferrors);
@ -172,4 +173,14 @@ public class DiscrepancyAnalysis extends DataAnalysis {
}
}
@Override
public String getContentType() {
return HashMap.class.getName();
}
@Override
public Object getContent() {
return output;
}
}

View File

@ -36,6 +36,7 @@ public class DistributionQualityAnalysis extends DataAnalysis {
float acceptanceThreshold = 0.8f;
float rejectionThreshold = 0.3f;
double bestThreshold = 0.5d;
private HashMap<String, String> output;
public HashMap<String, VarCouple> getInputParameters() {
@ -166,7 +167,7 @@ public class DistributionQualityAnalysis extends DataAnalysis {
double omissionrate = calculateOmissionRate(truePositives, falseNegatives);
double specificity = calculateSpecificity(trueNegatives, falsePositives);
HashMap<String, String> output = new HashMap<String, String>();
output = new HashMap<String, String>();
output.put("TRUE_POSITIVES", "" + truePositives);
output.put("TRUE_NEGATIVES", "" + trueNegatives);
output.put("FALSE_POSITIVES", "" + falsePositives);
@ -320,5 +321,16 @@ public class DistributionQualityAnalysis extends DataAnalysis {
System.out.println("AUC: " + auc);
}
@Override
public String getContentType() {
return HashMap.class.getName();
}
@Override
public Object getContent() {
return output;
}
}

View File

@ -18,4 +18,11 @@ public interface ComputationalAgent {
//gets the weight of the generator: according to this the generator will be placed in the execution order
public WEIGHT getWeight();
// gets the type of the content inside the generator: String, File, HashMap.
public String getContentType();
// gets the content of the model: e.g. Table indications etc.
public Object getContent();
}

View File

@ -23,10 +23,4 @@ public interface Generator extends ComputationalAgent{
public void generate() throws Exception;
// gets the type of the content inside the generator: String, File etc.
public String getContentType();
// gets the content of the model: e.g. Table indications etc.
public Object getContent();
}

View File

@ -41,11 +41,9 @@ public interface Model {
public void train(AlgorithmConfiguration Input, Model previousModel);
// gets the type of the content inside the model: e.g. Table Model, Vectorial Model etc.
public String getContentType();
// gets the content of the model: e.g. Table indications etc.
public Object getContent();
public void stop();
public String getContentType();
public Object getContent();
}

View File

@ -19,12 +19,6 @@ public interface Modeler extends ComputationalAgent{
public void stop();
//gets the class name of the model
public String getModelType();
// gets the content of the model: e.g. Table indications etc.
public Object getModelContent();
public Model getModel();
}

View File

@ -36,16 +36,6 @@ public class SimpleModeler implements Modeler{
return innermodel.getResources();
}
@Override
public String getModelType() {
return innermodel.getContentType();
}
@Override
public Object getModelContent() {
return innermodel.getContent();
}
@Override
public Model getModel() {
return innermodel;
@ -82,7 +72,12 @@ public class SimpleModeler implements Modeler{
return WEIGHT.LOWEST;
}
public String getContentType() {
return innermodel.getContentType();
}
public Object getContent() {
return innermodel.getContent();
}
}

View File

@ -182,12 +182,10 @@ public class ModelAquamapsNN implements Model {
status = 100f;
}
@Override
public String getContentType() {
return File.class.getName();
}
@Override
public Object getContent() {
return new File(fileName);

View File

@ -187,12 +187,10 @@ public class ModelAquamapsNNNS implements Model {
status = 100f;
}
@Override
public String getContentType() {
return String.class.getName();
}
@Override
public Object getContent() {
return fileName;

View File

@ -335,12 +335,10 @@ public class ModelHSPEN implements Model {
// take ending time
}
@Override
public String getContentType() {
return String.class.getName();
}
@Override
public Object getContent() {
return outputTable;
}