// // $Id: PlaceObject.java,v 1.7 2002/08/14 19:07:49 mdb Exp $ package com.threerings.crowd.data; import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.DSet; import com.threerings.presents.dobj.OidList; import com.threerings.crowd.chat.SpeakMarshaller; public class PlaceObject extends DObject { /** The field name of the occupants field. */ public static final String OCCUPANTS = "occupants"; /** The field name of the occupantInfo field. */ public static final String OCCUPANT_INFO = "occupantInfo"; /** The field name of the speakService field. */ public static final String SPEAK_SERVICE = "speakService"; /** * Tracks the oid of the body objects of all of the occupants of this * place. */ public OidList occupants = new OidList(); /** * Contains an info record (of type {@link OccupantInfo}) for each * occupant that contains information about that occupant that needs * to be known by everyone in the place. */ public DSet occupantInfo = new DSet(); /** Used to generate speak requests on this place object. */ public SpeakMarshaller speakService; /** * Requests that the specified oid be added to the * occupants oid list. The list will not change until the * event is actually propagated through the system. */ public void addToOccupants (int oid) { requestOidAdd(OCCUPANTS, oid); } /** * Requests that the specified oid be removed from the * occupants oid list. The list will not change until the * event is actually propagated through the system. */ public void removeFromOccupants (int oid) { requestOidRemove(OCCUPANTS, oid); } /** * 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. */ public void addToOccupantInfo (DSet.Entry elem) { requestEntryAdd(OCCUPANT_INFO, elem); } /** * 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. */ public void removeFromOccupantInfo (Object key) { requestEntryRemove(OCCUPANT_INFO, key); } /** * 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. */ public void updateOccupantInfo (DSet.Entry elem) { requestEntryUpdate(OCCUPANT_INFO, elem); } /** * 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. */ public void setOccupantInfo (DSet occupantInfo) { this.occupantInfo = occupantInfo; requestAttributeChange(OCCUPANT_INFO, occupantInfo); } /** * 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. */ public void setSpeakService (SpeakMarshaller speakService) { this.speakService = speakService; requestAttributeChange(SPEAK_SERVICE, speakService); } }