diff --git a/src/as/com/threerings/crowd/chat/client/ChatDirector.as b/src/as/com/threerings/crowd/chat/client/ChatDirector.as index 7a73ea8a5..b3cdf0ac3 100644 --- a/src/as/com/threerings/crowd/chat/client/ChatDirector.as +++ b/src/as/com/threerings/crowd/chat/client/ChatDirector.as @@ -24,8 +24,9 @@ package com.threerings.crowd.chat.client { import mx.collections.ArrayCollection; import com.threerings.util.ArrayUtil; +import com.threerings.util.HashMap; +import com.threerings.util.Map; import com.threerings.util.ResultListener; -import com.threerings.util.SimpleMap; import com.threerings.presents.client.BasicDirector; import com.threerings.presents.client.Client; @@ -308,7 +309,7 @@ public class ChatDirector extends BasicDirector args = StringUtil.trim(text.substring(sidx+1)); } - var possibleCommands :SimpleMap = getCommandHandlers(command); + var possibleCommands :Map = getCommandHandlers(command); switch (possibleCommands.size()) { case 0: return MessageBundle.tcompose( @@ -840,9 +841,9 @@ public class ChatDirector extends BasicDirector * specified command (i.e. the specified command is a prefix of their * registered command string). */ - internal function getCommandHandlers (command :String) :SimpleMap + internal function getCommandHandlers (command :String) :Map { - var matches :SimpleMap = new SimpleMap(); + var matches :Map = new HashMap(); var user :BodyObject = (_cctx.getClient().getClientObject() as BodyObject); var keys :Array = _handlers.keys(); @@ -977,7 +978,7 @@ public class ChatDirector extends BasicDirector /** A mapping from auxiliary chat objects to the types under which * they are registered. */ - protected var _auxes :SimpleMap = new SimpleMap(); + protected var _auxes :HashMap = new HashMap(); // /** Validator of who may be added to the chatters list. */ // protected var _chatterValidator :ChatterValidator; @@ -990,7 +991,7 @@ public class ChatDirector extends BasicDirector // new ObserverList(ObserverList.FAST_UNSAFE_NOTIFY); /** Registered chat command handlers. */ - protected static const _handlers :SimpleMap = new SimpleMap(); + protected static const _handlers :HashMap = new HashMap(); /** A history of chat commands. */ protected static const _history :Array = new Array(); diff --git a/src/as/com/threerings/crowd/chat/client/HelpHandler.as b/src/as/com/threerings/crowd/chat/client/HelpHandler.as index 1cf93b5d2..8c27603d9 100644 --- a/src/as/com/threerings/crowd/chat/client/HelpHandler.as +++ b/src/as/com/threerings/crowd/chat/client/HelpHandler.as @@ -1,7 +1,7 @@ package com.threerings.crowd.chat.client { +import com.threerings.util.Map; import com.threerings.util.MessageBundle; -import com.threerings.util.SimpleMap; import com.threerings.util.StringUtil; import com.threerings.crowd.chat.data.ChatCodes; @@ -34,7 +34,7 @@ public class HelpHandler extends CommandHandler } // handle "/help help" and "/help boguscmd" - var possibleCmds :SimpleMap = _chatdir.getCommandHandlers(hcmd); + var possibleCmds :Map = _chatdir.getCommandHandlers(hcmd); if ((hcmd === "help") || (possibleCmds.size() == 0)) { possibleCmds = _chatdir.getCommandHandlers(""); possibleCmds.remove("help"); // remove help from the list diff --git a/src/as/com/threerings/io/ObjectInputStream.as b/src/as/com/threerings/io/ObjectInputStream.as index bd60097a2..0401abfc0 100644 --- a/src/as/com/threerings/io/ObjectInputStream.as +++ b/src/as/com/threerings/io/ObjectInputStream.as @@ -6,9 +6,6 @@ import flash.utils.ByteArray; import flash.utils.IDataInput; import com.threerings.util.ClassUtil; -import com.threerings.util.SimpleMap; - -//import com.threerings.presents.Log; public class ObjectInputStream { @@ -235,7 +232,6 @@ public class ObjectInputStream - private static var _tempy :int = 0; } } diff --git a/src/as/com/threerings/io/ObjectOutputStream.as b/src/as/com/threerings/io/ObjectOutputStream.as index ed6f60347..6d861dba3 100644 --- a/src/as/com/threerings/io/ObjectOutputStream.as +++ b/src/as/com/threerings/io/ObjectOutputStream.as @@ -4,7 +4,7 @@ import flash.utils.ByteArray; import flash.utils.IDataOutput; import com.threerings.util.ClassUtil; -import com.threerings.util.SimpleMap; +import com.threerings.util.HashMap; public class ObjectOutputStream { @@ -180,6 +180,6 @@ public class ObjectOutputStream protected var _streamer :Streamer; /** A map of classname to ClassMapping info. */ - protected var _classMap :SimpleMap = new SimpleMap(); + protected var _classMap :HashMap = new HashMap(); } } diff --git a/src/as/com/threerings/io/Translations.as b/src/as/com/threerings/io/Translations.as index 3cadc967b..49eb4f2d2 100644 --- a/src/as/com/threerings/io/Translations.as +++ b/src/as/com/threerings/io/Translations.as @@ -1,6 +1,6 @@ package com.threerings.io { -import com.threerings.util.SimpleMap; +import com.threerings.util.HashMap; /** * Maintains a set of translations between actionscript class names @@ -28,10 +28,10 @@ public class Translations } /** A mapping of actionscript names to java names. */ - protected static var _toServer :SimpleMap = new SimpleMap(); + protected static var _toServer :HashMap = new HashMap(); /** A mapping of java names to actionscript names. */ - protected static var _fromServer :SimpleMap = new SimpleMap(); + protected static var _fromServer :HashMap = new HashMap(); // initialize some standard classes addTranslation("Object", "java.lang.Object"); diff --git a/src/as/com/threerings/presents/client/ClientDObjectMgr.as b/src/as/com/threerings/presents/client/ClientDObjectMgr.as index 11f673913..db06072b9 100644 --- a/src/as/com/threerings/presents/client/ClientDObjectMgr.as +++ b/src/as/com/threerings/presents/client/ClientDObjectMgr.as @@ -28,7 +28,7 @@ import flash.utils.Timer; import mx.collections.IList; import com.threerings.util.ClassUtil; -import com.threerings.util.SimpleMap; +import com.threerings.util.HashMap; import com.threerings.presents.dobj.DEvent; import com.threerings.presents.dobj.DObject; @@ -437,19 +437,19 @@ public class ClientDObjectMgr protected var _actions :Array = new Array(); /** All of the distributed objects that are active on this client. */ - protected var _ocache :SimpleMap = new SimpleMap(); //HashIntMap(); + protected var _ocache :HashMap = new HashMap(); /** Objects that have been marked for death. */ - protected var _dead :SimpleMap = new SimpleMap(); //HashIntMap(); + protected var _dead :HashMap = new HashMap(); /** Pending object subscriptions. */ - protected var _penders :SimpleMap = new SimpleMap(); //HashIntMap(); + protected var _penders :HashMap = new HashMap(); /** A mapping from distributed object class to flush delay. */ - protected var _delays :SimpleMap = new SimpleMap(); //HashMap(); + protected var _delays :HashMap = new HashMap(); /** A set of objects waiting to be flushed. */ - protected var _flushes :SimpleMap = new SimpleMap(); //HashIntMap(); + protected var _flushes :HashMap = new HashMap(); /** Flushes objects every now and again. */ protected var _flushInterval :Timer; diff --git a/src/as/com/threerings/presents/client/InvocationDirector.as b/src/as/com/threerings/presents/client/InvocationDirector.as index 12cb2a8d7..10c0bf532 100644 --- a/src/as/com/threerings/presents/client/InvocationDirector.as +++ b/src/as/com/threerings/presents/client/InvocationDirector.as @@ -3,7 +3,7 @@ package com.threerings.presents.client { import mx.collections.IViewCursor; import mx.collections.ArrayCollection; -import com.threerings.util.SimpleMap; +import com.threerings.util.HashMap; import com.threerings.presents.data.ListenerMarshaller; @@ -346,10 +346,10 @@ public class InvocationDirector /** Used to keep track of invocation service listeners which will * receive responses from invocation service requests. */ - protected var _listeners :SimpleMap = new SimpleMap(); + protected var _listeners :HashMap = new HashMap(); /** Used to keep track of invocation notification receivers. */ - protected var _receivers :SimpleMap = new SimpleMap(); + protected var _receivers :HashMap = new HashMap(); /** All registered receivers are maintained in a list so that we can * assign receiver ids to them when we go online. */ diff --git a/src/as/com/threerings/util/Byte.as b/src/as/com/threerings/util/Byte.as index 7faaae9e7..76c3a33f5 100644 --- a/src/as/com/threerings/util/Byte.as +++ b/src/as/com/threerings/util/Byte.as @@ -18,5 +18,11 @@ public class Byte { return (other is Byte) && (value === (other as Byte).value); } + + // documentation inherited + public function toString () :String + { + return "Byte(" + value + ")"; + } } } diff --git a/src/as/com/threerings/util/Hashtable.as b/src/as/com/threerings/util/Hashtable.as index 857247b06..80e25aac5 100644 --- a/src/as/com/threerings/util/Hashtable.as +++ b/src/as/com/threerings/util/Hashtable.as @@ -192,6 +192,7 @@ public class Hashtable return _simpleSize + _entriesSize; } + // documentation inherited from interface Map public function keys () :Array { var keys :Array = new Array(); diff --git a/src/as/com/threerings/util/Map.as b/src/as/com/threerings/util/Map.as index d642bdcd8..642cc514c 100644 --- a/src/as/com/threerings/util/Map.as +++ b/src/as/com/threerings/util/Map.as @@ -26,6 +26,11 @@ public interface Map */ function isEmpty () :Boolean; + /** + * Return all the unique keys in this Map, in Array form. + */ + function keys () :Array; + /** * Store a value in the map associated with the specified key. * Returns the previous value stored for that key, or undefined. diff --git a/src/as/com/threerings/util/MessageManager.as b/src/as/com/threerings/util/MessageManager.as index 363aee735..bd2f08dc6 100644 --- a/src/as/com/threerings/util/MessageManager.as +++ b/src/as/com/threerings/util/MessageManager.as @@ -177,7 +177,7 @@ public class MessageManager // protected var _loader :ClassLoader; /** A cache of instantiated message bundles. */ - protected var _cache :SimpleMap = new SimpleMap(); + protected var _cache :HashMap = new HashMap(); /** Our top-level message bundle, from which others obtain messages if * they can't find them within themselves. */ diff --git a/src/as/com/threerings/util/SimpleMap.as b/src/as/com/threerings/util/SimpleMap.as deleted file mode 100644 index 7b2f0a34e..000000000 --- a/src/as/com/threerings/util/SimpleMap.as +++ /dev/null @@ -1,58 +0,0 @@ -package com.threerings.util { - -/** - * I will likely extend this out to be a fully-featured map. - */ -public class SimpleMap extends Object -{ - public function clear () :void - { - _data = new Object(); - _size = 0; - } - - public function get (key :Object) :Object - { - var skey :String = key.toString(); - return _data[skey]; - } - - public function keys () :Array - { - var arr :Array = new Array(); - for (var skey :String in _data) { - arr.push(skey); - } - return arr; - } - - public function put (key :Object, value :Object) :Object - { - var skey :String = key.toString(); - var oldValue :* = _data[skey]; - _data[skey] = value; - if (oldValue === undefined) { - _size++; - } - return (oldValue as Object); - } - - public function remove (key :Object) :Object - { - var skey :String = key.toString(); - var value :Object = _data[skey]; - delete _data[skey]; - _size--; - return value; - } - - public function size () :int - { - return _size; - } - - protected var _data :Object = new Object(); - - protected var _size :int = 0; -} -}