Add support for clone().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@783 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-12-15 04:20:00 +00:00
parent b00fdc6ab5
commit fa0506c85a
@@ -1,5 +1,5 @@
//
// $Id: OccupantInfo.java,v 1.4 2001/12/14 00:11:17 mdb Exp $
// $Id: OccupantInfo.java,v 1.5 2001/12/15 04:20:00 mdb Exp $
package com.threerings.crowd.data;
@@ -13,15 +13,22 @@ import com.threerings.presents.dobj.DSet;
* The occupant info object contains all of the information about an
* occupant of a place that should be shared with other occupants of the
* place. These objects are stored in the place object itself and are
* updated when bodies enter and exit a place. A system that builds upon
* the Crowd framework can extend this class to include extra information
* about their occupants. They will need to be sure to return the proper
* class from {@link
* com.threerings.crowd.server.PlaceManager#getOccupantInfoClass}
* and populate their occupant info in {@link
* updated when bodies enter and exit a place.
*
* <p> A system that builds upon the Crowd framework can extend this class
* to include extra information about their occupants. They will need to
* be sure to return the proper class from {@link
* com.threerings.crowd.server.PlaceManager#getOccupantInfoClass} and
* populate their occupant info in {@link
* com.threerings.crowd.server.PlaceManager#populateOccupantInfo}.
*
* <p> Note also that this class implements {@link Cloneable} which means
* that if derived classes add non-primitive attributes, they are
* responsible for adding the code to clone those attributes when a clone
* is requested.
*/
public class OccupantInfo implements DSet.Element
public class OccupantInfo
implements DSet.Element, Cloneable
{
/** The body object id of this occupant (and our element key). */
public Integer bodyOid;
@@ -41,6 +48,18 @@ public class OccupantInfo implements DSet.Element
return bodyOid;
}
/**
* Generates a cloned copy of this instance.
*/
public Object clone ()
{
try {
return super.clone();
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException("WTF? " + cnse);
}
}
// documentation inherited
public void writeTo (DataOutputStream out)
throws IOException