diff --git a/src/as/com/threerings/bureau/client/BureauDirector.as b/src/as/com/threerings/bureau/client/BureauDirector.as index 293e7c9eb..f3e4e672b 100644 --- a/src/as/com/threerings/bureau/client/BureauDirector.as +++ b/src/as/com/threerings/bureau/client/BureauDirector.as @@ -21,7 +21,8 @@ package com.threerings.bureau.client { -import com.threerings.util.HashMap; +import com.threerings.util.Map; +import com.threerings.util.Maps; import com.threerings.util.Log; import com.threerings.presents.client.BasicDirector; @@ -182,8 +183,8 @@ public class BureauDirector extends BasicDirector protected var log :Log = Log.getLog("com.threerings.bureau"); protected var _bureauService :BureauService; - protected var _agents :HashMap = new HashMap(); - protected var _subscribers :HashMap = new HashMap(); + protected var _agents :Map = Maps.newMapOf(int); + protected var _subscribers :Map = Maps.newMapOf(int); } } diff --git a/src/as/com/threerings/crowd/chat/client/ChatDirector.as b/src/as/com/threerings/crowd/chat/client/ChatDirector.as index 5e1941626..eac4057ce 100644 --- a/src/as/com/threerings/crowd/chat/client/ChatDirector.as +++ b/src/as/com/threerings/crowd/chat/client/ChatDirector.as @@ -22,9 +22,9 @@ package com.threerings.crowd.chat.client { import com.threerings.util.ArrayUtil; -import com.threerings.util.HashMap; import com.threerings.util.Log; import com.threerings.util.Map; +import com.threerings.util.Maps; import com.threerings.util.ObserverList; import com.threerings.util.ResultListener; import com.threerings.util.StringUtil; @@ -914,7 +914,7 @@ public class ChatDirector extends BasicDirector */ internal function getCommandHandlers (command :String) :Map { - var matches :Map = new HashMap(); + var matches :Map = Maps.newMapOf(String); var user :BodyObject = (_cctx.getClient().getClientObject() as BodyObject); var keys :Array = _handlers.keys(); for (var ii :int = 0; ii < keys.length; ii++) { @@ -1059,7 +1059,7 @@ public class ChatDirector extends BasicDirector protected var _snoopers :ObserverList = new ObserverList(); /** A mapping from auxiliary chat objects to the types under which they are registered. */ - protected var _auxes :HashMap = new HashMap(); + protected var _auxes :Map = Maps.newMapOf(int); /** Validator of who may be added to the chatters list. */ protected var _chatterValidator :ChatterValidator; @@ -1071,7 +1071,7 @@ public class ChatDirector extends BasicDirector protected var _chatterObservers :ObserverList = new ObserverList(); /** Registered chat command handlers. */ - protected const _handlers :HashMap = new HashMap(); + protected const _handlers :Map = Maps.newMapOf(String); /** A history of chat commands. */ protected const _history :Array = new Array(); diff --git a/src/as/com/threerings/crowd/chat/client/MuteDirector.as b/src/as/com/threerings/crowd/chat/client/MuteDirector.as index 511780a2d..df983d19a 100644 --- a/src/as/com/threerings/crowd/chat/client/MuteDirector.as +++ b/src/as/com/threerings/crowd/chat/client/MuteDirector.as @@ -21,10 +21,11 @@ package com.threerings.crowd.chat.client { -import com.threerings.util.HashSet; import com.threerings.util.MessageBundle; import com.threerings.util.Name; import com.threerings.util.ObserverList; +import com.threerings.util.Set; +import com.threerings.util.Sets; import com.threerings.presents.client.BasicDirector; @@ -152,7 +153,7 @@ public class MuteDirector extends BasicDirector protected var _chatdir :ChatDirector; /** The mutelist. */ - protected var _mutelist :HashSet = new HashSet(); + protected var _mutelist :Set = Sets.newSetOf(Name); /** List of mutelist observers. */ protected var _observers :ObserverList = new ObserverList(ObserverList.FAST_UNSAFE_NOTIFY); diff --git a/src/as/com/threerings/io/ObjectOutputStream.as b/src/as/com/threerings/io/ObjectOutputStream.as index 92734023d..b0fe963bd 100644 --- a/src/as/com/threerings/io/ObjectOutputStream.as +++ b/src/as/com/threerings/io/ObjectOutputStream.as @@ -25,7 +25,8 @@ import flash.utils.ByteArray; import flash.utils.IDataOutput; import com.threerings.util.ClassUtil; -import com.threerings.util.HashMap; +import com.threerings.util.Map; +import com.threerings.util.Maps; import com.threerings.util.Log; import com.threerings.util.Long; import com.threerings.util.Short; @@ -205,6 +206,6 @@ public class ObjectOutputStream protected var _streamer :Streamer; /** A map of classname to ClassMapping info. */ - protected var _classMap :HashMap = new HashMap(); + protected var _classMap :Map = Maps.newMapOf(String); } } diff --git a/src/as/com/threerings/presents/client/ClientDObjectMgr.as b/src/as/com/threerings/presents/client/ClientDObjectMgr.as index 55acea843..c226ff34e 100644 --- a/src/as/com/threerings/presents/client/ClientDObjectMgr.as +++ b/src/as/com/threerings/presents/client/ClientDObjectMgr.as @@ -27,7 +27,8 @@ import flash.utils.Timer; import flash.utils.getTimer; // function import import com.threerings.util.ClassUtil; -import com.threerings.util.HashMap; +import com.threerings.util.Map; +import com.threerings.util.Maps; import com.threerings.util.Log; import com.threerings.presents.dobj.CompoundEvent; @@ -377,19 +378,19 @@ public class ClientDObjectMgr protected var _client :Client; /** All of the distributed objects that are active on this client. */ - protected var _ocache :HashMap = new HashMap(); + protected var _ocache :Map = Maps.newMapOf(int); /** Objects that have been marked for death. */ - protected var _dead :HashMap = new HashMap(); + protected var _dead :Map = Maps.newMapOf(int); /** Pending object subscriptions. */ - protected var _penders :HashMap = new HashMap(); + protected var _penders :Map = Maps.newMapOf(int); /** A mapping from distributed object class to flush delay. */ - protected var _delays :HashMap = new HashMap(); + protected var _delays :Map = Maps.newMapOf(int); /** A set of objects waiting to be flushed. */ - protected var _flushes :HashMap = new HashMap(); + protected var _flushes :Map = Maps.newMapOf(int); /** 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 85ffde1cc..d060b19c5 100644 --- a/src/as/com/threerings/presents/client/InvocationDirector.as +++ b/src/as/com/threerings/presents/client/InvocationDirector.as @@ -25,7 +25,8 @@ import flash.errors.IllegalOperationError; import flash.utils.getTimer; // function import import com.threerings.util.Boxed; -import com.threerings.util.HashMap; +import com.threerings.util.Map; +import com.threerings.util.Maps; import com.threerings.util.Log; import com.threerings.util.Short; @@ -410,10 +411,10 @@ public class InvocationDirector /** Used to keep track of invocation service listeners which will receive responses from * invocation service requests. */ - protected var _listeners :HashMap = new HashMap(); + protected var _listeners :Map = Maps.newMapOf(int); /** Used to keep track of invocation notification receivers. */ - protected var _receivers :HashMap = new HashMap(); + protected var _receivers :Map = Maps.newMapOf(int); /** A count of how deeply nested we are in transaction land. */ protected var _tcount :int; diff --git a/src/as/com/threerings/presents/net/Credentials.as b/src/as/com/threerings/presents/net/Credentials.as index e260eb20c..4f5759913 100644 --- a/src/as/com/threerings/presents/net/Credentials.as +++ b/src/as/com/threerings/presents/net/Credentials.as @@ -45,5 +45,45 @@ public /* abstract */ class Credentials { throw new Error(); // we never read Creds on the client } + + /* + // main + public function toString (joiner :Joiner = null) :String + { + if (joiner == null) { + return toString(new Joiner("ClassName")); + } + return joiner.add("baz", bit, "count", 33).toString(); + } + + // subclass + override public function toString (joiner :Joiner = null) :String + { + if (joiner != null) { + joiner.add("foo", bar); + } + return super.toString(joiner); + } + + + // ----- + + public function toString () :String + { + return join(new Joiner(this)).toString(); + } + + protected function join (joiner :Joiner) :Joiner + { + return joiner.add( + "baz", bit, "count", 33); + } + + override protected join (joiner :Joiner) :Joiner + { + return super.join(joiner).add( + "foo", bar); + } + */ } }