Regenerated our DObject derivations in the new world order.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3288 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-12-28 03:51:29 +00:00
parent d27b150365
commit 55a0ab91f7
23 changed files with 273 additions and 1096 deletions
@@ -1,80 +0,0 @@
//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.crowd.data;
import com.threerings.util.Name;
import com.threerings.presents.data.ClientObject;
import com.threerings.crowd.chat.data.SpeakObject;
/**
* The basic user object class for Crowd users. Bodies have a username, a
* location and a status.
*/
public class BodyObject extends ClientObject
implements SpeakObject
{
/**
* The username associated with this body object.
*/
public Name username;
/**
* The oid of the place currently occupied by this body or -1 if they
* currently occupy no place.
*/
public int location = -1;
/**
* The user's current status ({@link OccupantInfo#ACTIVE}, etc.).
*/
public byte status;
/**
* The time at which the {@link #status} field was last updated. This
* is only available on the server.
*/
public transient long statusTime;
/**
* If non-null, this contains a message to be auto-replied whenever
* another user delivers a tell message to this user.
*/
public String awayMessage;
// documentation inherited
public void applyToListeners (ListenerOp op)
{
op.apply(getOid());
}
// documentation inherited
public String who ()
{
StringBuffer buf = new StringBuffer(username.toString());
buf.append(" (").append(getOid());
if (status != OccupantInfo.ACTIVE) {
buf.append(" ").append(OccupantInfo.X_STATUS[status]);
}
return buf.append(")").toString();
}
}
@@ -33,6 +33,7 @@ import com.threerings.crowd.chat.data.SpeakObject;
public class BodyObject extends ClientObject
implements SpeakObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>username</code> field. */
public static final String USERNAME = "username";
@@ -44,6 +45,7 @@ public class BodyObject extends ClientObject
/** The field name of the <code>awayMessage</code> field. */
public static final String AWAY_MESSAGE = "awayMessage";
// AUTO-GENERATED: FIELDS END
/**
* The username associated with this body object.
@@ -90,59 +92,69 @@ public class BodyObject extends ClientObject
return buf.append(")").toString();
}
// AUTO-GENERATED: METHODS START
/**
* Requests that the <code>username</code> 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
* Requests that the <code>username</code> 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 setUsername (Name username)
public void setUsername (Name value)
{
requestAttributeChange(USERNAME, username);
this.username = username;
Name ovalue = this.username;
requestAttributeChange(
USERNAME, value, ovalue);
this.username = value;
}
/**
* Requests that the <code>location</code> 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
* Requests that the <code>location</code> 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 setLocation (int location)
public void setLocation (int value)
{
requestAttributeChange(LOCATION, new Integer(location));
this.location = location;
int ovalue = this.location;
requestAttributeChange(
LOCATION, new Integer(value), new Integer(ovalue));
this.location = value;
}
/**
* Requests that the <code>status</code> 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
* Requests that the <code>status</code> 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 setStatus (byte status)
public void setStatus (byte value)
{
requestAttributeChange(STATUS, new Byte(status));
this.status = status;
byte ovalue = this.status;
requestAttributeChange(
STATUS, new Byte(value), new Byte(ovalue));
this.status = value;
}
/**
* Requests that the <code>awayMessage</code> 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
* Requests that the <code>awayMessage</code> 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 setAwayMessage (String awayMessage)
public void setAwayMessage (String value)
{
requestAttributeChange(AWAY_MESSAGE, awayMessage);
this.awayMessage = awayMessage;
String ovalue = this.awayMessage;
requestAttributeChange(
AWAY_MESSAGE, value, ovalue);
this.awayMessage = value;
}
// AUTO-GENERATED: METHODS END
}
@@ -1,106 +0,0 @@
//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.crowd.data;
import java.util.Iterator;
import com.threerings.util.Name;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.DSet;
import com.threerings.presents.dobj.OidList;
import com.threerings.crowd.Log;
import com.threerings.crowd.chat.data.SpeakMarshaller;
import com.threerings.crowd.chat.data.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.
*/
public class PlaceObject extends DObject
implements SpeakObject
{
/**
* 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. <em>Note:</em> Don't obtain
* occupant info records directly from this set when on the server,
* use <code>PlaceManager.getOccupantInfo()</code> instead (along with
* <code>PlaceManager.updateOccupantInfo()</code>) 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.
*/
public DSet occupantInfo = new DSet();
/** Used to generate speak requests on this place object. */
public SpeakMarshaller speakService;
/**
* Used to indicate whether broadcast chat messages should be dispatched
* on this place object.
*/
public boolean shouldBroadcast ()
{
return true;
}
/**
* Looks up a user's occupant info by name.
*
* @return the occupant info record for the named user or null if no
* user in the room has that username.
*/
public OccupantInfo getOccupantInfo (Name username)
{
try {
Iterator iter = occupantInfo.entries();
while (iter.hasNext()) {
OccupantInfo info = (OccupantInfo)iter.next();
if (info.username.equals(username)) {
return info;
}
}
} catch (Throwable t) {
Log.warning("PlaceObject.getOccupantInfo choked.");
Log.logStackTrace(t);
}
return null;
}
// documentation inherited
public void applyToListeners (ListenerOp op)
{
for (int ii = 0, ll = occupants.size(); ii < ll; ii++) {
op.apply(occupants.get(ii));
}
}
}
@@ -42,6 +42,7 @@ import com.threerings.crowd.chat.data.SpeakObject;
public class PlaceObject extends DObject
implements SpeakObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>occupants</code> field. */
public static final String OCCUPANTS = "occupants";
@@ -50,6 +51,7 @@ public class PlaceObject extends DObject
/** The field name of the <code>speakService</code> field. */
public static final String SPEAK_SERVICE = "speakService";
// AUTO-GENERATED: FIELDS END
/**
* Tracks the oid of the body objects of all of the occupants of this
@@ -113,10 +115,11 @@ public class PlaceObject extends DObject
}
}
// AUTO-GENERATED: METHODS START
/**
* Requests that the specified oid be added to the
* <code>occupants</code> oid list. The list will not change until the
* event is actually propagated through the system.
* Requests that <code>oid</code> be added to the <code>occupants</code>
* oid list. The list will not change until the event is actually
* propagated through the system.
*/
public void addToOccupants (int oid)
{
@@ -124,7 +127,7 @@ public class PlaceObject extends DObject
}
/**
* Requests that the specified oid be removed from the
* Requests that <code>oid</code> be removed from the
* <code>occupants</code> oid list. The list will not change until the
* event is actually propagated through the system.
*/
@@ -140,7 +143,7 @@ public class PlaceObject extends DObject
*/
public void addToOccupantInfo (DSet.Entry elem)
{
requestEntryAdd(OCCUPANT_INFO, elem);
requestEntryAdd(OCCUPANT_INFO, occupantInfo, elem);
}
/**
@@ -150,7 +153,7 @@ public class PlaceObject extends DObject
*/
public void removeFromOccupantInfo (Comparable key)
{
requestEntryRemove(OCCUPANT_INFO, key);
requestEntryRemove(OCCUPANT_INFO, occupantInfo, key);
}
/**
@@ -160,7 +163,7 @@ public class PlaceObject extends DObject
*/
public void updateOccupantInfo (DSet.Entry elem)
{
requestEntryUpdate(OCCUPANT_INFO, elem);
requestEntryUpdate(OCCUPANT_INFO, occupantInfo, elem);
}
/**
@@ -175,21 +178,24 @@ public class PlaceObject extends DObject
*/
public void setOccupantInfo (DSet occupantInfo)
{
requestAttributeChange(OCCUPANT_INFO, occupantInfo);
requestAttributeChange(OCCUPANT_INFO, occupantInfo, this.occupantInfo);
this.occupantInfo = occupantInfo;
}
/**
* Requests that the <code>speakService</code> 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
* Requests that the <code>speakService</code> 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)
public void setSpeakService (SpeakMarshaller value)
{
requestAttributeChange(SPEAK_SERVICE, speakService);
this.speakService = speakService;
SpeakMarshaller ovalue = this.speakService;
requestAttributeChange(
SPEAK_SERVICE, value, ovalue);
this.speakService = value;
}
// AUTO-GENERATED: METHODS END
}