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:
@@ -28,6 +28,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.LRUHashMap;
|
import com.samskivert.util.LRUHashMap;
|
||||||
@@ -179,7 +180,7 @@ public class CharacterManager
|
|||||||
frames = createCompositeFrames(descrip, action);
|
frames = createCompositeFrames(descrip, action);
|
||||||
_actionFrames.put(key, frames);
|
_actionFrames.put(key, frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// periodically report our frame image cache performance
|
// periodically report our frame image cache performance
|
||||||
if (!_cacheStatThrottle.throttleOp()) {
|
if (!_cacheStatThrottle.throttleOp()) {
|
||||||
long size = getEstimatedCacheMemoryUsage();
|
long size = getEstimatedCacheMemoryUsage();
|
||||||
@@ -264,10 +265,10 @@ public class CharacterManager
|
|||||||
|
|
||||||
// maps components by class name for masks
|
// maps components by class name for masks
|
||||||
HashMap<String, ArrayList<TranslatedComponent>> ccomps =
|
HashMap<String, ArrayList<TranslatedComponent>> ccomps =
|
||||||
new HashMap<String, ArrayList<TranslatedComponent>>();
|
Maps.newHashMap();
|
||||||
|
|
||||||
// create colorized versions of all of the source action frames
|
// create colorized versions of all of the source action frames
|
||||||
ArrayList<ComponentFrames> sources = new ArrayList<ComponentFrames>(ccount);
|
ArrayList<ComponentFrames> sources = Lists.newArrayListWithCapacity(ccount);
|
||||||
for (int ii = 0; ii < ccount; ii++) {
|
for (int ii = 0; ii < ccount; ii++) {
|
||||||
ComponentFrames cframes = new ComponentFrames();
|
ComponentFrames cframes = new ComponentFrames();
|
||||||
sources.add(cframes);
|
sources.add(cframes);
|
||||||
@@ -291,20 +292,18 @@ public class CharacterManager
|
|||||||
TranslatedComponent tcomp = new TranslatedComponent(ccomp, xlation);
|
TranslatedComponent tcomp = new TranslatedComponent(ccomp, xlation);
|
||||||
ArrayList<TranslatedComponent> tcomps = ccomps.get(ccomp.componentClass.name);
|
ArrayList<TranslatedComponent> tcomps = ccomps.get(ccomp.componentClass.name);
|
||||||
if (tcomps == null) {
|
if (tcomps == null) {
|
||||||
ccomps.put(ccomp.componentClass.name,
|
ccomps.put(ccomp.componentClass.name, tcomps = Lists.newArrayList());
|
||||||
tcomps = new ArrayList<TranslatedComponent>());
|
|
||||||
}
|
}
|
||||||
tcomps.add(tcomp);
|
tcomps.add(tcomp);
|
||||||
|
|
||||||
// if this component has a shadow, make a note of it
|
// if this component has a shadow, make a note of it
|
||||||
if (ccomp.componentClass.isShadowed()) {
|
if (ccomp.componentClass.isShadowed()) {
|
||||||
if (shadows == null) {
|
if (shadows == null) {
|
||||||
shadows = new HashMap<String, ArrayList<TranslatedComponent>>();
|
shadows = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
ArrayList<TranslatedComponent> shadlist = shadows.get(ccomp.componentClass.shadow);
|
ArrayList<TranslatedComponent> shadlist = shadows.get(ccomp.componentClass.shadow);
|
||||||
if (shadlist == null) {
|
if (shadlist == null) {
|
||||||
shadows.put(ccomp.componentClass.shadow,
|
shadows.put(ccomp.componentClass.shadow, shadlist = Lists.newArrayList());
|
||||||
shadlist = new ArrayList<TranslatedComponent>());
|
|
||||||
}
|
}
|
||||||
shadlist.add(tcomp);
|
shadlist.add(tcomp);
|
||||||
}
|
}
|
||||||
@@ -349,7 +348,7 @@ public class CharacterManager
|
|||||||
// create a fake component for the shadow layer
|
// create a fake component for the shadow layer
|
||||||
cframes.ccomp = new CharacterComponent(-1, "shadow", cclass, null);
|
cframes.ccomp = new CharacterComponent(-1, "shadow", cclass, null);
|
||||||
|
|
||||||
ArrayList<ComponentFrames> sources = new ArrayList<ComponentFrames>();
|
ArrayList<ComponentFrames> sources = Lists.newArrayList();
|
||||||
for (TranslatedComponent scomp : scomps) {
|
for (TranslatedComponent scomp : scomps) {
|
||||||
ComponentFrames source = new ComponentFrames();
|
ComponentFrames source = new ComponentFrames();
|
||||||
source.ccomp = scomp.ccomp;
|
source.ccomp = scomp.ccomp;
|
||||||
@@ -384,7 +383,7 @@ public class CharacterManager
|
|||||||
String action, CharacterComponent ccomp, ActionFrames cframes,
|
String action, CharacterComponent ccomp, ActionFrames cframes,
|
||||||
ArrayList<TranslatedComponent> mcomps)
|
ArrayList<TranslatedComponent> mcomps)
|
||||||
{
|
{
|
||||||
ArrayList<ComponentFrames> sources = new ArrayList<ComponentFrames>();
|
ArrayList<ComponentFrames> sources = Lists.newArrayList();
|
||||||
sources.add(new ComponentFrames(ccomp, cframes));
|
sources.add(new ComponentFrames(ccomp, cframes));
|
||||||
for (TranslatedComponent mcomp : mcomps) {
|
for (TranslatedComponent mcomp : mcomps) {
|
||||||
ActionFrames mframes = mcomp.getFrames(action, StandardActions.CROP_TYPE);
|
ActionFrames mframes = mcomp.getFrames(action, StandardActions.CROP_TYPE);
|
||||||
@@ -435,7 +434,7 @@ public class CharacterManager
|
|||||||
|
|
||||||
/** A table of composited action sequences (these don't reference the
|
/** A table of composited action sequences (these don't reference the
|
||||||
* actual image data directly and thus take up little memory). */
|
* actual image data directly and thus take up little memory). */
|
||||||
protected Map<Tuple<CharacterDescriptor, String>, ActionFrames> _actionFrames =
|
protected Map<Tuple<CharacterDescriptor, String>, ActionFrames> _actionFrames =
|
||||||
Maps.newHashMap();
|
Maps.newHashMap();
|
||||||
|
|
||||||
/** A cache of composited animation frames. */
|
/** A cache of composited animation frames. */
|
||||||
@@ -457,7 +456,7 @@ public class CharacterManager
|
|||||||
"Size (in kb of memory used) of the character manager LRU " +
|
"Size (in kb of memory used) of the character manager LRU " +
|
||||||
"action cache [requires restart]", "narya.cast.action_cache_size",
|
"action cache [requires restart]", "narya.cast.action_cache_size",
|
||||||
CastPrefs.config, 32768);
|
CastPrefs.config, 32768);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache size to be used in this run. Adjusted by setCacheSize without affecting
|
* Cache size to be used in this run. Adjusted by setCacheSize without affecting
|
||||||
* the stored value.
|
* the stored value.
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.CollectionUtil;
|
import com.samskivert.util.CollectionUtil;
|
||||||
|
|
||||||
import com.threerings.cast.ComponentClass;
|
import com.threerings.cast.ComponentClass;
|
||||||
@@ -84,7 +87,7 @@ public class BuilderModel
|
|||||||
{
|
{
|
||||||
List<Integer> list = _components.get(cclass);
|
List<Integer> list = _components.get(cclass);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = new ArrayList<Integer>();
|
list = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -129,7 +132,7 @@ public class BuilderModel
|
|||||||
Integer cid = iter.next();
|
Integer cid = iter.next();
|
||||||
ArrayList<Integer> clist = _components.get(cclass);
|
ArrayList<Integer> clist = _components.get(cclass);
|
||||||
if (clist == null) {
|
if (clist == null) {
|
||||||
_components.put(cclass, clist = new ArrayList<Integer>());
|
_components.put(cclass, clist = Lists.newArrayList());
|
||||||
}
|
}
|
||||||
|
|
||||||
clist.add(cid);
|
clist.add(cid);
|
||||||
@@ -138,14 +141,14 @@ public class BuilderModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The currently selected character components. */
|
/** The currently selected character components. */
|
||||||
protected HashMap<ComponentClass, Integer> _selected = new HashMap<ComponentClass, Integer>();
|
protected HashMap<ComponentClass, Integer> _selected = Maps.newHashMap();
|
||||||
|
|
||||||
/** The hashtable of available component ids for each class. */
|
/** The hashtable of available component ids for each class. */
|
||||||
protected HashMap<ComponentClass, ArrayList<Integer>> _components = new HashMap<ComponentClass, ArrayList<Integer>>();
|
protected HashMap<ComponentClass, ArrayList<Integer>> _components = Maps.newHashMap();
|
||||||
|
|
||||||
/** The list of all available component classes. */
|
/** The list of all available component classes. */
|
||||||
protected ArrayList<ComponentClass> _classes = new ArrayList<ComponentClass>();
|
protected ArrayList<ComponentClass> _classes = Lists.newArrayList();
|
||||||
|
|
||||||
/** The model listeners. */
|
/** The model listeners. */
|
||||||
protected ArrayList<BuilderModelListener> _listeners = new ArrayList<BuilderModelListener>();
|
protected ArrayList<BuilderModelListener> _listeners = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.IntIntMap;
|
import com.samskivert.util.IntIntMap;
|
||||||
@@ -256,7 +257,7 @@ public class BundledComponentRepository
|
|||||||
// we have a hash of lists for mapping components by class/name
|
// we have a hash of lists for mapping components by class/name
|
||||||
ArrayList<CharacterComponent> comps = _classComps.get(cclass);
|
ArrayList<CharacterComponent> comps = _classComps.get(cclass);
|
||||||
if (comps == null) {
|
if (comps == null) {
|
||||||
comps = new ArrayList<CharacterComponent>();
|
comps = Lists.newArrayList();
|
||||||
_classComps.put(cclass, comps);
|
_classComps.put(cclass, comps);
|
||||||
}
|
}
|
||||||
if (!comps.contains(component)) {
|
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.Task;
|
||||||
import org.apache.tools.ant.types.FileSet;
|
import org.apache.tools.ant.types.FileSet;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.util.ComparableArrayList;
|
import com.samskivert.util.ComparableArrayList;
|
||||||
import com.samskivert.util.FileUtil;
|
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
|
// check to see if any of the source files are newer than the
|
||||||
// target file
|
// target file
|
||||||
ArrayList<Object> sources = new ArrayList<Object>();
|
ArrayList<Object> sources = Lists.newArrayList();
|
||||||
sources.addAll(_filesets);
|
sources.addAll(_filesets);
|
||||||
sources.add(_mapfile);
|
sources.add(_mapfile);
|
||||||
sources.add(_actionDef);
|
sources.add(_actionDef);
|
||||||
@@ -186,8 +188,8 @@ public class ComponentBundlerTask extends Task
|
|||||||
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) {
|
||||||
File cfile = new File(fromDir, srcFiles[f]);
|
File cfile = new File(fromDir, srcFile);
|
||||||
// determine the [class, name, action] triplet
|
// determine the [class, name, action] triplet
|
||||||
String[] info = decomposePath(cfile.getPath());
|
String[] info = decomposePath(cfile.getPath());
|
||||||
|
|
||||||
@@ -214,11 +216,11 @@ public class ComponentBundlerTask extends Task
|
|||||||
// crop files
|
// crop files
|
||||||
String action = info[2];
|
String action = info[2];
|
||||||
String ext = BundleUtil.IMAGE_EXTENSION;
|
String ext = BundleUtil.IMAGE_EXTENSION;
|
||||||
for (int aa = 0; aa < AUX_EXTS.length; aa++) {
|
for (String element : AUX_EXTS) {
|
||||||
File afile = new File(
|
File afile = new File(
|
||||||
FileUtil.resuffix(cfile, ext, AUX_EXTS[aa] + ext));
|
FileUtil.resuffix(cfile, ext, element + ext));
|
||||||
if (afile.exists()) {
|
if (afile.exists()) {
|
||||||
info[2] = action + AUX_EXTS[aa];
|
info[2] = action + element;
|
||||||
processComponent(info, aset, afile, fout, newest);
|
processComponent(info, aset, afile, fout, newest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -314,8 +316,8 @@ public class ComponentBundlerTask extends Task
|
|||||||
File fromDir = fs.getDir(getProject());
|
File fromDir = fs.getDir(getProject());
|
||||||
String[] srcFiles = ds.getIncludedFiles();
|
String[] srcFiles = ds.getIncludedFiles();
|
||||||
long newest = 0L;
|
long newest = 0L;
|
||||||
for (int f = 0; f < srcFiles.length; f++) {
|
for (String srcFile : srcFiles) {
|
||||||
File cfile = new File(fromDir, srcFiles[f]);
|
File cfile = new File(fromDir, srcFile);
|
||||||
newest = Math.max(newest, cfile.lastModified());
|
newest = Math.max(newest, cfile.lastModified());
|
||||||
}
|
}
|
||||||
return newest;
|
return newest;
|
||||||
@@ -667,7 +669,7 @@ public class ComponentBundlerTask extends Task
|
|||||||
protected String _root;
|
protected String _root;
|
||||||
|
|
||||||
/** 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 separate keys and values in the map file. */
|
/** Used to separate keys and values in the map file. */
|
||||||
protected static final String SEP_STR = " := ";
|
protected static final String SEP_STR = " := ";
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
package com.threerings.cast.bundle.tools;
|
package com.threerings.cast.bundle.tools;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarOutputStream;
|
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.BuildException;
|
||||||
import org.apache.tools.ant.Task;
|
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.samskivert.util.Tuple;
|
||||||
|
|
||||||
import com.threerings.media.tile.TileSet;
|
import com.threerings.media.tile.TileSet;
|
||||||
@@ -203,8 +205,8 @@ public class MetadataBundlerTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now create our mappings
|
// now create our mappings
|
||||||
Map<String, ActionSequence> actmap = new HashMap<String, ActionSequence>();
|
Map<String, ActionSequence> actmap = Maps.newHashMap();
|
||||||
Map<String, TileSet> setmap = new HashMap<String, TileSet>();
|
Map<String, TileSet> setmap = Maps.newHashMap();
|
||||||
|
|
||||||
// create the action map
|
// create the action map
|
||||||
for (int i = 0; i < setlist.size(); i++) {
|
for (int i = 0; i < setlist.size(); i++) {
|
||||||
@@ -239,7 +241,7 @@ public class MetadataBundlerTask extends Task
|
|||||||
"add", Object.class.getName());
|
"add", Object.class.getName());
|
||||||
|
|
||||||
ArrayList<?> setlist = parseList(digester, _classDef);
|
ArrayList<?> setlist = parseList(digester, _classDef);
|
||||||
Map<String, ComponentClass> clmap = new HashMap<String, ComponentClass>();
|
Map<String, ComponentClass> clmap = Maps.newHashMap();
|
||||||
|
|
||||||
// create the action map
|
// create the action map
|
||||||
for (int i = 0; i < setlist.size(); i++) {
|
for (int i = 0; i < setlist.size(); i++) {
|
||||||
@@ -257,7 +259,7 @@ public class MetadataBundlerTask extends Task
|
|||||||
FileInputStream fin = new FileInputStream(path);
|
FileInputStream fin = new FileInputStream(path);
|
||||||
BufferedInputStream bin = new BufferedInputStream(fin);
|
BufferedInputStream bin = new BufferedInputStream(fin);
|
||||||
|
|
||||||
ArrayList<Object> setlist = new ArrayList<Object>();
|
ArrayList<Object> setlist = Lists.newArrayList();
|
||||||
digester.push(setlist);
|
digester.push(setlist);
|
||||||
|
|
||||||
// now fire up the digester to parse the stream
|
// now fire up the digester to parse the stream
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ package com.threerings.cast.util;
|
|||||||
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.CollectionUtil;
|
import com.samskivert.util.CollectionUtil;
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
|
|
||||||
@@ -46,9 +48,9 @@ public class CastUtil
|
|||||||
String gender, ComponentRepository crepo)
|
String gender, ComponentRepository crepo)
|
||||||
{
|
{
|
||||||
// get all available classes
|
// get all available classes
|
||||||
ArrayList<ComponentClass> classes = new ArrayList<ComponentClass>();
|
ArrayList<ComponentClass> classes = Lists.newArrayList();
|
||||||
for (int i = 0; i < CLASSES.length; i++) {
|
for (String element : CLASSES) {
|
||||||
String cname = gender + "/" + CLASSES[i];
|
String cname = gender + "/" + element;
|
||||||
ComponentClass cclass = crepo.getComponentClass(cname);
|
ComponentClass cclass = crepo.getComponentClass(cname);
|
||||||
|
|
||||||
// make sure the component class exists
|
// make sure the component class exists
|
||||||
@@ -76,7 +78,7 @@ public class CastUtil
|
|||||||
ComponentClass cclass = classes.get(ii);
|
ComponentClass cclass = classes.get(ii);
|
||||||
|
|
||||||
// get the components available for this class
|
// get the components available for this class
|
||||||
ArrayList<Integer> choices = new ArrayList<Integer>();
|
ArrayList<Integer> choices = Lists.newArrayList();
|
||||||
Iterator<Integer> iter = crepo.enumerateComponentIds(cclass);
|
Iterator<Integer> iter = crepo.enumerateComponentIds(cclass);
|
||||||
CollectionUtil.addAll(choices, iter);
|
CollectionUtil.addAll(choices, iter);
|
||||||
|
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ public class Model extends ModelNode
|
|||||||
protected Model _toCopy;
|
protected Model _toCopy;
|
||||||
|
|
||||||
/** The set of added properties. */
|
/** The set of added properties. */
|
||||||
protected HashSet<String> _properties = new HashSet<String>();
|
protected HashSet<String> _properties = Sets.newHashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -443,7 +443,7 @@ public class Model extends ModelNode
|
|||||||
public void addAnimation (String name, Animation anim)
|
public void addAnimation (String name, Animation anim)
|
||||||
{
|
{
|
||||||
if (_anims == null) {
|
if (_anims == null) {
|
||||||
_anims = new HashMap<String, Animation>();
|
_anims = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
_anims.put(name, anim);
|
_anims.put(name, anim);
|
||||||
|
|
||||||
@@ -727,7 +727,7 @@ public class Model extends ModelNode
|
|||||||
if (animNames != null) {
|
if (animNames != null) {
|
||||||
Savable[] animValues = capsule.readSavableArray(
|
Savable[] animValues = capsule.readSavableArray(
|
||||||
"animValues", null);
|
"animValues", null);
|
||||||
_anims = new HashMap<String, Animation>();
|
_anims = Maps.newHashMap();
|
||||||
for (int ii = 0; ii < animNames.length; ii++) {
|
for (int ii = 0; ii < animNames.length; ii++) {
|
||||||
_anims.put(animNames[ii], (Animation)animValues[ii]);
|
_anims.put(animNames[ii], (Animation)animValues[ii]);
|
||||||
}
|
}
|
||||||
@@ -839,7 +839,7 @@ public class Model extends ModelNode
|
|||||||
{
|
{
|
||||||
// collect the instance's animation and controller targets and lock
|
// collect the instance's animation and controller targets and lock
|
||||||
// recursively
|
// recursively
|
||||||
HashSet<Spatial> targets = new HashSet<Spatial>();
|
HashSet<Spatial> targets = Sets.newHashSet();
|
||||||
for (String aname : getAnimationNames()) {
|
for (String aname : getAnimationNames()) {
|
||||||
Collections.addAll(targets, getAnimation(aname).transformTargets);
|
Collections.addAll(targets, getAnimation(aname).transformTargets);
|
||||||
}
|
}
|
||||||
@@ -872,7 +872,7 @@ public class Model extends ModelNode
|
|||||||
}
|
}
|
||||||
mstore._prototype = this;
|
mstore._prototype = this;
|
||||||
if (_anims != null) {
|
if (_anims != null) {
|
||||||
mstore._anims = new HashMap<String, Animation>();
|
mstore._anims = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
mstore._pnodes = Maps.newHashMap(properties.originalToCopy);
|
mstore._pnodes = Maps.newHashMap(properties.originalToCopy);
|
||||||
mstore._animMode = _animMode;
|
mstore._animMode = _animMode;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public abstract class ModelController extends Controller
|
|||||||
if (anims.length == 0) {
|
if (anims.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_animations = new HashSet<String>();
|
_animations = Sets.newHashSet();
|
||||||
Collections.addAll(_animations, anims);
|
Collections.addAll(_animations, anims);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ public abstract class ModelController extends Controller
|
|||||||
_target = (Spatial)capsule.readSavable("target", null);
|
_target = (Spatial)capsule.readSavable("target", null);
|
||||||
String[] anims = capsule.readStringArray("animations", null);
|
String[] anims = capsule.readStringArray("animations", null);
|
||||||
if (anims != null) {
|
if (anims != null) {
|
||||||
_animations = new HashSet<String>();
|
_animations = Sets.newHashSet();
|
||||||
Collections.addAll(_animations, anims);
|
Collections.addAll(_animations, anims);
|
||||||
} else {
|
} else {
|
||||||
_animations = null;
|
_animations = null;
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class ModelMesh extends TriMesh
|
|||||||
public void addOverlay (RenderState[] overlay)
|
public void addOverlay (RenderState[] overlay)
|
||||||
{
|
{
|
||||||
if (_overlays == null) {
|
if (_overlays == null) {
|
||||||
_overlays = new ArrayList<RenderState[]>(1);
|
_overlays = Lists.newArrayListWithCapacity(1);
|
||||||
}
|
}
|
||||||
_overlays.add(overlay);
|
_overlays.add(overlay);
|
||||||
}
|
}
|
||||||
@@ -461,7 +461,7 @@ public class ModelMesh extends TriMesh
|
|||||||
@Override // documentation inherited
|
@Override // documentation inherited
|
||||||
protected void setupBatchList ()
|
protected void setupBatchList ()
|
||||||
{
|
{
|
||||||
batchList = new ArrayList<GeomBatch>(1);
|
batchList = Lists.newArrayListWithCapacity(1);
|
||||||
TriangleBatch batch = createModelBatch();
|
TriangleBatch batch = createModelBatch();
|
||||||
batch.setParentGeom(this);
|
batch.setParentGeom(this);
|
||||||
batchList.add(batch);
|
batchList.add(batch);
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ public class SkinMesh extends ModelMesh
|
|||||||
_weightGroups = weightGroups;
|
_weightGroups = weightGroups;
|
||||||
|
|
||||||
// compile a list of all referenced bones
|
// compile a list of all referenced bones
|
||||||
HashSet<Bone> bones = new HashSet<Bone>();
|
HashSet<Bone> bones = Sets.newHashSet();
|
||||||
for (WeightGroup group : weightGroups) {
|
for (WeightGroup group : weightGroups) {
|
||||||
Collections.addAll(bones, group.bones);
|
Collections.addAll(bones, group.bones);
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ public class SkinMesh extends ModelMesh
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_osconfigs == null) {
|
if (_osconfigs == null) {
|
||||||
_osconfigs = new ArrayList<SkinShaderConfig>(1);
|
_osconfigs = Lists.newArrayListWithCapacity(1);
|
||||||
}
|
}
|
||||||
SkinShaderConfig osconfig = (SkinShaderConfig)_sconfig.clone();
|
SkinShaderConfig osconfig = (SkinShaderConfig)_sconfig.clone();
|
||||||
osconfig.getState().uniforms = _sconfig.getState().uniforms;
|
osconfig.getState().uniforms = _sconfig.getState().uniforms;
|
||||||
@@ -299,7 +299,7 @@ public class SkinMesh extends ModelMesh
|
|||||||
mstore._useDisplayLists = _useDisplayLists;
|
mstore._useDisplayLists = _useDisplayLists;
|
||||||
mstore._invRefTransform = _invRefTransform;
|
mstore._invRefTransform = _invRefTransform;
|
||||||
mstore._bones = new Bone[_bones.length];
|
mstore._bones = new Bone[_bones.length];
|
||||||
HashMap<Bone, Bone> bmap = new HashMap<Bone, Bone>();
|
HashMap<Bone, Bone> bmap = Maps.newHashMap();
|
||||||
for (int ii = 0; ii < _bones.length; ii++) {
|
for (int ii = 0; ii < _bones.length; ii++) {
|
||||||
bmap.put(_bones[ii], mstore._bones[ii] =
|
bmap.put(_bones[ii], mstore._bones[ii] =
|
||||||
_bones[ii].rebind(properties.originalToCopy));
|
_bones[ii].rebind(properties.originalToCopy));
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public abstract class TextureController extends ModelController
|
|||||||
protected void initTextures ()
|
protected void initTextures ()
|
||||||
{
|
{
|
||||||
// find and clone all textures under the target
|
// find and clone all textures under the target
|
||||||
final HashMap<Texture, Texture> clones = new HashMap<Texture, Texture>();
|
final HashMap<Texture, Texture> clones = Maps.newHashMap();
|
||||||
new SpatialVisitor<ModelMesh>(ModelMesh.class) {
|
new SpatialVisitor<ModelMesh>(ModelMesh.class) {
|
||||||
protected void visit (ModelMesh mesh) {
|
protected void visit (ModelMesh mesh) {
|
||||||
TextureState otstate = (TextureState)mesh.getRenderState(RenderState.RS_TEXTURE);
|
TextureState otstate = (TextureState)mesh.getRenderState(RenderState.RS_TEXTURE);
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ public class AnimationDef
|
|||||||
public static class FrameDef
|
public static class FrameDef
|
||||||
{
|
{
|
||||||
/** Transform for affected nodes. */
|
/** Transform for affected nodes. */
|
||||||
public ArrayList<TransformDef> transforms =
|
public ArrayList<TransformDef> transforms = Lists.newArrayList();
|
||||||
new ArrayList<TransformDef>();
|
|
||||||
|
|
||||||
public void addTransform (TransformDef transform)
|
public void addTransform (TransformDef transform)
|
||||||
{
|
{
|
||||||
@@ -122,14 +121,13 @@ public class AnimationDef
|
|||||||
{
|
{
|
||||||
return new Model.Transform(
|
return new Model.Transform(
|
||||||
new Vector3f(translation[0], translation[1], translation[2]),
|
new Vector3f(translation[0], translation[1], translation[2]),
|
||||||
new Quaternion(rotation[0], rotation[1], rotation[2],
|
new Quaternion(rotation[0], rotation[1], rotation[2], rotation[3]),
|
||||||
rotation[3]),
|
|
||||||
new Vector3f(scale[0], scale[1], scale[2]));
|
new Vector3f(scale[0], scale[1], scale[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The individual frames of the animation. */
|
/** The individual frames of the animation. */
|
||||||
public ArrayList<FrameDef> frames = new ArrayList<FrameDef>();
|
public ArrayList<FrameDef> frames = Lists.newArrayList();
|
||||||
|
|
||||||
public void addFrame (FrameDef frame)
|
public void addFrame (FrameDef frame)
|
||||||
{
|
{
|
||||||
@@ -185,8 +183,8 @@ public class AnimationDef
|
|||||||
Properties props, HashMap<String, Spatial> nodes, HashMap<String, TransformNode> tnodes)
|
Properties props, HashMap<String, Spatial> nodes, HashMap<String, TransformNode> tnodes)
|
||||||
{
|
{
|
||||||
// find all affected nodes
|
// find all affected nodes
|
||||||
HashSet<Spatial> staticTargets = new HashSet<Spatial>(),
|
HashSet<Spatial> staticTargets = Sets.newHashSet(),
|
||||||
transformTargets = new HashSet<Spatial>();
|
transformTargets = Sets.newHashSet();
|
||||||
for (int ii = 0, nn = frames.size(); ii < nn; ii++) {
|
for (int ii = 0, nn = frames.size(); ii < nn; ii++) {
|
||||||
frames.get(ii).addTransformTargets(nodes, tnodes, staticTargets, transformTargets);
|
frames.get(ii).addTransformTargets(nodes, tnodes, staticTargets, transformTargets);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class CompileModel
|
|||||||
|
|
||||||
// preprocess the model and animations to determine which nodes never move, which never
|
// preprocess the model and animations to determine which nodes never move, which never
|
||||||
// move within an animation, and which never move with respect to others
|
// move within an animation, and which never move with respect to others
|
||||||
HashMap<String, TransformNode> tnodes = new HashMap<String, TransformNode>();
|
HashMap<String, TransformNode> tnodes = Maps.newHashMap();
|
||||||
Node troot = mdef.createTransformTree(props, tnodes);
|
Node troot = mdef.createTransformTree(props, tnodes);
|
||||||
for (AnimationDef adef : adefs) {
|
for (AnimationDef adef : adefs) {
|
||||||
adef.filterTransforms(troot, tnodes);
|
adef.filterTransforms(troot, tnodes);
|
||||||
@@ -119,7 +119,7 @@ public class CompileModel
|
|||||||
mdef.mergeSpatials(tnodes);
|
mdef.mergeSpatials(tnodes);
|
||||||
|
|
||||||
// load the model content
|
// load the model content
|
||||||
HashMap<String, Spatial> nodes = new HashMap<String, Spatial>();
|
HashMap<String, Spatial> nodes = Maps.newHashMap();
|
||||||
Model model = mdef.createModel(props, nodes);
|
Model model = mdef.createModel(props, nodes);
|
||||||
model.initPrototype();
|
model.initPrototype();
|
||||||
|
|
||||||
|
|||||||
@@ -81,5 +81,5 @@ public class CompileModelTask extends Task
|
|||||||
protected File _dest;
|
protected File _dest;
|
||||||
|
|
||||||
/** A list of filesets that contain XML models. */
|
/** A list of filesets that contain XML models. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,5 +130,5 @@ public class ConvertModelTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain tileset bundle definitions. */
|
/** A list of filesets that contain tileset bundle definitions. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ public class ModelDef
|
|||||||
public HashArrayList<Vertex> vertices = new HashArrayList<Vertex>();
|
public HashArrayList<Vertex> vertices = new HashArrayList<Vertex>();
|
||||||
|
|
||||||
/** The triangle indices. */
|
/** The triangle indices. */
|
||||||
public ArrayList<Integer> indices = new ArrayList<Integer>();
|
public ArrayList<Integer> indices = Lists.newArrayList();
|
||||||
|
|
||||||
/** Whether or not any of the vertices have texture coordinates. */
|
/** Whether or not any of the vertices have texture coordinates. */
|
||||||
public boolean tcoords;
|
public boolean tcoords;
|
||||||
@@ -265,7 +265,7 @@ public class ModelDef
|
|||||||
Triangle triangle = new Triangle(tverts);
|
Triangle triangle = new Triangle(tverts);
|
||||||
for (Vertex tvert : tverts) {
|
for (Vertex tvert : tverts) {
|
||||||
if (tvert.triangles == null) {
|
if (tvert.triangles == null) {
|
||||||
tvert.triangles = new ArrayList<Triangle>();
|
tvert.triangles = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
tvert.triangles.add(triangle);
|
tvert.triangles.add(triangle);
|
||||||
}
|
}
|
||||||
@@ -410,10 +410,8 @@ public class ModelDef
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create and set the final weight groups
|
// create and set the final weight groups
|
||||||
SkinMesh.WeightGroup[] wgroups =
|
SkinMesh.WeightGroup[] wgroups = new SkinMesh.WeightGroup[_groups.size()];
|
||||||
new SkinMesh.WeightGroup[_groups.size()];
|
HashMap<String, SkinMesh.Bone> bones = Maps.newHashMap();
|
||||||
HashMap<String, SkinMesh.Bone> bones =
|
|
||||||
new HashMap<String, SkinMesh.Bone>();
|
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
int mweights = 0, tweights = 0;
|
int mweights = 0, tweights = 0;
|
||||||
for (Map.Entry<Set<String>, WeightGroupDef> entry :
|
for (Map.Entry<Set<String>, WeightGroupDef> entry :
|
||||||
@@ -444,7 +442,7 @@ public class ModelDef
|
|||||||
protected void configureMesh (Properties props)
|
protected void configureMesh (Properties props)
|
||||||
{
|
{
|
||||||
// divide the vertices up by weight groups
|
// divide the vertices up by weight groups
|
||||||
_groups = new HashMap<Set<String>, WeightGroupDef>();
|
_groups = Maps.newHashMap();
|
||||||
for (int ii = 0, nn = vertices.size(); ii < nn; ii++) {
|
for (int ii = 0, nn = vertices.size(); ii < nn; ii++) {
|
||||||
SkinVertex svertex = (SkinVertex)vertices.get(ii);
|
SkinVertex svertex = (SkinVertex)vertices.get(ii);
|
||||||
Set<String> bones = svertex.boneWeights.keySet();
|
Set<String> bones = svertex.boneWeights.keySet();
|
||||||
@@ -597,8 +595,7 @@ public class ModelDef
|
|||||||
public static class SkinVertex extends Vertex
|
public static class SkinVertex extends Vertex
|
||||||
{
|
{
|
||||||
/** The bones influencing the vertex, mapped by name. */
|
/** The bones influencing the vertex, mapped by name. */
|
||||||
public HashMap<String, BoneWeight> boneWeights =
|
public HashMap<String, BoneWeight> boneWeights = Maps.newHashMap();
|
||||||
new HashMap<String, BoneWeight>();
|
|
||||||
|
|
||||||
public void addBoneWeight (BoneWeight weight)
|
public void addBoneWeight (BoneWeight weight)
|
||||||
{
|
{
|
||||||
@@ -616,7 +613,7 @@ public class ModelDef
|
|||||||
/** Finds the bone nodes influencing this vertex. */
|
/** Finds the bone nodes influencing this vertex. */
|
||||||
public HashSet<ModelNode> getBones (HashMap<String, Spatial> nodes)
|
public HashSet<ModelNode> getBones (HashMap<String, Spatial> nodes)
|
||||||
{
|
{
|
||||||
HashSet<ModelNode> bones = new HashSet<ModelNode>();
|
HashSet<ModelNode> bones = Sets.newHashSet();
|
||||||
for (String bone : boneWeights.keySet()) {
|
for (String bone : boneWeights.keySet()) {
|
||||||
Spatial node = nodes.get(bone);
|
Spatial node = nodes.get(bone);
|
||||||
if (node instanceof ModelNode) {
|
if (node instanceof ModelNode) {
|
||||||
@@ -651,10 +648,10 @@ public class ModelDef
|
|||||||
public static class WeightGroupDef
|
public static class WeightGroupDef
|
||||||
{
|
{
|
||||||
/** The indices of the affected vertex. */
|
/** The indices of the affected vertex. */
|
||||||
public ArrayList<Integer> indices = new ArrayList<Integer>();
|
public ArrayList<Integer> indices = Lists.newArrayList();
|
||||||
|
|
||||||
/** The interleaved vertex weights. */
|
/** The interleaved vertex weights. */
|
||||||
public ArrayList<Float> weights = new ArrayList<Float>();
|
public ArrayList<Float> weights = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Contains the transform of a node for preprocessing. */
|
/** Contains the transform of a node for preprocessing. */
|
||||||
@@ -754,7 +751,7 @@ public class ModelDef
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The meshes and bones comprising the model. */
|
/** The meshes and bones comprising the model. */
|
||||||
public ArrayList<SpatialDef> spatials = new ArrayList<SpatialDef>();
|
public ArrayList<SpatialDef> spatials = Lists.newArrayList();
|
||||||
|
|
||||||
public void addSpatial (SpatialDef spatial)
|
public void addSpatial (SpatialDef spatial)
|
||||||
{
|
{
|
||||||
@@ -775,7 +772,7 @@ public class ModelDef
|
|||||||
|
|
||||||
// resolve the parents and collect the names of the bones
|
// resolve the parents and collect the names of the bones
|
||||||
Node root = new Node("root");
|
Node root = new Node("root");
|
||||||
HashSet<String> bones = new HashSet<String>();
|
HashSet<String> bones = Sets.newHashSet();
|
||||||
for (TransformNode node : nodes.values()) {
|
for (TransformNode node : nodes.values()) {
|
||||||
if (node.spatial.parent == null) {
|
if (node.spatial.parent == null) {
|
||||||
root.attachChild(node);
|
root.attachChild(node);
|
||||||
@@ -811,7 +808,7 @@ public class ModelDef
|
|||||||
root.updateGeometricState(0f, true);
|
root.updateGeometricState(0f, true);
|
||||||
for (TransformNode node : nodes.values()) {
|
for (TransformNode node : nodes.values()) {
|
||||||
node.baseLocalTransform = new Matrix4f(node.localTransform);
|
node.baseLocalTransform = new Matrix4f(node.localTransform);
|
||||||
node.relativeTransforms = new ArrayList<Tuple<TransformNode, Matrix4f>>();
|
node.relativeTransforms = Lists.newArrayList();
|
||||||
for (TransformNode onode : nodes.values()) {
|
for (TransformNode onode : nodes.values()) {
|
||||||
if (node == onode || !node.canMerge(props, onode)) {
|
if (node == onode || !node.canMerge(props, onode)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -858,9 +855,8 @@ public class ModelDef
|
|||||||
nodes.put(spatial.getName(), spatial);
|
nodes.put(spatial.getName(), spatial);
|
||||||
}
|
}
|
||||||
|
|
||||||
// then go through again, resolving any name references and attaching
|
// then go through again, resolving any name references and attaching root children
|
||||||
// root children
|
HashSet<Spatial> referenced = Sets.newHashSet();
|
||||||
HashSet<Spatial> referenced = new HashSet<Spatial>();
|
|
||||||
for (int ii = 0, nn = spatials.size(); ii < nn; ii++) {
|
for (int ii = 0, nn = spatials.size(); ii < nn; ii++) {
|
||||||
SpatialDef sdef = spatials.get(ii);
|
SpatialDef sdef = spatials.get(ii);
|
||||||
sdef.resolveReferences(nodes, referenced);
|
sdef.resolveReferences(nodes, referenced);
|
||||||
@@ -1036,6 +1032,6 @@ public class ModelDef
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Maps elements to their indices in the list. */
|
/** Maps elements to their indices in the list. */
|
||||||
protected HashMap<Object, Integer> _indices = new HashMap<Object, Integer>();
|
protected HashMap<Object, Integer> _indices = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -738,8 +738,7 @@ public class ModelViewer extends JmeCanvasApp
|
|||||||
}
|
}
|
||||||
return tstate;
|
return tstate;
|
||||||
}
|
}
|
||||||
protected HashMap<String, TextureState> _tstates =
|
protected HashMap<String, TextureState> _tstates = Maps.newHashMap();
|
||||||
new HashMap<String, TextureState>();
|
|
||||||
});
|
});
|
||||||
_model.updateRenderState();
|
_model.updateRenderState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -380,16 +380,13 @@ public class ImageCache
|
|||||||
protected ResourceManager _rsrcmgr;
|
protected ResourceManager _rsrcmgr;
|
||||||
|
|
||||||
/** A cache of {@link Image} instances. */
|
/** A cache of {@link Image} instances. */
|
||||||
protected HashMap<String,WeakReference<Image>> _imgcache =
|
protected HashMap<String,WeakReference<Image>> _imgcache = Maps.newHashMap();
|
||||||
new HashMap<String,WeakReference<Image>>();
|
|
||||||
|
|
||||||
/** A cache of {@link BImage} instances. */
|
/** A cache of {@link BImage} instances. */
|
||||||
protected HashMap<String,WeakReference<BImage>> _buicache =
|
protected HashMap<String,WeakReference<BImage>> _buicache = Maps.newHashMap();
|
||||||
new HashMap<String,WeakReference<BImage>>();
|
|
||||||
|
|
||||||
/** A cache of {@link BufferedImage} instances. */
|
/** A cache of {@link BufferedImage} instances. */
|
||||||
protected HashMap<String,WeakReference<BufferedImage>> _bufcache =
|
protected HashMap<String,WeakReference<BufferedImage>> _bufcache = Maps.newHashMap();
|
||||||
new HashMap<String,WeakReference<BufferedImage>>();
|
|
||||||
|
|
||||||
/** Used to create buffered images in a format compatible with OpenGL. */
|
/** Used to create buffered images in a format compatible with OpenGL. */
|
||||||
protected static ComponentColorModel GL_ALPHA_MODEL = new ComponentColorModel(
|
protected static ComponentColorModel GL_ALPHA_MODEL = new ComponentColorModel(
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class ShaderCache
|
|||||||
public String frag;
|
public String frag;
|
||||||
|
|
||||||
/** The set of preprocessor definitions. */
|
/** The set of preprocessor definitions. */
|
||||||
public HashSet<String> defs = new HashSet<String>();
|
public HashSet<String> defs = Sets.newHashSet();
|
||||||
|
|
||||||
public ShaderKey (String vert, String frag, String[] defs)
|
public ShaderKey (String vert, String frag, String[] defs)
|
||||||
{
|
{
|
||||||
@@ -253,8 +253,8 @@ public class ShaderCache
|
|||||||
protected ResourceManager _rsrcmgr;
|
protected ResourceManager _rsrcmgr;
|
||||||
|
|
||||||
/** Maps shader names to source strings. */
|
/** Maps shader names to source strings. */
|
||||||
protected HashMap<String, String> _sources = new HashMap<String, String>();
|
protected HashMap<String, String> _sources = Maps.newHashMap();
|
||||||
|
|
||||||
/** Maps shader keys to linked program ids. */
|
/** Maps shader keys to linked program ids. */
|
||||||
protected HashMap<ShaderKey, Integer> _programIds = new HashMap<ShaderKey, Integer>();
|
protected HashMap<ShaderKey, Integer> _programIds = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ public abstract class ShaderConfig
|
|||||||
// reconfigure the shader state, generating the derived definitions only if the
|
// reconfigure the shader state, generating the derived definitions only if the
|
||||||
// required configuration isn't in the cache
|
// required configuration isn't in the cache
|
||||||
String vert = getVertexShader(), frag = getFragmentShader();
|
String vert = getVertexShader(), frag = getFragmentShader();
|
||||||
ArrayList<String> defs = new ArrayList<String>();
|
ArrayList<String> defs = Lists.newArrayList();
|
||||||
getDefinitions(defs);
|
getDefinitions(defs);
|
||||||
String[] darray = defs.toArray(new String[defs.size()]), ddarray = null;
|
String[] darray = defs.toArray(new String[defs.size()]), ddarray = null;
|
||||||
if (!_scache.isLoaded(vert, frag, darray)) {
|
if (!_scache.isLoaded(vert, frag, darray)) {
|
||||||
ArrayList<String> ddefs = new ArrayList<String>();
|
ArrayList<String> ddefs = Lists.newArrayList();
|
||||||
getDerivedDefinitions(ddefs);
|
getDerivedDefinitions(ddefs);
|
||||||
ddarray = ddefs.toArray(new String[ddefs.size()]);
|
ddarray = ddefs.toArray(new String[ddefs.size()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import javax.swing.SwingUtilities;
|
|||||||
import javax.swing.event.AncestorEvent;
|
import javax.swing.event.AncestorEvent;
|
||||||
import javax.swing.event.MouseInputAdapter;
|
import javax.swing.event.MouseInputAdapter;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.swing.Controller;
|
import com.samskivert.swing.Controller;
|
||||||
import com.samskivert.swing.event.AncestorAdapter;
|
import com.samskivert.swing.event.AncestorAdapter;
|
||||||
import com.samskivert.swing.event.CommandEvent;
|
import com.samskivert.swing.event.CommandEvent;
|
||||||
@@ -367,7 +369,7 @@ public class MediaPanel extends JComponent
|
|||||||
*/
|
*/
|
||||||
public void addObscurer (Obscurer obscurer) {
|
public void addObscurer (Obscurer obscurer) {
|
||||||
if (_obscurerList == null) {
|
if (_obscurerList == null) {
|
||||||
_obscurerList = new ArrayList<Obscurer>();
|
_obscurerList = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
_obscurerList.add(obscurer);
|
_obscurerList.add(obscurer);
|
||||||
}
|
}
|
||||||
@@ -640,7 +642,7 @@ public class MediaPanel extends JComponent
|
|||||||
*/
|
*/
|
||||||
protected Sprite getHit (MouseEvent me)
|
protected Sprite getHit (MouseEvent me)
|
||||||
{
|
{
|
||||||
ArrayList<Sprite> list = new ArrayList<Sprite>();
|
ArrayList<Sprite> list = Lists.newArrayList();
|
||||||
getSpriteManager().getHitSprites(list, me.getX(), me.getY());
|
getSpriteManager().getHitSprites(list, me.getX(), me.getY());
|
||||||
for (int ii = 0, nn = list.size(); ii < nn; ii++) {
|
for (int ii = 0, nn = list.size(); ii < nn; ii++) {
|
||||||
Object o = list.get(ii);
|
Object o = list.get(ii);
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import java.awt.event.MouseWheelEvent;
|
|||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.RunAnywhere;
|
import com.samskivert.util.RunAnywhere;
|
||||||
|
|
||||||
import com.threerings.media.image.ImageUtil;
|
import com.threerings.media.image.ImageUtil;
|
||||||
@@ -462,5 +464,5 @@ public class VirtualMediaPanel extends MediaPanel
|
|||||||
protected Rectangle _abounds = new Rectangle();
|
protected Rectangle _abounds = new Rectangle();
|
||||||
|
|
||||||
/** A list of entities to be informed when the view scrolls. */
|
/** A list of entities to be informed when the view scrolls. */
|
||||||
protected ArrayList<ViewTracker> _trackers = new ArrayList<ViewTracker>();
|
protected ArrayList<ViewTracker> _trackers = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.swing.util.SwingUtil;
|
import com.samskivert.swing.util.SwingUtil;
|
||||||
|
|
||||||
import static com.threerings.media.Log.log;
|
import static com.threerings.media.Log.log;
|
||||||
@@ -42,7 +44,7 @@ public class AnimationArranger
|
|||||||
public void positionAvoidAnimation (Animation anim, Rectangle viewBounds)
|
public void positionAvoidAnimation (Animation anim, Rectangle viewBounds)
|
||||||
{
|
{
|
||||||
Rectangle abounds = new Rectangle(anim.getBounds());
|
Rectangle abounds = new Rectangle(anim.getBounds());
|
||||||
@SuppressWarnings("unchecked") ArrayList<Animation> avoidables =
|
@SuppressWarnings("unchecked") ArrayList<Animation> avoidables =
|
||||||
(ArrayList<Animation>) _avoidAnims.clone();
|
(ArrayList<Animation>) _avoidAnims.clone();
|
||||||
// if we are able to place it somewhere, do so
|
// if we are able to place it somewhere, do so
|
||||||
if (SwingUtil.positionRect(abounds, viewBounds, avoidables)) {
|
if (SwingUtil.positionRect(abounds, viewBounds, avoidables)) {
|
||||||
@@ -56,7 +58,7 @@ public class AnimationArranger
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The animations that other animations may wish to avoid. */
|
/** The animations that other animations may wish to avoid. */
|
||||||
protected ArrayList<Animation> _avoidAnims = new ArrayList<Animation>();
|
protected ArrayList<Animation> _avoidAnims = Lists.newArrayList();
|
||||||
|
|
||||||
/** Automatically removes avoid animations when they're done. */
|
/** Automatically removes avoid animations when they're done. */
|
||||||
protected AnimationAdapter _avoidAnimObs = new AnimationAdapter() {
|
protected AnimationAdapter _avoidAnimObs = new AnimationAdapter() {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import java.util.ArrayList;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import static com.threerings.media.Log.log;
|
import static com.threerings.media.Log.log;
|
||||||
@@ -284,10 +286,10 @@ public class AnimationSequencer extends Animation
|
|||||||
protected AnimationManager _animmgr;
|
protected AnimationManager _animmgr;
|
||||||
|
|
||||||
/** Animations that have not been fired. */
|
/** Animations that have not been fired. */
|
||||||
protected ArrayList<AnimRecord> _queued = new ArrayList<AnimRecord>();
|
protected ArrayList<AnimRecord> _queued = Lists.newArrayList();
|
||||||
|
|
||||||
/** Animations that are currently running. */
|
/** Animations that are currently running. */
|
||||||
protected ArrayList<AnimRecord> _running = new ArrayList<AnimRecord>();
|
protected ArrayList<AnimRecord> _running = Lists.newArrayList();
|
||||||
|
|
||||||
/** The timestamp at which we fired the last animation. */
|
/** The timestamp at which we fired the last animation. */
|
||||||
protected long _lastStamp;
|
protected long _lastStamp;
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import java.text.ParseException;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -133,7 +135,7 @@ public class ColorPository implements Serializable
|
|||||||
{
|
{
|
||||||
// figure out our starter ids if we haven't already
|
// figure out our starter ids if we haven't already
|
||||||
if (_starters == null) {
|
if (_starters == null) {
|
||||||
ArrayList<ColorRecord> list = new ArrayList<ColorRecord>();
|
ArrayList<ColorRecord> list = Lists.newArrayList();
|
||||||
for (ColorRecord color : colors.values()) {
|
for (ColorRecord color : colors.values()) {
|
||||||
if (color.starter) {
|
if (color.starter) {
|
||||||
list.add(color);
|
list.add(color);
|
||||||
@@ -144,8 +146,8 @@ public class ColorPository implements Serializable
|
|||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (_starters.length < 1) {
|
if (_starters.length < 1) {
|
||||||
log.warning("Requested random starting color from " +
|
log.warning("Requested random starting color from colorless component class",
|
||||||
"colorless component class " + this + "].");
|
"class", this);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ import java.awt.Rectangle;
|
|||||||
import java.awt.Transparency;
|
import java.awt.Transparency;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.LRUHashMap;
|
import com.samskivert.util.LRUHashMap;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -477,7 +479,7 @@ public class ImageManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_colorized == null) {
|
if (_colorized == null) {
|
||||||
_colorized = new ArrayList<Tuple<Colorization[], BufferedImage>>();
|
_colorized = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we search linearly through our list of colorized copies because it is not likely to
|
// we search linearly through our list of colorized copies because it is not likely to
|
||||||
@@ -540,7 +542,7 @@ public class ImageManager
|
|||||||
protected LRUHashMap<ImageKey, CacheRecord> _ccache;
|
protected LRUHashMap<ImageKey, CacheRecord> _ccache;
|
||||||
|
|
||||||
/** The set of all keys we've ever seen. */
|
/** The set of all keys we've ever seen. */
|
||||||
protected HashSet<ImageKey> _keySet = new HashSet<ImageKey>();
|
protected HashSet<ImageKey> _keySet = Sets.newHashSet();
|
||||||
|
|
||||||
/** Throttle our cache status logging to once every 300 seconds. */
|
/** Throttle our cache status logging to once every 300 seconds. */
|
||||||
protected Throttle _cacheStatThrottle = new Throttle(1, 300000L);
|
protected Throttle _cacheStatThrottle = new Throttle(1, 300000L);
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ import javax.sound.sampled.UnsupportedAudioFileException;
|
|||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.LRUHashMap;
|
import com.samskivert.util.LRUHashMap;
|
||||||
import com.samskivert.util.Queue;
|
import com.samskivert.util.Queue;
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
@@ -759,7 +761,7 @@ public class JavaSoundPlayer extends SoundPlayer
|
|||||||
* The set of locked audio clips; this is separate from the LRU so that locking clips doesn't
|
* The set of locked audio clips; this is separate from the LRU so that locking clips doesn't
|
||||||
* booch up an otherwise normal caching agenda.
|
* booch up an otherwise normal caching agenda.
|
||||||
*/
|
*/
|
||||||
protected HashMap<SoundKey,byte[][]> _lockedClips = new HashMap<SoundKey,byte[][]>();
|
protected HashMap<SoundKey,byte[][]> _lockedClips = Maps.newHashMap();
|
||||||
|
|
||||||
/** Soundkey command constants. */
|
/** Soundkey command constants. */
|
||||||
protected static final byte PLAY = 0;
|
protected static final byte PLAY = 0;
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ package com.threerings.media.tile.bundle;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.IntMap;
|
import com.samskivert.util.IntMap;
|
||||||
@@ -74,7 +76,7 @@ public class BundledTileSetRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes our bundles,
|
* Initializes our bundles,
|
||||||
*/
|
*/
|
||||||
protected void initBundles (ResourceManager rmgr, String name)
|
protected void initBundles (ResourceManager rmgr, String name)
|
||||||
{
|
{
|
||||||
@@ -91,12 +93,12 @@ public class BundledTileSetRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
HashIntMap<TileSet> idmap = new HashIntMap<TileSet>();
|
HashIntMap<TileSet> idmap = new HashIntMap<TileSet>();
|
||||||
HashMap<String, Integer> namemap = new HashMap<String, Integer>();
|
HashMap<String, Integer> namemap = Maps.newHashMap();
|
||||||
|
|
||||||
// iterate over the resource bundles in the set, loading up the
|
// iterate over the resource bundles in the set, loading up the
|
||||||
// tileset bundles in each resource bundle
|
// tileset bundles in each resource bundle
|
||||||
for (int i = 0; i < rbundles.length; i++) {
|
for (ResourceBundle rbundle : rbundles) {
|
||||||
addBundle(idmap, namemap, rbundles[i]);
|
addBundle(idmap, namemap, rbundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill in our bundles array and wake up any waiters
|
// fill in our bundles array and wake up any waiters
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ import org.xml.sax.SAXException;
|
|||||||
import org.apache.commons.digester.Digester;
|
import org.apache.commons.digester.Digester;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
@@ -137,7 +139,7 @@ public class TileSetBundler
|
|||||||
Digester digester = new Digester();
|
Digester digester = new Digester();
|
||||||
|
|
||||||
// push our mappings array onto the stack
|
// push our mappings array onto the stack
|
||||||
ArrayList<Mapping> mappings = new ArrayList<Mapping>();
|
ArrayList<Mapping> mappings = Lists.newArrayList();
|
||||||
digester.push(mappings);
|
digester.push(mappings);
|
||||||
|
|
||||||
// create a mapping object for each mapping entry and append it to
|
// create a mapping object for each mapping entry and append it to
|
||||||
@@ -232,7 +234,7 @@ public class TileSetBundler
|
|||||||
{
|
{
|
||||||
// stick an array list on the top of the stack into which we will
|
// stick an array list on the top of the stack into which we will
|
||||||
// collect parsed tilesets
|
// collect parsed tilesets
|
||||||
ArrayList<TileSet> sets = new ArrayList<TileSet>();
|
ArrayList<TileSet> sets = Lists.newArrayList();
|
||||||
_digester.push(sets);
|
_digester.push(sets);
|
||||||
|
|
||||||
// parse the tilesets
|
// parse the tilesets
|
||||||
@@ -367,7 +369,7 @@ public class TileSetBundler
|
|||||||
// write all of the image files to the bundle, converting the
|
// write all of the image files to the bundle, converting the
|
||||||
// tilesets to trimmed tilesets in the process
|
// tilesets to trimmed tilesets in the process
|
||||||
Iterator<Integer> iditer = bundle.enumerateTileSetIds();
|
Iterator<Integer> iditer = bundle.enumerateTileSetIds();
|
||||||
|
|
||||||
// Store off the updated TileSets in a separate Map so we can wait to change the
|
// Store off the updated TileSets in a separate Map so we can wait to change the
|
||||||
// bundle till we're done iterating.
|
// bundle till we're done iterating.
|
||||||
HashIntMap<TileSet> toUpdate = new HashIntMap<TileSet>();
|
HashIntMap<TileSet> toUpdate = new HashIntMap<TileSet>();
|
||||||
|
|||||||
@@ -31,6 +31,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.media.tile.tools.MapFileTileSetIDBroker;
|
import com.threerings.media.tile.tools.MapFileTileSetIDBroker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,8 +94,8 @@ public class TileSetBundlerTask extends Task
|
|||||||
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) {
|
||||||
cfile = new File(fromDir, srcFiles[f]);
|
cfile = new File(fromDir, srcFile);
|
||||||
|
|
||||||
// figure out the bundle file based on the definition
|
// figure out the bundle file based on the definition
|
||||||
// file
|
// file
|
||||||
@@ -158,5 +160,5 @@ public class TileSetBundlerTask extends Task
|
|||||||
protected File _mapfile;
|
protected File _mapfile;
|
||||||
|
|
||||||
/** A list of filesets that contain tileset bundle definitions. */
|
/** A list of filesets that contain tileset bundle definitions. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,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.Maps;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
import com.samskivert.io.PersistenceException;
|
||||||
import com.samskivert.util.QuickSort;
|
import com.samskivert.util.QuickSort;
|
||||||
|
|
||||||
@@ -60,14 +62,14 @@ public class MapFileTileSetIDBroker implements TileSetIDBroker
|
|||||||
_nextTileSetID = readInt(bin);
|
_nextTileSetID = readInt(bin);
|
||||||
_storedTileSetID = _nextTileSetID;
|
_storedTileSetID = _nextTileSetID;
|
||||||
// read in our mappings
|
// read in our mappings
|
||||||
_map = new HashMap<String, Integer>();
|
_map = Maps.newHashMap();
|
||||||
readMapFile(bin, _map);
|
readMapFile(bin, _map);
|
||||||
|
|
||||||
bin.close();
|
bin.close();
|
||||||
|
|
||||||
} catch (FileNotFoundException fnfe) {
|
} catch (FileNotFoundException fnfe) {
|
||||||
// create a blank map if our map file doesn't exist
|
// create a blank map if our map file doesn't exist
|
||||||
_map = new HashMap<String, Integer>();
|
_map = Maps.newHashMap();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// other errors are more fatal
|
// other errors are more fatal
|
||||||
@@ -170,8 +172,8 @@ public class MapFileTileSetIDBroker implements TileSetIDBroker
|
|||||||
lines[ii] = key + SEP_STR + value;
|
lines[ii] = key + SEP_STR + value;
|
||||||
}
|
}
|
||||||
QuickSort.sort(lines);
|
QuickSort.sort(lines);
|
||||||
for (int ii = 0; ii < lines.length; ii++) {
|
for (String line : lines) {
|
||||||
bout.write(lines[ii], 0, lines[ii].length());
|
bout.write(line, 0, line.length());
|
||||||
bout.newLine();
|
bout.newLine();
|
||||||
}
|
}
|
||||||
bout.flush();
|
bout.flush();
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.media.tile.tools.xml;
|
package com.threerings.media.tile.tools.xml;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -35,6 +34,8 @@ import org.xml.sax.SAXException;
|
|||||||
|
|
||||||
import org.apache.commons.digester.Digester;
|
import org.apache.commons.digester.Digester;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.ConfigUtil;
|
import com.samskivert.util.ConfigUtil;
|
||||||
import com.samskivert.xml.ValidatedSetNextRule;
|
import com.samskivert.xml.ValidatedSetNextRule;
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ public class XMLTileSetParser
|
|||||||
{
|
{
|
||||||
// stick an array list on the top of the stack for collecting
|
// stick an array list on the top of the stack for collecting
|
||||||
// parsed tilesets
|
// parsed tilesets
|
||||||
List<TileSet> setlist = new ArrayList<TileSet>();
|
List<TileSet> setlist = Lists.newArrayList();
|
||||||
_digester.push(setlist);
|
_digester.push(setlist);
|
||||||
|
|
||||||
// now fire up the digester to parse the stream
|
// now fire up the digester to parse the stream
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ import javax.swing.JToggleButton;
|
|||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.QuickSort;
|
import com.samskivert.util.QuickSort;
|
||||||
|
|
||||||
import com.samskivert.swing.HGroupLayout;
|
import com.samskivert.swing.HGroupLayout;
|
||||||
@@ -250,7 +252,7 @@ public class RecolorImage extends JPanel
|
|||||||
Graphics gfx = img.getGraphics();
|
Graphics gfx = img.getGraphics();
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
ArrayList<Integer> sortedKeys = new ArrayList<Integer>();
|
ArrayList<Integer> sortedKeys = Lists.newArrayList();
|
||||||
sortedKeys.addAll(colClass.colors.keySet());
|
sortedKeys.addAll(colClass.colors.keySet());
|
||||||
|
|
||||||
QuickSort.sort(sortedKeys, new Comparator<Integer>() {
|
QuickSort.sort(sortedKeys, new Comparator<Integer>() {
|
||||||
@@ -340,7 +342,7 @@ public class RecolorImage extends JPanel
|
|||||||
|
|
||||||
_classList.removeAllItems();
|
_classList.removeAllItems();
|
||||||
Iterator<ColorPository.ClassRecord> iter = _colRepo.enumerateClasses();
|
Iterator<ColorPository.ClassRecord> iter = _colRepo.enumerateClasses();
|
||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = Lists.newArrayList();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
String str = iter.next().name;
|
String str = iter.next().name;
|
||||||
names.add(str);
|
names.add(str);
|
||||||
|
|||||||
@@ -32,6 +32,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a file that lists all the resources in a fileset out to an index file.
|
* Creates a file that lists all the resources in a fileset out to an index file.
|
||||||
*/
|
*/
|
||||||
@@ -44,19 +46,19 @@ public class ResourceIndexerTask extends Task
|
|||||||
{
|
{
|
||||||
_filesets.add(set);
|
_filesets.add(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIndexFile (String file)
|
public void setIndexFile (String file)
|
||||||
{
|
{
|
||||||
_indexFile = file;
|
_indexFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute () throws BuildException
|
public void execute () throws BuildException
|
||||||
{
|
{
|
||||||
PrintWriter fout = null;
|
PrintWriter fout = null;
|
||||||
try {
|
try {
|
||||||
fout = new PrintWriter(new FileWriter(_indexFile));
|
fout = new PrintWriter(new FileWriter(_indexFile));
|
||||||
|
|
||||||
for (FileSet fs : _filesets) {
|
for (FileSet fs : _filesets) {
|
||||||
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
|
||||||
String[] srcFiles = ds.getIncludedFiles();
|
String[] srcFiles = ds.getIncludedFiles();
|
||||||
@@ -64,7 +66,7 @@ public class ResourceIndexerTask extends Task
|
|||||||
fout.println(filename);
|
fout.println(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new BuildException(ioe);
|
throw new BuildException(ioe);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -75,8 +77,8 @@ public class ResourceIndexerTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain files to include in the index. */
|
/** A list of filesets that contain files to include in the index. */
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
|
|
||||||
/** The name of the file to which we should write the index. */
|
/** The name of the file to which we should write the index. */
|
||||||
protected String _indexFile;
|
protected String _indexFile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import java.util.TreeSet;
|
|||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -270,7 +272,7 @@ public class AStarPathUtil
|
|||||||
protected static List<Point> getNodePath (Node n)
|
protected static List<Point> getNodePath (Node n)
|
||||||
{
|
{
|
||||||
Node cur = n;
|
Node cur = n;
|
||||||
ArrayList<Point> path = new ArrayList<Point>();
|
ArrayList<Point> path = Lists.newArrayList();
|
||||||
|
|
||||||
while (cur != null) {
|
while (cur != null) {
|
||||||
// add to the head of the list since we're traversing from
|
// add to the head of the list since we're traversing from
|
||||||
@@ -337,7 +339,7 @@ public class AStarPathUtil
|
|||||||
|
|
||||||
// construct the open and closed lists
|
// construct the open and closed lists
|
||||||
open = new TreeSet<Node>();
|
open = new TreeSet<Node>();
|
||||||
closed = new ArrayList<Node>();
|
closed = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.util.DirectionCodes;
|
import com.threerings.util.DirectionCodes;
|
||||||
@@ -237,7 +239,7 @@ public class LineSegmentPath
|
|||||||
if (ox != nx || oy != ny) {
|
if (ox != nx || oy != ny) {
|
||||||
pable.setLocation(nx, ny);
|
pable.setLocation(nx, ny);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -340,7 +342,7 @@ public class LineSegmentPath
|
|||||||
addNode(p.x, p.y, dir);
|
addNode(p.x, p.y, dir);
|
||||||
last = p;
|
last = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the next node in the path.
|
* Gets the next node in the path.
|
||||||
@@ -348,10 +350,10 @@ public class LineSegmentPath
|
|||||||
protected PathNode getNextNode ()
|
protected PathNode getNextNode ()
|
||||||
{
|
{
|
||||||
return _niter.next();
|
return _niter.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The nodes that make up the path. */
|
/** The nodes that make up the path. */
|
||||||
protected ArrayList<PathNode> _nodes = new ArrayList<PathNode>();
|
protected ArrayList<PathNode> _nodes = Lists.newArrayList();
|
||||||
|
|
||||||
/** We use this when moving along this path. */
|
/** We use this when moving along this path. */
|
||||||
protected Iterator<PathNode> _niter;
|
protected Iterator<PathNode> _niter;
|
||||||
@@ -371,7 +373,7 @@ public class LineSegmentPath
|
|||||||
/** The path velocity in pixels per millisecond. */
|
/** The path velocity in pixels per millisecond. */
|
||||||
protected float _vel = DEFAULT_VELOCITY;
|
protected float _vel = DEFAULT_VELOCITY;
|
||||||
|
|
||||||
/** When moving, the pathable position including fractional pixels. */
|
/** When moving, the pathable position including fractional pixels. */
|
||||||
protected float _movex, _movey;
|
protected float _movex, _movey;
|
||||||
|
|
||||||
/** When moving, the distance to move on each axis per tick. */
|
/** When moving, the distance to move on each axis per tick. */
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ public class PathSequence
|
|||||||
implements Path
|
implements Path
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Conveniently construct a path sequence with the two specified
|
* Conveniently construct a path sequence with the two specified paths.
|
||||||
* paths.
|
|
||||||
*/
|
*/
|
||||||
public PathSequence (Path first, Path second)
|
public PathSequence (Path first, Path second)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.threerings.media.util;
|
package com.threerings.media.util;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -64,7 +63,7 @@ public class PerformanceMonitor
|
|||||||
Map<String, PerformanceAction> actions = _observers.get(obs);
|
Map<String, PerformanceAction> actions = _observers.get(obs);
|
||||||
if (actions == null) {
|
if (actions == null) {
|
||||||
// create it if it didn't exist
|
// create it if it didn't exist
|
||||||
_observers.put(obs, actions = new HashMap<String, PerformanceAction>());
|
_observers.put(obs, actions = Maps.newHashMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the action to the set we're tracking
|
// add the action to the set we're tracking
|
||||||
@@ -147,7 +146,7 @@ public class PerformanceMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The observers monitoring some set of actions. */
|
/** The observers monitoring some set of actions. */
|
||||||
protected static Map<PerformanceObserver, Map<String, PerformanceAction>> _observers =
|
protected static Map<PerformanceObserver, Map<String, PerformanceAction>> _observers =
|
||||||
Maps.newHashMap();
|
Maps.newHashMap();
|
||||||
|
|
||||||
/** Used to obtain high resolution time stamps. */
|
/** Used to obtain high resolution time stamps. */
|
||||||
@@ -207,7 +206,7 @@ class PerformanceAction
|
|||||||
/** The number of milliseconds between each checkpoint. */
|
/** The number of milliseconds between each checkpoint. */
|
||||||
protected long _delta;
|
protected long _delta;
|
||||||
|
|
||||||
/** The time the last time a checkpoint was made. */
|
/** The time the last time a checkpoint was made. */
|
||||||
protected long _lastDelta;
|
protected long _lastDelta;
|
||||||
|
|
||||||
/** The number of ticks since the last checkpoint. */
|
/** The number of ticks since the last checkpoint. */
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import java.util.Comparator;
|
|||||||
|
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.SortableArrayList;
|
import com.samskivert.util.SortableArrayList;
|
||||||
|
|
||||||
import com.threerings.media.sprite.Sprite;
|
import com.threerings.media.sprite.Sprite;
|
||||||
@@ -663,7 +665,7 @@ public class DirtyItemList
|
|||||||
protected Comparator<DirtyItem> _rcomp = new RenderComparator();
|
protected Comparator<DirtyItem> _rcomp = new RenderComparator();
|
||||||
|
|
||||||
/** Unused dirty items. */
|
/** Unused dirty items. */
|
||||||
protected ArrayList<DirtyItem> _freelist = new ArrayList<DirtyItem>();
|
protected ArrayList<DirtyItem> _freelist = Lists.newArrayList();
|
||||||
|
|
||||||
/** Whether to log debug info when comparing pairs of dirty items. */
|
/** Whether to log debug info when comparing pairs of dirty items. */
|
||||||
protected static final boolean DEBUG_COMPARE = false;
|
protected static final boolean DEBUG_COMPARE = false;
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import java.awt.geom.AffineTransform;
|
|||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.IntTuple;
|
import com.samskivert.util.IntTuple;
|
||||||
|
|
||||||
import com.threerings.media.util.MathUtil;
|
import com.threerings.media.util.MathUtil;
|
||||||
@@ -159,7 +161,7 @@ public class ResolutionView extends JPanel
|
|||||||
|
|
||||||
protected MisoScenePanel _panel;
|
protected MisoScenePanel _panel;
|
||||||
protected MisoSceneMetrics _metrics;
|
protected MisoSceneMetrics _metrics;
|
||||||
protected HashMap<IntTuple, BlockGlyph> _blocks = new HashMap<IntTuple, BlockGlyph>();
|
protected HashMap<IntTuple, BlockGlyph> _blocks = Maps.newHashMap();
|
||||||
|
|
||||||
protected static final int TILE_SIZE = 10;
|
protected static final int TILE_SIZE = 10;
|
||||||
protected static final int MAX_WIDTH = 30;
|
protected static final int MAX_WIDTH = 30;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import java.util.Set;
|
|||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.ArrayUtil;
|
import com.samskivert.util.ArrayUtil;
|
||||||
import com.samskivert.util.IntMap;
|
import com.samskivert.util.IntMap;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -157,7 +159,7 @@ public class SceneBlock
|
|||||||
// resolve our objects
|
// resolve our objects
|
||||||
ObjectSet set = new ObjectSet();
|
ObjectSet set = new ObjectSet();
|
||||||
_model.getObjects(_bounds, set);
|
_model.getObjects(_bounds, set);
|
||||||
ArrayList<SceneObject> scobjs = new ArrayList<SceneObject>();
|
ArrayList<SceneObject> scobjs = Lists.newArrayList();
|
||||||
now = System.currentTimeMillis();
|
now = System.currentTimeMillis();
|
||||||
for (int ii = 0, ll = set.size(); ii < ll; ii++) {
|
for (int ii = 0, ll = set.size(); ii < ll; ii++) {
|
||||||
SceneObject scobj = makeSceneObject(set.get(ii));
|
SceneObject scobj = makeSceneObject(set.get(ii));
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ public class FringeConfiguration implements Serializable
|
|||||||
public int priority;
|
public int priority;
|
||||||
|
|
||||||
/** A list of the possible tilesets that can be used for fringing. */
|
/** A list of the possible tilesets that can be used for fringing. */
|
||||||
public ArrayList<FringeTileSetRecord> tilesets = new ArrayList<FringeTileSetRecord>();
|
public ArrayList<FringeTileSetRecord> tilesets = Lists.newArrayList();
|
||||||
|
|
||||||
/** Used when parsing the tilesets definitions. */
|
/** Used when parsing the tilesets definitions. */
|
||||||
public void addTileset (FringeTileSetRecord record)
|
public void addTileset (FringeTileSetRecord record)
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import org.xml.sax.Attributes;
|
|||||||
import org.apache.commons.digester.Digester;
|
import org.apache.commons.digester.Digester;
|
||||||
import org.apache.commons.digester.Rule;
|
import org.apache.commons.digester.Rule;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.xml.CallMethodSpecialRule;
|
import com.samskivert.xml.CallMethodSpecialRule;
|
||||||
import com.samskivert.xml.SetFieldRule;
|
import com.samskivert.xml.SetFieldRule;
|
||||||
import com.samskivert.xml.SetPropertyFieldsRule;
|
import com.samskivert.xml.SetPropertyFieldsRule;
|
||||||
@@ -85,9 +87,9 @@ public class SimpleMisoSceneRuleSet implements NestableRuleSet
|
|||||||
public void parseAndSet (String bodyText, Object target)
|
public void parseAndSet (String bodyText, Object target)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unchecked") ArrayList<ObjectInfo> ilist =
|
@SuppressWarnings("unchecked") ArrayList<ObjectInfo> ilist =
|
||||||
(ArrayList<ObjectInfo>)target;
|
(ArrayList<ObjectInfo>)target;
|
||||||
ArrayList<ObjectInfo> ulist = new ArrayList<ObjectInfo>();
|
ArrayList<ObjectInfo> ulist = Lists.newArrayList();
|
||||||
SimpleMisoSceneModel model = (SimpleMisoSceneModel)
|
SimpleMisoSceneModel model = (SimpleMisoSceneModel)
|
||||||
digester.peek(1);
|
digester.peek(1);
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An audio stream read from one or more files.
|
* An audio stream read from one or more files.
|
||||||
*/
|
*/
|
||||||
@@ -93,7 +95,7 @@ public class FileStream extends Stream
|
|||||||
protected StreamDecoder _decoder;
|
protected StreamDecoder _decoder;
|
||||||
|
|
||||||
/** The queue of files to play after the current one. */
|
/** The queue of files to play after the current one. */
|
||||||
protected ArrayList<QueuedFile> _queue = new ArrayList<QueuedFile>();
|
protected ArrayList<QueuedFile> _queue = Lists.newArrayList();
|
||||||
|
|
||||||
/** A file queued for play. */
|
/** A file queued for play. */
|
||||||
protected class QueuedFile
|
protected class QueuedFile
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import org.lwjgl.openal.AL10;
|
import org.lwjgl.openal.AL10;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import static com.threerings.openal.Log.log;
|
import static com.threerings.openal.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,5 +149,5 @@ public class SoundGroup
|
|||||||
protected SoundManager _manager;
|
protected SoundManager _manager;
|
||||||
protected ClipProvider _provider;
|
protected ClipProvider _provider;
|
||||||
|
|
||||||
protected ArrayList<PooledSource> _sources = new ArrayList<PooledSource>();
|
protected ArrayList<PooledSource> _sources = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import org.lwjgl.BufferUtils;
|
|||||||
import org.lwjgl.openal.AL;
|
import org.lwjgl.openal.AL;
|
||||||
import org.lwjgl.openal.AL10;
|
import org.lwjgl.openal.AL10;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.IntListUtil;
|
import com.samskivert.util.IntListUtil;
|
||||||
@@ -393,7 +394,7 @@ public class SoundManager
|
|||||||
protected Queue<ClipBuffer> _toLoad;
|
protected Queue<ClipBuffer> _toLoad;
|
||||||
|
|
||||||
/** The list of active streams. */
|
/** The list of active streams. */
|
||||||
protected ArrayList<Stream> _streams = new ArrayList<Stream>();
|
protected ArrayList<Stream> _streams = Lists.newArrayList();
|
||||||
|
|
||||||
/** The list of sources to be deleted. */
|
/** The list of sources to be deleted. */
|
||||||
protected int[] _finalizedSources;
|
protected int[] _finalizedSources;
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import org.lwjgl.BufferUtils;
|
|||||||
import org.lwjgl.openal.AL10;
|
import org.lwjgl.openal.AL10;
|
||||||
import org.lwjgl.openal.AL11;
|
import org.lwjgl.openal.AL11;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an OpenAL source object.
|
* Represents an OpenAL source object.
|
||||||
*/
|
*/
|
||||||
@@ -420,5 +422,5 @@ public class Source
|
|||||||
protected float _coneOuterGain;
|
protected float _coneOuterGain;
|
||||||
|
|
||||||
/** The source's queue of buffers (storing them keeps them from being garbage-collected). */
|
/** The source's queue of buffers (storing them keeps them from being garbage-collected). */
|
||||||
protected ArrayList<Buffer> _queue = new ArrayList<Buffer>();
|
protected ArrayList<Buffer> _queue = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import javax.imageio.ImageIO;
|
|||||||
import javax.imageio.stream.ImageInputStream;
|
import javax.imageio.stream.ImageInputStream;
|
||||||
import javax.imageio.stream.MemoryCacheImageInputStream;
|
import javax.imageio.stream.MemoryCacheImageInputStream;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.io.StreamUtil;
|
import com.samskivert.io.StreamUtil;
|
||||||
@@ -293,7 +294,7 @@ public class ResourceManager
|
|||||||
Properties config = loadConfig(configPath);
|
Properties config = loadConfig(configPath);
|
||||||
|
|
||||||
// resolve the configured resource sets
|
// resolve the configured resource sets
|
||||||
List<ResourceBundle> dlist = new ArrayList<ResourceBundle>();
|
List<ResourceBundle> dlist = Lists.newArrayList();
|
||||||
Enumeration<?> names = config.propertyNames();
|
Enumeration<?> names = config.propertyNames();
|
||||||
while (names.hasMoreElements()) {
|
while (names.hasMoreElements()) {
|
||||||
String key = (String)names.nextElement();
|
String key = (String)names.nextElement();
|
||||||
@@ -464,7 +465,7 @@ public class ResourceManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// start a thread to unpack our bundles
|
// start a thread to unpack our bundles
|
||||||
ArrayList<ResourceBundle> list = new ArrayList<ResourceBundle>();
|
ArrayList<ResourceBundle> list = Lists.newArrayList();
|
||||||
list.add(bundle);
|
list.add(bundle);
|
||||||
Unpacker unpack = new Unpacker(list, new InitObserver() {
|
Unpacker unpack = new Unpacker(list, new InitObserver() {
|
||||||
public void progress (int percent, long remaining) {
|
public void progress (int percent, long remaining) {
|
||||||
@@ -804,7 +805,7 @@ public class ResourceManager
|
|||||||
protected void resolveResourceSet (
|
protected void resolveResourceSet (
|
||||||
String setName, String definition, String setType, List<ResourceBundle> dlist)
|
String setName, String definition, String setType, List<ResourceBundle> dlist)
|
||||||
{
|
{
|
||||||
List<ResourceBundle> set = new ArrayList<ResourceBundle>();
|
List<ResourceBundle> set = Lists.newArrayList();
|
||||||
StringTokenizer tok = new StringTokenizer(definition, ":");
|
StringTokenizer tok = new StringTokenizer(definition, ":");
|
||||||
while (tok.hasMoreTokens()) {
|
while (tok.hasMoreTokens()) {
|
||||||
set.add(createResourceBundle(setType, tok.nextToken().trim(), dlist));
|
set.add(createResourceBundle(setType, tok.nextToken().trim(), dlist));
|
||||||
|
|||||||
@@ -31,6 +31,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.samskivert.util.FileUtil;
|
import com.samskivert.util.FileUtil;
|
||||||
|
|
||||||
import com.threerings.util.CompiledConfig;
|
import com.threerings.util.CompiledConfig;
|
||||||
@@ -153,5 +155,5 @@ public class CompiledConfigTask extends Task
|
|||||||
protected File _target;
|
protected File _target;
|
||||||
protected File _dest;
|
protected File _dest;
|
||||||
protected String _parser;
|
protected String _parser;
|
||||||
protected ArrayList<FileSet> _filesets = new ArrayList<FileSet>();
|
protected ArrayList<FileSet> _filesets = Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import javax.swing.event.AncestorEvent;
|
|||||||
import javax.swing.event.AncestorListener;
|
import javax.swing.event.AncestorListener;
|
||||||
import javax.swing.text.JTextComponent;
|
import javax.swing.text.JTextComponent;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,7 +268,7 @@ public class KeyDispatcher
|
|||||||
new LinkedList<JTextComponent>();
|
new LinkedList<JTextComponent>();
|
||||||
|
|
||||||
/** Global key listeners. */
|
/** Global key listeners. */
|
||||||
protected ArrayList<KeyListener> _listeners = new ArrayList<KeyListener>();
|
protected ArrayList<KeyListener> _listeners = Lists.newArrayList();
|
||||||
|
|
||||||
/** Keys that are currently held down. */
|
/** Keys that are currently held down. */
|
||||||
protected HashIntMap<KeyEvent> _downKeys = new HashIntMap<KeyEvent>();
|
protected HashIntMap<KeyEvent> _downKeys = new HashIntMap<KeyEvent>();
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +50,7 @@ public class KeyTranslatorImpl
|
|||||||
* Adds a mapping from a key press to an action command string that will auto-repeat at the
|
* Adds a mapping from a key press to an action command string that will auto-repeat at the
|
||||||
* specified repeat rate. Overwrites any existing mapping and repeat rate that may have
|
* specified repeat rate. Overwrites any existing mapping and repeat rate that may have
|
||||||
* already been registered.
|
* already been registered.
|
||||||
*
|
*
|
||||||
* @param rate the number of times each second that the key press should be repeated while the
|
* @param rate the number of times each second that the key press should be repeated while the
|
||||||
* key is down, or <code>0</code> to disable auto-repeat for the key.
|
* key is down, or <code>0</code> to disable auto-repeat for the key.
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +63,7 @@ public class KeyTranslatorImpl
|
|||||||
* Adds a mapping from a key press to an action command string that will auto-repeat at the
|
* Adds a mapping from a key press to an action command string that will auto-repeat at the
|
||||||
* specified repeat rate after the specified auto-repeat delay has expired. Overwrites any
|
* specified repeat rate after the specified auto-repeat delay has expired. Overwrites any
|
||||||
* existing mapping for the specified key code that may have already been registered.
|
* existing mapping for the specified key code that may have already been registered.
|
||||||
*
|
*
|
||||||
* @param rate the number of times each second that the key press should be repeated while the
|
* @param rate the number of times each second that the key press should be repeated while the
|
||||||
* key is down; passing <code>0</code> will result in no repeating.
|
* key is down; passing <code>0</code> will result in no repeating.
|
||||||
* @param repeatDelay the delay in milliseconds before auto-repeating key press events will be
|
* @param repeatDelay the delay in milliseconds before auto-repeating key press events will be
|
||||||
@@ -116,7 +119,7 @@ public class KeyTranslatorImpl
|
|||||||
KeyRecord krec = _keys.get(keyCode);
|
KeyRecord krec = _keys.get(keyCode);
|
||||||
return (krec == null) ? null : krec.pressCommand;
|
return (krec == null) ? null : krec.pressCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface KeyTranslator
|
// documentation inherited from interface KeyTranslator
|
||||||
public String getPressCommand (char ch)
|
public String getPressCommand (char ch)
|
||||||
{
|
{
|
||||||
@@ -130,7 +133,7 @@ public class KeyTranslatorImpl
|
|||||||
KeyRecord krec = _keys.get(keyCode);
|
KeyRecord krec = _keys.get(keyCode);
|
||||||
return (krec == null) ? null : krec.releaseCommand;
|
return (krec == null) ? null : krec.releaseCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface KeyTranslator
|
// documentation inherited from interface KeyTranslator
|
||||||
public String getReleaseCommand (char ch)
|
public String getReleaseCommand (char ch)
|
||||||
{
|
{
|
||||||
@@ -144,7 +147,7 @@ public class KeyTranslatorImpl
|
|||||||
KeyRecord krec = _keys.get(keyCode);
|
KeyRecord krec = _keys.get(keyCode);
|
||||||
return (krec == null) ? DEFAULT_REPEAT_RATE : krec.repeatRate;
|
return (krec == null) ? DEFAULT_REPEAT_RATE : krec.repeatRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface KeyTranslator
|
// documentation inherited from interface KeyTranslator
|
||||||
public int getRepeatRate (char ch)
|
public int getRepeatRate (char ch)
|
||||||
{
|
{
|
||||||
@@ -158,7 +161,7 @@ public class KeyTranslatorImpl
|
|||||||
KeyRecord krec = _keys.get(keyCode);
|
KeyRecord krec = _keys.get(keyCode);
|
||||||
return (krec == null) ? DEFAULT_REPEAT_DELAY : krec.repeatDelay;
|
return (krec == null) ? DEFAULT_REPEAT_DELAY : krec.repeatDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface KeyTranslator
|
// documentation inherited from interface KeyTranslator
|
||||||
public long getRepeatDelay (char ch)
|
public long getRepeatDelay (char ch)
|
||||||
{
|
{
|
||||||
@@ -169,7 +172,7 @@ public class KeyTranslatorImpl
|
|||||||
// documentation inherited from interface KeyTranslator
|
// documentation inherited from interface KeyTranslator
|
||||||
public Iterator<String> enumeratePressCommands ()
|
public Iterator<String> enumeratePressCommands ()
|
||||||
{
|
{
|
||||||
ArrayList<String> commands = new ArrayList<String>();
|
ArrayList<String> commands = Lists.newArrayList();
|
||||||
for (KeyRecord rec : _keys.values()) {
|
for (KeyRecord rec : _keys.values()) {
|
||||||
commands.add(rec.pressCommand);
|
commands.add(rec.pressCommand);
|
||||||
}
|
}
|
||||||
@@ -180,7 +183,7 @@ public class KeyTranslatorImpl
|
|||||||
// documentation inherited from interface KeyTranslator
|
// documentation inherited from interface KeyTranslator
|
||||||
public Iterator<String> enumerateReleaseCommands ()
|
public Iterator<String> enumerateReleaseCommands ()
|
||||||
{
|
{
|
||||||
ArrayList<String> commands = new ArrayList<String>();
|
ArrayList<String> commands = Lists.newArrayList();
|
||||||
for (KeyRecord rec : _keys.values()) {
|
for (KeyRecord rec : _keys.values()) {
|
||||||
commands.add(rec.releaseCommand);
|
commands.add(rec.releaseCommand);
|
||||||
}
|
}
|
||||||
@@ -195,7 +198,7 @@ public class KeyTranslatorImpl
|
|||||||
|
|
||||||
/** The command to be posted when the key is released. */
|
/** The command to be posted when the key is released. */
|
||||||
public String releaseCommand;
|
public String releaseCommand;
|
||||||
|
|
||||||
/** The rate in presses per second at which the key is to be auto-repeated. */
|
/** The rate in presses per second at which the key is to be auto-repeated. */
|
||||||
public int repeatRate;
|
public int repeatRate;
|
||||||
|
|
||||||
@@ -205,14 +208,14 @@ public class KeyTranslatorImpl
|
|||||||
*/
|
*/
|
||||||
public long repeatDelay;
|
public long repeatDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The keys for which commands are registered. */
|
/** The keys for which commands are registered. */
|
||||||
protected HashIntMap<KeyRecord> _keys = new HashIntMap<KeyRecord>();
|
protected HashIntMap<KeyRecord> _keys = new HashIntMap<KeyRecord>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any commands we wish to perform upon key typed events for characters.
|
* Any commands we wish to perform upon key typed events for characters.
|
||||||
*/
|
*/
|
||||||
protected HashMap<Character,KeyRecord> _charCommands = new HashMap<Character,KeyRecord>();
|
protected HashMap<Character,KeyRecord> _charCommands = Maps.newHashMap();
|
||||||
|
|
||||||
/** The default key press repeat rate. */
|
/** The default key press repeat rate. */
|
||||||
protected static final int DEFAULT_REPEAT_RATE = 5;
|
protected static final int DEFAULT_REPEAT_RATE = 5;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import javax.swing.SwingUtilities;
|
|||||||
import javax.swing.event.AncestorEvent;
|
import javax.swing.event.AncestorEvent;
|
||||||
import javax.swing.event.AncestorListener;
|
import javax.swing.event.AncestorListener;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
import com.samskivert.util.ObserverList;
|
import com.samskivert.util.ObserverList;
|
||||||
@@ -69,7 +71,7 @@ public class KeyboardManager
|
|||||||
public interface KeyObserver
|
public interface KeyObserver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Called whenever a key event occurs for a particular key.
|
* Called whenever a key event occurs for a particular key.
|
||||||
*/
|
*/
|
||||||
public void handleKeyEvent (int id, int keyCode, long timestamp);
|
public void handleKeyEvent (int id, int keyCode, long timestamp);
|
||||||
}
|
}
|
||||||
@@ -180,7 +182,7 @@ public class KeyboardManager
|
|||||||
if (_window != null) {
|
if (_window != null) {
|
||||||
_window.addWindowFocusListener(this);
|
_window.addWindowFocusListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// assume the keyboard focus since we were just enabled
|
// assume the keyboard focus since we were just enabled
|
||||||
_focus = true;
|
_focus = true;
|
||||||
@@ -275,7 +277,7 @@ public class KeyboardManager
|
|||||||
|
|
||||||
case KeyEvent.KEY_TYPED:
|
case KeyEvent.KEY_TYPED:
|
||||||
return keyTyped(e);
|
return keyTyped(e);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -311,7 +313,7 @@ public class KeyboardManager
|
|||||||
|
|
||||||
return hasCommand;
|
return hasCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when Swing notifies us that a key has been typed while the
|
* Called when Swing notifies us that a key has been typed while the
|
||||||
* keyboard manager is active.
|
* keyboard manager is active.
|
||||||
@@ -330,18 +332,18 @@ public class KeyboardManager
|
|||||||
// keyboard repeating turned on. Oh well.
|
// keyboard repeating turned on. Oh well.
|
||||||
if (_shouldDisableNativeRepeat) {
|
if (_shouldDisableNativeRepeat) {
|
||||||
_shouldDisableNativeRepeat = false;
|
_shouldDisableNativeRepeat = false;
|
||||||
|
|
||||||
if (Keyboard.isAvailable()) {
|
if (Keyboard.isAvailable()) {
|
||||||
Keyboard.setKeyRepeat(!_shouldDisableNativeRepeat);
|
Keyboard.setKeyRepeat(!_shouldDisableNativeRepeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyInfo info = _chars.get(keyChar);
|
KeyInfo info = _chars.get(keyChar);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
info = new KeyInfo(keyChar);
|
info = new KeyInfo(keyChar);
|
||||||
_chars.put(keyChar, info);
|
_chars.put(keyChar, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember the last time this key was pressed
|
// remember the last time this key was pressed
|
||||||
info.setPressTime(RunAnywhere.getWhen(e));
|
info.setPressTime(RunAnywhere.getWhen(e));
|
||||||
}
|
}
|
||||||
@@ -351,7 +353,7 @@ public class KeyboardManager
|
|||||||
|
|
||||||
return hasCommand;
|
return hasCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when Swing notifies us that a key has been released while
|
* Called when Swing notifies us that a key has been released while
|
||||||
* the keyboard manager is active.
|
* the keyboard manager is active.
|
||||||
@@ -453,7 +455,7 @@ public class KeyboardManager
|
|||||||
_pressDelay = (rate == 0) ? 0 : (1000L / rate);
|
_pressDelay = (rate == 0) ? 0 : (1000L / rate);
|
||||||
_repeatDelay = _xlate.getRepeatDelay(_keyCode);
|
_repeatDelay = _xlate.getRepeatDelay(_keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a key info object for the given character.
|
* Constructs a key info object for the given character.
|
||||||
*/
|
*/
|
||||||
@@ -467,7 +469,7 @@ public class KeyboardManager
|
|||||||
_pressDelay = (rate == 0) ? 0 : (1000L / rate);
|
_pressDelay = (rate == 0) ? 0 : (1000L / rate);
|
||||||
_repeatDelay = _xlate.getRepeatDelay(_keyChar);
|
_repeatDelay = _xlate.getRepeatDelay(_keyChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if we're based off a character & key typed events rather than a keycode
|
* Returns true if we're based off a character & key typed events rather than a keycode
|
||||||
* and key pressed/released events.
|
* and key pressed/released events.
|
||||||
@@ -494,7 +496,7 @@ public class KeyboardManager
|
|||||||
"repeatDelay", _repeatDelay,
|
"repeatDelay", _repeatDelay,
|
||||||
"scheduled", _scheduled);
|
"scheduled", _scheduled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_lastPress == 0 && _pressCommand != null) {
|
if (_lastPress == 0 && _pressCommand != null) {
|
||||||
// post the initial key press command
|
// post the initial key press command
|
||||||
postPress(time);
|
postPress(time);
|
||||||
@@ -527,7 +529,7 @@ public class KeyboardManager
|
|||||||
{
|
{
|
||||||
release(time);
|
release(time);
|
||||||
_lastRelease = time;
|
_lastRelease = time;
|
||||||
|
|
||||||
if (_debugTyping.getValue()) {
|
if (_debugTyping.getValue()) {
|
||||||
log.info("setReleaseTime",
|
log.info("setReleaseTime",
|
||||||
"time", time,
|
"time", time,
|
||||||
@@ -585,7 +587,7 @@ public class KeyboardManager
|
|||||||
"repeatDelay", _repeatDelay,
|
"repeatDelay", _repeatDelay,
|
||||||
"scheduled", _scheduled);
|
"scheduled", _scheduled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bail if we're not currently pressed
|
// bail if we're not currently pressed
|
||||||
if (_lastPress == 0) {
|
if (_lastPress == 0) {
|
||||||
return;
|
return;
|
||||||
@@ -616,7 +618,7 @@ public class KeyboardManager
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
long deltaPress = now - _lastPress;
|
long deltaPress = now - _lastPress;
|
||||||
long deltaRelease = now - _lastRelease;
|
long deltaRelease = now - _lastRelease;
|
||||||
|
|
||||||
if (_debugTyping.getValue()) {
|
if (_debugTyping.getValue()) {
|
||||||
log.info("expired",
|
log.info("expired",
|
||||||
"time", now,
|
"time", now,
|
||||||
@@ -636,7 +638,7 @@ public class KeyboardManager
|
|||||||
log.info("Interval",
|
log.info("Interval",
|
||||||
"key", _keyText, "deltaPress", deltaPress, "deltaRelease", deltaRelease);
|
"key", _keyText, "deltaPress", deltaPress, "deltaRelease", deltaRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
// cease repeating if we're certain the key is now up, or repeat the key
|
// cease repeating if we're certain the key is now up, or repeat the key
|
||||||
// command if we're certain the key is still down
|
// command if we're certain the key is still down
|
||||||
if (_lastRelease != _lastPress) {
|
if (_lastRelease != _lastPress) {
|
||||||
@@ -674,7 +676,7 @@ public class KeyboardManager
|
|||||||
"repeatDelay", _repeatDelay,
|
"repeatDelay", _repeatDelay,
|
||||||
"scheduled", _scheduled);
|
"scheduled", _scheduled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCharacterBased()) {
|
if (!isCharacterBased()) {
|
||||||
notifyObservers(KeyEvent.KEY_PRESSED, _keyCode, timestamp);
|
notifyObservers(KeyEvent.KEY_PRESSED, _keyCode, timestamp);
|
||||||
} else {
|
} else {
|
||||||
@@ -700,7 +702,7 @@ public class KeyboardManager
|
|||||||
"repeatDelay", _repeatDelay,
|
"repeatDelay", _repeatDelay,
|
||||||
"scheduled", _scheduled);
|
"scheduled", _scheduled);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyObservers(KeyEvent.KEY_RELEASED, _keyCode, timestamp);
|
notifyObservers(KeyEvent.KEY_RELEASED, _keyCode, timestamp);
|
||||||
Controller.postAction(_target, _releaseCommand);
|
Controller.postAction(_target, _releaseCommand);
|
||||||
}
|
}
|
||||||
@@ -731,7 +733,7 @@ public class KeyboardManager
|
|||||||
|
|
||||||
/** The key code associated with this key info object, if any. */
|
/** The key code associated with this key info object, if any. */
|
||||||
protected int _keyCode = KeyEvent.VK_UNDEFINED;
|
protected int _keyCode = KeyEvent.VK_UNDEFINED;
|
||||||
|
|
||||||
/** The character associated with this key info object, if any. */
|
/** The character associated with this key info object, if any. */
|
||||||
protected char _keyChar;
|
protected char _keyChar;
|
||||||
|
|
||||||
@@ -785,9 +787,9 @@ public class KeyboardManager
|
|||||||
|
|
||||||
/** A hashtable mapping key codes to {@link KeyInfo} objects. */
|
/** A hashtable mapping key codes to {@link KeyInfo} objects. */
|
||||||
protected HashIntMap<KeyInfo> _keys = new HashIntMap<KeyInfo>();
|
protected HashIntMap<KeyInfo> _keys = new HashIntMap<KeyInfo>();
|
||||||
|
|
||||||
/** A hashtable mapping characters to {@link KeyInfo} objects. */
|
/** A hashtable mapping characters to {@link KeyInfo} objects. */
|
||||||
protected HashMap<Character,KeyInfo> _chars = new HashMap<Character,KeyInfo>();
|
protected HashMap<Character,KeyInfo> _chars = Maps.newHashMap();
|
||||||
|
|
||||||
/** Whether the keyboard manager currently has the keyboard focus. */
|
/** Whether the keyboard manager currently has the keyboard focus. */
|
||||||
protected boolean _focus;
|
protected boolean _focus;
|
||||||
@@ -814,13 +816,13 @@ public class KeyboardManager
|
|||||||
|
|
||||||
/** Whether native key auto-repeating was enabled when the keyboard manager was last enabled. */
|
/** Whether native key auto-repeating was enabled when the keyboard manager was last enabled. */
|
||||||
protected boolean _nativeRepeat;
|
protected boolean _nativeRepeat;
|
||||||
|
|
||||||
/** Whether we want to disable native key auto-repeating. If we're dealing with wacky keys that
|
/** Whether we want to disable native key auto-repeating. If we're dealing with wacky keys that
|
||||||
* send only key typed events, we might need to fall back to letting that happen so things work
|
* send only key typed events, we might need to fall back to letting that happen so things work
|
||||||
* right.
|
* right.
|
||||||
*/
|
*/
|
||||||
protected boolean _shouldDisableNativeRepeat = true;
|
protected boolean _shouldDisableNativeRepeat = true;
|
||||||
|
|
||||||
/** A debug hook that toggles excessive logging to help debug keyTyped behavior. */
|
/** A debug hook that toggles excessive logging to help debug keyTyped behavior. */
|
||||||
protected static RuntimeAdjust.BooleanAdjust _debugTyping = new RuntimeAdjust.BooleanAdjust(
|
protected static RuntimeAdjust.BooleanAdjust _debugTyping = new RuntimeAdjust.BooleanAdjust(
|
||||||
"Toggles key typed debugging", "nenya.util.keyboard",
|
"Toggles key typed debugging", "nenya.util.keyboard",
|
||||||
|
|||||||
Reference in New Issue
Block a user