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,45 +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.admin.data;
import java.lang.reflect.Field;
import javax.swing.JPanel;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.util.PresentsContext;
import com.threerings.admin.client.FieldEditor;
/**
* Base class for runtime config distributed objects. Used to allow
* config objects to supply custom object editing UI.
*/
public class ConfigObject extends DObject
{
/**
* Returns the editor panel for the specified field.
*/
public JPanel getEditor (PresentsContext ctx, Field field)
{
return new FieldEditor(ctx, field, this);
}
}
@@ -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
}
@@ -1,33 +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.micasa.lobby;
import com.threerings.crowd.data.PlaceObject;
/**
* Presently the lobby object contains nothing specific, but the class
* acts as a placeholder in case lobby-wide fields are needed in the
* future.
*/
public class LobbyObject extends PlaceObject
{
}
@@ -1,58 +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.micasa.lobby.table;
import com.threerings.presents.dobj.DSet;
import com.threerings.parlor.data.Table;
import com.threerings.micasa.lobby.LobbyObject;
public class TableLobbyObject
extends LobbyObject
implements com.threerings.parlor.data.TableLobbyObject
{
/** A set containing all of the tables being managed by this lobby. */
public DSet tableSet = new DSet();
// documentation inherited
public DSet getTables ()
{
return tableSet;
}
// documentation inherited from interface
public void addToTables (Table table)
{
addToTableSet(table);
}
// documentation inherited from interface
public void updateTables (Table table)
{
updateTableSet(table);
}
// documentation inherited from interface
public void removeFromTables (Comparable key)
{
removeFromTableSet(key);
}
}
@@ -29,8 +29,10 @@ public class TableLobbyObject
extends LobbyObject
implements com.threerings.parlor.data.TableLobbyObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>tableSet</code> field. */
public static final String TABLE_SET = "tableSet";
// AUTO-GENERATED: FIELDS END
/** A set containing all of the tables being managed by this lobby. */
public DSet tableSet = new DSet();
@@ -59,6 +61,7 @@ public class TableLobbyObject
removeFromTableSet(key);
}
// AUTO-GENERATED: METHODS START
/**
* Requests that the specified entry be added to the
* <code>tableSet</code> set. The set will not change until the event is
@@ -66,7 +69,7 @@ public class TableLobbyObject
*/
public void addToTableSet (DSet.Entry elem)
{
requestEntryAdd(TABLE_SET, elem);
requestEntryAdd(TABLE_SET, tableSet, elem);
}
/**
@@ -76,7 +79,7 @@ public class TableLobbyObject
*/
public void removeFromTableSet (Comparable key)
{
requestEntryRemove(TABLE_SET, key);
requestEntryRemove(TABLE_SET, tableSet, key);
}
/**
@@ -86,7 +89,7 @@ public class TableLobbyObject
*/
public void updateTableSet (DSet.Entry elem)
{
requestEntryUpdate(TABLE_SET, elem);
requestEntryUpdate(TABLE_SET, tableSet, elem);
}
/**
@@ -101,7 +104,8 @@ public class TableLobbyObject
*/
public void setTableSet (DSet tableSet)
{
requestAttributeChange(TABLE_SET, tableSet);
requestAttributeChange(TABLE_SET, tableSet, this.tableSet);
this.tableSet = tableSet;
}
// AUTO-GENERATED: METHODS END
}
@@ -1,182 +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.parlor.game;
import com.samskivert.util.ListUtil;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
import com.threerings.crowd.data.PlaceObject;
/**
* A game object hosts the shared data associated with a game played by
* one or more players. The game object extends the place object so that
* the game can act as a place where players actually go when playing the
* game. Only very basic information is maintained in the base game
* object. It serves as the base for a hierarchy of game object
* derivatives that handle basic gameplay for a suite of different game
* types (ie. turn based games, party games, board games, card games,
* etc.).
*/
public class GameObject extends PlaceObject
{
/** A game state constant indicating that the game has not yet started
* and is still awaiting the arrival of all of the players. */
public static final int AWAITING_PLAYERS = 0;
/** A game state constant indicating that the game is in play. */
public static final int IN_PLAY = 1;
/** A game state constant indicating that the game ended normally. */
public static final int GAME_OVER = 2;
/** A game state constant indicating that the game was cancelled. */
public static final int CANCELLED = 3;
/** Provides general game invocation services. */
public GameMarshaller gameService;
/** The game state, one of {@link #AWAITING_PLAYERS}, {@link #IN_PLAY},
* {@link #GAME_OVER}, or {@link #CANCELLED}. */
public int state;
/** Indicates whether or not this game is rated. */
public boolean isRated;
/** The usernames of the players involved in this game. */
public Name[] players;
/** Whether each player in the game is a winner, or <code>null</code>
* if the game is not yet over. */
public boolean[] winners;
/** The unique round identifier for the current round. */
public int roundId;
/** The player index of the creating player if this is a party game. */
public int creator;
/**
* Returns the number of players in the game.
*/
public int getPlayerCount ()
{
int count = 0;
int size = players.length;
for (int ii = 0; ii < size; ii++) {
if (players[ii] != null) {
count++;
}
}
return count;
}
/**
* Returns the player index of the given user in the game, or
* <code>-1</code> if the player is not involved in the game.
*/
public int getPlayerIndex (Name username)
{
int size = (players == null) ? 0 : players.length;
for (int ii = 0; ii < size; ii++) {
if (players[ii] != null && players[ii].equals(username)) {
return ii;
}
}
return -1;
}
/**
* Returns whether the game is in play. A game that is not in play
* could either be awaiting players, ended, or cancelled.
*/
public boolean isInPlay ()
{
return (state == IN_PLAY);
}
/**
* Returns whether the given player index in the game is occupied.
*/
public boolean isOccupiedPlayer (int pidx)
{
return (players[pidx] != null);
}
/**
* Returns whether the given player index is a winner, or false if the
* winners are not yet assigned.
*/
public boolean isWinner (int pidx)
{
return (winners == null) ? false : winners[pidx];
}
/**
* Returns the number of winners for this game, or <code>0</code> if
* the winners array is not populated, e.g., the game is not yet over.
*/
public int getWinnerCount ()
{
int count = 0;
int size = (winners == null) ? 0 : winners.length;
for (int ii = 0; ii < size; ii++) {
if (winners[ii]) {
count++;
}
}
return count;
}
/**
* Returns true if the game is ended in a draw.
*/
public boolean isDraw ()
{
return getWinnerCount() == getPlayerCount();
}
/**
* Returns the winner index of the first winning player for this game,
* or <code>-1</code> if there are no winners or the winners array is
* not yet assigned. This is only likely to be useful for games that
* are known to have a single winner.
*/
public int getWinnerIndex ()
{
int size = (winners == null) ? 0 : winners.length;
for (int ii = 0; ii < size; ii++) {
if (winners[ii]) {
return ii;
}
}
return -1;
}
// documentation inherited
protected void which (StringBuffer buf)
{
super.which(buf);
StringUtil.toString(buf, players);
buf.append(":").append(state);
}
}
@@ -39,6 +39,7 @@ import com.threerings.crowd.data.PlaceObject;
*/
public class GameObject extends PlaceObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>gameService</code> field. */
public static final String GAME_SERVICE = "gameService";
@@ -59,6 +60,7 @@ public class GameObject extends PlaceObject
/** The field name of the <code>creator</code> field. */
public static final String CREATOR = "creator";
// AUTO-GENERATED: FIELDS END
/** A game state constant indicating that the game has not yet started
* and is still awaiting the arrival of all of the players. */
@@ -201,129 +203,151 @@ public class GameObject extends PlaceObject
buf.append(":").append(state);
}
// AUTO-GENERATED: METHODS START
/**
* Requests that the <code>gameService</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>gameService</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 setGameService (GameMarshaller gameService)
public void setGameService (GameMarshaller value)
{
requestAttributeChange(GAME_SERVICE, gameService);
this.gameService = gameService;
GameMarshaller ovalue = this.gameService;
requestAttributeChange(
GAME_SERVICE, value, ovalue);
this.gameService = value;
}
/**
* Requests that the <code>state</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>state</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 setState (int state)
public void setState (int value)
{
requestAttributeChange(STATE, new Integer(state));
this.state = state;
int ovalue = this.state;
requestAttributeChange(
STATE, new Integer(value), new Integer(ovalue));
this.state = value;
}
/**
* Requests that the <code>isRated</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>isRated</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 setIsRated (boolean isRated)
public void setIsRated (boolean value)
{
requestAttributeChange(IS_RATED, new Boolean(isRated));
this.isRated = isRated;
boolean ovalue = this.isRated;
requestAttributeChange(
IS_RATED, new Boolean(value), new Boolean(ovalue));
this.isRated = value;
}
/**
* Requests that the <code>players</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>players</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 setPlayers (Name[] players)
public void setPlayers (Name[] value)
{
requestAttributeChange(PLAYERS, players);
this.players = players;
Name[] ovalue = this.players;
requestAttributeChange(
PLAYERS, value, ovalue);
this.players = value;
}
/**
* Requests that the <code>index</code>th element of
* <code>players</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.
* <code>players</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 setPlayersAt (Name value, int index)
{
requestElementUpdate(PLAYERS, value, index);
Name ovalue = this.players[index];
requestElementUpdate(
PLAYERS, index, value, ovalue);
this.players[index] = value;
}
/**
* Requests that the <code>winners</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>winners</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 setWinners (boolean[] winners)
public void setWinners (boolean[] value)
{
requestAttributeChange(WINNERS, winners);
this.winners = winners;
boolean[] ovalue = this.winners;
requestAttributeChange(
WINNERS, value, ovalue);
this.winners = value;
}
/**
* Requests that the <code>index</code>th element of
* <code>winners</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.
* <code>winners</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 setWinnersAt (boolean value, int index)
{
requestElementUpdate(WINNERS, new Boolean(value), index);
boolean ovalue = this.winners[index];
requestElementUpdate(
WINNERS, index, new Boolean(value), new Boolean(ovalue));
this.winners[index] = value;
}
/**
* Requests that the <code>roundId</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>roundId</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 setRoundId (int roundId)
public void setRoundId (int value)
{
requestAttributeChange(ROUND_ID, new Integer(roundId));
this.roundId = roundId;
int ovalue = this.roundId;
requestAttributeChange(
ROUND_ID, new Integer(value), new Integer(ovalue));
this.roundId = value;
}
/**
* Requests that the <code>creator</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>creator</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 setCreator (int creator)
public void setCreator (int value)
{
requestAttributeChange(CREATOR, new Integer(creator));
this.creator = creator;
int ovalue = this.creator;
requestAttributeChange(
CREATOR, new Integer(value), new Integer(ovalue));
this.creator = value;
}
// AUTO-GENERATED: METHODS END
}
@@ -1,78 +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.presents.data;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.DSet;
/**
* Every client in the system has an associated client object to which
* only they subscribe. The client object can be used to deliver messages
* solely to a particular client as well as to publish client-specific
* data.
*/
public class ClientObject extends DObject
{
/** The name of a message event delivered to the client when they
* switch usernames (and therefore user objects). */
public static final String CLOBJ_CHANGED = "!clobj_changed!";
/** Used to publish all invocation service receivers registered on
* this client. */
public DSet receivers = new DSet();
/**
* Returns a short string identifying this client.
*/
public String who ()
{
return "(" + getOid() + ")";
}
/**
* Used for reference counting client objects, adds a reference to
* this object.
*/
public synchronized void reference ()
{
_references++;
// Log.info("Incremented references [who=" + who() +
// ", refs=" + _references + "].");
}
/**
* Used for reference counting client objects, releases a reference to
* this object.
*
* @return true if the object has remaining references, false
* otherwise.
*/
public synchronized boolean release ()
{
// Log.info("Decremented references [who=" + who() +
// ", refs=" + (_references-1) + "].");
return (--_references > 0);
}
/** Used to reference count resolved client objects. */
protected transient int _references;
}
@@ -32,8 +32,10 @@ import com.threerings.presents.dobj.DSet;
*/
public class ClientObject extends DObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>receivers</code> field. */
public static final String RECEIVERS = "receivers";
// AUTO-GENERATED: FIELDS END
/** The name of a message event delivered to the client when they
* switch usernames (and therefore user objects). */
@@ -79,6 +81,7 @@ public class ClientObject extends DObject
/** Used to reference count resolved client objects. */
protected transient int _references;
// AUTO-GENERATED: METHODS START
/**
* Requests that the specified entry be added to the
* <code>receivers</code> set. The set will not change until the event is
@@ -86,7 +89,7 @@ public class ClientObject extends DObject
*/
public void addToReceivers (DSet.Entry elem)
{
requestEntryAdd(RECEIVERS, elem);
requestEntryAdd(RECEIVERS, receivers, elem);
}
/**
@@ -96,7 +99,7 @@ public class ClientObject extends DObject
*/
public void removeFromReceivers (Comparable key)
{
requestEntryRemove(RECEIVERS, key);
requestEntryRemove(RECEIVERS, receivers, key);
}
/**
@@ -106,7 +109,7 @@ public class ClientObject extends DObject
*/
public void updateReceivers (DSet.Entry elem)
{
requestEntryUpdate(RECEIVERS, elem);
requestEntryUpdate(RECEIVERS, receivers, elem);
}
/**
@@ -121,7 +124,8 @@ public class ClientObject extends DObject
*/
public void setReceivers (DSet receivers)
{
requestAttributeChange(RECEIVERS, receivers);
requestAttributeChange(RECEIVERS, receivers, this.receivers);
this.receivers = receivers;
}
// AUTO-GENERATED: METHODS END
}
@@ -1,5 +1,5 @@
//
// $Id: InvocationObject.java,v 1.5 2004/08/27 02:20:19 mdb Exp $
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -1,122 +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.presents.data;
import com.threerings.presents.dobj.DObject;
/**
* Used to communicate time bases to clients so that more efficient delta
* times can be transmitted over the network. Two time stamps are
* maintained: even and odd. When the even time base is sufficiently old
* that our delta time container (usually a short or an int) will exceed
* its maximum value, we switch to the odd time base. The bouncing between
* two separate values prevents problems from arising when the base time
* is changed, yet values using the old base time might still be
* propagating through the system.
*
* <p> Note that for sufficiently small delta time containers, stale
* values could still linger longer than the time required for two swaps
* (two byte delta stamps for example, must swap every 30 seconds).
*/
public class TimeBaseObject extends DObject
{
/** The even time base, used to decode even delta times. */
public long evenBase;
/** The odd time base, used to decode odd delta times. */
public long oddBase;
/**
* Converts the supplied time stamp into a time delta (measured
* relative to the appropriate time base, even or odd) with maximum
* value of 2^15. (One bit must be used to indicate that it is an even
* or odd time stamp).
*/
public short toShortDelta (long timeStamp)
{
return (short)getDelta(timeStamp, Short.MAX_VALUE);
}
/**
* Converts the supplied time stamp into a time delta (measured
* relative to the appropriate time base, even or odd) with maximum
* value of 2^31. (One bit must be used to indicate that it is an even
* or odd time stamp).
*/
public int toIntDelta (long timeStamp)
{
return (int)getDelta(timeStamp, Integer.MAX_VALUE);
}
/**
* Converts the supplied delta time back to a wall time based on the
* base time in this time base object. Either an int or short delta
* can be passed to this method (the short will have been promoted to
* an int in the process but that will not mess up its encoded value).
*/
public long fromDelta (int delta)
{
boolean even = (delta > 0);
long time = even ? evenBase : oddBase;
if (even) {
time += delta;
} else {
time += (-1 - delta);
}
return time;
}
/**
* Obtains a delta with the specified maximum value, swapping from
* even to odd, if necessary.
*/
protected long getDelta (long timeStamp, long maxValue)
{
boolean even = (evenBase > oddBase);
long base = even ? evenBase : oddBase;
long delta = timeStamp - base;
// make sure this timestamp is not sufficiently old that we can't
// generate a delta time with it
if (delta < 0) {
String errmsg = "Time stamp too old for conversion to delta time";
throw new IllegalArgumentException(errmsg);
}
// see if it's time to swap
if (delta > maxValue) {
if (even) {
setOddBase(timeStamp);
} else {
setEvenBase(timeStamp);
}
delta = 0;
}
// if we're odd, we need to mark the value as such
if (!even) {
delta = (-1 - delta);
}
return delta;
}
}
@@ -39,11 +39,13 @@ import com.threerings.presents.dobj.DObject;
*/
public class TimeBaseObject extends DObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>evenBase</code> field. */
public static final String EVEN_BASE = "evenBase";
/** The field name of the <code>oddBase</code> field. */
public static final String ODD_BASE = "oddBase";
// AUTO-GENERATED: FIELDS END
/** The even time base, used to decode even delta times. */
public long evenBase;
@@ -126,31 +128,37 @@ public class TimeBaseObject extends DObject
return delta;
}
// AUTO-GENERATED: METHODS START
/**
* Requests that the <code>evenBase</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>evenBase</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 setEvenBase (long evenBase)
public void setEvenBase (long value)
{
requestAttributeChange(EVEN_BASE, new Long(evenBase));
this.evenBase = evenBase;
long ovalue = this.evenBase;
requestAttributeChange(
EVEN_BASE, new Long(value), new Long(ovalue));
this.evenBase = value;
}
/**
* Requests that the <code>oddBase</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>oddBase</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 setOddBase (long oddBase)
public void setOddBase (long value)
{
requestAttributeChange(ODD_BASE, new Long(oddBase));
this.oddBase = oddBase;
long ovalue = this.oddBase;
requestAttributeChange(
ODD_BASE, new Long(value), new Long(ovalue));
this.oddBase = value;
}
// AUTO-GENERATED: METHODS END
}
@@ -1,84 +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.puzzle.data;
import com.threerings.parlor.game.GameObject;
/**
* Extends the basic {@link GameObject} to add individual player
* status. Puzzle games typically contain numerous players that may be
* knocked out of the game while the overall game continues on, thereby
* necessitating this second level of game status.
*/
public class PuzzleObject extends GameObject
implements PuzzleCodes
{
/** The player status constant for a player whose game is in play. */
public static final int PLAYER_IN_PLAY = 0;
/** The player status constant for a player whose has been knocked out
* of the game. */
public static final int PLAYER_KNOCKED_OUT = 1;
/** Provides general puzzle game invocation services. */
public PuzzleGameMarshaller puzzleGameService;
/** The puzzle difficulty level. */
public int difficulty;
/** The status of each of the players in the game. The status value
* is one of {@link #PLAYER_KNOCKED_OUT} or {@link
* #PLAYER_IN_PLAY}. */
public int[] playerStatus;
/** Summaries of the boards of all players in this puzzle (may be null
* if the puzzle doesn't support individual player boards). */
public BoardSummary[] summaries;
/** The seed used to germinate the boards. */
public long seed;
/**
* Returns the number of active players in the game.
*/
public int getActivePlayerCount ()
{
int count = 0;
int size = players.length;
for (int ii = 0; ii < size; ii++) {
if (isActivePlayer(ii)) {
count++;
}
}
return count;
}
/**
* Returns whether the given player is still an active player, e.g.,
* their game has not ended.
*/
public boolean isActivePlayer (int pidx)
{
return (isOccupiedPlayer(pidx) &&
playerStatus != null && playerStatus[pidx] == PLAYER_IN_PLAY);
}
}
@@ -32,6 +32,7 @@ import com.threerings.parlor.game.GameObject;
public class PuzzleObject extends GameObject
implements PuzzleCodes
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>puzzleGameService</code> field. */
public static final String PUZZLE_GAME_SERVICE = "puzzleGameService";
@@ -46,6 +47,7 @@ public class PuzzleObject extends GameObject
/** The field name of the <code>seed</code> field. */
public static final String SEED = "seed";
// AUTO-GENERATED: FIELDS END
/** The player status constant for a player whose game is in play. */
public static final int PLAYER_IN_PLAY = 0;
@@ -97,101 +99,119 @@ public class PuzzleObject extends GameObject
playerStatus != null && playerStatus[pidx] == PLAYER_IN_PLAY);
}
// AUTO-GENERATED: METHODS START
/**
* Requests that the <code>puzzleGameService</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>puzzleGameService</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 setPuzzleGameService (PuzzleGameMarshaller puzzleGameService)
public void setPuzzleGameService (PuzzleGameMarshaller value)
{
requestAttributeChange(PUZZLE_GAME_SERVICE, puzzleGameService);
this.puzzleGameService = puzzleGameService;
PuzzleGameMarshaller ovalue = this.puzzleGameService;
requestAttributeChange(
PUZZLE_GAME_SERVICE, value, ovalue);
this.puzzleGameService = value;
}
/**
* Requests that the <code>difficulty</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>difficulty</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 setDifficulty (int difficulty)
public void setDifficulty (int value)
{
requestAttributeChange(DIFFICULTY, new Integer(difficulty));
this.difficulty = difficulty;
int ovalue = this.difficulty;
requestAttributeChange(
DIFFICULTY, new Integer(value), new Integer(ovalue));
this.difficulty = value;
}
/**
* Requests that the <code>playerStatus</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>playerStatus</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 setPlayerStatus (int[] playerStatus)
public void setPlayerStatus (int[] value)
{
requestAttributeChange(PLAYER_STATUS, playerStatus);
this.playerStatus = playerStatus;
int[] ovalue = this.playerStatus;
requestAttributeChange(
PLAYER_STATUS, value, ovalue);
this.playerStatus = value;
}
/**
* Requests that the <code>index</code>th element of
* <code>playerStatus</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.
* <code>playerStatus</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 setPlayerStatusAt (int value, int index)
{
requestElementUpdate(PLAYER_STATUS, new Integer(value), index);
int ovalue = this.playerStatus[index];
requestElementUpdate(
PLAYER_STATUS, index, new Integer(value), new Integer(ovalue));
this.playerStatus[index] = value;
}
/**
* Requests that the <code>summaries</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>summaries</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 setSummaries (BoardSummary[] summaries)
public void setSummaries (BoardSummary[] value)
{
requestAttributeChange(SUMMARIES, summaries);
this.summaries = summaries;
BoardSummary[] ovalue = this.summaries;
requestAttributeChange(
SUMMARIES, value, ovalue);
this.summaries = value;
}
/**
* Requests that the <code>index</code>th element of
* <code>summaries</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.
* <code>summaries</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 setSummariesAt (BoardSummary value, int index)
{
requestElementUpdate(SUMMARIES, value, index);
BoardSummary ovalue = this.summaries[index];
requestElementUpdate(
SUMMARIES, index, value, ovalue);
this.summaries[index] = value;
}
/**
* Requests that the <code>seed</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>seed</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 setSeed (long seed)
public void setSeed (long value)
{
requestAttributeChange(SEED, new Long(seed));
this.seed = seed;
long ovalue = this.seed;
requestAttributeChange(
SEED, new Long(value), new Long(ovalue));
this.seed = value;
}
// AUTO-GENERATED: METHODS END
}
@@ -1,5 +1,5 @@
//
// $Id: SceneObject.java,v 1.3 2004/08/27 02:20:42 mdb Exp $
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -1,47 +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.whirled.spot.data;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.OidList;
import com.threerings.crowd.chat.data.SpeakObject;
/**
* Used to dispatch chat in clusters.
*/
public class ClusterObject extends DObject
implements SpeakObject
{
/**
* Tracks the oid of the body objects that occupy this cluster.
*/
public OidList occupants = new OidList();
// documentation inherited
public void applyToListeners (ListenerOp op)
{
for (int ii = 0, ll = occupants.size(); ii < ll; ii++) {
op.apply(occupants.get(ii));
}
}
}
@@ -32,8 +32,10 @@ import com.threerings.crowd.chat.data.SpeakObject;
public class ClusterObject extends DObject
implements SpeakObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>occupants</code> field. */
public static final String OCCUPANTS = "occupants";
// AUTO-GENERATED: FIELDS END
/**
* Tracks the oid of the body objects that occupy this cluster.
@@ -48,10 +50,11 @@ public class ClusterObject 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)
{
@@ -59,7 +62,7 @@ public class ClusterObject 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.
*/
@@ -67,4 +70,5 @@ public class ClusterObject extends DObject
{
requestOidRemove(OCCUPANTS, oid);
}
// AUTO-GENERATED: METHODS END
}
@@ -1,38 +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.whirled.spot.data;
import com.threerings.presents.dobj.DSet;
import com.threerings.whirled.data.SceneObject;
/**
* Extends the {@link SceneObject} with information specific to spots.
*/
public class SpotSceneObject extends SceneObject
{
/** A distributed set containing {@link SceneLocation} records for all
* occupants of this scene. */
public DSet occupantLocs = new DSet();
/** Contains information on all {@link Cluster}s in this scene. */
public DSet clusters = new DSet();
}
@@ -29,11 +29,13 @@ import com.threerings.whirled.data.SceneObject;
*/
public class SpotSceneObject extends SceneObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>occupantLocs</code> field. */
public static final String OCCUPANT_LOCS = "occupantLocs";
/** The field name of the <code>clusters</code> field. */
public static final String CLUSTERS = "clusters";
// AUTO-GENERATED: FIELDS END
/** A distributed set containing {@link SceneLocation} records for all
* occupants of this scene. */
@@ -42,6 +44,7 @@ public class SpotSceneObject extends SceneObject
/** Contains information on all {@link Cluster}s in this scene. */
public DSet clusters = new DSet();
// AUTO-GENERATED: METHODS START
/**
* Requests that the specified entry be added to the
* <code>occupantLocs</code> set. The set will not change until the event is
@@ -49,7 +52,7 @@ public class SpotSceneObject extends SceneObject
*/
public void addToOccupantLocs (DSet.Entry elem)
{
requestEntryAdd(OCCUPANT_LOCS, elem);
requestEntryAdd(OCCUPANT_LOCS, occupantLocs, elem);
}
/**
@@ -59,7 +62,7 @@ public class SpotSceneObject extends SceneObject
*/
public void removeFromOccupantLocs (Comparable key)
{
requestEntryRemove(OCCUPANT_LOCS, key);
requestEntryRemove(OCCUPANT_LOCS, occupantLocs, key);
}
/**
@@ -69,7 +72,7 @@ public class SpotSceneObject extends SceneObject
*/
public void updateOccupantLocs (DSet.Entry elem)
{
requestEntryUpdate(OCCUPANT_LOCS, elem);
requestEntryUpdate(OCCUPANT_LOCS, occupantLocs, elem);
}
/**
@@ -84,7 +87,7 @@ public class SpotSceneObject extends SceneObject
*/
public void setOccupantLocs (DSet occupantLocs)
{
requestAttributeChange(OCCUPANT_LOCS, occupantLocs);
requestAttributeChange(OCCUPANT_LOCS, occupantLocs, this.occupantLocs);
this.occupantLocs = occupantLocs;
}
@@ -95,7 +98,7 @@ public class SpotSceneObject extends SceneObject
*/
public void addToClusters (DSet.Entry elem)
{
requestEntryAdd(CLUSTERS, elem);
requestEntryAdd(CLUSTERS, clusters, elem);
}
/**
@@ -105,7 +108,7 @@ public class SpotSceneObject extends SceneObject
*/
public void removeFromClusters (Comparable key)
{
requestEntryRemove(CLUSTERS, key);
requestEntryRemove(CLUSTERS, clusters, key);
}
/**
@@ -115,7 +118,7 @@ public class SpotSceneObject extends SceneObject
*/
public void updateClusters (DSet.Entry elem)
{
requestEntryUpdate(CLUSTERS, elem);
requestEntryUpdate(CLUSTERS, clusters, elem);
}
/**
@@ -130,7 +133,8 @@ public class SpotSceneObject extends SceneObject
*/
public void setClusters (DSet clusters)
{
requestAttributeChange(CLUSTERS, clusters);
requestAttributeChange(CLUSTERS, clusters, this.clusters);
this.clusters = clusters;
}
// AUTO-GENERATED: METHODS END
}
@@ -1,36 +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.presents.server;
import com.threerings.presents.dobj.*;
/**
* A test distributed object.
*/
public class TestObject extends DObject
{
public int foo;
public String bar;
public int[] ints = new int[5];
public String[] strings = new String[5];
public OidList list = new OidList();
}