Well, it compiles.

It's not functional, there are still large holes in the implementation.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3868 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-02-20 03:53:04 +00:00
parent d63ffd9108
commit ea0a3dce06
43 changed files with 178 additions and 103 deletions
@@ -26,7 +26,7 @@ public class ObjectInputStream
_source = source;
}
public function readObject () :*
public function readObject () :Object
//throws IOError
{
try {
@@ -61,7 +61,7 @@ public class ObjectInputStream
}
}
var target :*;
var target :Object;
if (cmap.streamer === null) {
var clazz :Class = flash.util.getClassByName(cmap.classname);
target = new clazz();
@@ -75,15 +75,16 @@ public class ObjectInputStream
} catch (me :MemoryError) {
throw new IOError("out of memory" + me.message);
}
return null; // not reached: compiler dumb
}
public function readBareObject (obj :*) :void
public function readBareObject (obj :Object) :void
//throws IOError
{
readBareObjectImpl(obj, Streamer.getStreamer(obj));
}
protected function readBareObjectImpl (obj :*, streamer :Streamer) :void
protected function readBareObjectImpl (obj :Object, streamer :Streamer) :void
{
// streamable objects
if (streamer == null) {
@@ -105,11 +106,11 @@ public class ObjectInputStream
// TODO: this is the equivalent of marshalling something for which
// we have a basic streamer. Fill out with all the java types
public function readField (clazz :Class) :*
public function readField (clazz :Class) :Object
//throws IOError
{
if (readBoolean()) {
var obj :* = new clazz();
var obj :Object = new clazz();
return readBareObject(obj);
}
return null;
@@ -179,7 +180,7 @@ public class ObjectInputStream
/**
* Used by a Streamer that is reading an array of Streamable instances.
*/
protected function setCurrent (streamer :Streamer, current :*)
protected function setCurrent (streamer :Streamer, current :Object)
{
_streamer = streamer;
_current = current;
@@ -189,7 +190,7 @@ public class ObjectInputStream
protected var _source :IDataInput;
/** The object currently being read from the stream. */
protected var _current :*;
protected var _current :Object;
/** The stramer being used currently. */
protected var _streamer :Streamer;
@@ -15,7 +15,7 @@ public class ObjectOutputStream
_targ = targ;
}
public function writeObject (obj :*) :void
public function writeObject (obj :Object) :void
//throws IOError
{
// if the object to be written is null (or undefined) write a zero
@@ -53,13 +53,13 @@ public class ObjectOutputStream
writeBareObjectImpl(obj, cmap.streamer);
}
public function writeBareObject (obj :*) :void
public function writeBareObject (obj :Object) :void
//throws IOError
{
writeBareObjectImpl(obj, Streamer.getStreamer(obj));
}
protected function writeBareObjectImpl (obj :*, streamer :Streamer)
protected function writeBareObjectImpl (obj :Object, streamer :Streamer)
{
// if it's Streamable, it goes straight through
if (streamer == null) {
@@ -80,7 +80,7 @@ public class ObjectOutputStream
// TODO: this is equivalent to marshalling a field for which there
// is a basic streamer. Work needs doing here.
public function writeField (val :*) :void
public function writeField (val :Object) :void
//throws IOError
{
var b :Boolean = (val != null);
@@ -165,7 +165,7 @@ public class ObjectOutputStream
/**
* Used by a Streamer that is writing an array of Streamable instances.
*/
protected function setCurrent (streamer :Streamer, current :*)
protected function setCurrent (streamer :Streamer, current :Object)
{
_streamer = streamer;
_current = current;
@@ -178,7 +178,7 @@ public class ObjectOutputStream
protected var _nextCode :int = 1;
/** The object currently being written out. */
protected var _current :*;
protected var _current :Object;
/** The streamer being used currently. */
protected var _streamer :Streamer;
+5 -5
View File
@@ -32,7 +32,7 @@ public class Streamer
}
*/
public static function getStreamer (obj :*) :Streamer
public static function getStreamer (obj :Object) :Streamer
{
if (obj is Streamable) {
return null;
@@ -74,7 +74,7 @@ public class Streamer
_jname = jname;
}
public function isStreamerFor (obj :*) :Boolean
public function isStreamerFor (obj :Object) :Boolean
{
return (obj is _targ); // scripting langs are weird
}
@@ -87,7 +87,7 @@ public class Streamer
return _jname;
}
public function writeObject (obj :*, out :ObjectOutputStream) :void
public function writeObject (obj :Object, out :ObjectOutputStream) :void
//throws IOError
{
trace("TODO");
@@ -102,14 +102,14 @@ public class Streamer
}
}
public function createObject (ins :ObjectInputStream) :*
public function createObject (ins :ObjectInputStream) :Object
//throws IOError
{
// actionscript is so fucked up
return new _targ();
}
public function readObject (obj :*, ins :ObjectInputStream) :void
public function readObject (obj :Object, ins :ObjectInputStream) :void
//throws IOError
{
trace("TODO");
@@ -14,12 +14,13 @@ public class ArrayStreamer extends Streamer
super(Array, "[Ljava.lang.Object");
}
public override function createObject (ins :ObjectInputStream) :*
public override function createObject (ins :ObjectInputStream) :Object
{
return new Array(ins.readInt());
}
public override function writeObject (obj :*, out :ObjectOutputStream) :void
public override function writeObject (obj :Object, out :ObjectOutputStream)
:void
{
var arr :Array = (obj as Array);
out.writeInt(arr.length);
@@ -28,7 +29,8 @@ public class ArrayStreamer extends Streamer
}
}
public override function readObject (obj :*, ins :ObjectInputStream) :void
public override function readObject (obj :Object, ins :ObjectInputStream)
:void
{
var arr :Array = (obj as Array);
for (var ii :int = 0; ii < arr.length; ii++) {
@@ -16,21 +16,23 @@ public class ByteArrayStreamer extends Streamer
super(ByteArray, "[B"); // yes, that's the Java class for a byte[].
}
public override function createObject (ins :ObjectInputStream) :*
public override function createObject (ins :ObjectInputStream) :Object
{
var bytes :ByteArray = new ByteArray();
bytes.length = ins.readInt();
return bytes;
}
public override function writeObject (obj :*, out :ObjectOutputStream) :void
public override function writeObject (obj :Object, out :ObjectOutputStream)
:void
{
var bytes :ByteArray = (obj as ByteArray);
out.writeInt(bytes.length);
out.writeBytes(bytes);
}
public override function readObject (obj :*, ins :ObjectInputStream) :void
public override function readObject (obj :Object, ins :ObjectInputStream)
:void
{
var bytes :ByteArray = (obj as ByteArray);
ins.readBytes(bytes, 0, bytes.length);
@@ -14,18 +14,20 @@ public class IntStreamer extends Streamer
super(int, "java.lang.Integer");
}
public override function createObject (ins :ObjectInputStream) :*
public override function createObject (ins :ObjectInputStream) :Object
{
return ins.readInt();
}
public override function writeObject (obj :*, out :ObjectOutputStream) :void
public override function writeObject (obj :Object, out :ObjectOutputStream)
:void
{
var i :int = (obj as int);
out.writeInt(i);
}
public override function readObject (obj :*, ins :ObjectInputStream) :void
public override function readObject (obj :Object, ins :ObjectInputStream)
:void
{
// nothing here, the int is fully read in createObject()
}
@@ -14,18 +14,20 @@ public class NumberStreamer extends Streamer
super(Number, "java.lang.Double");
}
public override function createObject (ins :ObjectInputStream) :*
public override function createObject (ins :ObjectInputStream) :Object
{
return ins.readDouble();
}
public override function writeObject (obj :*, out :ObjectOutputStream) :void
public override function writeObject (obj :Object, out :ObjectOutputStream)
:void
{
var n :Number = (obj as Number);
out.writeDouble(n);
}
public override function readObject (obj :*, ins :ObjectInputStream) :void
public override function readObject (obj :Object, ins :ObjectInputStream)
:void
{
// nothing here, the Number is fully read in createObject()
}
@@ -14,18 +14,20 @@ public class StringStreamer extends Streamer
super(String, "java.lang.String");
}
public override function createObject (ins :ObjectInputStream) :*
public override function createObject (ins :ObjectInputStream) :Object
{
return ins.readUTF();
}
public override function writeObject (obj :*, out :ObjectOutputStream) :void
public override function writeObject (obj :Object, out :ObjectOutputStream)
:void
{
var s :String = (obj as String);
out.writeUTF(s);
}
public override function readObject (obj :*, ins :ObjectInputStream) :void
public override function readObject (obj :Object, ins :ObjectInputStream)
:void
{
// nothing here, the String is fully read in createObject()
}
@@ -99,6 +99,7 @@ public class Client extends EventDispatcher
}
// TODO
return null;
}
public function requireService (clazz :Class) :InvocationService
@@ -44,6 +44,8 @@ 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.SubscribeRequest;
import com.threerings.presents.net.UnsubscribeRequest;
import com.threerings.presents.net.UnsubscribeResponse;
/**
@@ -241,7 +243,7 @@ public class ClientDObjectMgr
var events :IList = (event as CompoundEvent).getEvents();
var ecount :int = events.length;
for (var ii :int = 0; ii < ecount; ii++) {
dispatchEvent(events.getItemAt(ii));
dispatchEvent(events.getItemAt(ii) as DEvent);
}
return;
}
@@ -275,7 +277,7 @@ public class ClientDObjectMgr
target.notifyListeners(event);
}
} catch (e :Exception) {
} catch (e :Error) {
trace("Failure processing event [event=" + event +
", target=" + target + "].");
//Log.logStackTrace(e);
@@ -415,7 +417,7 @@ public class ClientDObjectMgr
protected function flushObjects () :void
{
var now :Number = new Date().getTime();
for (var oid :int in _flushes) {
for (var oid :String in _flushes) {
var rec :FlushRecord = _flushes[oid];
if (rec.expire <= now) {
_flushes[oid] = undefined;
@@ -469,7 +471,8 @@ class ObjectAction
public var subscribe :Boolean;
public function ObjectAction (
oid :int, target :com.threerings.presents.dobj.Subscriber, subscribe :Boolean)
oid :int, target :com.threerings.presents.dobj.Subscriber,
subscribe :Boolean)
{
this.oid = oid;
this.target = target;
@@ -492,7 +495,8 @@ class PendingRequest
this.oid = oid;
}
public function addTarget (target :com.threerings.presents.dobj.Subscriber) :void
public function addTarget (
target :com.threerings.presents.dobj.Subscriber) :void
{
targets.push(target);
}
@@ -507,7 +511,8 @@ class FlushRecord
/** The time at which we flush it. */
public var expire :Number;
public function FlushRecord (obj :com.threerings.presents.dobj.DObject, expire :Number)
public function FlushRecord (
obj :com.threerings.presents.dobj.DObject, expire :Number)
{
this.obj = obj;
this.expire = expire;
@@ -106,7 +106,7 @@ public class Communicator
/**
* Returns the time at which we last sent a packet to the server.
*/
protected function getLastWrite () :Number
internal function getLastWrite () :Number
{
return _lastWrite;
}
@@ -114,7 +114,7 @@ public class Communicator
/**
* Makes a note of the time at which we last communicated with the server.
*/
protected function updateWriteStamp () :void
internal function updateWriteStamp () :void
{
_lastWrite = new Date().getTime();
}
@@ -128,7 +128,8 @@ public class Communicator
// convert the frame data into a message from the server
var frameData :ByteArray = event.getFrameData();
_inStream.setSource(frameData);
var msg :DownstreamMessage = _inStream.readObject();
var msg :DownstreamMessage =
(_inStream.readObject() as DownstreamMessage);
if (frameData.bytesAvailable > 0) {
trace("OMG, we didn't fully read the frame. Surely there's a bug");
}
@@ -56,7 +56,7 @@ public class ClientObject extends DObject
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
receivers = ins.readObject();
receivers = (ins.readObject() as DSet);
}
}
}
@@ -14,7 +14,7 @@ public class AttributeChangedEvent extends NamedEvent
/**
* Returns the new value of the attribute.
*/
public function getValue () :*
public function getValue () :Object
{
return _value;
}
@@ -23,7 +23,7 @@ public class AttributeChangedEvent extends NamedEvent
* Returns the value of the attribute prior to the application of this
* event.
*/
public function getOldValue () :*
public function getOldValue () :Object
{
return _oldValue;
}
@@ -60,7 +60,7 @@ public class AttributeChangedEvent extends NamedEvent
* used).
*/
public function AttributeChangedEvent (
targetOid :int, name :String, value :*, oldValue :*)
targetOid :int, name :String, value :Object, oldValue :Object)
{
super(targetOid, name);
_value = value;
@@ -68,7 +68,7 @@ public class AttributeChangedEvent extends NamedEvent
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is AttributeChangeListener) {
listener.attributeChanged(this);
@@ -83,7 +83,7 @@ public class AttributeChangedEvent extends NamedEvent
buf.append(", value=", _value);
}
protected var _value :*;
protected var _oldValue :* = UNSET_OLD_ENTRY;
protected var _value :Object;
protected var _oldValue :Object = UNSET_OLD_ENTRY;
}
}
@@ -92,7 +92,7 @@ public class CompoundEvent extends DEvent
case 0: // nothing doing
break;
case 1: // no point in being compound
_omgr.postEvent(_events.getItemAt(0));
_omgr.postEvent(_events.getItemAt(0) as DEvent);
break;
default: // now we're talking
_omgr.postEvent(this);
@@ -152,7 +152,7 @@ public class CompoundEvent extends DEvent
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_events = ins.readObject();
_events = (ins.readObject() as StreamableArrayList);
}
/** The object manager that we'll post ourselves to when we're
@@ -32,9 +32,10 @@ public class DEvent
* return true here and short-circuit the normal proxy event dispatch
* mechanism.
*/
public function applyToObject (target :DObject) :void
public function applyToObject (target :DObject) :Boolean
{
trace("TODO: abstract methods?");
return false;
}
/**
@@ -44,7 +45,7 @@ public class DEvent
* AttributeChangedEvent} will notify listeners that implement {@link
* AttributeChangeListener}.
*/
protected function notifyListener (listener :*) :void
internal function notifyListener (listener :Object) :void
{
// the default is to do nothing
}
+55 -3
View File
@@ -24,6 +24,29 @@ public class DObject // extends EventDispatcher
return _omgr;
}
public function addSubscriber (sub :Subscriber) :void
{
if (!_subscribers.contains(sub)) {
_subscribers.addItem(sub);
}
}
public function removeSubscriber (sub :Subscriber) :void
{
var dex :int = _subscribers.getItemIndex(sub);
if (dex != -1) {
_subscribers.removeItemAt(dex);
if (_subscribers.length == 0) {
_omgr.removedLastSubscriber(this, _deathWish);
}
}
}
public function setDestroyOnLastSubscriberRemoved (deathWish :Boolean) :void
{
_deathWish = deathWish;
}
public function addListener (listener :ChangeListener) :void
{
if (_listeners == null) {
@@ -53,7 +76,7 @@ public class DObject // extends EventDispatcher
}
for (var ii :int = 0; ii < _listeners.length; ii++) {
var listener :* = _listeners.getItemAt(ii);
var listener :Object = _listeners.getItemAt(ii);
try {
event.notifyListener(listener);
@@ -83,6 +106,31 @@ public class DObject // extends EventDispatcher
}
}
public function startTransaction () :void
{
// TODO
}
public function commitTransaction () :void
{
// TODO
}
public function inTransaction () :Boolean
{
return false; // TODO
}
public function cancelTransaction () :void
{
// TODO
}
internal function clearTransaction () :void
{
// TODO
}
public function isActive () :Boolean
{
return (_omgr != null);
@@ -106,7 +154,7 @@ public class DObject // extends EventDispatcher
* called.
*/
protected function requestAttributeChange (
name :String, value :*, oldValue :*) :void
name :String, value :Object, oldValue :Object) :void
{
postEvent(new AttributeChangedEvent(_oid, name, value, oldValue));
}
@@ -116,7 +164,7 @@ public class DObject // extends EventDispatcher
* called.
*/
protected function requestElementUpdate (
name :String, index :int, value :*, oldValue :*) :void
name :String, index :int, value :Object, oldValue :Object) :void
{
// dispatch an attribute changed event
postEvent(new ElementUpdatedEvent(_oid, name, value, oldValue, index));
@@ -186,5 +234,9 @@ public class DObject // extends EventDispatcher
/** Our event listeners. */
protected var _listeners :ArrayCollection;
protected var _subscribers :ArrayCollection;
protected var _deathWish :Boolean = false;
}
}
+5 -5
View File
@@ -158,7 +158,7 @@ public class DSet
* @return true if the entry was added, false if it was already in
* the set.
*/
protected function add (elem :DSetEntry) :Boolean
internal function add (elem :DSetEntry) :Boolean
{
if (contains(elem)) {
trace("Refusing to add duplicate entry [set=" + this +
@@ -179,7 +179,7 @@ public class DSet
* @return true if the entry was removed, false if it was not in the
* set.
*/
protected function remove (elem :DSetEntry) :Boolean
internal function remove (elem :DSetEntry) :Boolean
{
return (null != removeKey(elem.getKey()));
}
@@ -193,7 +193,7 @@ public class DSet
* @return the old matching entry if found and removed, null if not
* found.
*/
protected function removeKey (key :Comparable) :DSetEntry
internal function removeKey (key :Comparable) :DSetEntry
{
// o(n) for now
// TODO
@@ -217,7 +217,7 @@ public class DSet
* @return the old entry that was replaced, or null if it was not
* found (in which case nothing is updated).
*/
protected function update (elem :DSetEntry) :DSetEntry
internal function update (elem :DSetEntry) :DSetEntry
{
var key :Comparable = elem.getKey();
for (var ii :int = 0; ii < _entries.length; ii++) {
@@ -250,7 +250,7 @@ public class DSet
// documentation inherited from interface Streamable
public function readObject (ins :ObjectInputStream) :void
{
_entries = ins.readField(Array);
_entries = (ins.readObject() as Array);
_entries.length = ins.readInt(); // then read the length and limit it
}
@@ -31,7 +31,8 @@ public class ElementUpdatedEvent extends NamedEvent
* @param index the index in the array of the updated element.
*/
public function ElementUpdatedEvent (
targetOid :int, name :String, value :*, oldValue :*, index :int)
targetOid :int, name :String, value :Object, oldValue :Object,
index :int)
{
super(targetOid, name);
_value = value;
@@ -42,7 +43,7 @@ public class ElementUpdatedEvent extends NamedEvent
/**
* Returns the new value of the element.
*/
public function getValue () :*
public function getValue () :Object
{
return _value;
}
@@ -51,7 +52,7 @@ public class ElementUpdatedEvent extends NamedEvent
* Returns the value of the element prior to the application of this
* event.
*/
public function getOldValue () :*
public function getOldValue () :Object
{
return _oldValue;
}
@@ -89,12 +90,12 @@ public class ElementUpdatedEvent extends NamedEvent
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_value = ins.readObjct();
_value = ins.readObject();
_index = ins.readInt();
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is ElementUpdateListener) {
listener.elementUpdated(this);
@@ -110,8 +111,8 @@ public class ElementUpdatedEvent extends NamedEvent
buf.append(", index=", _index);
}
protected var _value :*;
protected var _value :Object;
protected var _index :int;
protected var _oldValue :* = UNSET_OLD_ENTRY;
protected var _oldValue :Object = UNSET_OLD_ENTRY;
}
}
@@ -54,7 +54,7 @@ public class EntryAddedEvent extends NamedEvent
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is SetListener) {
listener.entryAdded(this);
@@ -62,7 +62,7 @@ public class EntryAddedEvent extends NamedEvent
}
// documentation inherited
protected override function toStringBuf (buf :StringBuilder)
protected override function toStringBuf (buf :StringBuilder) :void
{
buf.append("ELADD:");
super.toStringBuf(buf);
@@ -78,7 +78,7 @@ public class EntryAddedEvent extends NamedEvent
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_entry = ins.readObject();
_entry = (ins.readObject() as DSetEntry);
}
protected var _entry :DSetEntry;
@@ -66,7 +66,7 @@ public class EntryRemovedEvent extends NamedEvent
if (_oldEntry == null) {
// complain if there was actually nothing there
trace("No matching entry to remove [key=" + _key +
", set=" + set + "].");
", set=" + dset + "].");
return false;
}
}
@@ -74,7 +74,7 @@ public class EntryRemovedEvent extends NamedEvent
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is SetListener) {
listener.entryRemoved(this);
@@ -82,7 +82,7 @@ public class EntryRemovedEvent extends NamedEvent
}
// documentation inherited
protected override function toStringBuf (buf :StringBuilder)
protected override function toStringBuf (buf :StringBuilder) :void
{
buf.append("ELREM:");
super.toStringBuf(buf);
@@ -98,7 +98,7 @@ public class EntryRemovedEvent extends NamedEvent
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_key = ins.readObject();
_key = (ins.readObject() as Comparable);
}
protected var _key :Comparable;
@@ -73,7 +73,7 @@ public class EntryUpdatedEvent extends NamedEvent
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is SetListener) {
listener.entryUpdated(this);
@@ -97,7 +97,7 @@ public class EntryUpdatedEvent extends NamedEvent
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_entry = ins.readObject();
_entry = (ins.readObject() as DSetEntry);
}
protected var _entry :DSetEntry;
@@ -61,7 +61,7 @@ public class MessageEvent extends NamedEvent
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is MessageListener) {
listener.messageReceived(this);
@@ -47,7 +47,7 @@ public class NamedEvent extends DEvent
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_name = ins.readField(String);
_name = (ins.readField(String) as String);
}
/** The name of the event. */
@@ -42,7 +42,7 @@ public class ObjectAddedEvent extends NamedEvent
/**
* Applies this event to the object.
*/
public override function applyToObject (target :DObject) :void
public override function applyToObject (target :DObject) :Boolean
//throws ObjectAccessException
{
var list :OidList = target[_name];
@@ -51,7 +51,7 @@ public class ObjectAddedEvent extends NamedEvent
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is OidListListener) {
listener.objectAdded(this);
@@ -53,7 +53,7 @@ public class ObjectDestroyedEvent extends DEvent
}
// documentation inherited
protected override function notifyListener (listener :Object) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is ObjectDeathListener) {
listener.objectDestroyed(this);
@@ -74,7 +74,7 @@ public class ObjectRemovedEvent extends NamedEvent
}
// documentation inherited
protected override function notifyListener (listener :*) :void
internal override function notifyListener (listener :Object) :void
{
if (listener is OidListListener) {
listener.objectRemoved(this);
@@ -1,6 +1,7 @@
package com.threerings.presents.dobj {
import flash.util.trace;
import flash.util.StringBuilder;
import com.threerings.io.Streamable;
@@ -24,8 +24,8 @@ public class AuthRequest extends UpstreamMessage
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_creds = ins.readObject();
_version = ins.readField(String);
_creds = (ins.readObject() as Credentials);
_version = (ins.readField(String) as String);
}
protected var _creds :Credentials;
@@ -13,7 +13,7 @@ public class AuthResponse extends DownstreamMessage
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_data = ins.readObject();
_data = (ins.readObject() as AuthResponseData);
}
protected var _data :AuthResponseData;
@@ -25,7 +25,7 @@ public class AuthResponseData extends DObject
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
code = ins.readField(String);
code = (ins.readField(String) as String);
}
}
}
@@ -34,7 +34,7 @@ public class BootstrapData
public function readObject (ins :ObjectInputStream) :void
{
clientOid = ins.readInt();
services = ins.readObject();
services = (ins.readObject() as StreamableArrayList);
}
}
}
@@ -12,7 +12,7 @@ public class BootstrapNotification extends DownstreamMessage
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_data = ins.readObject();
_data = (ins.readObject() as BootstrapData);
}
/** The data associated with this notification. */
@@ -22,7 +22,7 @@ public class Credentials
public function readObject (ins :ObjectInputStream) :void
//throws IOError
{
_username = ins.readObject();
_username = (ins.readObject() as Name);
}
/** The username. */
@@ -40,7 +40,7 @@ public class EventNotification extends DownstreamMessage
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_event = ins.readObject();
_event = (ins.readObject() as DEvent);
}
/** The event which we are forwarding. */
@@ -53,7 +53,7 @@ public class ForwardEventRequest extends UpstreamMessage
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_event = ins.readObject();
_event = (ins.readObject() as DEvent);
}
public function toString () :String
@@ -40,7 +40,7 @@ public class ObjectResponse extends DownstreamMessage
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_dobj = ins.readObject();
_dobj = (ins.readObject() as DObject);
}
/** The object which is associated with this response. */
@@ -20,7 +20,7 @@ public class PingRequest extends UpstreamMessage
}
// documentation inherited
public override function writeObject (out :ObjectOutputStream)
public override function writeObject (out :ObjectOutputStream) :void
{
_packStamp = new Date().getTime();
super.writeObject(out);
@@ -28,13 +28,13 @@ public class PongResponse extends DownstreamMessage
return _unpackStamp;
}
public override function readObject (ins :ObjectInputStream)
public override function readObject (ins :ObjectInputStream) :void
{
_unpackStamp = new Date().getTime();
super.readObject(ins);
// TODO: Figure out how we're really going to cope with longs
_packStamp = new long();
_packStamp = new long(0);
_packStamp.readObject(ins);
_processDelay = ins.readInt();
@@ -42,7 +42,7 @@ public class SubscribeRequest extends UpstreamMessage
return _oid;
}
public override function toString () :String
public function toString () :String
{
return "[type=SUB, msgid=" + messageId + ", oid=" + _oid + "]";
}
@@ -47,7 +47,7 @@ public class UnsubscribeRequest extends UpstreamMessage
return "[type=UNSUB, msgid=" + messageId + ", oid=" + _oid + "]";
}
public function writeObject (out :ObjectOutputStream) :void
public override function writeObject (out :ObjectOutputStream) :void
{
super.writeObject(out);
out.writeInt(_oid);
@@ -6,6 +6,8 @@ import com.threerings.io.Streamable;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.util.JavaConstants;
public class UpstreamMessage
implements Streamable
{
+2 -2
View File
@@ -2,12 +2,12 @@ package com.threerings.util {
public class ClassUtil
{
public static function getClassName (obj :*) :String
public static function getClassName (obj :Object) :String
{
return flash.util.getQualifiedClassName(obj).replace("::", ".");
}
public static function getClass (obj :*) :Class
public static function getClass (obj :Object) :Class
{
return flash.util.getClassByName(getClassName(obj));
}
+1 -1
View File
@@ -56,7 +56,7 @@ public class Name extends Object
public function readObject (ins :ObjectInputStream) :void
//throws IOError
{
_name = ins.readField(String);
_name = (ins.readField(String) as String);
}
protected function normalize (txt :String) :String