com.threerings.stats.data
Class StatModifier<T extends Stat>

java.lang.Object
  extended by com.threerings.stats.data.StatModifier<T>
All Implemented Interfaces:
com.threerings.io.Streamable
Direct Known Subclasses:
IntSetStatAdder, IntStatIncrementer, IntStatMinimumer

public abstract class StatModifier<T extends Stat>
extends Object
implements com.threerings.io.Streamable

Encapsulates a modification to a single stat that can be serialized and sent to a different server, if needed, to update stats loaded at runtime.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
com.threerings.io.Streamable.Closure
 
Constructor Summary
StatModifier(Stat.Type type)
          Creates a modifier that will operate on the supplied stat type.
 
Method Summary
 Stat.Type getType()
          Returns the Stat.Type of the stat being modified.
abstract  void modify(T stat)
          Applies the modification to the stat in question.
 void readObject(com.threerings.io.ObjectInputStream in)
          Reads our custom streamable fields.
 void writeObject(com.threerings.io.ObjectOutputStream out)
          Writes our custom streamable fields.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatModifier

public StatModifier(Stat.Type type)
Creates a modifier that will operate on the supplied stat type. Note that this type may be serialized and shipped between servers.

Method Detail

getType

public Stat.Type getType()
Returns the Stat.Type of the stat being modified.


writeObject

public void writeObject(com.threerings.io.ObjectOutputStream out)
                 throws IOException
Writes our custom streamable fields.

Throws:
IOException

readObject

public void readObject(com.threerings.io.ObjectInputStream in)
                throws IOException,
                       ClassNotFoundException
Reads our custom streamable fields.

Throws:
IOException
ClassNotFoundException

modify

public abstract void modify(T stat)
Applies the modification to the stat in question.



Copyright © 2011. All Rights Reserved.