}
private void modifyDataValue(String dataName, int increment,
boolean ignoreExistingValue) {
String prefix = dataPrefix + getDataNamespace();
dataName = DataRepository.createDataName(prefix, dataName);
DoubleData val;
try {
val = (DoubleData)data.getValue(dataName);
} catch (ClassCastException cce) {
return; // Do nothing - don't overwrite values of other types
}
if (val instanceof NumberFunction) {
return; // Do nothing - don't overwrite old-style calculations
} else if (ignoreExistingValue && increment == 0) {
if (val != null && val.getDouble() != 0)
data.restoreDefaultValue(dataName);
return;
} else if (val == null || ignoreExistingValue) {
val = new DoubleData(increment);
} else {
val = new DoubleData(val.getInteger() + increment);
}
val.setEditable(false);
data.putValue(dataName, val);
}