public Solution getReferenceSolution(Problem p) {
int personalityVal = 1;
int templateNameVal = 0;
...
Solution personality = getComponentFactory().constructSolution(personalityVal);
Solution templateName = getComponentFactory().constructSolution(templateNameVal);
...
return personality,templateName,..;
}
Here is the original code for class Solution:
public class Solution
extends Object
implements java.io.Serializable,
edu.indiana.iucbrf.feature.Featured,
Comparable,
edu.indiana.util.xml.XMLRepresentable {
private FeatureKey firstFeatureKey;
private FeatureCollection features;
/** Creates new Solution.
*/
protected Solution() {
}
public Solution(FeatureCollection features,
Domain domain) {
this.features = features;
}
public boolean getIsReferenceSolution() {
return features.getIsReferenceSolution();
}
public void setIsReferenceSolution(boolean isReferenceSolution) {
features.setIsReferenceSolution(isReferenceSolution);
}
public boolean equals(Object other) {
return (this.compareTo(other) == 0);
}
}
Here is inside Domain class code:
public Solution[] getReferenceSolution(Problem p)
throws UnsupportedOperationException {
Solution result;
if (!haveReferenceSolution)
throw new UnsupportedOperationException("Domain.getReferenceSolution: A getReferenceSolution() method has not been specified for this domain. If its use is required, please specify one using setEquivalenceClasses() or by overriding Domain.getReferenceSolution().");
else {
if (haveBooleanSolutionCutoff)
result = findNearestEquivalenceClass(p).applyTo(p, booleanSolutionCutoff);
else
result = findNearestEquivalenceClass(p).applyTo(p);
}
result.setIsReferenceSolution(true);
return result; //<---- error over here!
}