com.threerings.crowd.data
Class PlaceObject

java.lang.Object
  extended by com.threerings.presents.dobj.DObject
      extended by com.threerings.crowd.data.PlaceObject
All Implemented Interfaces:
SpeakObject, Streamable

public class PlaceObject
extends DObject
implements SpeakObject

A distributed object that contains information on a place that is occupied by bodies. This place might be a chat room, a game room, an island in a massively multiplayer piratical universe, anything that has occupants that might want to chat with one another.


Nested Class Summary
 class PlaceObject.ManagerCaller
          Exists to make calls into the manager look sensible: _plobj.manager.invoke("someMethod", args); and to route events through the right distributed object manager if we are running in standalone/single-player mode where both client and server are running in the same VM.
 
Nested classes/interfaces inherited from interface com.threerings.crowd.chat.data.SpeakObject
SpeakObject.ListenerOp
 
Field Summary
 PlaceObject.ManagerCaller manager
          Allows the client to call methods on the manager.
static String OCCUPANT_INFO
          The field name of the occupantInfo field.
 DSet<OccupantInfo> occupantInfo
          Contains an info record (of type OccupantInfo) for each occupant that contains information about that occupant that needs to be known by everyone in the place.
 OidList occupants
          Tracks the oid of the body objects of all of the occupants of this place.
static String OCCUPANTS
          The field name of the occupants field.
static String SPEAK_SERVICE
          The field name of the speakService field.
 SpeakMarshaller speakService
          Used to generate speak requests on this place object.
 
Fields inherited from class com.threerings.presents.dobj.DObject
_controller, _deathWish, _fields, _ftable, _listeners, _locattrs, _locks, _oid, _omgr, _scount, _subs, _tcancelled, _tcount, _tevent, FIELD_COMP, NO_ATTRS
 
Constructor Summary
PlaceObject()
           
 
Method Summary
 void addToOccupantInfo(OccupantInfo elem)
          Requests that the specified entry be added to the occupantInfo set.
 void addToOccupants(int oid)
          Requests that oid be added to the occupants oid list.
 void applyToListeners(SpeakObject.ListenerOp op)
          The speak service will call this every time a chat message is delivered on this speak object to note the listeners that received the message.
 OccupantInfo getOccupantInfo(Name username)
          Looks up a user's occupant info by name.
 void initManagerCaller(DObjectManager omgr)
          Called on the client when the location director receives this place object to configure our manager caller using the client's distributed object manager.
 void removeFromOccupantInfo(Comparable<?> key)
          Requests that the entry matching the supplied key be removed from the occupantInfo set.
 void removeFromOccupants(int oid)
          Requests that oid be removed from the occupants oid list.
 void setOccupantInfo(DSet<OccupantInfo> value)
          Requests that the occupantInfo field be set to the specified value.
 void setSpeakService(SpeakMarshaller value)
          Requests that the speakService field be set to the specified value.
 boolean shouldBroadcast()
          Used to indicate whether broadcast chat messages should be dispatched on this place object.
 void updateOccupantInfo(OccupantInfo elem)
          Requests that the specified entry be updated in the occupantInfo set.
 
Methods inherited from class com.threerings.presents.dobj.DObject
acquireLock, addListener, addSubscriber, addToSet, cancelTransaction, changeAttribute, checkPermissions, checkPermissions, clearLock, clearTransaction, commitTransaction, destroy, getAccessController, getAttribute, getField, getLocal, getLocals, getManager, getOid, getSet, inTransaction, isActive, notifyListeners, notifyProxies, postEvent, postMessage, postMessage, releaseLock, removeFromSet, removeListener, removeSubscriber, requestAttributeChange, requestAttributeChange, requestElementUpdate, requestElementUpdate, requestEntryAdd, requestEntryRemove, requestEntryUpdate, requestEntryUpdate, requestOidAdd, requestOidRemove, setAccessController, setAttribute, setDestroyOnLastSubscriberRemoved, setLocal, setManager, setOid, startTransaction, toString, toString, updateSet, which, which
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OCCUPANTS

public static final String OCCUPANTS
The field name of the occupants field.

See Also:
Constant Field Values

OCCUPANT_INFO

public static final String OCCUPANT_INFO
The field name of the occupantInfo field.

See Also:
Constant Field Values

SPEAK_SERVICE

public static final String SPEAK_SERVICE
The field name of the speakService field.

See Also:
Constant Field Values

manager

public transient PlaceObject.ManagerCaller manager
Allows the client to call methods on the manager.


occupants

public OidList occupants
Tracks the oid of the body objects of all of the occupants of this place.


occupantInfo

public DSet<OccupantInfo> occupantInfo
Contains an info record (of type OccupantInfo) for each occupant that contains information about that occupant that needs to be known by everyone in the place. Note: Don't obtain occupant info records directly from this set when on the server, use PlaceManager.getOccupantInfo() instead (along with PlaceManager.updateOccupantInfo()) because it does some special processing to ensure that readers and updaters don't step on one another even if they make rapid fire changes to a user's occupant info.


speakService

public SpeakMarshaller speakService
Used to generate speak requests on this place object.

Constructor Detail

PlaceObject

public PlaceObject()
Method Detail

initManagerCaller

public void initManagerCaller(DObjectManager omgr)
Called on the client when the location director receives this place object to configure our manager caller using the client's distributed object manager.


shouldBroadcast

public boolean shouldBroadcast()
Used to indicate whether broadcast chat messages should be dispatched on this place object.


getOccupantInfo

public OccupantInfo getOccupantInfo(Name username)
Looks up a user's occupant info by name.

Returns:
the occupant info record for the named user or null if no user in the room has that username.

applyToListeners

public void applyToListeners(SpeakObject.ListenerOp op)
Description copied from interface: SpeakObject
The speak service will call this every time a chat message is delivered on this speak object to note the listeners that received the message.

Specified by:
applyToListeners in interface SpeakObject

addToOccupants

public void addToOccupants(int oid)
Requests that oid be added to the occupants oid list. The list will not change until the event is actually propagated through the system.


removeFromOccupants

public void removeFromOccupants(int oid)
Requests that oid be removed from the occupants oid list. The list will not change until the event is actually propagated through the system.


addToOccupantInfo

public void addToOccupantInfo(OccupantInfo elem)
Requests that the specified entry be added to the occupantInfo set. The set will not change until the event is actually propagated through the system.


removeFromOccupantInfo

public void removeFromOccupantInfo(Comparable<?> key)
Requests that the entry matching the supplied key be removed from the occupantInfo set. The set will not change until the event is actually propagated through the system.


updateOccupantInfo

public void updateOccupantInfo(OccupantInfo elem)
Requests that the specified entry be updated in the occupantInfo set. The set will not change until the event is actually propagated through the system.


setOccupantInfo

public void setOccupantInfo(DSet<OccupantInfo> value)
Requests that the occupantInfo field be set to the specified value. Generally one only adds, updates and removes entries of a distributed set, but certain situations call for a complete replacement of the set value. The local value will be updated immediately and an event will be propagated through the system to notify all listeners that the attribute did change. Proxied copies of this object (on clients) will apply the value change when they received the attribute changed notification.


setSpeakService

public void setSpeakService(SpeakMarshaller value)
Requests that the speakService field be set to the specified value. The local value will be updated immediately and an event will be propagated through the system to notify all listeners that the attribute did change. Proxied copies of this object (on clients) will apply the value change when they received the attribute changed notification.