Node childNode = new Node();
childNode.setName("Image properties");
rootN.addChild(childNode);
Leaf leafWithUnit = new Leaf();
leafWithUnit.setName("Amount of Pixel");
leafWithUnit.changeScale(new PositiveIntegerScale());
leafWithUnit.getScale().setUnit("px");
childNode.addChild(leafWithUnit);
Leaf ordinalLeaf = new Leaf();
ordinalLeaf.setName("Karma");
OrdinalScale ordinalScale = new OrdinalScale();
ordinalScale.setRestriction("Good/Bad/Evil");
ordinalLeaf.changeScale(ordinalScale);
rootN.addChild(ordinalLeaf);
Leaf numericLeaf = new Leaf();
numericLeaf.setName("Filesize (in Relation to Original)");
numericLeaf.changeScale(new PositiveFloatScale());
numericLeaf.getScale().setUnit("MB");
rootN.addChild(numericLeaf);
Leaf singleLeaf = new Leaf();
singleLeaf.setName("A Single-Leaf");
singleLeaf.changeScale(new PositiveFloatScale());
singleLeaf.getScale().setUnit("tbd");
singleLeaf.setSingle(true);
rootN.addChild(singleLeaf);
Leaf restrictedLeaf = new Leaf();
restrictedLeaf.setName("IntRange 0-10");
IntRangeScale range = new IntRangeScale();
range.setLowerBound(0);
range.setUpperBound(10);
restrictedLeaf.changeScale(range);
rootN.addChild(restrictedLeaf);
q.getTree().setRoot(rootN);
q.getTree().initValues(q.getAlternativesDefinition().getAlternatives(),
q.getSampleRecordsDefinition().getRecords().size());
int j = 3;
int alternativeIndex = 0;
for (Alternative alt : q.getAlternativesDefinition().getAlternatives()) {
double[] singleLeafValues = { 3.2, 5.2 };
int[][] leafWithUnitValues = { { 1024, 2048 }, { 2048, 2048 } };
int[][] ordinalValues = { { 0, 1 }, { 2, 1 } };
double[][] numericValues = { { 6500.32, 7312, 28 },
{ 8212.65, 7921.235 } };
int[][] restrictedValues = { { 8, 5 }, { 3, 7 } };
((PositiveFloatValue) singleLeaf.getValueMap().get(alt.getName())
.getValue(0)).setValue(singleLeafValues[alternativeIndex]);
List<String> ordinalOptions = ((OrdinalScale) ordinalLeaf
.getScale()).getList();
for (int i = 0; i < q.getSampleRecordsDefinition().getRecords()
.size(); i++) {
((PositiveIntegerValue) leafWithUnit.getValueMap().get(
alt.getName()).getValue(i))
.setValue(leafWithUnitValues[alternativeIndex][i]);
((OrdinalValue) ordinalLeaf.getValueMap().get(alt.getName())
.getValue(i)).setValue(ordinalOptions
.get(ordinalValues[alternativeIndex][i]));
((PositiveFloatValue) numericLeaf.getValueMap().get(
alt.getName()).getValue(i))
.setValue(numericValues[alternativeIndex][i]);
((IntRangeValue) restrictedLeaf.getValueMap()
.get(alt.getName()).getValue(i))
.setValue(restrictedValues[alternativeIndex][i]);
}
/*
NumericTransformer nt = (NumericTransformer) singleLeaf