Rolled SettedObject right into DObject, because it's just too useful.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3019 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DObject.java,v 1.72 2004/02/25 14:45:16 mdb Exp $
|
||||
// $Id: DObject.java,v 1.73 2004/06/03 18:15:03 ray Exp $
|
||||
|
||||
package com.threerings.presents.dobj;
|
||||
|
||||
@@ -255,6 +255,45 @@ public class DObject implements Streamable
|
||||
return _controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the DSet with the specified name.
|
||||
*/
|
||||
public final DSet getSet (String setName)
|
||||
{
|
||||
try {
|
||||
return (DSet) getField(setName).get(this);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("No such set: " + setName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the specified item added to the specified DSet.
|
||||
*/
|
||||
public void addToSet (String setName, DSet.Entry entry)
|
||||
{
|
||||
getSet(setName); // validate the set
|
||||
requestEntryAdd(setName, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the specified item updated in the specified DSet.
|
||||
*/
|
||||
public void updateSet (String setName, DSet.Entry entry)
|
||||
{
|
||||
getSet(setName); // validate the set
|
||||
requestEntryUpdate(setName, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the specified key removed from the specified DSet.
|
||||
*/
|
||||
public void removeFromSet (String setName, Comparable key)
|
||||
{
|
||||
getSet(setName); // validate the set
|
||||
requestEntryRemove(setName, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* At times, an entity on the server may need to ensure that events it
|
||||
* has queued up have made it through the event queue and are applied
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// $Id: SettedObject.java,v 1.1 2004/06/03 16:34:07 ray Exp $
|
||||
|
||||
package com.threerings.presents.dobj;
|
||||
|
||||
/**
|
||||
* Allows manipulation of DSets in generic ways.
|
||||
*/
|
||||
public interface SettedObject
|
||||
{
|
||||
/**
|
||||
* Get the specified set.
|
||||
*/
|
||||
public DSet getSet (String name);
|
||||
|
||||
/**
|
||||
* Add the item to the set.
|
||||
*/
|
||||
public void addToSet (String setName, DSet.Entry entry);
|
||||
|
||||
/**
|
||||
* Update an item in the set.
|
||||
*/
|
||||
public void updateSet (String setName, DSet.Entry entry);
|
||||
|
||||
/**
|
||||
* Remove the item from set.
|
||||
*/
|
||||
public void removeFromSet (String setName, Comparable key);
|
||||
|
||||
/**
|
||||
* See {@link DObject#getOid}.
|
||||
*/
|
||||
public int getOid ();
|
||||
|
||||
/**
|
||||
* See {@link DObject#addListener}.
|
||||
*/
|
||||
public void addListener (ChangeListener listener);
|
||||
|
||||
/**
|
||||
* See {@link DObject#removeListener}.
|
||||
*/
|
||||
public void removeListener (ChangeListener listener);
|
||||
}
|
||||
Reference in New Issue
Block a user