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; int numberofvectors;
float maxerror; float maxerror;
String maxdiscrepancyPoint; String maxdiscrepancyPoint;
private HashMap<String, String> output;
@Override @Override
public HashMap<String, VarCouple> getInputParameters() { public HashMap<String, VarCouple> getInputParameters() {
@ -101,7 +102,7 @@ public class DiscrepancyAnalysis extends DataAnalysis {
analyzeCompareList(takePoints); analyzeCompareList(takePoints);
calcDiscrepancy(); calcDiscrepancy();
HashMap<String, String> output = new HashMap<String, String>(); output = new HashMap<String, String>();
output.put("MEAN", "" + mean); output.put("MEAN", "" + mean);
output.put("VARIANCE", "" + variance); output.put("VARIANCE", "" + variance);
output.put("NUMBER_OF_ERRORS", "" + numberoferrors); 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 acceptanceThreshold = 0.8f;
float rejectionThreshold = 0.3f; float rejectionThreshold = 0.3f;
double bestThreshold = 0.5d; double bestThreshold = 0.5d;
private HashMap<String, String> output;
public HashMap<String, VarCouple> getInputParameters() { public HashMap<String, VarCouple> getInputParameters() {
@ -166,7 +167,7 @@ public class DistributionQualityAnalysis extends DataAnalysis {
double omissionrate = calculateOmissionRate(truePositives, falseNegatives); double omissionrate = calculateOmissionRate(truePositives, falseNegatives);
double specificity = calculateSpecificity(trueNegatives, falsePositives); 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_POSITIVES", "" + truePositives);
output.put("TRUE_NEGATIVES", "" + trueNegatives); output.put("TRUE_NEGATIVES", "" + trueNegatives);
output.put("FALSE_POSITIVES", "" + falsePositives); output.put("FALSE_POSITIVES", "" + falsePositives);
@ -321,4 +322,15 @@ public class DistributionQualityAnalysis extends DataAnalysis {
} }
@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 //gets the weight of the generator: according to this the generator will be placed in the execution order
public WEIGHT getWeight(); 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; 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); public void train(AlgorithmConfiguration Input, Model previousModel);
// gets the type of the content inside the model: e.g. Table Model, Vectorial Model etc. public void stop();
public String getContentType(); public String getContentType();
// gets the content of the model: e.g. Table indications etc.
public Object getContent(); public Object getContent();
public void stop();
} }

View File

@ -19,12 +19,6 @@ public interface Modeler extends ComputationalAgent{
public void stop(); 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(); public Model getModel();
} }

View File

@ -36,16 +36,6 @@ public class SimpleModeler implements Modeler{
return innermodel.getResources(); return innermodel.getResources();
} }
@Override
public String getModelType() {
return innermodel.getContentType();
}
@Override
public Object getModelContent() {
return innermodel.getContent();
}
@Override @Override
public Model getModel() { public Model getModel() {
return innermodel; return innermodel;
@ -82,7 +72,12 @@ public class SimpleModeler implements Modeler{
return WEIGHT.LOWEST; 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; status = 100f;
} }
@Override
public String getContentType() { public String getContentType() {
return File.class.getName(); return File.class.getName();
} }
@Override
public Object getContent() { public Object getContent() {
return new File(fileName); return new File(fileName);

View File

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

View File

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