if (scale == null)
return;
for (Alternative a : list) {
// for every Alternative we get the container of the values of each sample object
// from the map
Values v = valueMap.get(a.getName());
// If it doesnt exist, we create it and link it in the map
if (v == null) {
v = new Values();
valueMap.put(a.getName(), v);
// it the valueMap has just been created and the leaf is single,
// we need to add one value.
if (isSingle()) {
v.add(scale.createValue());
}
}
// 20090217, hotfix CB: if a Leaf is set to SINGLE *after* initValues has been called,
// the Value object at position 0 of the ValueS object might not be properly initialised.
// Check and initialise if needed:
if (isSingle()) {
if (v.size() == 0) {
PlatoLogger.getLogger(this.getClass()).warn("adding value to a SINGLE LEAF WITH A VALUES OBJECT WITHOUT A PROPER VALUE:" + getName());
v.getList().add(scale.createValue());
} else {
if (v.getValue(0) == null) {
PlatoLogger.getLogger(this.getClass()).warn("adding value to a SINGLE LEAF WITH A VALUES OBJECT WITHOUT A PROPER VALUE:" + getName());
v.setValue(0,scale.createValue());
}
}
}
// end hotfix 20090217
// So we can be sure now that we have a value container and
// that it is linked and that for Action criteria, i.e. single
// values, we have the one value.
// For Object criteria we have to be sure that the number of values
// corresponds to the number of sample objects, so we fill the list up
if (!isSingle()) {
// this is to add MISSING values for records.
// it doesnt make a difference for this condition
// whether we just created a new valuemap or are
// refilling an existing one
// Note that the index here starts at the size of the values array
// and runs to the total number of records.
// so if we have enough - nothing happens; if some are missing, they are
// added at the end
for (int i = v.size(); i < records; i++) {
v.add(scale.createValue());
}
}
}
if (addLinkage) {
initScaleValueLinkage(list, records);