A healthy splash of google-collections

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@822 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2009-05-23 01:31:14 +00:00
parent a20117d922
commit d2b9e2ebb9
52 changed files with 246 additions and 191 deletions
@@ -32,6 +32,7 @@ import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.samskivert.util.IntIntMap;
@@ -256,7 +257,7 @@ public class BundledComponentRepository
// we have a hash of lists for mapping components by class/name
ArrayList<CharacterComponent> comps = _classComps.get(cclass);
if (comps == null) {
comps = new ArrayList<CharacterComponent>();
comps = Lists.newArrayList();
_classComps.put(cclass, comps);
}
if (!comps.contains(component)) {
@@ -51,6 +51,8 @@ import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import com.google.common.collect.Lists;
import com.samskivert.io.PersistenceException;
import com.samskivert.util.ComparableArrayList;
import com.samskivert.util.FileUtil;
@@ -152,7 +154,7 @@ public class ComponentBundlerTask extends Task
// check to see if any of the source files are newer than the
// target file
ArrayList<Object> sources = new ArrayList<Object>();
ArrayList<Object> sources = Lists.newArrayList();
sources.addAll(_filesets);
sources.add(_mapfile);
sources.add(_actionDef);
@@ -186,8 +188,8 @@ public class ComponentBundlerTask extends Task
File fromDir = fs.getDir(getProject());
String[] srcFiles = ds.getIncludedFiles();
for (int f = 0; f < srcFiles.length; f++) {
File cfile = new File(fromDir, srcFiles[f]);
for (String srcFile : srcFiles) {
File cfile = new File(fromDir, srcFile);
// determine the [class, name, action] triplet
String[] info = decomposePath(cfile.getPath());
@@ -214,11 +216,11 @@ public class ComponentBundlerTask extends Task
// crop files
String action = info[2];
String ext = BundleUtil.IMAGE_EXTENSION;
for (int aa = 0; aa < AUX_EXTS.length; aa++) {
for (String element : AUX_EXTS) {
File afile = new File(
FileUtil.resuffix(cfile, ext, AUX_EXTS[aa] + ext));
FileUtil.resuffix(cfile, ext, element + ext));
if (afile.exists()) {
info[2] = action + AUX_EXTS[aa];
info[2] = action + element;
processComponent(info, aset, afile, fout, newest);
}
}
@@ -314,8 +316,8 @@ public class ComponentBundlerTask extends Task
File fromDir = fs.getDir(getProject());
String[] srcFiles = ds.getIncludedFiles();
long newest = 0L;
for (int f = 0; f < srcFiles.length; f++) {
File cfile = new File(fromDir, srcFiles[f]);
for (String srcFile : srcFiles) {
File cfile = new File(fromDir, srcFile);
newest = Math.max(newest, cfile.lastModified());
}
return newest;
@@ -667,7 +669,7 @@ public class ComponentBundlerTask extends Task
protected String _root;
/** A list of filesets that contain tile images. */
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
/** Used to separate keys and values in the map file. */
protected static final String SEP_STR = " := ";
@@ -22,7 +22,6 @@
package com.threerings.cast.bundle.tools;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
@@ -41,6 +40,9 @@ import org.apache.commons.digester.Digester;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.samskivert.util.Tuple;
import com.threerings.media.tile.TileSet;
@@ -203,8 +205,8 @@ public class MetadataBundlerTask extends Task
}
// now create our mappings
Map<String, ActionSequence> actmap = new HashMap<String, ActionSequence>();
Map<String, TileSet> setmap = new HashMap<String, TileSet>();
Map<String, ActionSequence> actmap = Maps.newHashMap();
Map<String, TileSet> setmap = Maps.newHashMap();
// create the action map
for (int i = 0; i < setlist.size(); i++) {
@@ -239,7 +241,7 @@ public class MetadataBundlerTask extends Task
"add", Object.class.getName());
ArrayList<?> setlist = parseList(digester, _classDef);
Map<String, ComponentClass> clmap = new HashMap<String, ComponentClass>();
Map<String, ComponentClass> clmap = Maps.newHashMap();
// create the action map
for (int i = 0; i < setlist.size(); i++) {
@@ -257,7 +259,7 @@ public class MetadataBundlerTask extends Task
FileInputStream fin = new FileInputStream(path);
BufferedInputStream bin = new BufferedInputStream(fin);
ArrayList<Object> setlist = new ArrayList<Object>();
ArrayList<Object> setlist = Lists.newArrayList();
digester.push(setlist);
// now fire up the digester to parse the stream