Use setModified() instead of modifying our value directly. That way it can be
overridden to intercept such things if necessary (it's not necesary in this case, we're just trying to set a good example for future programmers). git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@667 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -35,7 +35,7 @@ public class IntArrayStat extends Stat
|
||||
{
|
||||
if (!Arrays.equals(_value, value)) {
|
||||
_value = value;
|
||||
_modified = true;
|
||||
setModified(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -47,7 +47,7 @@ public class IntArrayStat extends Stat
|
||||
public void appendValue (int value)
|
||||
{
|
||||
_value = ArrayUtil.append(_value, value);
|
||||
_modified = true;
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
@Override // documentation inherited
|
||||
|
||||
@@ -30,7 +30,7 @@ public class IntStat extends Stat
|
||||
{
|
||||
if (value != _value) {
|
||||
_value = value;
|
||||
_modified = true;
|
||||
setModified(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class StringMapStat extends Stat
|
||||
int ovalue = _values[iidx];
|
||||
_values[iidx] = Math.min(value, getMaxValue());
|
||||
if (_values[iidx] != ovalue) {
|
||||
_modified = true;
|
||||
setModified(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -67,7 +67,7 @@ public abstract class StringMapStat extends Stat
|
||||
int ovalue = _values[iidx];
|
||||
_values[iidx] = Math.min(_values[iidx] + amount, getMaxValue());
|
||||
if (_values[iidx] != ovalue) {
|
||||
_modified = true;
|
||||
setModified(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class StringSetStat extends Stat
|
||||
System.arraycopy(_values, iidx, values, iidx+1, (_values.length-iidx));
|
||||
values[iidx] = key;
|
||||
_values = values;
|
||||
_modified = true;
|
||||
setModified(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user