Use new Maps factory.
The old HashMap class was a frankenstein one-size-fits-all mess of: - storing simple objects - storing Hashables - having the capability to provide external functions to hash and check equality of any other type of key. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5927 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user