A healthy dash of google-collections
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5798 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -23,6 +23,8 @@ package com.threerings.admin.client;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.client.ClientAdapter;
|
import com.threerings.presents.client.ClientAdapter;
|
||||||
import com.threerings.presents.dobj.DObjectManager;
|
import com.threerings.presents.dobj.DObjectManager;
|
||||||
@@ -41,7 +43,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
|
|||||||
{
|
{
|
||||||
public ConfigObjectManager (Client client)
|
public ConfigObjectManager (Client client)
|
||||||
{
|
{
|
||||||
_serverconfig = new HashMap<String, ConfigObject>();
|
_serverconfig = Maps.newHashMap();
|
||||||
_client = client;
|
_client = client;
|
||||||
_client.addClientObserver(new ClientAdapter() {
|
_client.addClientObserver(new ClientAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -57,8 +59,8 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
|
|||||||
@Override
|
@Override
|
||||||
public void clientDidLogoff (Client client) {
|
public void clientDidLogoff (Client client) {
|
||||||
// Clean up our subscription to the server's configuration
|
// Clean up our subscription to the server's configuration
|
||||||
for (int ii = 0; ii < _csubscribers.length; ii++) {
|
for (ConfigObjectSubscriber _csubscriber : _csubscribers) {
|
||||||
_csubscribers[ii].cleanup();
|
_csubscriber.cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.io.ByteArrayOutInputStream;
|
import com.samskivert.io.ByteArrayOutInputStream;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
@@ -412,7 +414,7 @@ public abstract class ConfigRegistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A mapping from identifying key to config object. */
|
/** A mapping from identifying key to config object. */
|
||||||
protected HashMap<String, ObjectRecord> _configs = new HashMap<String, ObjectRecord>();
|
protected HashMap<String, ObjectRecord> _configs = Maps.newHashMap();
|
||||||
|
|
||||||
/** If we need to transition serialized Streamables to a new class format in init.. */
|
/** If we need to transition serialized Streamables to a new class format in init.. */
|
||||||
protected boolean _transitioning;
|
protected boolean _transitioning;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ package com.threerings.admin.server;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
@@ -134,7 +135,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
|
|||||||
_data = _repo.loadConfig(_node, _path);
|
_data = _repo.loadConfig(_node, _path);
|
||||||
} catch (DatabaseException pe) {
|
} catch (DatabaseException pe) {
|
||||||
log.warning("Failed to load object configuration", "path", _path, pe);
|
log.warning("Failed to load object configuration", "path", _path, pe);
|
||||||
_data = new HashMap<String, String>();
|
_data = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.init();
|
super.init();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ package com.threerings.admin.server;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ public class PeeredDatabaseConfigRegistry extends DatabaseConfigRegistry
|
|||||||
PEER_CACHE_PREFIX + _path, new StreamableTuple<String, Object>(field, value));
|
PEER_CACHE_PREFIX + _path, new StreamableTuple<String, Object>(field, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArrayList<String> _pendingSyncs = new ArrayList<String>();
|
protected ArrayList<String> _pendingSyncs = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PeerManager _peermgr;
|
protected PeerManager _peermgr;
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ package com.threerings.admin.server.persist;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.depot.DepotRepository;
|
import com.samskivert.depot.DepotRepository;
|
||||||
import com.samskivert.depot.PersistenceContext;
|
import com.samskivert.depot.PersistenceContext;
|
||||||
import com.samskivert.depot.PersistentRecord;
|
import com.samskivert.depot.PersistentRecord;
|
||||||
@@ -49,7 +51,7 @@ public class ConfigRepository extends DepotRepository
|
|||||||
*/
|
*/
|
||||||
public HashMap<String, String> loadConfig (String node, String object)
|
public HashMap<String, String> loadConfig (String node, String object)
|
||||||
{
|
{
|
||||||
HashMap<String, String> data = new HashMap<String, String>();
|
HashMap<String, String> data = Maps.newHashMap();
|
||||||
Where where = new Where(ConfigRecord.OBJECT, object, ConfigRecord.NODE, node);
|
Where where = new Where(ConfigRecord.OBJECT, object, ConfigRecord.NODE, node);
|
||||||
for (ConfigRecord record : findAll(ConfigRecord.class, where)) {
|
for (ConfigRecord record : findAll(ConfigRecord.class, where)) {
|
||||||
data.put(record.field, record.value);
|
data.put(record.field, record.value);
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ import java.util.StringTokenizer;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.Collections;
|
import com.samskivert.util.Collections;
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
@@ -950,7 +953,7 @@ public class ChatDirector extends BasicDirector
|
|||||||
*/
|
*/
|
||||||
protected HashMap<String, CommandHandler> getCommandHandlers (String command)
|
protected HashMap<String, CommandHandler> getCommandHandlers (String command)
|
||||||
{
|
{
|
||||||
HashMap<String, CommandHandler> matches = new HashMap<String, CommandHandler>();
|
HashMap<String, CommandHandler> matches = Maps.newHashMap();
|
||||||
BodyObject user = (BodyObject)_ctx.getClient().getClientObject();
|
BodyObject user = (BodyObject)_ctx.getClient().getClientObject();
|
||||||
for (Map.Entry<String, CommandHandler> entry : _handlers.entrySet()) {
|
for (Map.Entry<String, CommandHandler> entry : _handlers.entrySet()) {
|
||||||
String cmd = entry.getKey();
|
String cmd = entry.getKey();
|
||||||
@@ -1436,11 +1439,10 @@ public class ChatDirector extends BasicDirector
|
|||||||
protected DisplayMessageOp _displayMessageOp = new DisplayMessageOp();
|
protected DisplayMessageOp _displayMessageOp = new DisplayMessageOp();
|
||||||
|
|
||||||
/** Registered chat command handlers. */
|
/** Registered chat command handlers. */
|
||||||
protected static HashMap<String, CommandHandler> _handlers =
|
protected static HashMap<String, CommandHandler> _handlers = Maps.newHashMap();
|
||||||
new HashMap<String, CommandHandler>();
|
|
||||||
|
|
||||||
/** A history of chat commands. */
|
/** A history of chat commands. */
|
||||||
protected static ArrayList<String> _history = new ArrayList<String>();
|
protected static ArrayList<String> _history = Lists.newArrayList();
|
||||||
|
|
||||||
/** The maximum number of chatter usernames to track. */
|
/** The maximum number of chatter usernames to track. */
|
||||||
protected static final int MAX_CHATTERS = 6;
|
protected static final int MAX_CHATTERS = 6;
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package com.threerings.crowd.chat.client;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.CollectionUtil;
|
import com.samskivert.util.CollectionUtil;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
|
|
||||||
@@ -183,7 +185,7 @@ public class MuteDirector extends BasicDirector
|
|||||||
protected ChatDirector _chatdir;
|
protected ChatDirector _chatdir;
|
||||||
|
|
||||||
/** The mutelist. */
|
/** The mutelist. */
|
||||||
protected HashSet<Name> _mutelist = new HashSet<Name>();
|
protected HashSet<Name> _mutelist = Sets.newHashSet();
|
||||||
|
|
||||||
/** List of mutelist observers. */
|
/** List of mutelist observers. */
|
||||||
protected ObserverList<MuteObserver> _observers =
|
protected ObserverList<MuteObserver> _observers =
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.swing.Controller;
|
import com.samskivert.swing.Controller;
|
||||||
|
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
@@ -250,7 +252,7 @@ public abstract class PlaceController extends Controller
|
|||||||
protected void addDelegate (PlaceControllerDelegate delegate)
|
protected void addDelegate (PlaceControllerDelegate delegate)
|
||||||
{
|
{
|
||||||
if (_delegates == null) {
|
if (_delegates == null) {
|
||||||
_delegates = new ArrayList<PlaceControllerDelegate>();
|
_delegates = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
_delegates.add(delegate);
|
_delegates.add(delegate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import java.util.RandomAccess;
|
|||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code to read and write basic object types (like arrays of primitives, {@link Integer} instances,
|
* Code to read and write basic object types (like arrays of primitives, {@link Integer} instances,
|
||||||
* {@link Double} instances, etc.).
|
* {@link Double} instances, etc.).
|
||||||
@@ -562,7 +564,7 @@ public class BasicStreamers
|
|||||||
throws IOException, ClassNotFoundException
|
throws IOException, ClassNotFoundException
|
||||||
{
|
{
|
||||||
int ecount = ins.readInt();
|
int ecount = ins.readInt();
|
||||||
ArrayList<Object> list = new ArrayList<Object>(ecount);
|
ArrayList<Object> list = Lists.newArrayListWithCapacity(ecount);
|
||||||
for (int ii = 0; ii < ecount; ii++) {
|
for (int ii = 0; ii < ecount; ii++) {
|
||||||
list.add(ins.readObject());
|
list.add(ins.readObject());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import java.lang.reflect.ReflectPermission;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import static com.threerings.NaryaLog.log;
|
import static com.threerings.NaryaLog.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,7 +224,7 @@ public abstract class FieldMarshaller
|
|||||||
protected static void createMarshallers ()
|
protected static void createMarshallers ()
|
||||||
{
|
{
|
||||||
// create our table
|
// create our table
|
||||||
_marshallers = new HashMap<Class<?>, FieldMarshaller>();
|
_marshallers = Maps.newHashMap();
|
||||||
|
|
||||||
// create a generic marshaller for streamable instances
|
// create a generic marshaller for streamable instances
|
||||||
FieldMarshaller gmarsh = new FieldMarshaller() {
|
FieldMarshaller gmarsh = new FieldMarshaller() {
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ import java.io.DataInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import static com.threerings.NaryaLog.log;
|
import static com.threerings.NaryaLog.log;
|
||||||
@@ -64,7 +67,7 @@ public class ObjectInputStream extends DataInputStream
|
|||||||
public void addTranslation (String oldname, String newname)
|
public void addTranslation (String oldname, String newname)
|
||||||
{
|
{
|
||||||
if (_translations == null) {
|
if (_translations == null) {
|
||||||
_translations = new HashMap<String, String>();
|
_translations = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
_translations.put(oldname, newname);
|
_translations.put(oldname, newname);
|
||||||
}
|
}
|
||||||
@@ -108,7 +111,7 @@ public class ObjectInputStream extends DataInputStream
|
|||||||
{
|
{
|
||||||
// create our intern map if necessary
|
// create our intern map if necessary
|
||||||
if (_internmap == null) {
|
if (_internmap == null) {
|
||||||
_internmap = new ArrayList<String>();
|
_internmap = Lists.newArrayList();
|
||||||
// insert a zeroth element
|
// insert a zeroth element
|
||||||
_internmap.add(null);
|
_internmap.add(null);
|
||||||
}
|
}
|
||||||
@@ -168,7 +171,7 @@ public class ObjectInputStream extends DataInputStream
|
|||||||
{
|
{
|
||||||
// create our classmap if necessary
|
// create our classmap if necessary
|
||||||
if (_classmap == null) {
|
if (_classmap == null) {
|
||||||
_classmap = new ArrayList<ClassMapping>();
|
_classmap = Lists.newArrayList();
|
||||||
// insert a zeroth element
|
// insert a zeroth element
|
||||||
_classmap.add(null);
|
_classmap.add(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,13 +21,14 @@
|
|||||||
|
|
||||||
package com.threerings.io;
|
package com.threerings.io;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import static com.threerings.NaryaLog.log;
|
import static com.threerings.NaryaLog.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,7 +54,7 @@ public class ObjectOutputStream extends DataOutputStream
|
|||||||
public void addTranslation (String className, String streamedName)
|
public void addTranslation (String className, String streamedName)
|
||||||
{
|
{
|
||||||
if (_translations == null) {
|
if (_translations == null) {
|
||||||
_translations = new HashMap<String, String>();
|
_translations = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
_translations.put(className, streamedName);
|
_translations.put(className, streamedName);
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,7 @@ public class ObjectOutputStream extends DataOutputStream
|
|||||||
|
|
||||||
// create our intern map if necessary
|
// create our intern map if necessary
|
||||||
if (_internmap == null) {
|
if (_internmap == null) {
|
||||||
_internmap = new HashMap<String, Short>();
|
_internmap = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// look up the intern mapping record
|
// look up the intern mapping record
|
||||||
@@ -163,7 +164,7 @@ public class ObjectOutputStream extends DataOutputStream
|
|||||||
{
|
{
|
||||||
// create our classmap if necessary
|
// create our classmap if necessary
|
||||||
if (_classmap == null) {
|
if (_classmap == null) {
|
||||||
_classmap = new HashMap<Class<?>, ClassMapping>();
|
_classmap = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// look up the class mapping record
|
// look up the class mapping record
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import java.security.AccessController;
|
|||||||
import java.security.PrivilegedActionException;
|
import java.security.PrivilegedActionException;
|
||||||
import java.security.PrivilegedExceptionAction;
|
import java.security.PrivilegedExceptionAction;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -39,6 +38,7 @@ import java.io.IOException;
|
|||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.ClassUtil;
|
import com.samskivert.util.ClassUtil;
|
||||||
|
|
||||||
@@ -482,7 +482,7 @@ public class Streamer
|
|||||||
*/
|
*/
|
||||||
protected static void createStreamers ()
|
protected static void createStreamers ()
|
||||||
{
|
{
|
||||||
_streamers = new HashMap<Class<?>, Streamer>();
|
_streamers = Maps.newHashMap();
|
||||||
|
|
||||||
// register all of the basic streamers
|
// register all of the basic streamers
|
||||||
int bscount = BasicStreamers.BSTREAMER_TYPES.length;
|
int bscount = BasicStreamers.BSTREAMER_TYPES.length;
|
||||||
@@ -491,7 +491,7 @@ public class Streamer
|
|||||||
BasicStreamers.BSTREAMER_INSTANCES[ii]);
|
BasicStreamers.BSTREAMER_INSTANCES[ii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used to coerce the type system into quietude when reading enums from the wire. */
|
/** Used to coerce the type system into quietude when reading enums from the wire. */
|
||||||
protected static enum EnumReader { NOT_USED };
|
protected static enum EnumReader { NOT_USED };
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,13 @@
|
|||||||
package com.threerings.io;
|
package com.threerings.io;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends {@link ObjectOutputStream} for use in unreliable channels, where we must transmit class
|
* Extends {@link ObjectOutputStream} for use in unreliable channels, where we must transmit class
|
||||||
* mappings with every object until we are explicitly notified that the receiver has cached the
|
* mappings with every object until we are explicitly notified that the receiver has cached the
|
||||||
@@ -193,8 +194,8 @@ public class UnreliableObjectOutputStream extends ObjectOutputStream
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The set of classes for which we have written mappings. */
|
/** The set of classes for which we have written mappings. */
|
||||||
protected Set<Class<?>> _mappedClasses = new HashSet<Class<?>>();
|
protected Set<Class<?>> _mappedClasses = Sets.newHashSet();
|
||||||
|
|
||||||
/** The set of pooled strings for which we have written mappings. */
|
/** The set of pooled strings for which we have written mappings. */
|
||||||
protected Set<String> _mappedInterns = new HashSet<String>();
|
protected Set<String> _mappedInterns = Sets.newHashSet();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package com.threerings.presents.client;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
import com.samskivert.util.RunAnywhere;
|
import com.samskivert.util.RunAnywhere;
|
||||||
@@ -995,7 +997,7 @@ public class Client
|
|||||||
protected BootstrapData _bstrap;
|
protected BootstrapData _bstrap;
|
||||||
|
|
||||||
/** The set of bootstrap service groups this client cares about. */
|
/** The set of bootstrap service groups this client cares about. */
|
||||||
protected HashSet<String> _bootGroups = new HashSet<String>(); {
|
protected HashSet<String> _bootGroups = Sets.newHashSet(); {
|
||||||
_bootGroups.add(InvocationCodes.GLOBAL_GROUP);
|
_bootGroups.add(InvocationCodes.GLOBAL_GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.DebugChords;
|
import com.samskivert.util.DebugChords;
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.IntMap;
|
import com.samskivert.util.IntMap;
|
||||||
@@ -491,7 +494,7 @@ public class ClientDObjectMgr
|
|||||||
protected static final class PendingRequest<T extends DObject>
|
protected static final class PendingRequest<T extends DObject>
|
||||||
{
|
{
|
||||||
public int oid;
|
public int oid;
|
||||||
public ArrayList<Subscriber<T>> targets = new ArrayList<Subscriber<T>>();
|
public ArrayList<Subscriber<T>> targets = Lists.newArrayList();
|
||||||
|
|
||||||
public PendingRequest (int oid)
|
public PendingRequest (int oid)
|
||||||
{
|
{
|
||||||
@@ -542,7 +545,7 @@ public class ClientDObjectMgr
|
|||||||
protected HashIntMap<PendingRequest<?>> _penders = new HashIntMap<PendingRequest<?>>();
|
protected HashIntMap<PendingRequest<?>> _penders = new HashIntMap<PendingRequest<?>>();
|
||||||
|
|
||||||
/** A mapping from distributed object class to flush delay. */
|
/** A mapping from distributed object class to flush delay. */
|
||||||
protected HashMap<Class<?>, Long> _delays = new HashMap<Class<?>, Long>();
|
protected HashMap<Class<?>, Long> _delays = Maps.newHashMap();
|
||||||
|
|
||||||
/** A set of objects waiting to be flushed. */
|
/** A set of objects waiting to be flushed. */
|
||||||
protected HashIntMap<FlushRecord> _flushes = new HashIntMap<FlushRecord>();
|
protected HashIntMap<FlushRecord> _flushes = new HashIntMap<FlushRecord>();
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ package com.threerings.presents.client;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
import com.threerings.presents.client.InvocationReceiver.Registration;
|
import com.threerings.presents.client.InvocationReceiver.Registration;
|
||||||
@@ -424,7 +426,7 @@ public class InvocationDirector
|
|||||||
|
|
||||||
/** All registered receivers are maintained in a list so that we can assign receiver ids to
|
/** All registered receivers are maintained in a list so that we can assign receiver ids to
|
||||||
* them when we go online. */
|
* them when we go online. */
|
||||||
protected ArrayList<InvocationDecoder> _reclist = new ArrayList<InvocationDecoder>();
|
protected ArrayList<InvocationDecoder> _reclist = Lists.newArrayList();
|
||||||
|
|
||||||
/** The last time we flushed our listeners. */
|
/** The last time we flushed our listeners. */
|
||||||
protected long _lastFlushTime;
|
protected long _lastFlushTime;
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import java.lang.reflect.Method;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.MethodFinder;
|
import com.samskivert.util.MethodFinder;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
@@ -139,5 +141,5 @@ public class DynamicListener<T extends DSet.Entry>
|
|||||||
protected MethodFinder _finder;
|
protected MethodFinder _finder;
|
||||||
|
|
||||||
/** A cache of already resolved methods. */
|
/** A cache of already resolved methods. */
|
||||||
protected HashMap<String, Method> _mcache = new HashMap<String, Method>();
|
protected HashMap<String, Method> _mcache = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import java.lang.reflect.Proxy;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.client.InvocationService;
|
import com.threerings.presents.client.InvocationService;
|
||||||
import com.threerings.presents.server.InvocationProvider;
|
import com.threerings.presents.server.InvocationProvider;
|
||||||
@@ -70,5 +72,5 @@ public class PeerUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Maps provider interface methods to service interface methods. */
|
/** Maps provider interface methods to service interface methods. */
|
||||||
protected static HashMap<Method, Method> _pmethods = new HashMap<Method, Method>();
|
protected static HashMap<Method, Method> _pmethods = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package com.threerings.presents.server;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.threerings.presents.client.TimeBaseService.GotTimeBaseListener;
|
import com.threerings.presents.client.TimeBaseService.GotTimeBaseListener;
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.data.TimeBaseCodes;
|
import com.threerings.presents.data.TimeBaseCodes;
|
||||||
@@ -91,8 +93,7 @@ public class TimeBaseProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Used to keep track of our time base objects. */
|
/** Used to keep track of our time base objects. */
|
||||||
protected static HashMap<String,TimeBaseObject> _timeBases =
|
protected static HashMap<String,TimeBaseObject> _timeBases = Maps.newHashMap();
|
||||||
new HashMap<String,TimeBaseObject>();
|
|
||||||
|
|
||||||
/** The invocation manager with which we interoperate. */
|
/** The invocation manager with which we interoperate. */
|
||||||
protected static InvocationManager _invmgr;
|
protected static InvocationManager _invmgr;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import java.io.FileReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.util.ActionScript;
|
import com.threerings.util.ActionScript;
|
||||||
@@ -116,25 +118,25 @@ public class ActionScriptSource
|
|||||||
|
|
||||||
public String[] implementedInterfaces;
|
public String[] implementedInterfaces;
|
||||||
|
|
||||||
public ArrayList<Member> publicConstants = new ArrayList<Member>();
|
public ArrayList<Member> publicConstants = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> publicFields = new ArrayList<Member>();
|
public ArrayList<Member> publicFields = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> publicStaticMethods = new ArrayList<Member>();
|
public ArrayList<Member> publicStaticMethods = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> publicConstructors = new ArrayList<Member>();
|
public ArrayList<Member> publicConstructors = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> publicMethods = new ArrayList<Member>();
|
public ArrayList<Member> publicMethods = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> protectedConstructors = new ArrayList<Member>();
|
public ArrayList<Member> protectedConstructors = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> protectedMethods = new ArrayList<Member>();
|
public ArrayList<Member> protectedMethods = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> protectedStaticMethods = new ArrayList<Member>();
|
public ArrayList<Member> protectedStaticMethods = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> protectedFields = new ArrayList<Member>();
|
public ArrayList<Member> protectedFields = Lists.newArrayList();
|
||||||
|
|
||||||
public ArrayList<Member> protectedConstants = new ArrayList<Member>();
|
public ArrayList<Member> protectedConstants = Lists.newArrayList();
|
||||||
|
|
||||||
public static String toSimpleName (String name)
|
public static String toSimpleName (String name)
|
||||||
{
|
{
|
||||||
@@ -306,7 +308,7 @@ public class ActionScriptSource
|
|||||||
isAbstract = ((jclass.getModifiers() & Modifier.ABSTRACT) != 0);
|
isAbstract = ((jclass.getModifiers() & Modifier.ABSTRACT) != 0);
|
||||||
|
|
||||||
// note our implemented interfaces
|
// note our implemented interfaces
|
||||||
ArrayList<String> ifaces = new ArrayList<String>();
|
ArrayList<String> ifaces = Lists.newArrayList();
|
||||||
for (Class<?> iclass : jclass.getInterfaces()) {
|
for (Class<?> iclass : jclass.getInterfaces()) {
|
||||||
// we cannot use the FooCodes interface pattern in ActionScript so we just nix it
|
// we cannot use the FooCodes interface pattern in ActionScript so we just nix it
|
||||||
if (iclass.getName().endsWith("Codes")) {
|
if (iclass.getName().endsWith("Codes")) {
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import org.apache.tools.ant.DirectoryScanner;
|
|||||||
import org.apache.tools.ant.Task;
|
import org.apache.tools.ant.Task;
|
||||||
import org.apache.tools.ant.types.FileSet;
|
import org.apache.tools.ant.types.FileSet;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates our own ResourceBundle classes.
|
* Generates our own ResourceBundle classes.
|
||||||
*
|
*
|
||||||
@@ -62,9 +64,9 @@ public class GenActionScriptBundlesTask extends Task
|
|||||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
||||||
File fromDir = fs.getDir(getProject());
|
File fromDir = fs.getDir(getProject());
|
||||||
String[] srcFiles = ds.getIncludedFiles();
|
String[] srcFiles = ds.getIncludedFiles();
|
||||||
for (int f = 0; f < srcFiles.length; f++) {
|
for (String srcFile : srcFiles) {
|
||||||
try {
|
try {
|
||||||
processBundle(new File(fromDir, srcFiles[f]));
|
processBundle(new File(fromDir, srcFile));
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new BuildException(ioe);
|
throw new BuildException(ioe);
|
||||||
}
|
}
|
||||||
@@ -162,7 +164,7 @@ public class GenActionScriptBundlesTask extends Task
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
protected File _asroot;
|
protected File _asroot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import org.apache.tools.ant.Task;
|
|||||||
import org.apache.tools.ant.types.FileSet;
|
import org.apache.tools.ant.types.FileSet;
|
||||||
import org.apache.velocity.app.VelocityEngine;
|
import org.apache.velocity.app.VelocityEngine;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.velocity.VelocityUtil;
|
import com.samskivert.velocity.VelocityUtil;
|
||||||
|
|
||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.Streamable;
|
||||||
@@ -99,8 +101,8 @@ public class GenActionScriptTask extends Task
|
|||||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
||||||
File fromDir = fs.getDir(getProject());
|
File fromDir = fs.getDir(getProject());
|
||||||
String[] srcFiles = ds.getIncludedFiles();
|
String[] srcFiles = ds.getIncludedFiles();
|
||||||
for (int f = 0; f < srcFiles.length; f++) {
|
for (String srcFile : srcFiles) {
|
||||||
processClass(new File(fromDir, srcFiles[f]));
|
processClass(new File(fromDir, srcFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,7 +340,7 @@ public class GenActionScriptTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain tile images. */
|
/** A list of filesets that contain tile images. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
/** A header to put on all generated source files. */
|
/** A header to put on all generated source files. */
|
||||||
protected String _header;
|
protected String _header;
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ import org.apache.tools.ant.util.ClasspathUtils;
|
|||||||
import org.apache.velocity.VelocityContext;
|
import org.apache.velocity.VelocityContext;
|
||||||
import org.apache.velocity.app.VelocityEngine;
|
import org.apache.velocity.app.VelocityEngine;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.samskivert.velocity.VelocityUtil;
|
import com.samskivert.velocity.VelocityUtil;
|
||||||
@@ -151,7 +153,7 @@ public class GenDObjectTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine which fields we need to deal with
|
// determine which fields we need to deal with
|
||||||
ArrayList<Field> flist = new ArrayList<Field>();
|
ArrayList<Field> flist = Lists.newArrayList();
|
||||||
Field[] fields = oclass.getDeclaredFields();
|
Field[] fields = oclass.getDeclaredFields();
|
||||||
for (Field f : fields) {
|
for (Field f : fields) {
|
||||||
int mods = f.getModifiers();
|
int mods = f.getModifiers();
|
||||||
@@ -270,7 +272,7 @@ public class GenDObjectTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain tile images. */
|
/** A list of filesets that contain tile images. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
/** Used to do our own classpath business. */
|
/** Used to do our own classpath business. */
|
||||||
protected ClassLoader _cloader;
|
protected ClassLoader _cloader;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import org.apache.velocity.VelocityContext;
|
|||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.ComparableArrayList;
|
import com.samskivert.util.ComparableArrayList;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -74,8 +75,7 @@ public class GenServiceTask extends InvocationTask
|
|||||||
{
|
{
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
Method[] methdecls = listener.getDeclaredMethods();
|
Method[] methdecls = listener.getDeclaredMethods();
|
||||||
for (int ii = 0; ii < methdecls.length; ii++) {
|
for (Method m : methdecls) {
|
||||||
Method m = methdecls[ii];
|
|
||||||
// service interface methods must be public and abstract
|
// service interface methods must be public and abstract
|
||||||
if (!Modifier.isPublic(m.getModifiers()) &&
|
if (!Modifier.isPublic(m.getModifiers()) &&
|
||||||
!Modifier.isAbstract(m.getModifiers())) {
|
!Modifier.isAbstract(m.getModifiers())) {
|
||||||
@@ -620,8 +620,7 @@ public class GenServiceTask extends InvocationTask
|
|||||||
// look through and locate our service methods, also locating any
|
// look through and locate our service methods, also locating any
|
||||||
// custom InvocationListener derivations along the way
|
// custom InvocationListener derivations along the way
|
||||||
Method[] methdecls = service.getDeclaredMethods();
|
Method[] methdecls = service.getDeclaredMethods();
|
||||||
for (int ii = 0; ii < methdecls.length; ii++) {
|
for (Method m : methdecls) {
|
||||||
Method m = methdecls[ii];
|
|
||||||
// service interface methods must be public and abstract
|
// service interface methods must be public and abstract
|
||||||
if (!Modifier.isPublic(m.getModifiers()) &&
|
if (!Modifier.isPublic(m.getModifiers()) &&
|
||||||
!Modifier.isAbstract(m.getModifiers())) {
|
!Modifier.isAbstract(m.getModifiers())) {
|
||||||
@@ -629,10 +628,10 @@ public class GenServiceTask extends InvocationTask
|
|||||||
}
|
}
|
||||||
// check this method for custom listener declarations
|
// check this method for custom listener declarations
|
||||||
Class<?>[] args = m.getParameterTypes();
|
Class<?>[] args = m.getParameterTypes();
|
||||||
for (int aa = 0; aa < args.length; aa++) {
|
for (Class<?> arg : args) {
|
||||||
if (_ilistener.isAssignableFrom(args[aa]) &&
|
if (_ilistener.isAssignableFrom(arg) &&
|
||||||
GenUtil.simpleName(args[aa]).startsWith(sname + ".")) {
|
GenUtil.simpleName(arg).startsWith(sname + ".")) {
|
||||||
checkedAdd(listeners, new ServiceListener(service, args[aa]));
|
checkedAdd(listeners, new ServiceListener(service, arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_verbose) {
|
if (_verbose) {
|
||||||
@@ -678,7 +677,7 @@ public class GenServiceTask extends InvocationTask
|
|||||||
protected File _asroot;
|
protected File _asroot;
|
||||||
|
|
||||||
/** Services for which we should not generate provider interfaces. */
|
/** Services for which we should not generate provider interfaces. */
|
||||||
protected HashSet<String> _providerless = new HashSet<String>();
|
protected HashSet<String> _providerless = Sets.newHashSet();
|
||||||
|
|
||||||
/** Specifies the path to the marshaller template. */
|
/** Specifies the path to the marshaller template. */
|
||||||
protected static final String MARSHALLER_TMPL =
|
protected static final String MARSHALLER_TMPL =
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import org.apache.tools.ant.DirectoryScanner;
|
|||||||
import org.apache.tools.ant.Task;
|
import org.apache.tools.ant.Task;
|
||||||
import org.apache.tools.ant.types.FileSet;
|
import org.apache.tools.ant.types.FileSet;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.threerings.io.SimpleStreamableObject;
|
import com.threerings.io.SimpleStreamableObject;
|
||||||
import com.threerings.io.Streamable;
|
import com.threerings.io.Streamable;
|
||||||
|
|
||||||
@@ -60,8 +62,8 @@ public class GenStreamableTask extends Task
|
|||||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
||||||
File fromDir = fs.getDir(getProject());
|
File fromDir = fs.getDir(getProject());
|
||||||
String[] srcFiles = ds.getIncludedFiles();
|
String[] srcFiles = ds.getIncludedFiles();
|
||||||
for (int f = 0; f < srcFiles.length; f++) {
|
for (String srcFile : srcFiles) {
|
||||||
processClass(new File(fromDir, srcFiles[f]));
|
processClass(new File(fromDir, srcFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +245,7 @@ public class GenStreamableTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain tile images. */
|
/** A list of filesets that contain tile images. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
protected static final String READ_OPEN =
|
protected static final String READ_OPEN =
|
||||||
" // from interface Streamable\n" +
|
" // from interface Streamable\n" +
|
||||||
|
|||||||
@@ -21,12 +21,14 @@
|
|||||||
|
|
||||||
package com.threerings.presents.tools;
|
package com.threerings.presents.tools;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.ComparableArrayList;
|
import com.samskivert.util.ComparableArrayList;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
@@ -247,7 +249,7 @@ public class ImportSet
|
|||||||
*/
|
*/
|
||||||
public void replace (String... replace)
|
public void replace (String... replace)
|
||||||
{
|
{
|
||||||
HashSet<String> toAdd = new HashSet<String>();
|
HashSet<String> toAdd = Sets.newHashSet();
|
||||||
Iterator<String> i = _imports.iterator();
|
Iterator<String> i = _imports.iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
String name = i.next();
|
String name = i.next();
|
||||||
@@ -292,7 +294,7 @@ public class ImportSet
|
|||||||
public void duplicateAndMunge (String pattern, String... replace)
|
public void duplicateAndMunge (String pattern, String... replace)
|
||||||
{
|
{
|
||||||
Pattern pat = makePattern(pattern);
|
Pattern pat = makePattern(pattern);
|
||||||
HashSet<String> toMunge = new HashSet<String>();
|
HashSet<String> toMunge = Sets.newHashSet();
|
||||||
for (String name : _imports) {
|
for (String name : _imports) {
|
||||||
if (pat.matcher(name).matches()) {
|
if (pat.matcher(name).matches()) {
|
||||||
toMunge.add(name);
|
toMunge.add(name);
|
||||||
@@ -355,8 +357,8 @@ public class ImportSet
|
|||||||
return Pattern.compile(pattern.toString());
|
return Pattern.compile(pattern.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HashSet<String> _imports = new HashSet<String>();
|
protected HashSet<String> _imports = Sets.newHashSet();
|
||||||
protected List<String> _pushed = new ArrayList<String>();
|
protected List<String> _pushed = Lists.newArrayList();
|
||||||
|
|
||||||
protected static Pattern _splitter = Pattern.compile("\\*");
|
protected static Pattern _splitter = Pattern.compile("\\*");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ import org.apache.tools.ant.Task;
|
|||||||
import org.apache.tools.ant.types.FileSet;
|
import org.apache.tools.ant.types.FileSet;
|
||||||
import org.apache.tools.ant.types.Path;
|
import org.apache.tools.ant.types.Path;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.io.StreamUtil;
|
import com.samskivert.io.StreamUtil;
|
||||||
|
|
||||||
import com.threerings.io.BasicStreamers;
|
import com.threerings.io.BasicStreamers;
|
||||||
@@ -107,8 +110,8 @@ public class InstrumentStreamableTask extends Task
|
|||||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
||||||
File fromDir = fs.getDir(getProject());
|
File fromDir = fs.getDir(getProject());
|
||||||
String[] srcFiles = ds.getIncludedFiles();
|
String[] srcFiles = ds.getIncludedFiles();
|
||||||
for (int f = 0; f < srcFiles.length; f++) {
|
for (String srcFile : srcFiles) {
|
||||||
processClass(new File(fromDir, srcFiles[f]));
|
processClass(new File(fromDir, srcFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +148,7 @@ public class InstrumentStreamableTask extends Task
|
|||||||
protected void processStreamable (File source, CtClass clazz)
|
protected void processStreamable (File source, CtClass clazz)
|
||||||
throws NotFoundException
|
throws NotFoundException
|
||||||
{
|
{
|
||||||
ArrayList<CtField> fields = new ArrayList<CtField>();
|
ArrayList<CtField> fields = Lists.newArrayList();
|
||||||
for (CtField field : clazz.getDeclaredFields()) {
|
for (CtField field : clazz.getDeclaredFields()) {
|
||||||
int modifiers = field.getModifiers();
|
int modifiers = field.getModifiers();
|
||||||
if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers) ||
|
if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers) ||
|
||||||
@@ -155,7 +158,7 @@ public class InstrumentStreamableTask extends Task
|
|||||||
fields.add(field);
|
fields.add(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet<String> methods = new HashSet<String>();
|
HashSet<String> methods = Sets.newHashSet();
|
||||||
for (CtMethod method : clazz.getMethods()) {
|
for (CtMethod method : clazz.getMethods()) {
|
||||||
methods.add(method.getName());
|
methods.add(method.getName());
|
||||||
}
|
}
|
||||||
@@ -337,10 +340,10 @@ public class InstrumentStreamableTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain Streamable class files. */
|
/** A list of filesets that contain Streamable class files. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
/** A list of paths that make up our classpath. */
|
/** A list of paths that make up our classpath. */
|
||||||
protected ArrayList<Path> _paths = new ArrayList<Path>();
|
protected ArrayList<Path> _paths = Lists.newArrayList();
|
||||||
|
|
||||||
/** The directory to which we write our instrumented class files. */
|
/** The directory to which we write our instrumented class files. */
|
||||||
protected File _outdir;
|
protected File _outdir;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import java.lang.reflect.ParameterizedType;
|
|||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.lang.reflect.WildcardType;
|
import java.lang.reflect.WildcardType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -48,6 +47,7 @@ import org.apache.velocity.app.VelocityEngine;
|
|||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.Logger;
|
import com.samskivert.util.Logger;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -105,7 +105,7 @@ public abstract class InvocationTask extends Task
|
|||||||
{
|
{
|
||||||
public Method method;
|
public Method method;
|
||||||
|
|
||||||
public List<ListenerArgument> listenerArgs = new ArrayList<ListenerArgument>();
|
public List<ListenerArgument> listenerArgs = Lists.newArrayList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new service method.
|
* Creates a new service method.
|
||||||
@@ -461,7 +461,7 @@ public abstract class InvocationTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain tile images. */
|
/** A list of filesets that contain tile images. */
|
||||||
protected List<FileSet> _filesets = new ArrayList<FileSet>();
|
protected List<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
/** A header to put on all generated source files. */
|
/** A header to put on all generated source files. */
|
||||||
protected String _header;
|
protected String _header;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import java.io.FileReader;
|
|||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +48,7 @@ public class SourceFile
|
|||||||
{
|
{
|
||||||
// slurp our source file into newline separated strings
|
// slurp our source file into newline separated strings
|
||||||
BufferedReader bin = new BufferedReader(new FileReader(source));
|
BufferedReader bin = new BufferedReader(new FileReader(source));
|
||||||
ArrayList<String> llist = new ArrayList<String>();
|
ArrayList<String> llist = Lists.newArrayList();
|
||||||
String line = null;
|
String line = null;
|
||||||
while ((line = bin.readLine()) != null) {
|
while ((line = bin.readLine()) != null) {
|
||||||
llist.add(line);
|
llist.add(line);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.threerings.io.UnreliableObjectInputStream;
|
import com.threerings.io.UnreliableObjectInputStream;
|
||||||
import com.threerings.io.UnreliableObjectOutputStream;
|
import com.threerings.io.UnreliableObjectOutputStream;
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ public class DatagramSequencer
|
|||||||
mappedClasses = null;
|
mappedClasses = null;
|
||||||
} else {
|
} else {
|
||||||
_uout.setMappedClasses(new HashSet<Class<?>>());
|
_uout.setMappedClasses(new HashSet<Class<?>>());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// likewise with the intern mappings
|
// likewise with the intern mappings
|
||||||
@@ -79,6 +81,7 @@ public class DatagramSequencer
|
|||||||
mappedInterns = null;
|
mappedInterns = null;
|
||||||
} else {
|
} else {
|
||||||
_uout.setMappedInterns(new HashSet<String>());
|
_uout.setMappedInterns(new HashSet<String>());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// record the transmission
|
// record the transmission
|
||||||
@@ -164,5 +167,5 @@ public class DatagramSequencer
|
|||||||
protected int _lastReceived;
|
protected int _lastReceived;
|
||||||
|
|
||||||
/** Records of datagrams sent. */
|
/** Records of datagrams sent. */
|
||||||
protected ArrayList<SendRecord> _sendrecs = new ArrayList<SendRecord>();
|
protected ArrayList<SendRecord> _sendrecs = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package com.threerings.util;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maintains a bidirectional graph to manage the order that the items are removed. Children
|
* Maintains a bidirectional graph to manage the order that the items are removed. Children
|
||||||
* must wait until their parents are accessed - thus removing an available element means that
|
* must wait until their parents are accessed - thus removing an available element means that
|
||||||
@@ -96,8 +99,8 @@ public class DependencyGraph<T>
|
|||||||
DependencyNode<T> node1 = _nodes.get(elem1);
|
DependencyNode<T> node1 = _nodes.get(elem1);
|
||||||
DependencyNode<T> node2 = _nodes.get(elem2);
|
DependencyNode<T> node2 = _nodes.get(elem2);
|
||||||
|
|
||||||
ArrayList<DependencyNode<T>> nodesToCheck = new ArrayList<DependencyNode<T>>();
|
ArrayList<DependencyNode<T>> nodesToCheck = Lists.newArrayList();
|
||||||
ArrayList<DependencyNode<T>> nodesAlreadyChecked = new ArrayList<DependencyNode<T>>();
|
ArrayList<DependencyNode<T>> nodesAlreadyChecked = Lists.newArrayList();
|
||||||
nodesToCheck.addAll(node1.parents);
|
nodesToCheck.addAll(node1.parents);
|
||||||
|
|
||||||
// We prevent circular dependencies when we add dependencies. Otherwise, this'd be
|
// We prevent circular dependencies when we add dependencies. Otherwise, this'd be
|
||||||
@@ -124,10 +127,10 @@ public class DependencyGraph<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** All the nodes included in the graph. */
|
/** All the nodes included in the graph. */
|
||||||
protected HashMap<T, DependencyNode<T>> _nodes = new HashMap<T, DependencyNode<T>>();
|
protected HashMap<T, DependencyNode<T>> _nodes = Maps.newHashMap();
|
||||||
|
|
||||||
/** Nodes in the graph with no parents/dependencies. */
|
/** Nodes in the graph with no parents/dependencies. */
|
||||||
protected ArrayList<T> _orphans = new ArrayList<T>();
|
protected ArrayList<T> _orphans = Lists.newArrayList();
|
||||||
|
|
||||||
/** Represents a node in our dependency graph. */
|
/** Represents a node in our dependency graph. */
|
||||||
protected class DependencyNode<DT>
|
protected class DependencyNode<DT>
|
||||||
@@ -139,8 +142,8 @@ public class DependencyGraph<T>
|
|||||||
public DependencyNode (DT contents)
|
public DependencyNode (DT contents)
|
||||||
{
|
{
|
||||||
this.content = contents;
|
this.content = contents;
|
||||||
this.parents = new ArrayList<DependencyNode<DT>>();
|
this.parents = Lists.newArrayList();
|
||||||
this.children = new ArrayList<DependencyNode<DT>>();
|
this.children = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import java.util.Locale;
|
|||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import static com.threerings.NaryaLog.log;
|
import static com.threerings.NaryaLog.log;
|
||||||
@@ -195,7 +197,7 @@ public class MessageManager
|
|||||||
protected ClassLoader _loader;
|
protected ClassLoader _loader;
|
||||||
|
|
||||||
/** A cache of instantiated message bundles. */
|
/** A cache of instantiated message bundles. */
|
||||||
protected HashMap<String, MessageBundle> _cache = new HashMap<String, MessageBundle>();
|
protected HashMap<String, MessageBundle> _cache = Maps.newHashMap();
|
||||||
|
|
||||||
/** Our top-level message bundle, from which others obtain messages if
|
/** Our top-level message bundle, from which others obtain messages if
|
||||||
* they can't find them within themselves. */
|
* they can't find them within themselves. */
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ package com.threerings.util;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility for times.
|
* Utility for times.
|
||||||
*/
|
*/
|
||||||
@@ -104,7 +106,7 @@ public class TimeUtil
|
|||||||
minUnit = (byte) Math.min(minUnit, MAX_UNIT);
|
minUnit = (byte) Math.min(minUnit, MAX_UNIT);
|
||||||
duration = Math.abs(duration);
|
duration = Math.abs(duration);
|
||||||
|
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = Lists.newArrayList();
|
||||||
int parts = 0; // how many parts are in the translation string?
|
int parts = 0; // how many parts are in the translation string?
|
||||||
for (byte uu = MILLISECOND; uu <= MAX_UNIT; uu++) {
|
for (byte uu = MILLISECOND; uu <= MAX_UNIT; uu++) {
|
||||||
int quantity = getQuantityPerUnit(uu);
|
int quantity = getQuantityPerUnit(uu);
|
||||||
|
|||||||
Reference in New Issue
Block a user