From 7a80c5cb43345fb978104723a93e760fbc84d9fe Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Mon, 20 Feb 2006 02:38:56 +0000 Subject: [PATCH] Got compiling working under Linux, now correcting various errors. Checkpoint. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3866 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/README.txt | 8 ++ src/as/com/threerings/io/ObjectInputStream.as | 6 +- .../com/threerings/io/ObjectOutputStream.as | 2 + src/as/com/threerings/io/Streamer.as | 2 + .../com/threerings/presents/client/Client.as | 13 +- .../presents/client/ClientDObjectMgr.as | 43 ++++-- .../presents/client/Communicator.as | 24 +++- .../presents/client/InvocationDirector.as | 4 + .../presents/client/InvocationService.as | 129 ++++++++++++++++++ .../threerings/presents/data/ClientObject.as | 62 +++++++++ .../presents/dobj/AttributeChangedEvent.as | 6 +- .../threerings/presents/dobj/CompoundEvent.as | 18 +-- src/as/com/threerings/presents/dobj/DEvent.as | 43 +++--- .../com/threerings/presents/dobj/DObject.as | 7 +- src/as/com/threerings/presents/dobj/DSet.as | 7 +- .../com/threerings/presents/dobj/DSetEntry.as | 2 + .../presents/dobj/ElementUpdatedEvent.as | 6 +- .../presents/dobj/EntryAddedEvent.as | 5 +- .../presents/dobj/EntryRemovedEvent.as | 6 +- .../presents/dobj/EntryUpdatedEvent.as | 8 +- .../threerings/presents/dobj/MessageEvent.as | 4 +- .../threerings/presents/dobj/NamedEvent.as | 6 +- .../presents/dobj/ObjectAddedEvent.as | 4 +- .../presents/dobj/ObjectDestroyedEvent.as | 29 ++-- .../presents/dobj/ObjectRemovedEvent.as | 4 +- .../com/threerings/presents/dobj/OidList.as | 33 ++--- .../dobj/{SetListener.java => SetListener.as} | 9 +- .../threerings/presents/dobj/Subscriber.as | 63 +++++++++ .../threerings/presents/net/AuthRequest.as | 10 +- .../threerings/presents/net/AuthResponse.as | 2 +- .../threerings/presents/net/BootstrapData.as | 2 + .../presents/net/BootstrapNotification.as | 2 +- .../presents/net/DownstreamMessage.as | 2 + .../presents/net/EventNotification.as | 2 +- .../presents/net/FailureResponse.as | 2 +- .../presents/net/ForwardEventRequest.as | 2 +- .../presents/net/UnsubscribeResponse.as | 2 +- .../presents/net/UpstreamMessage.as | 2 + .../presents/net/UsernamePasswordCreds.as | 4 +- src/as/com/threerings/util/Comparable.as | 7 + src/as/com/threerings/util/long.as | 2 + 41 files changed, 453 insertions(+), 141 deletions(-) create mode 100644 src/as/com/threerings/presents/client/InvocationService.as create mode 100644 src/as/com/threerings/presents/data/ClientObject.as rename src/as/com/threerings/presents/dobj/{SetListener.java => SetListener.as} (90%) create mode 100644 src/as/com/threerings/presents/dobj/Subscriber.as create mode 100644 src/as/com/threerings/util/Comparable.as diff --git a/src/as/com/threerings/README.txt b/src/as/com/threerings/README.txt index c7559e959..7cf8bb6de 100644 --- a/src/as/com/threerings/README.txt +++ b/src/as/com/threerings/README.txt @@ -80,3 +80,11 @@ Notes I will play around with trying to just use a Timer with a 1ms interval, and see if the frequency is limited to the actual framerate. + +- All methods must be marked with the 'override' keyword if they override + a method in their parent, except for toString(), even though it's defined + for Object. Ya got me... + +- 'protected' doesn't mean the same thing in ActionScript: it means that + ONLY subclasses can access a field/method, other classes in the same + package cannot access it. diff --git a/src/as/com/threerings/io/ObjectInputStream.as b/src/as/com/threerings/io/ObjectInputStream.as index 72cb285b3..7698d108e 100644 --- a/src/as/com/threerings/io/ObjectInputStream.as +++ b/src/as/com/threerings/io/ObjectInputStream.as @@ -92,7 +92,7 @@ public class ObjectInputStream } _current = obj; - _streamer = steamer; + _streamer = streamer; try { _streamer.readObject(obj, this); @@ -134,13 +134,13 @@ public class ObjectInputStream } public function readBytes (bytes :ByteArray, offset :uint = 0, - length :uint = undefined) :void + length :uint = 0) :void //throws IOError { // IDataInput reads all available bytes if a length is not passed // in. Protect against an easy error to make by using the length of // the array - if (length === undefined) { + if (length === 0) { length = bytes.length; } _source.readBytes(bytes, offset, length); diff --git a/src/as/com/threerings/io/ObjectOutputStream.as b/src/as/com/threerings/io/ObjectOutputStream.as index 01f02750a..13ff3cbaf 100644 --- a/src/as/com/threerings/io/ObjectOutputStream.as +++ b/src/as/com/threerings/io/ObjectOutputStream.as @@ -1,5 +1,7 @@ package com.threerings.io { +import flash.util.trace; + import flash.util.ByteArray; import flash.util.IDataOutput; diff --git a/src/as/com/threerings/io/Streamer.as b/src/as/com/threerings/io/Streamer.as index 9ca0a0b4b..d489a746b 100644 --- a/src/as/com/threerings/io/Streamer.as +++ b/src/as/com/threerings/io/Streamer.as @@ -1,5 +1,7 @@ package com.threerings.io { +import flash.util.trace; + import flash.util.ByteArray; import com.threerings.util.SimpleMap; diff --git a/src/as/com/threerings/presents/client/Client.as b/src/as/com/threerings/presents/client/Client.as index 285a30bac..e9818d22e 100644 --- a/src/as/com/threerings/presents/client/Client.as +++ b/src/as/com/threerings/presents/client/Client.as @@ -1,5 +1,7 @@ package com.threerings.presents.client { +import flash.util.trace; + import flash.events.EventDispatcher; import flash.events.TimerEvent; import flash.util.Timer; @@ -65,6 +67,11 @@ public class Client extends EventDispatcher return _authData; } + public function setAuthResponseData (data :AuthResponseData) :void + { + _authData = data; + } + public function getDObjectManager () :DObjectManager { return _omgr; @@ -216,7 +223,7 @@ public class Client extends EventDispatcher notifyObservers(ClientEvent.CLIENT_OBJECT_CHANGED); } - protected function cleanup (logonError :Error) :void + internal function cleanup (logonError :Error) :void { // clear out our references _comm = null; @@ -238,7 +245,7 @@ public class Client extends EventDispatcher /** * Called by the omgr when we receive a pong packet. */ - protected function gotPong (pong :PongResponse) :void + public function gotPong (pong :PongResponse) :void { // TODO: compute time delta bowl-shit } @@ -247,7 +254,7 @@ public class Client extends EventDispatcher * Convenience method to dispatch a client event to any listeners * and return the result of dispatchEvent. */ - protected function notifyObservers (evtCode :String, cause :Error = null) + public function notifyObservers (evtCode :String, cause :Error = null) :Boolean { return dispatchEvent(new ClientEvent(evtCode, this, cause)); diff --git a/src/as/com/threerings/presents/client/ClientDObjectMgr.as b/src/as/com/threerings/presents/client/ClientDObjectMgr.as index 002a0da29..13311f79c 100644 --- a/src/as/com/threerings/presents/client/ClientDObjectMgr.as +++ b/src/as/com/threerings/presents/client/ClientDObjectMgr.as @@ -24,12 +24,27 @@ package com.threerings.presents.client { import flash.events.TimerEvent; import flash.util.Timer; +import flash.util.trace; + import mx.collections.IList; +import com.threerings.util.ClassUtil; import com.threerings.util.SimpleMap; +import com.threerings.presents.dobj.DEvent; import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.DObjectManager; +import com.threerings.presents.dobj.ObjectDestroyedEvent; +import com.threerings.presents.dobj.Subscriber; + +import com.threerings.presents.net.BootstrapNotification; +import com.threerings.presents.net.EventNotification; +import com.threerings.presents.net.DownstreamMessage; +import com.threerings.presents.net.FailureResponse; +import com.threerings.presents.net.ForwardEventRequest; +import com.threerings.presents.net.ObjectResponse; +import com.threerings.presents.net.PongResponse; +import com.threerings.presents.net.UnsubscribeResponse; /** * The client distributed object manager manages a set of proxy objects @@ -202,7 +217,7 @@ public class ClientDObjectMgr notifyFailure(oid); } else if (obj is PongResponse) { - _client.gotPong(obj); + _client.gotPong(obj as PongResponse); } else if (obj is ObjectAction) { var act :ObjectAction = (obj as ObjectAction); @@ -223,7 +238,7 @@ public class ClientDObjectMgr // if this is a compound event, we need to process its contained // events in order if (event is CompoundEvent) { - var events :IList = event.getEvents(); + var events :IList = (event as CompoundEvent).getEvents(); var ecount :int = events.length; for (var ii :int = 0; ii < ecount; ii++) { dispatchEvent(events.getItemAt(ii)); @@ -404,7 +419,7 @@ public class ClientDObjectMgr var rec :FlushRecord = _flushes[oid]; if (rec.expire <= now) { _flushes[oid] = undefined; - flushObject(rec.object); + flushObject(rec.obj); } } } @@ -436,7 +451,7 @@ public class ClientDObjectMgr /** Flushes objects every now and again. */ protected var _flushInterval :Timer; - protected var _flushInterval :Timer; + protected var _actionInterval :Timer; /** Flush expired objects every 30 seconds. */ protected static const FLUSH_INTERVAL :Number = 30 * 1000; @@ -447,27 +462,27 @@ public class ClientDObjectMgr * The object action is used to queue up a subscribe or unsubscribe * request. */ -protected class ObjectAction +class ObjectAction { public var oid :int; - public var target :Subscriber; + public var target :com.threerings.presents.dobj.Subscriber; public var subscribe :Boolean; public function ObjectAction ( - oid :int, target :Subscriber, subscribe :Boolean) + oid :int, target :com.threerings.presents.dobj.Subscriber, subscribe :Boolean) { this.oid = oid; this.target = target; this.subscribe = subscribe; } - public override function toString () :String + public function toString () :String { return "oid=" + oid + ", target=" + target + ", subscribe=" + subscribe; } } -protected class PendingRequest +class PendingRequest { public var oid :int; public var targets :Array = new Array(); @@ -477,24 +492,24 @@ protected class PendingRequest this.oid = oid; } - public function addTarget (target :Subscriber) :void + public function addTarget (target :com.threerings.presents.dobj.Subscriber) :void { targets.push(target); } } /** Used to manage pending object flushes. */ -protected class FlushRecord +class FlushRecord { /** The object to be flushed. */ - public var obj :DObject; + public var obj :com.threerings.presents.dobj.DObject; /** The time at which we flush it. */ public var expire :Number; - public function FlushRecord (obj :DObject, expire :Number) + public function FlushRecord (obj :com.threerings.presents.dobj.DObject, expire :Number) { - this.object = object; + this.obj = obj; this.expire = expire; } } diff --git a/src/as/com/threerings/presents/client/Communicator.as b/src/as/com/threerings/presents/client/Communicator.as index 667b216af..67e37e7b5 100644 --- a/src/as/com/threerings/presents/client/Communicator.as +++ b/src/as/com/threerings/presents/client/Communicator.as @@ -1,5 +1,10 @@ package com.threerings.presents.client { +import flash.util.trace; + +import flash.events.Event; +import flash.events.IOErrorEvent; + import flash.net.Socket; import flash.util.ByteArray; @@ -10,6 +15,13 @@ import com.threerings.io.FrameReader; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; +import com.threerings.presents.net.AuthRequest; +import com.threerings.presents.net.AuthResponse; +import com.threerings.presents.net.AuthResponseData; +import com.threerings.presents.net.DownstreamMessage; +import com.threerings.presents.net.LogoffRequest; +import com.threerings.presents.net.UpstreamMessage; + public class Communicator { public function Communicator (client :Client) @@ -50,6 +62,11 @@ public class Communicator shutdown(null); } + public function postMessage (msg :UpstreamMessage) :void + { + sendMessage(msg); // send it now: we have no out queue (TODO?) + } + protected function shutdown (logonError :Error) :void { if (_socket != null) { @@ -132,7 +149,7 @@ public class Communicator // logon success _omgr = new ClientDObjectMgr(this, _client); - _client._authData = data; + _client.setAuthResponseData(data); } /** @@ -160,17 +177,18 @@ public class Communicator */ protected function socketClosed (event :Event) :void { - _client.notifyObserver(ClientEvent.CLIENT_CONNECTION_FAILED); + _client.notifyObservers(ClientEvent.CLIENT_CONNECTION_FAILED); shutdown(null); } protected var _client :Client; - protected var _omgr :ClientDObjectManager; + protected var _omgr :ClientDObjectMgr; protected var _outBuffer :ByteArray; protected var _outStream :ObjectOutputStream; protected var _inStream :ObjectInputStream; + protected var _frameReader :FrameReader; protected var _socket :Socket; diff --git a/src/as/com/threerings/presents/client/InvocationDirector.as b/src/as/com/threerings/presents/client/InvocationDirector.as index ec60dcf95..c74b60e98 100644 --- a/src/as/com/threerings/presents/client/InvocationDirector.as +++ b/src/as/com/threerings/presents/client/InvocationDirector.as @@ -1,7 +1,11 @@ package com.threerings.presents.client { +import flash.util.trace; + import com.threerings.presents.dobj.DObjectManager; +import com.threerings.presents.data.ClientObject; + public class InvocationDirector { public function init (omgr :DObjectManager, cloid :int, client :Client) :void diff --git a/src/as/com/threerings/presents/client/InvocationService.as b/src/as/com/threerings/presents/client/InvocationService.as new file mode 100644 index 000000000..47805f30e --- /dev/null +++ b/src/as/com/threerings/presents/client/InvocationService.as @@ -0,0 +1,129 @@ +// +// $Id: InvocationService.java 3099 2004-08-27 02:21:06Z mdb $ +// +// 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.client { + +/** + * Serves as the base interface for invocation services. An invocation + * service can be defined by extending this interface and defining service + * methods, as well as response listeners (which must extend {@link + * InvocationListener}). For example: + * + *
+ * public interface LocationService extends InvocationService
+ * {
+ *     
+ *     // Used to communicate responses to moveTo() requests.
+ *     public interface MoveListener extends InvocationListener
+ *     {
+ *         // Called in response to a successful moveTo() request.
+ *         public void moveSucceeded (PlaceConfig config);
+ *     }
+ *
+ *     // Requests that this client's body be moved to the specified
+ *     // location.
+ *     //
+ *     // @param placeId the object id of the place object to which the
+ *     // body should be moved.
+ *     // @param listener the listener that will be informed of success or
+ *     // failure.
+ *     public void moveTo (int placeId, MoveListener listener);
+ * }
+ * 
+ * + * From this interface, a LocationProvider interface will be + * generated which should be implemented by whatever server entity that + * will actually provide the server side of this invocation service. That + * provider interface would look like the following: + * + *
+ * public interface LocationProvider extends InvocationProvider
+ * {
+ *      // Requests that this client's body be moved to the specified
+ *      // location.
+ *      //
+ *      // @param caller the client object of the client that invoked this
+ *      // remotely callable method.
+ *      // @param placeId the object id of the place object to which the
+ *      // body should be moved.
+ *      // @param listener the listener that should be informed of success
+ *      // or failure.
+ *     public void moveTo (ClientObject caller, int placeId,
+ *                         MoveListener listener)
+ *         throws InvocationException;
+ * }
+ * 
+ */ +public interface InvocationService +{ + /** + * Invocation service methods that require a response should take a + * listener argument that can be notified of request success or + * failure. The listener argument should extend this interface so that + * generic failure can be reported in all cases. For example: + * + *
+     * // Used to communicate responses to moveTo requests.
+     * public interface MoveListener extends InvocationListener
+     * {
+     *     // Called in response to a successful moveTo
+     *     // request.
+     *     public void moveSucceeded (PlaceConfig config);
+     * }
+     * 
+ */ +// public static interface InvocationListener +// { + /** + * Called to report request failure. If the invocation services + * system detects failure of any kind, it will report it via this + * callback. Particular services may also make use of this + * callback to report failures of their own, or they may opt to + * define more specific failure callbacks. + */ +// public void requestFailed (String cause); +// } + + /** + * Extends the {@link InvocationListener} with a basic success + * callback. + */ +// public static interface ConfirmListener extends InvocationListener +// { + /** + * Indicates that the request was successfully processed. + */ +// public void requestProcessed (); +// } + + /** + * Extends the {@link InvocationListener} with a basic success + * callback that delivers a result object. + */ +// public static interface ResultListener extends InvocationListener +// { + /** + * Indicates that the request was successfully processed. + */ +// public void requestProcessed (Object result); +// } +} +} diff --git a/src/as/com/threerings/presents/data/ClientObject.as b/src/as/com/threerings/presents/data/ClientObject.as new file mode 100644 index 000000000..699df61cc --- /dev/null +++ b/src/as/com/threerings/presents/data/ClientObject.as @@ -0,0 +1,62 @@ +// +// $Id: ClientObject.java 3300 2005-01-08 22:05:00Z ray $ +// +// 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; + +import com.threerings.io.ObjectInputStream; +import com.threerings.io.ObjectOutputStream; + +/** + * 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 +{ + /** Used to publish all invocation service receivers registered on + * this client. */ + public var receivers :DSet; + + /** + * Returns a short string identifying this client. + */ + public function who () :String + { + return "(" + getOid() + ")"; + } + + public override function writeObject (out :ObjectOutputStream) :void + { + super.writeObject(out); + out.writeObject(receivers); + } + + public override function readObject (ins :ObjectInputStream) :void + { + super.readObject(ins); + receivers = ins.readObject(); + } +} +} diff --git a/src/as/com/threerings/presents/dobj/AttributeChangedEvent.as b/src/as/com/threerings/presents/dobj/AttributeChangedEvent.as index f8b230abc..fe719d824 100644 --- a/src/as/com/threerings/presents/dobj/AttributeChangedEvent.as +++ b/src/as/com/threerings/presents/dobj/AttributeChangedEvent.as @@ -59,7 +59,7 @@ public class AttributeChangedEvent extends NamedEvent * primitive types, the reflection-defined object-alternative is * used). */ - protected function AttributeChangedEvent ( + public function AttributeChangedEvent ( targetOid :int, name :String, value :*, oldValue :*) { super(targetOid, name); @@ -76,10 +76,10 @@ public class AttributeChangedEvent extends NamedEvent } // documentation inherited - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("CHANGE:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", value=", _value); } diff --git a/src/as/com/threerings/presents/dobj/CompoundEvent.as b/src/as/com/threerings/presents/dobj/CompoundEvent.as index 1fd3ff7a6..654fd4a68 100644 --- a/src/as/com/threerings/presents/dobj/CompoundEvent.as +++ b/src/as/com/threerings/presents/dobj/CompoundEvent.as @@ -41,7 +41,7 @@ public class CompoundEvent extends DEvent /** * Constructs a compound event and prepares it for operation. */ - public CompoundEvent (target :DObject, omgr :DObjectManager) + public function CompoundEvent (target :DObject, omgr :DObjectManager) { super(target.getOid()); @@ -112,18 +112,6 @@ public class CompoundEvent extends DEvent _events.removeAll(); } - /** - * We need to propagate our source oid to our constituent events. - */ - public override function setSourceOid (sourceOid :int) :void - { - super.setSourceOid(sourceOid); - - for (var ii :int = 0; ii < _events.length; ii++) { - _events.getItemAt(ii).setSourceOid(sourceOid); - } - } - /** * Nothing to apply here. */ @@ -145,10 +133,10 @@ public class CompoundEvent extends DEvent } // documentation inherited - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("COMPOUND:"); - super.toString(buf); + super.toStringBuf(buf); for (var ii :int = 0; ii < _events.length; ii++) { buf.append(", ", _events.getItemAt(ii)); diff --git a/src/as/com/threerings/presents/dobj/DEvent.as b/src/as/com/threerings/presents/dobj/DEvent.as index c4e81b6aa..ffd4a2efb 100644 --- a/src/as/com/threerings/presents/dobj/DEvent.as +++ b/src/as/com/threerings/presents/dobj/DEvent.as @@ -1,19 +1,18 @@ package com.threerings.presents.dobj { import flash.util.StringBuilder; +import flash.util.trace; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; +import com.threerings.util.Comparable; + public class DEvent implements Streamable { - public function DEvent () - { - } - - public function DEvent (int targetOid) + public function DEvent (targetOid :int) { _toid = targetOid; } @@ -50,18 +49,6 @@ public class DEvent // the default is to do nothing } - /** - * Constructs and returns a string representation of this event. - */ - public override function toString () :String - { - StringBuilder buf = new StringBuilder(); - buf.append("["); - toString(buf); - buf.append("]"); - return buf.toString(); - } - // documentation inherited from interface Streamable public function writeObject (out :ObjectOutputStream) :void { @@ -74,12 +61,24 @@ public class DEvent _toid = ins.readInt(); } + /** + * Constructs and returns a string representation of this event. + */ + public function toString () :String + { + var buf :StringBuilder = new StringBuilder(); + buf.append("["); + toStringBuf(buf); + buf.append("]"); + return buf.toString(); + } + /** * This should be overridden by derived classes (which should be sure * to call super.toString()) to append the derived class * specific event information to the string buffer. */ - protected function toString (buf :StringBuilder) :void + protected function toStringBuf (buf :StringBuilder) :void { buf.append("targetOid=", _toid); } @@ -91,18 +90,18 @@ public class DEvent } } -class DummyEntry implements DSetEntry +class DummyEntry implements com.threerings.presents.dobj.DSetEntry { - public function getKey () :Comparable + public function getKey () :com.threerings.util.Comparable { return null; } - public function writeObject (out :ObjectOutputStream) :void + public function writeObject (out :com.threerings.io.ObjectOutputStream) :void { } - public function readObject (ins :ObjectInputStream) :void + public function readObject (ins :com.threerings.io.ObjectInputStream) :void { } } diff --git a/src/as/com/threerings/presents/dobj/DObject.as b/src/as/com/threerings/presents/dobj/DObject.as index 5dfe8041a..58e6b949b 100644 --- a/src/as/com/threerings/presents/dobj/DObject.as +++ b/src/as/com/threerings/presents/dobj/DObject.as @@ -1,9 +1,12 @@ package com.threerings.presents.dobj { import flash.events.EventDispatcher; +import flash.util.trace; import mx.collections.ArrayCollection; +import com.threerings.util.Comparable; + import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; @@ -140,7 +143,7 @@ public class DObject // extends EventDispatcher /** * Calls by derived instances when a set adder method was called. */ - protected function requestEntryAdd (name :String, entry :DSet.Entry) :void + protected function requestEntryAdd (name :String, entry :DSetEntry) :void { // dispatch an entry added event postEvent(new EntryAddedEvent(_oid, name, entry, false)); @@ -158,7 +161,7 @@ public class DObject // extends EventDispatcher /** * Calls by derived instances when a set updater method was called. */ - protected function requestEntryUpdate (name :String, entry :DSet.Entry) + protected function requestEntryUpdate (name :String, entry :DSetEntry) { // dispatch an entry updated event postEvent(new EntryUpdatedEvent(_oid, name, entry, null)); diff --git a/src/as/com/threerings/presents/dobj/DSet.as b/src/as/com/threerings/presents/dobj/DSet.as index eebef0e3f..adccc80c9 100644 --- a/src/as/com/threerings/presents/dobj/DSet.as +++ b/src/as/com/threerings/presents/dobj/DSet.as @@ -1,11 +1,14 @@ package com.threerings.presents.dobj { import flash.util.StringBuilder; +import flash.util.trace; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; +import com.threerings.util.Comparable; + /** * The distributed set class provides a means by which an unordered set of @@ -230,9 +233,9 @@ public class DSet /** * Generates a string representation of this set instance. */ - public override function toString () :String + public function toString () :String { - StringBuilder buf = new StringBuilder("("); + var buf :StringBuilder = new StringBuilder("("); buf.append(_entries.toString()); buf.append(")"); return buf.toString(); diff --git a/src/as/com/threerings/presents/dobj/DSetEntry.as b/src/as/com/threerings/presents/dobj/DSetEntry.as index a5d00ac93..4115b3965 100644 --- a/src/as/com/threerings/presents/dobj/DSetEntry.as +++ b/src/as/com/threerings/presents/dobj/DSetEntry.as @@ -2,6 +2,8 @@ package com.threerings.presents.dobj { import com.threerings.io.Streamable; +import com.threerings.util.Comparable; + public interface DSetEntry extends Streamable { function getKey () :Comparable; diff --git a/src/as/com/threerings/presents/dobj/ElementUpdatedEvent.as b/src/as/com/threerings/presents/dobj/ElementUpdatedEvent.as index 235d90f17..bb598a8f0 100644 --- a/src/as/com/threerings/presents/dobj/ElementUpdatedEvent.as +++ b/src/as/com/threerings/presents/dobj/ElementUpdatedEvent.as @@ -30,7 +30,7 @@ public class ElementUpdatedEvent extends NamedEvent * used). * @param index the index in the array of the updated element. */ - public ElementUpdatedEvent ( + public function ElementUpdatedEvent ( targetOid :int, name :String, value :*, oldValue :*, index :int) { super(targetOid, name); @@ -102,10 +102,10 @@ public class ElementUpdatedEvent extends NamedEvent } // documentation inherited - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("UPDATE:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", value=", _value); buf.append(", index=", _index); } diff --git a/src/as/com/threerings/presents/dobj/EntryAddedEvent.as b/src/as/com/threerings/presents/dobj/EntryAddedEvent.as index d5ef5baf0..250c46b22 100644 --- a/src/as/com/threerings/presents/dobj/EntryAddedEvent.as +++ b/src/as/com/threerings/presents/dobj/EntryAddedEvent.as @@ -1,6 +1,7 @@ package com.threerings.presents.dobj { import flash.util.StringBuilder; +import flash.util.trace; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; @@ -61,10 +62,10 @@ public class EntryAddedEvent extends NamedEvent } // documentation inherited - protected override function toString (StringBuilder buf) + protected override function toStringBuf (buf :StringBuilder) { buf.append("ELADD:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", entry=", _entry); } diff --git a/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as b/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as index fb053b049..6f1f2967f 100644 --- a/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as +++ b/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as @@ -1,10 +1,12 @@ package com.threerings.presents.dobj { import flash.util.StringBuilder; +import flash.util.trace; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; +import com.threerings.util.Comparable; /** * An entry removed event is dispatched when an entry is removed from a @@ -80,10 +82,10 @@ public class EntryRemovedEvent extends NamedEvent } // documentation inherited - protected override function toString (buf :StringBuilder) + protected override function toStringBuf (buf :StringBuilder) { buf.append("ELREM:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", key=", _key); } diff --git a/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as b/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as index 1286a83cf..cdd1ad854 100644 --- a/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as +++ b/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as @@ -1,5 +1,7 @@ package com.threerings.presents.dobj { +import flash.util.trace; + import flash.util.StringBuilder; import com.threerings.io.ObjectInputStream; @@ -63,7 +65,7 @@ public class EntryUpdatedEvent extends NamedEvent if (_oldEntry == null) { // complain if we didn't update anything trace("No matching entry to update [entry=" + this + - ", set=" + set + "]."); + ", set=" + dset + "]."); return false; } } @@ -79,10 +81,10 @@ public class EntryUpdatedEvent extends NamedEvent } // documentation inherited - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("ELUPD:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", entry=", _entry); } diff --git a/src/as/com/threerings/presents/dobj/MessageEvent.as b/src/as/com/threerings/presents/dobj/MessageEvent.as index 83e0f46ea..6164b9e32 100644 --- a/src/as/com/threerings/presents/dobj/MessageEvent.as +++ b/src/as/com/threerings/presents/dobj/MessageEvent.as @@ -69,10 +69,10 @@ public class MessageEvent extends NamedEvent } // documentation inherited - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("MSG:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", args=", _args); } diff --git a/src/as/com/threerings/presents/dobj/NamedEvent.as b/src/as/com/threerings/presents/dobj/NamedEvent.as index 290e77e9d..d7bb4d4eb 100644 --- a/src/as/com/threerings/presents/dobj/NamedEvent.as +++ b/src/as/com/threerings/presents/dobj/NamedEvent.as @@ -18,7 +18,7 @@ public class NamedEvent extends DEvent * @param targetOid the object id of the object in question. * @param name the name associated with this event. */ - public NamedEvent (targetOid :int, name :String) + public function NamedEvent (targetOid :int, name :String) { super(targetOid); _name = name; @@ -32,9 +32,9 @@ public class NamedEvent extends DEvent return _name; } - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { - super.toString(buf); + super.toStringBuf(buf); buf.append(", name=", _name); } diff --git a/src/as/com/threerings/presents/dobj/ObjectAddedEvent.as b/src/as/com/threerings/presents/dobj/ObjectAddedEvent.as index 3552f20c5..4355e1f90 100644 --- a/src/as/com/threerings/presents/dobj/ObjectAddedEvent.as +++ b/src/as/com/threerings/presents/dobj/ObjectAddedEvent.as @@ -71,10 +71,10 @@ public class ObjectAddedEvent extends NamedEvent } // documentation inherited - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("OBJADD:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", oid=", _oid); } diff --git a/src/as/com/threerings/presents/dobj/ObjectDestroyedEvent.as b/src/as/com/threerings/presents/dobj/ObjectDestroyedEvent.as index 47a1c27c0..bbc3b8825 100644 --- a/src/as/com/threerings/presents/dobj/ObjectDestroyedEvent.as +++ b/src/as/com/threerings/presents/dobj/ObjectDestroyedEvent.as @@ -19,7 +19,9 @@ // 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.dobj; +package com.threerings.presents.dobj { + +import flash.util.StringBuilder; /** * An object destroyed event is dispatched when an object has been removed @@ -36,22 +38,14 @@ public class ObjectDestroyedEvent extends DEvent * * @param targetOid the object id of the object that will be destroyed. */ - public ObjectDestroyedEvent (int targetOid) + public function ObjectDestroyedEvent (targetOid :int) { super(targetOid); } - /** - * Constructs a blank instance of this event in preparation for - * unserialization from the network. - */ - public ObjectDestroyedEvent () - { - } - // documentation inherited - public boolean applyToObject (DObject target) - throws ObjectAccessException + public override function applyToObject (target :DObject) :Boolean + //throws ObjectAccessException { // nothing to do in preparation for destruction, the omgr will // have to recognize this type of event and do the right thing @@ -59,17 +53,18 @@ public class ObjectDestroyedEvent extends DEvent } // documentation inherited - protected void notifyListener (Object listener) + protected override function notifyListener (listener :Object) :void { - if (listener instanceof ObjectDeathListener) { - ((ObjectDeathListener)listener).objectDestroyed(this); + if (listener is ObjectDeathListener) { + listener.objectDestroyed(this); } } // documentation inherited - protected void toString (StringBuffer buf) + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("DESTROY:"); - super.toString(buf); + super.toStringBuf(buf); } } +} diff --git a/src/as/com/threerings/presents/dobj/ObjectRemovedEvent.as b/src/as/com/threerings/presents/dobj/ObjectRemovedEvent.as index f09a9fdc6..85f72fe3a 100644 --- a/src/as/com/threerings/presents/dobj/ObjectRemovedEvent.as +++ b/src/as/com/threerings/presents/dobj/ObjectRemovedEvent.as @@ -94,10 +94,10 @@ public class ObjectRemovedEvent extends NamedEvent } // documentation inherited - protected override function toString (buf :StringBuilder) :void + protected override function toStringBuf (buf :StringBuilder) :void { buf.append("OBJREM:"); - super.toString(buf); + super.toStringBuf(buf); buf.append(", oid=", _oid); } diff --git a/src/as/com/threerings/presents/dobj/OidList.as b/src/as/com/threerings/presents/dobj/OidList.as index 965e0c30a..e0bf4c088 100644 --- a/src/as/com/threerings/presents/dobj/OidList.as +++ b/src/as/com/threerings/presents/dobj/OidList.as @@ -1,5 +1,7 @@ package com.threerings.presents.dobj { +import flash.util.trace; + import com.threerings.io.Streamable; import com.threerings.io.ObjectInputStream; @@ -27,7 +29,7 @@ public class OidList */ public function size () :int { - return _size; + return _oids.length; } /** @@ -40,19 +42,14 @@ public class OidList public function add (oid :int) :Boolean { // check for existence - for (int i = 0; i < _size; i++) { - if (_oids[i] == oid) { + for (var ii :int = 0; ii < _oids.length; ii++) { + if (_oids[ii] == oid) { return false; } } - // make room if necessary - if (_size+1 >= _oids.length) { - expand(); - } - // add the oid - _oids[_size++] = oid; + _oids[_oids.length] = oid; return true; } @@ -62,13 +59,13 @@ public class OidList * @return true if the oid was in the list and was removed, false * otherwise. */ - public boolean remove (int oid) + public function remove (oid :int) :Boolean { // scan for the oid in question - for (int i = 0; i < _size; i++) { - if (_oids[i] == oid) { + for (var ii :int = 0; ii < _oids.length; ii++) { + if (_oids[ii] == oid) { // shift the rest of the list back one - System.arraycopy(_oids, i+1, _oids, i, --_size-i); + _oids.splice(ii, 1); return true; } } @@ -79,10 +76,10 @@ public class OidList /** * Returns true if the specified oid is in the list, false if not. */ - public boolean contains (int oid) + public function contains (oid :int) :Boolean { - for (int i = 0; i < _size; i++) { - if (_oids[i] == oid) { + for (var ii :int = 0; ii < _oids.length; ii++) { + if (_oids[ii] == oid) { return true; } } @@ -118,9 +115,9 @@ public class OidList } - public override function toString () :String + public function toString () :String { - StringBuilder buf = new StringBuilder(); + var buf :StringBuilder = new StringBuilder(); buf.append("{"); buf.append(_oids.toString()); buf.append("}"); diff --git a/src/as/com/threerings/presents/dobj/SetListener.java b/src/as/com/threerings/presents/dobj/SetListener.as similarity index 90% rename from src/as/com/threerings/presents/dobj/SetListener.java rename to src/as/com/threerings/presents/dobj/SetListener.as index 98d834f14..2e48ece75 100644 --- a/src/as/com/threerings/presents/dobj/SetListener.java +++ b/src/as/com/threerings/presents/dobj/SetListener.as @@ -19,7 +19,7 @@ // 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.dobj; +package com.threerings.presents.dobj { /** * Implemented by entites which wish to hear about changes that occur to @@ -36,7 +36,7 @@ public interface SetListener extends ChangeListener * * @param event The event that was dispatched on the object. */ - public void entryAdded (EntryAddedEvent event); + function entryAdded (event :EntryAddedEvent) :void; /** * Called when an entry updated event has been dispatched on an @@ -45,7 +45,7 @@ public interface SetListener extends ChangeListener * * @param event The event that was dispatched on the object. */ - public void entryUpdated (EntryUpdatedEvent event); + function entryUpdated (event :EntryUpdatedEvent) :void; /** * Called when an entry removed event has been dispatched on an @@ -54,5 +54,6 @@ public interface SetListener extends ChangeListener * * @param event The event that was dispatched on the object. */ - public void entryRemoved (EntryRemovedEvent event); + function entryRemoved (event :EntryRemovedEvent) :void; +} } diff --git a/src/as/com/threerings/presents/dobj/Subscriber.as b/src/as/com/threerings/presents/dobj/Subscriber.as new file mode 100644 index 000000000..afb21c309 --- /dev/null +++ b/src/as/com/threerings/presents/dobj/Subscriber.as @@ -0,0 +1,63 @@ +// +// $Id: Subscriber.java 3099 2004-08-27 02:21:06Z mdb $ +// +// 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.dobj { + +/** + * A subscriber is an entity that has access to a distributed object. The + * process of obtaining access to a distributed object is an asynchronous + * one, and changes made to an object are delivered asynchronously. By + * registering as a subscriber to an object, an entity can react to + * changes made to an object and ensure that their object is kept up to + * date. + * + *

To actually receive callbacks when events are dispatched on a + * distributed object, an entity should register itself as a listener on + * the object once it has received its object reference. + * + * @see EventListener + * @see AttributeChangeListener + * @see SetListener + * @see OidListListener + */ +public interface Subscriber +{ + /** + * Called when a subscription request has succeeded and the object is + * available. If the object was requested for subscription, the + * subscriber can subsequently receive notifications by registering + * itself as a listener of some sort (see {@link + * DObject#addListener}). + * + * @see DObjectManager#subscribeToObject + */ + function objectAvailable (obj :DObject) :void; + + /** + * Called when a subscription request has failed. The nature of the + * failure will be communicated via the supplied + * ObjectAccessException. + * + * @see DObjectManager#subscribeToObject + */ + function requestFailed (oid :int, cause :ObjectAccessError) :void; +} +} diff --git a/src/as/com/threerings/presents/net/AuthRequest.as b/src/as/com/threerings/presents/net/AuthRequest.as index 6206628ae..bf7a14e26 100644 --- a/src/as/com/threerings/presents/net/AuthRequest.as +++ b/src/as/com/threerings/presents/net/AuthRequest.as @@ -5,20 +5,14 @@ import com.threerings.io.ObjectOutputStream; public class AuthRequest extends UpstreamMessage { - public function AuthRequest () - { - super(); - } - public function AuthRequest (creds :Credentials, version :String) { - super(); _creds = creds; _version = version; } // documentation inherited - public function writeObject (out :ObjectOutputStream) :void + public override function writeObject (out :ObjectOutputStream) :void { super.writeObject(out); @@ -27,7 +21,7 @@ public class AuthRequest extends UpstreamMessage } // documentation inherited - public function readObject (ins :ObjectInputStream) :void + public override function readObject (ins :ObjectInputStream) :void { super.readObject(ins); _creds = ins.readObject(); diff --git a/src/as/com/threerings/presents/net/AuthResponse.as b/src/as/com/threerings/presents/net/AuthResponse.as index 5c55b3d42..e324f8923 100644 --- a/src/as/com/threerings/presents/net/AuthResponse.as +++ b/src/as/com/threerings/presents/net/AuthResponse.as @@ -10,7 +10,7 @@ public class AuthResponse extends DownstreamMessage return _data; } - public function readObject (ins :ObjectInputStream) :void + public override function readObject (ins :ObjectInputStream) :void { super.readObject(ins); _data = ins.readObject(); diff --git a/src/as/com/threerings/presents/net/BootstrapData.as b/src/as/com/threerings/presents/net/BootstrapData.as index 8b14ee930..7a1936afd 100644 --- a/src/as/com/threerings/presents/net/BootstrapData.as +++ b/src/as/com/threerings/presents/net/BootstrapData.as @@ -1,5 +1,7 @@ package com.threerings.presents.net { +import flash.util.trace; + import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; diff --git a/src/as/com/threerings/presents/net/BootstrapNotification.as b/src/as/com/threerings/presents/net/BootstrapNotification.as index ea22c4b64..a95605353 100644 --- a/src/as/com/threerings/presents/net/BootstrapNotification.as +++ b/src/as/com/threerings/presents/net/BootstrapNotification.as @@ -9,7 +9,7 @@ public class BootstrapNotification extends DownstreamMessage return _data; } - public function readObject (ins :ObjectInputStream) :void + public override function readObject (ins :ObjectInputStream) :void { super.readObject(ins); _data = ins.readObject(); diff --git a/src/as/com/threerings/presents/net/DownstreamMessage.as b/src/as/com/threerings/presents/net/DownstreamMessage.as index e2af144c2..101d989cf 100644 --- a/src/as/com/threerings/presents/net/DownstreamMessage.as +++ b/src/as/com/threerings/presents/net/DownstreamMessage.as @@ -1,5 +1,7 @@ package com.threerings.presents.net { +import flash.util.trace; + import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; diff --git a/src/as/com/threerings/presents/net/EventNotification.as b/src/as/com/threerings/presents/net/EventNotification.as index c5c894e19..d0f362479 100644 --- a/src/as/com/threerings/presents/net/EventNotification.as +++ b/src/as/com/threerings/presents/net/EventNotification.as @@ -32,7 +32,7 @@ public class EventNotification extends DownstreamMessage return _event; } - public override function toString () :String + public function toString () :String { return "[type=EVT, evt=" + _event + "]"; } diff --git a/src/as/com/threerings/presents/net/FailureResponse.as b/src/as/com/threerings/presents/net/FailureResponse.as index 5dabde136..ff9077773 100644 --- a/src/as/com/threerings/presents/net/FailureResponse.as +++ b/src/as/com/threerings/presents/net/FailureResponse.as @@ -41,6 +41,6 @@ public class FailureResponse extends DownstreamMessage _oid = ins.readInt(); } - protected int _oid; + protected var _oid :int; } } diff --git a/src/as/com/threerings/presents/net/ForwardEventRequest.as b/src/as/com/threerings/presents/net/ForwardEventRequest.as index 2a88ccd59..363a77527 100644 --- a/src/as/com/threerings/presents/net/ForwardEventRequest.as +++ b/src/as/com/threerings/presents/net/ForwardEventRequest.as @@ -56,7 +56,7 @@ public class ForwardEventRequest extends UpstreamMessage _event = ins.readObject(); } - public override function toString () :String + public function toString () :String { return "[type=FWD, evt=" + _event + "]"; } diff --git a/src/as/com/threerings/presents/net/UnsubscribeResponse.as b/src/as/com/threerings/presents/net/UnsubscribeResponse.as index f5f7625e9..97d1d29b9 100644 --- a/src/as/com/threerings/presents/net/UnsubscribeResponse.as +++ b/src/as/com/threerings/presents/net/UnsubscribeResponse.as @@ -40,7 +40,7 @@ public class UnsubscribeResponse extends DownstreamMessage return "[type=UNACK, msgid=" + messageId + ", oid=" + _oid + "]"; } - public function readObject (ins :ObjectInputStream) :void + public override function readObject (ins :ObjectInputStream) :void { super.readObject(ins); _oid = ins.readInt(); diff --git a/src/as/com/threerings/presents/net/UpstreamMessage.as b/src/as/com/threerings/presents/net/UpstreamMessage.as index f24eef8f7..55d280430 100644 --- a/src/as/com/threerings/presents/net/UpstreamMessage.as +++ b/src/as/com/threerings/presents/net/UpstreamMessage.as @@ -1,5 +1,7 @@ package com.threerings.presents.net { +import flash.util.trace; + import com.threerings.io.Streamable; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; diff --git a/src/as/com/threerings/presents/net/UsernamePasswordCreds.as b/src/as/com/threerings/presents/net/UsernamePasswordCreds.as index 3fa2afe6c..b388c5b9a 100644 --- a/src/as/com/threerings/presents/net/UsernamePasswordCreds.as +++ b/src/as/com/threerings/presents/net/UsernamePasswordCreds.as @@ -55,9 +55,9 @@ public class UsernamePasswordCreds extends Credentials } // documentation inherited - protected override function toString (buf :StringBuilder) + protected override function toStringBuf (buf :StringBuilder) { - super.toString(buf); + super.toStringBuf(buf); buf.append(", password=", _password); } diff --git a/src/as/com/threerings/util/Comparable.as b/src/as/com/threerings/util/Comparable.as new file mode 100644 index 000000000..23df1c438 --- /dev/null +++ b/src/as/com/threerings/util/Comparable.as @@ -0,0 +1,7 @@ +package com.threerings.util { + +public interface Comparable +{ + function compareTo (other :Object) :int; +} +} diff --git a/src/as/com/threerings/util/long.as b/src/as/com/threerings/util/long.as index 98501814f..790fedc43 100644 --- a/src/as/com/threerings/util/long.as +++ b/src/as/com/threerings/util/long.as @@ -2,6 +2,8 @@ package com.threerings.util { import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; +import com.threerings.io.Streamable; + /** * TODO: stuff.