StatSet.addToSetStat, for IntSetStats
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@671 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -127,6 +127,24 @@ public final class StatSet extends DSet<Stat>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an int value to a {@link IntSetStat}.
|
||||
*
|
||||
* @exception ClassCastException thrown if the registered type of the specified stat is not an
|
||||
* {@link IntSetStat}.
|
||||
*/
|
||||
public void addToSetStat (Stat.Type type, int value)
|
||||
{
|
||||
IntSetStat stat = (IntSetStat)get(type.name());
|
||||
if (stat == null) {
|
||||
stat = (IntSetStat)type.newStat();
|
||||
stat.add(value);
|
||||
addStat(stat);
|
||||
} else if (stat.add(value)) {
|
||||
updateStat(stat);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments a string value in a {@link StringMapStat}.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user