* necessary when we introduce property-specific transformers stored in the
* knowledge base.
*/
public void calculateDefaultTransformers() {
for (Leaf leaf : tree.getRoot().getAllLeaves()) {
Transformer t = leaf.getTransformer();
if (t instanceof NumericTransformer) {
// calculate min, max
// set min,max
NumericTransformer nt = (NumericTransformer) t;
// A very specific assumption: the lower the better (!)
// obviously often not true, e.g. for format/numberOfTools
double min = Long.MAX_VALUE;
double max = Long.MIN_VALUE;
for (Alternative a : alternativesDefinition.getConsideredAlternatives()) {
for (Value v : leaf.getValues(a.getName()).getList()) {
INumericValue value = (INumericValue) v;
if (value.value() > max) {
max = value.value();
}
if (value.value() < min) {
min = value.value();
}
}
}
nt.defaults(min, max);
nt.setMode(TransformationMode.LINEAR);
} else {
OrdinalTransformer ot = (OrdinalTransformer) t;
if (leaf.getScale() instanceof BooleanScale) {
ot.getMapping().put("Yes", new TargetValueObject(5));
ot.getMapping().put("No", new TargetValueObject(1));
} else {
// total nonsense placeholder for setting something
// until we have proper heuristics and property-specific
// transformers in the knowledge base
for (String s : ot.getMapping().keySet()) {
ot.getMapping().put(s, new TargetValueObject(3.33));
}
}
}
t.touch();
}
}