valueMap.clear();
return;
}
// Get the Values for each Alternative
for (Alternative a : list) {
Values values = valueMap.get(a.getName());
if (values == null) {
log.debug("values is null for alternative " + a.getName() + " in Leaf " + name);
continue;
}
// Check value of each sample object for conformance with Scale -
// if we find a changed scale, we reset everything.
// It might be faster not to check ALL values, but this is safer.
for (Value value : values.getList()) {
// If the scale has changed, we reset all evaluation values of
// this Alternative:
// this may look strange, but it is OK that the scale of a value
// is null.
// If there have been values before, you change the scale and
// then save - the linkage is lost
// if (value.getScale() == null) {
// LogFactory.getLog(Leaf.class).error("WHAT THE...?? no scale for value"+getName());
// } else {
if ((value.getScale() == null) || (!value.getScale().getClass().equals(scale.getClass()))) {
if (!a.isDiscarded()) { // for discarded alternatives,
// that's ok.
log.debug("Leaf " + this.getName() + " Class: " + value.getClass() + " not like "
+ scale.getClass() + ". RESETTING the valuemap now!");
valueMap.clear(); // reset all values
return;
}
}
// }
// PLEASE NOTE- WRT ORDINAL RESTRICTIONS:
// we do NOT reset values when the restriction has changed, such
// as
// the ordinal values or the boundaries.
// Instead, those values that are still valid remain, the others
// will be checked
// and need to be corrected anyway in the evaluate step.
// Should be nicer for the user. If we find out this leads to
// validation problems
// (which shouldnt be the case because the data types are valid
// as long as the scale
// doesnt change) then we will reset the values even if just the
// restriction changes.
}
/*
* maybe this leaf was set to single, reset all values
*/
if (isSingle() && values.size() > 1) {
valueMap.clear();
return;
}
}
}