Rebuilt various bits using the code generator. Annotated some Java sources
along the way. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@99 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -36,6 +36,11 @@ import com.threerings.whirled.client.SceneController;
|
||||
*/
|
||||
public class DefaultSceneConfig extends PlaceConfig
|
||||
{
|
||||
public function DefaultSceneConfig ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
override public function getManagerClassName () :String
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.threerings.util.Cloneable;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
import com.threerings.io.TypedArray;
|
||||
|
||||
/**
|
||||
@@ -38,8 +38,8 @@ import com.threerings.io.TypedArray;
|
||||
* what is transmitted over the wire when communicating scenes from the
|
||||
* server to the client.
|
||||
*/
|
||||
public class SceneModel
|
||||
implements Streamable, Cloneable
|
||||
public class SceneModel extends SimpleStreamableObject
|
||||
implements Cloneable
|
||||
{
|
||||
/** This scene's unique identifier. */
|
||||
public var sceneId :int;
|
||||
@@ -56,6 +56,21 @@ public class SceneModel
|
||||
/** Auxiliary scene model information. */
|
||||
public var auxModels :TypedArray = TypedArray.create(AuxModel);
|
||||
|
||||
/**
|
||||
* Creates and returns a blank scene model.
|
||||
*/
|
||||
public static function blankSceneModel () :SceneModel
|
||||
{
|
||||
var model :SceneModel = new SceneModel();
|
||||
populateBlankSceneModel(model);
|
||||
return model;
|
||||
}
|
||||
|
||||
public function SceneModel ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified auxiliary model to this scene model.
|
||||
*/
|
||||
@@ -81,31 +96,23 @@ public class SceneModel
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeInt(sceneId);
|
||||
out.writeField(name);
|
||||
out.writeInt(version);
|
||||
out.writeObject(auxModels);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
sceneId = ins.readInt();
|
||||
name = (ins.readField(String) as String);
|
||||
version = ins.readInt();
|
||||
auxModels = (ins.readObject() as TypedArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a blank scene model.
|
||||
*/
|
||||
public static function blankSceneModel () :SceneModel
|
||||
// documentation inherited from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
var model :SceneModel = new SceneModel();
|
||||
populateBlankSceneModel(model);
|
||||
return model;
|
||||
super.writeObject(out);
|
||||
out.writeInt(sceneId);
|
||||
out.writeField(name);
|
||||
out.writeInt(version);
|
||||
out.writeObject(auxModels);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,26 +29,36 @@ import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
|
||||
import com.threerings.util.Cloneable;
|
||||
|
||||
/**
|
||||
* Used to encapsulate updates to scenes in such a manner that updates can
|
||||
* be stored persistently and sent to clients to update their own local
|
||||
* copies of scenes.
|
||||
*/
|
||||
public class SceneUpdate
|
||||
implements Streamable /*, Cloneable */
|
||||
implements Streamable, Cloneable
|
||||
{
|
||||
public function SceneUpdate ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes this scene update such that it will operate on a scene
|
||||
* with the specified target scene and version number.
|
||||
*
|
||||
* @param targetId the id of the scene on which we are to operate.
|
||||
* @param targetVersion the version of the scene on which we are to
|
||||
* operate.
|
||||
* Applies this update to the specified scene model. Derived classes
|
||||
* will want to override this method and apply updates of their own,
|
||||
* being sure to call <code>super.apply</code>.
|
||||
*/
|
||||
public function init (targetId :int, targetVersion :int) :void
|
||||
public function apply (model :SceneModel) :void
|
||||
{
|
||||
_targetId = targetId;
|
||||
_targetVersion = targetVersion;
|
||||
// increment the version; disallowing integer overflow
|
||||
model.version = Math.max(_targetVersion + 1, model.version);
|
||||
|
||||
// sanity check for the amazing two billion updates
|
||||
if (model.version == _targetVersion) {
|
||||
Log.getLog(this).warning("Egads! This scene has been updated two" +
|
||||
" billion times [model=" + model + ", update=" + this + "].");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,6 +77,44 @@ public class SceneUpdate
|
||||
return _targetVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this instance.
|
||||
*/
|
||||
public function toString () :String
|
||||
{
|
||||
var buf :StringBuilder = new StringBuilder("[");
|
||||
toStringBuilder(buf);
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes this scene update such that it will operate on a scene
|
||||
* with the specified target scene and version number.
|
||||
*
|
||||
* @param targetId the id of the scene on which we are to operate.
|
||||
* @param targetVersion the version of the scene on which we are to
|
||||
* operate.
|
||||
*/
|
||||
public function init (targetId :int, targetVersion :int) :void
|
||||
{
|
||||
_targetId = targetId;
|
||||
_targetVersion = targetVersion;
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeInt(_targetId);
|
||||
out.writeInt(_targetVersion);
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
_targetId = ins.readInt();
|
||||
_targetVersion = ins.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to ensure that the scene is in the appropriate state prior
|
||||
* to applying the update.
|
||||
@@ -90,54 +138,17 @@ public class SceneUpdate
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this update to the specified scene model. Derived classes
|
||||
* will want to override this method and apply updates of their own,
|
||||
* being sure to call <code>super.apply</code>.
|
||||
*/
|
||||
public function apply (model :SceneModel) :void
|
||||
// from interface Cloneable
|
||||
public function clone () :Object
|
||||
{
|
||||
// increment the version; disallowing integer overflow
|
||||
model.version = Math.max(_targetVersion + 1, model.version);
|
||||
|
||||
// sanity check for the amazing two billion updates
|
||||
if (model.version == _targetVersion) {
|
||||
Log.getLog(this).warning("Egads! This scene has been updated two" +
|
||||
" billion times [model=" + model + ", update=" + this + "].");
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
//throws IOException
|
||||
{
|
||||
out.writeInt(_targetId);
|
||||
out.writeInt(_targetVersion);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
//throws IOException, ClassNotFoundException
|
||||
{
|
||||
_targetId = ins.readInt();
|
||||
_targetVersion = ins.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this instance.
|
||||
*/
|
||||
public function toString () :String
|
||||
{
|
||||
var buf :StringBuilder = new StringBuilder("[");
|
||||
toStringBuf(buf);
|
||||
return buf.append("]").toString();
|
||||
throw new Error("Not implemented.");
|
||||
}
|
||||
|
||||
/**
|
||||
* An extensible mechanism for generating a string representation of
|
||||
* this instance.
|
||||
*/
|
||||
protected function toStringBuf (buf :StringBuilder) :void
|
||||
protected function toStringBuilder (buf :StringBuilder) :void
|
||||
{
|
||||
buf.append("sceneId=").append(_targetId);
|
||||
buf.append(", version=").append(_targetVersion);
|
||||
|
||||
@@ -23,6 +23,8 @@ package com.threerings.whirled.spot.data {
|
||||
|
||||
import flash.geom.Rectangle;
|
||||
|
||||
import com.threerings.util.Hashable;
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
@@ -33,38 +35,23 @@ import com.threerings.presents.dobj.DSet_Entry;
|
||||
* Contains information on clusters.
|
||||
*/
|
||||
public class Cluster extends Rectangle
|
||||
implements DSet_Entry, Streamable
|
||||
implements DSet_Entry, Streamable /*, Hashable */
|
||||
{
|
||||
/** A unique identifier for this cluster (also the distributed object
|
||||
* id of the cluster chat object). */
|
||||
public var clusterOid :int;
|
||||
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
public function Cluster ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public function hashCode () :int
|
||||
{
|
||||
return clusterOid;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeInt(x);
|
||||
out.writeInt(y);
|
||||
out.writeInt(width);
|
||||
out.writeInt(height);
|
||||
out.writeInt(clusterOid);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
x = ins.readInt();
|
||||
y = ins.readInt();
|
||||
width = ins.readInt();
|
||||
height = ins.readInt();
|
||||
clusterOid = ins.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this instance.
|
||||
*/
|
||||
@@ -72,5 +59,26 @@ public class Cluster extends Rectangle
|
||||
{
|
||||
return super.toString() + ", clusterOid=" + clusterOid;
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return clusterOid;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
clusterOid = ins.readInt();
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeInt(clusterOid);
|
||||
}
|
||||
|
||||
/** Used for {@link #getKey}. */
|
||||
protected var _key :int;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,17 +39,9 @@ public class ModifyPortalsUpdate extends SceneUpdate
|
||||
/** The portals to be added to the scene. */
|
||||
public var portalsAdded :TypedArray;
|
||||
|
||||
/**
|
||||
* Initialize the update with all necessary data.
|
||||
*/
|
||||
public function initialize (
|
||||
targetId :int, targetVersion :int, removed :TypedArray,
|
||||
added :TypedArray) :void
|
||||
public function ModifyPortalsUpdate ()
|
||||
{
|
||||
init(targetId, targetVersion);
|
||||
|
||||
portalsRemoved = removed;
|
||||
portalsAdded = added;
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
override public function apply (model :SceneModel) :void
|
||||
@@ -72,20 +64,33 @@ public class ModifyPortalsUpdate extends SceneUpdate
|
||||
}
|
||||
}
|
||||
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
/**
|
||||
* Initialize the update with all necessary data.
|
||||
*/
|
||||
public function initialize (
|
||||
targetId :int, targetVersion :int, removed :TypedArray,
|
||||
added :TypedArray) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
init(targetId, targetVersion);
|
||||
|
||||
out.writeObject(portalsRemoved);
|
||||
out.writeObject(portalsAdded);
|
||||
portalsRemoved = removed;
|
||||
portalsAdded = added;
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
|
||||
portalsRemoved = (ins.readObject() as TypedArray);
|
||||
portalsAdded = (ins.readObject() as TypedArray);
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeObject(portalsRemoved);
|
||||
out.writeObject(portalsAdded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,12 @@ package com.threerings.whirled.spot.data {
|
||||
|
||||
import com.threerings.util.ClassUtil;
|
||||
import com.threerings.util.Cloneable;
|
||||
import com.threerings.util.Hashable;
|
||||
import com.threerings.util.StringBuilder;
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
import com.threerings.util.Hashable;
|
||||
|
||||
@@ -39,15 +41,14 @@ import com.threerings.util.Hashable;
|
||||
* when using this portal and the location at which the body sprite should
|
||||
* appear in that target scene.
|
||||
*/
|
||||
public class Portal
|
||||
implements Streamable, Hashable, Cloneable
|
||||
public class Portal extends SimpleStreamableObject
|
||||
implements Cloneable, Hashable
|
||||
{
|
||||
/** This portal's unique identifier. */
|
||||
public var portalId :int;
|
||||
|
||||
/** The location of the portal. Typically this is a base Location (2d)
|
||||
* class, but different games could use a different subclass of
|
||||
* Location. */
|
||||
/** The location of the portal.
|
||||
* This field is present on client and server, it is streamed specially. */
|
||||
public var loc :Location;
|
||||
|
||||
/** The scene identifier of the scene to which a body will exit when
|
||||
@@ -55,16 +56,13 @@ public class Portal
|
||||
public var targetSceneId :int;
|
||||
|
||||
/** The portal identifier of the portal at which a body will enter
|
||||
* the target scene when they "use" this portal. */
|
||||
* the target scene when they "use" this portal, or -1 to specify
|
||||
* that the body enters on the default portal, whatever id it is. */
|
||||
public var targetPortalId :int;
|
||||
|
||||
/**
|
||||
* Returns a location instance configured with the location and
|
||||
* orientation of this portal.
|
||||
*/
|
||||
public function getLocation () :Location
|
||||
public function Portal ()
|
||||
{
|
||||
return (loc.clone() as Location);
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,34 +77,10 @@ public class Portal
|
||||
return loc.getOpposite();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the portal has a potentially valid target scene and
|
||||
* portal id (they are not guaranteed to exist, but they are at least
|
||||
* potentially valid values rather than 0).
|
||||
*/
|
||||
public function isValid () :Boolean
|
||||
// documentation inherited from interface Hashable
|
||||
public function hashCode () :int
|
||||
{
|
||||
return (targetSceneId > 0) &&
|
||||
// the target portal must be positive, or -1
|
||||
((targetPortalId > 0) || (targetPortalId == -1));
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeShort(portalId);
|
||||
out.writeObject(loc);
|
||||
out.writeInt(targetSceneId);
|
||||
out.writeShort(targetPortalId);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
portalId = ins.readShort();
|
||||
loc = (ins.readObject() as Location);
|
||||
targetSceneId = ins.readInt();
|
||||
targetPortalId = ins.readShort();
|
||||
return portalId;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Cloneable
|
||||
@@ -127,16 +101,53 @@ public class Portal
|
||||
((other as Portal).portalId == portalId);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Hashable
|
||||
public function hashCode () :int
|
||||
/**
|
||||
* Returns a location instance configured with the location and
|
||||
* orientation of this portal.
|
||||
*/
|
||||
public function getLocation () :Location
|
||||
{
|
||||
return portalId;
|
||||
return (loc.clone() as Location);
|
||||
}
|
||||
|
||||
public function toString () :String
|
||||
/**
|
||||
* Returns true if the portal has a potentially valid target scene and
|
||||
* portal id (they are not guaranteed to exist, but they are at least
|
||||
* potentially valid values rather than 0).
|
||||
*/
|
||||
public function isValid () :Boolean
|
||||
{
|
||||
return "Portal[id=" + portalId + ", destScene=" + targetSceneId +
|
||||
", loc=" + loc + "].";
|
||||
return (targetSceneId > 0) &&
|
||||
// the target portal must be positive, or -1
|
||||
((targetPortalId > 0) || (targetPortalId == -1));
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
portalId = ins.readShort();
|
||||
loc = (ins.readObject() as Location);
|
||||
targetSceneId = ins.readInt();
|
||||
targetPortalId = ins.readShort();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeShort(portalId);
|
||||
out.writeObject(loc);
|
||||
out.writeInt(targetSceneId);
|
||||
out.writeShort(targetPortalId);
|
||||
}
|
||||
|
||||
// from SimpleStreamableObject
|
||||
override protected function toStringBuilder (buf :StringBuilder): void
|
||||
{
|
||||
buf.append("id=").append(portalId);
|
||||
buf.append(", destScene=").append(targetSceneId);
|
||||
buf.append(", loc=").append(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.threerings.util.Hashable;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
|
||||
@@ -32,7 +33,7 @@ import com.threerings.presents.dobj.DSet_Entry;
|
||||
* Extends {@link Location} with the data and functionality needed to
|
||||
* represent a particular user's location in a scene.
|
||||
*/
|
||||
public class SceneLocation
|
||||
public class SceneLocation extends SimpleStreamableObject
|
||||
implements DSet_Entry, Hashable
|
||||
{
|
||||
/** The oid of the body that occupies this location. */
|
||||
@@ -50,10 +51,10 @@ public class SceneLocation
|
||||
this.bodyOid = bodyOid;
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
// documentation inherited from interface Hashable
|
||||
public function hashCode () :int
|
||||
{
|
||||
return bodyOid;
|
||||
return loc.hashCode();
|
||||
}
|
||||
|
||||
// documentation inherited from interface Hashable
|
||||
@@ -63,24 +64,29 @@ public class SceneLocation
|
||||
this.loc.equals((other as SceneLocation).loc);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Hashable
|
||||
public function hashCode () :int
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return loc.hashCode();
|
||||
return bodyOid;
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
bodyOid = ins.readInt();
|
||||
loc = (ins.readObject() as Location);
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeInt(bodyOid);
|
||||
out.writeObject(loc);
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
bodyOid = ins.readInt();
|
||||
loc = (ins.readObject() as Location);
|
||||
}
|
||||
/** Used for {@link #getKey}. */
|
||||
protected var _key :int;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ package com.threerings.whirled.spot.data {
|
||||
import com.threerings.util.ArrayUtil;
|
||||
import com.threerings.util.ClassUtil;
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
import com.threerings.io.TypedArray;
|
||||
|
||||
import com.threerings.whirled.data.AuxModel;
|
||||
@@ -38,8 +38,8 @@ import com.threerings.whirled.data.SceneModel;
|
||||
* scene and unchanging, so that portals can stably reference the target
|
||||
* portal in the scene to which they connect.
|
||||
*/
|
||||
public class SpotSceneModel
|
||||
implements Streamable, AuxModel
|
||||
public class SpotSceneModel extends SimpleStreamableObject
|
||||
implements AuxModel
|
||||
{
|
||||
/** An array containing all portals in this scene. */
|
||||
public var portals :TypedArray = TypedArray.create(Portal);
|
||||
@@ -49,48 +49,6 @@ public class SpotSceneModel
|
||||
* portal at which they would appear. */
|
||||
public var defaultEntranceId :int = -1;
|
||||
|
||||
/**
|
||||
* Adds a portal to this scene model.
|
||||
*/
|
||||
public function addPortal (portal :Portal) :void
|
||||
{
|
||||
portals.push(portal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a portal from this model.
|
||||
*/
|
||||
public function removePortal (portal :Portal) :void
|
||||
{
|
||||
ArrayUtil.removeFirst(portals, portal);
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Cloneable
|
||||
public function clone () :Object
|
||||
{
|
||||
var clazz :Class = ClassUtil.getClass(this);
|
||||
var model :SpotSceneModel = new clazz();
|
||||
|
||||
for each (var portal :Portal in portals) {
|
||||
model.portals.push(portal.clone());
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
out.writeObject(portals);
|
||||
out.writeInt(defaultEntranceId);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
portals = (ins.readObject() as TypedArray);
|
||||
defaultEntranceId = ins.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Locates and returns the {@link SpotSceneModel} among the auxiliary
|
||||
* scene models associated with the supplied scene
|
||||
@@ -106,5 +64,54 @@ public class SpotSceneModel
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function SpotSceneModel ()
|
||||
{
|
||||
// nothing needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a portal from this model.
|
||||
*/
|
||||
public function removePortal (portal :Portal) :void
|
||||
{
|
||||
ArrayUtil.removeFirst(portals, portal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a portal to this scene model.
|
||||
*/
|
||||
public function addPortal (portal :Portal) :void
|
||||
{
|
||||
portals.push(portal);
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Cloneable
|
||||
public function clone () :Object
|
||||
{
|
||||
var clazz :Class = ClassUtil.getClass(this);
|
||||
var model :SpotSceneModel = new clazz();
|
||||
|
||||
for each (var portal :Portal in portals) {
|
||||
model.portals.push(portal.clone());
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
portals = (ins.readObject() as TypedArray);
|
||||
defaultEntranceId = ins.readInt();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeObject(portals);
|
||||
out.writeInt(defaultEntranceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.samskivert.util.StringUtil;
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.util.ActionScript;
|
||||
|
||||
import com.threerings.whirled.Log;
|
||||
|
||||
@@ -142,6 +143,7 @@ public class SceneUpdate
|
||||
* scene id and version fields are stored in separate columns and the rest
|
||||
* if the representation is contained in an opaque blob.
|
||||
*/
|
||||
@ActionScript(omit=true)
|
||||
public void persistTo (ObjectOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
@@ -157,6 +159,7 @@ public class SceneUpdate
|
||||
* Unserializes this instance from the bare representation created by
|
||||
* {@link #persistTo}.
|
||||
*/
|
||||
@ActionScript(omit=true)
|
||||
public void unpersistFrom (ObjectInputStream in)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
@@ -182,6 +185,7 @@ public class SceneUpdate
|
||||
* An extensible mechanism for generating a string representation of
|
||||
* this instance.
|
||||
*/
|
||||
@ActionScript(name="toStringBuilder")
|
||||
protected void toString (StringBuilder buf)
|
||||
{
|
||||
buf.append("sceneId=").append(_targetId);
|
||||
@@ -197,5 +201,6 @@ public class SceneUpdate
|
||||
protected transient int _targetVersion;
|
||||
|
||||
/** Used when serializing this update for storage in the database. */
|
||||
@ActionScript(omit=true)
|
||||
protected static ThreadLocal<Boolean> _dbSer = new ThreadLocal<Boolean>();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.awt.Rectangle;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.util.ActionScript;
|
||||
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
|
||||
@@ -49,6 +50,7 @@ public class Cluster extends Rectangle
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@ActionScript(omit=true)
|
||||
public boolean equals (Object other)
|
||||
{
|
||||
if (other instanceof Cluster) {
|
||||
|
||||
Reference in New Issue
Block a user