|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.presents.dobj.DSet<Stat>
com.threerings.stats.data.StatSet
public class StatSet
A distributed set containing Stat objects.
| Nested Class Summary | |
|---|---|
static interface |
StatSet.Container
An interface to be implemented by an entity that wishes to be notified when the contents of a stat set change. |
| Nested classes/interfaces inherited from class com.threerings.presents.dobj.DSet |
|---|
DSet.Entry |
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
Streamable.Closure |
| Field Summary | |
|---|---|
protected StatSet.Container |
_container
|
| Fields inherited from class com.threerings.presents.dobj.DSet |
|---|
_entries, _modCount, _size, ENTRY_COMP, INITIAL_CAPACITY |
| Constructor Summary | |
|---|---|
StatSet()
Creates a blank stat set. |
|
StatSet(Iterable<Stat> contents)
Creates a stat set with the specified contents. |
|
StatSet(Iterator<Stat> contents)
Creates a stat set with the specified contents. |
|
| Method Summary | ||
|---|---|---|
void |
addQuietly(Stat stat)
Don't call this method, it's only needed by some tricky business we do when preventing distributed object event generation for all but the bounty criteria related stats. |
|
protected void |
addStat(Stat stat,
boolean syncingWithRepo)
Adds the specified Stat to the set. |
|
|
addToSetStat(Stat.Type type,
T value)
Adds a value to a SetStat. |
|
void |
appendStat(Stat.Type type,
int value)
Appends an integer value to an IntArrayStat. |
|
|
containsValue(Stat.Type type,
T value)
Returns true if the specified SetStat contains the specified value, false
otherwise. |
|
int[] |
getIntArrayStat(Stat.Type type)
Returns the current value of the specified integer array statistic. |
|
int |
getIntStat(Stat.Type type)
Returns the current value of the specified integer statistic. |
|
int |
getMapValue(Stat.Type type,
String value)
Returns the value to which the specified string is mapped in a StringMapStat or zero
if the value has not been mapped. |
|
int |
getMaxIntStat(Stat.Type type)
Returns the maximum value by which the specified integer statistic has ever been incremented. |
|
int |
getSetStatSize(Stat.Type type)
Returns the current size of the specified SetStat statistic. |
|
protected Stat |
getStat(Stat.Type type)
Returns the Stat of the given type, if it exists in the set, and null otherwise. |
|
void |
incrementMapStat(Stat.Type type,
String value,
int amount)
Increments a string value in a StringMapStat. |
|
void |
incrementStat(Stat.Type type,
int delta)
Increments an integer statistic in this set. |
|
void |
maxStat(Stat.Type type,
int value)
Sets an integer stat to the specified value, if it exceeds our existing recorded value. |
|
void |
setContainer(StatSet.Container container)
Wires this stat set up to a containing user object. |
|
void |
setStat(Stat.Type type,
int value)
Sets an integer statistic in this set. |
|
|
syncStat(StatModifier<T> modifier)
Updates a stat in this set, using the supplied StatModifier. |
|
protected void |
updateStat(Stat stat,
boolean syncingWithRepo)
Updates the specified Stat in the set. |
|
| Methods inherited from class com.threerings.presents.dobj.DSet |
|---|
add, asSet, clone, compare, contains, containsKey, entries, get, getWarningSize, isEmpty, iterator, newDSet, newDSet, readField__entries, readField__size, readObject, remove, removeKey, size, toArray, toArray, toString, typedClone, update, writeField__entries, writeField__size, writeObject |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected transient StatSet.Container _container
| Constructor Detail |
|---|
public StatSet(Iterable<Stat> contents)
public StatSet(Iterator<Stat> contents)
public StatSet()
| Method Detail |
|---|
public void setContainer(StatSet.Container container)
public <T extends Stat> void syncStat(StatModifier<T> modifier)
public void setStat(Stat.Type type,
int value)
ClassCastException - thrown if the registered type of the specified stat is not an
IntStat.
public void maxStat(Stat.Type type,
int value)
ClassCastException - thrown if the registered type of the specified stat is not an
IntStat.
public void incrementStat(Stat.Type type,
int delta)
ClassCastException - thrown if the registered type of the specified stat is not an
IntStat.
public void appendStat(Stat.Type type,
int value)
IntArrayStat.
ClassCastException - thrown if the registered type of the specified stat is not an
IntArrayStat.
public <T> void addToSetStat(Stat.Type type,
T value)
SetStat.
ClassCastException - thrown if the registered type of the specified stat is not
an SetStat parameterized on the given type.
public void incrementMapStat(Stat.Type type,
String value,
int amount)
StringMapStat.
ClassCastException - thrown if the registered type of the specified stat is not an
StringMapStat.public int getIntStat(Stat.Type type)
ClassCastException - thrown if the registered type of the specified stat is not an
IntStat.public int getMaxIntStat(Stat.Type type)
ClassCastException - thrown if the registered type of the specified stat is not an
MaxIntStat.public int[] getIntArrayStat(Stat.Type type)
ClassCastException - thrown if the registered type of the specified stat is not an
IntArrayStat.public int getSetStatSize(Stat.Type type)
ClassCastException - thrown if the registered type of the specified stat is not an
SetStat.
public <T> boolean containsValue(Stat.Type type,
T value)
SetStat contains the specified value, false
otherwise.
public int getMapValue(Stat.Type type,
String value)
StringMapStat or zero
if the value has not been mapped.
public void addQuietly(Stat stat)
protected void addStat(Stat stat,
boolean syncingWithRepo)
syncingWithRepo - should be set to true only when called from syncStat(com.threerings.stats.data.StatModifier) ,
which itself is called only when a stat modification has been made to the database,
and the in-memory StatSet needs to be updated as a result.
protected void updateStat(Stat stat,
boolean syncingWithRepo)
syncingWithRepo - should be set to true only when called from syncStat(com.threerings.stats.data.StatModifier) ,
which itself is called only when a stat modification has been made to the database,
and the in-memory StatSet needs to be updated as a result.protected Stat getStat(Stat.Type type)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||