The following piece of code is redundant, in a bad way. The first half prints adjacency-evaluation data. The second half, which is almost identical, prints coefficient-evaluation data. The only difference between them is the set of "System.out" statements inside the inner loop.
The right thing to do should be to refactor it, by pushing the outer loop into a new method, and passing to this method the set of properties to be recorded.
But how can I pass properties in Java? Do I need to turn them into Strings and use reflection?
Here's the code:
The right thing to do should be to refactor it, by pushing the outer loop into a new method, and passing to this method the set of properties to be recorded.
But how can I pass properties in Java? Do I need to turn them into Strings and use reflection?
Here's the code:
System.out.println("************************************************************************");
System.out.println("*** comparing runs for this setting: adjacency (errOmission,errCommission,loss) ***");
System.out.println("************************************************************************");
//for each run
for (List run : evalTable){
String s = "#" + i + ":" + __;
//for each method, show omission, commission and loss
for(EvaluationResult eval : run){
s += eval.adj.errorsOfOmission + _;
s += eval.adj.errorsOfCommission + _;
s += eval.adj.loss() + __;
}
//s+=winner;
System.out.println(s);
i++;
}
System.out.println("************************************************************************");
System.out.println("*** comparing runs for this setting: all coefficients (total_loss) ***");
System.out.println("************************************************************************");
i=0; //run-number
//for each run
for (List run : evalTable){
System.out.print("#" + i + ":" + __);
//for each method, show omission, commission and loss
for(EvaluationResult eval : run){
System.out.print(eval.coeffAll.loss() + _);
}
//s+=winner;
System.out.println("");
i++;
}