Changed DSet.Element to DSet.Entry in preparation for the addition of

array element update support. (Arrays have elements, sets have entries.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1133 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-03-18 23:21:26 +00:00
parent 76cff072be
commit 7ccb9594b9
18 changed files with 323 additions and 327 deletions
@@ -1,5 +1,5 @@
//
// $Id: OccupantManager.java,v 1.10 2001/12/20 02:48:21 mdb Exp $
// $Id: OccupantManager.java,v 1.11 2002/03/18 23:21:25 mdb Exp $
package com.threerings.crowd.client;
@@ -89,7 +89,7 @@ public class OccupantManager
return null;
}
Iterator iter = _place.occupantInfo.elements();
Iterator iter = _place.occupantInfo.entries();
while (iter.hasNext()) {
OccupantInfo info = (OccupantInfo)iter.next();
if (info.username.equals(username)) {
@@ -121,7 +121,7 @@ public class OccupantManager
_place.addListener(this);
// cache the occupant info for the occupants in this room
Iterator iter = _place.occupantInfo.elements();
Iterator iter = _place.occupantInfo.entries();
while (iter.hasNext()) {
OccupantInfo info = (OccupantInfo)iter.next();
_ocache.put(info.getBodyOid(), info);
@@ -137,7 +137,7 @@ public class OccupantManager
/**
* Deals with all of the processing when an occupant shows up.
*/
public void elementAdded (ElementAddedEvent event)
public void entryAdded (EntryAddedEvent event)
{
// bail if this isn't for the OCCUPANT_INFO field
if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
@@ -145,7 +145,7 @@ public class OccupantManager
}
// put the info in our cache for use when we get a left event
OccupantInfo info = (OccupantInfo)event.getElement();
OccupantInfo info = (OccupantInfo)event.getEntry();
int bodyOid = info.getBodyOid();
_ocache.put(bodyOid, info);
@@ -159,7 +159,7 @@ public class OccupantManager
/**
* Deals with all of the processing when an occupant is updated.
*/
public void elementUpdated (ElementUpdatedEvent event)
public void entryUpdated (EntryUpdatedEvent event)
{
// bail if this isn't for the OCCUPANT_INFO field
if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
@@ -167,7 +167,7 @@ public class OccupantManager
}
// update our cache
OccupantInfo info = (OccupantInfo)event.getElement();
OccupantInfo info = (OccupantInfo)event.getEntry();
int bodyOid = info.getBodyOid();
_ocache.put(bodyOid, info);
@@ -181,7 +181,7 @@ public class OccupantManager
/**
* Deals with all of the processing when an occupant leaves.
*/
public void elementRemoved (ElementRemovedEvent event)
public void entryRemoved (EntryRemovedEvent event)
{
// bail if this isn't for the OCCUPANT_INFO field
if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
@@ -1,5 +1,5 @@
//
// $Id: OccupantInfo.java,v 1.5 2001/12/15 04:20:00 mdb Exp $
// $Id: OccupantInfo.java,v 1.6 2002/03/18 23:21:26 mdb Exp $
package com.threerings.crowd.data;
@@ -28,9 +28,9 @@ import com.threerings.presents.dobj.DSet;
* is requested.
*/
public class OccupantInfo
implements DSet.Element, Cloneable
implements DSet.Entry, Cloneable
{
/** The body object id of this occupant (and our element key). */
/** The body object id of this occupant (and our entry key). */
public Integer bodyOid;
/** The username of this occupant. */
@@ -1,5 +1,5 @@
//
// $Id: PlaceObject.java,v 1.4 2002/03/08 01:06:12 mdb Exp $
// $Id: PlaceObject.java,v 1.5 2002/03/18 23:21:26 mdb Exp $
package com.threerings.crowd.data;
@@ -47,39 +47,39 @@ public class PlaceObject extends DObject
}
/**
* Requests that the specified element be added to the
* Requests that the specified entry be added to the
* <code>occupantInfo</code> set. The set will not change until the event is
* actually propagated through the system.
*/
public void addToOccupantInfo (DSet.Element elem)
public void addToOccupantInfo (DSet.Entry elem)
{
requestElementAdd(OCCUPANT_INFO, elem);
requestEntryAdd(OCCUPANT_INFO, elem);
}
/**
* Requests that the element matching the supplied key be removed from
* Requests that the entry matching the supplied key be removed from
* the <code>occupantInfo</code> set. The set will not change until the
* event is actually propagated through the system.
*/
public void removeFromOccupantInfo (Object key)
{
requestElementRemove(OCCUPANT_INFO, key);
requestEntryRemove(OCCUPANT_INFO, key);
}
/**
* Requests that the specified element be updated in the
* Requests that the specified entry be updated in the
* <code>occupantInfo</code> set. The set will not change until the event is
* actually propagated through the system.
*/
public void updateOccupantInfo (DSet.Element elem)
public void updateOccupantInfo (DSet.Entry elem)
{
requestElementUpdate(OCCUPANT_INFO, elem);
requestEntryUpdate(OCCUPANT_INFO, elem);
}
/**
* Requests that the <code>occupantInfo</code> field be set to the
* specified value. Generally one only adds, updates and removes
* elements of a distributed set, but certain situations call for a
* 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
@@ -1,5 +1,5 @@
//
// $Id: PlaceManager.java,v 1.27 2002/02/14 18:08:53 mdb Exp $
// $Id: PlaceManager.java,v 1.28 2002/03/18 23:21:26 mdb Exp $
package com.threerings.crowd.server;
@@ -136,7 +136,7 @@ public class PlaceManager
_plobj = plobj;
// configure the occupant info set
plobj.occupantInfo.setElementType(getOccupantInfoClass());
plobj.occupantInfo.setEntryType(getOccupantInfoClass());
// we'll need to hear about place object events
plobj.addListener(this);