com.threerings.crowd.data
Class OccupantInfo

java.lang.Object
  extended by com.threerings.io.SimpleStreamableObject
      extended by com.threerings.crowd.data.OccupantInfo
All Implemented Interfaces:
Streamable, DSet.Entry, Cloneable

public class OccupantInfo
extends SimpleStreamableObject
implements DSet.Entry, Cloneable

The occupant info object contains all of the information about an occupant of a place that should be shared with other occupants of the place. These objects are stored in the place object itself and are updated when bodies enter and exit a place.

A system that builds upon the Crowd framework can extend this class to include extra information about their occupants. They will need to provide a derived BodyObject that creates and configures their occupant info in BodyObject.createOccupantInfo(com.threerings.crowd.data.PlaceObject).

Note also that this class implements Cloneable which means that if derived classes add non-primitive attributes, they are responsible for adding the code to clone those attributes when a clone is requested.


Nested Class Summary
static class OccupantInfo.NameUpdater
          An update to dispatch when an occupant's name changes.
static interface OccupantInfo.Updater<T extends OccupantInfo>
          Used by PlaceManager.updateOccupantInfo.
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
static byte ACTIVE
          Constant value for status.
 Integer bodyOid
          The body object id of this occupant (and our entry key).
static byte DISCONNECTED
          Constant value for status.
static byte IDLE
          Constant value for status.
 byte status
          The status of this occupant.
 Name username
          The username of this occupant.
static String[] X_STATUS
          Maps status codes to human readable strings.
 
Constructor Summary
OccupantInfo()
          Used for unserialization.
OccupantInfo(BodyObject body)
          Creates an occupant info with information from the specified occupant's body object.
 
Method Summary
 OccupantInfo clone()
           
 int getBodyOid()
          Access to the body object id as an int.
 Comparable<?> getKey()
          Each entry provide an associated key which is used to determine its uniqueness in the set.
 
Methods inherited from class com.threerings.io.SimpleStreamableObject
toString, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTIVE

public static final byte ACTIVE
Constant value for status.

See Also:
Constant Field Values

IDLE

public static final byte IDLE
Constant value for status.

See Also:
Constant Field Values

DISCONNECTED

public static final byte DISCONNECTED
Constant value for status.

See Also:
Constant Field Values

X_STATUS

public static final String[] X_STATUS
Maps status codes to human readable strings.


bodyOid

public Integer bodyOid
The body object id of this occupant (and our entry key).


username

public Name username
The username of this occupant.


status

public byte status
The status of this occupant.

Constructor Detail

OccupantInfo

public OccupantInfo(BodyObject body)
Creates an occupant info with information from the specified occupant's body object.


OccupantInfo

public OccupantInfo()
Used for unserialization.

Method Detail

getBodyOid

public int getBodyOid()
Access to the body object id as an int.


getKey

public Comparable<?> getKey()
Description copied from interface: DSet.Entry
Each entry provide an associated key which is used to determine its uniqueness in the set. See the DSet class documentation for further information.

Specified by:
getKey in interface DSet.Entry

clone

public OccupantInfo clone()
Overrides:
clone in class Object