From f1ad37f7993773891c5e4a28c3c4570ccfe5550e Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Sat, 1 Jan 2011 05:03:08 +0000 Subject: [PATCH] Whitespace git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@1104 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../threerings/media/image/ColorPository.java | 47 +++++++------------ .../threerings/media/image/Colorization.java | 30 +++++------- .../image/tools/xml/ColorPositoryParser.java | 4 +- .../threerings/resource/ResourceManager.java | 23 ++++----- .../tools/xml/CompiledConfigParser.java | 13 ++--- .../com/threerings/util/CompiledConfig.java | 8 ++-- 6 files changed, 46 insertions(+), 79 deletions(-) diff --git a/src/main/java/com/threerings/media/image/ColorPository.java b/src/main/java/com/threerings/media/image/ColorPository.java index 1e13b11c..3682d3d8 100644 --- a/src/main/java/com/threerings/media/image/ColorPository.java +++ b/src/main/java/com/threerings/media/image/ColorPository.java @@ -85,8 +85,7 @@ public class ColorPository implements Serializable public HashIntMap colors = new HashIntMap(); /** Used when parsing the color definitions. */ - public void addColor (ColorRecord record) - { + public void addColor (ColorRecord record) { // validate the color id if (record.colorId > 127) { log.warning("Refusing to add color record; colorId > 127", @@ -133,14 +132,12 @@ public class ColorPository implements Serializable } /** Returns a random starting id from the entries in this class. */ - public ColorRecord randomStartingColor () - { + public ColorRecord randomStartingColor () { return randomStartingColor(RandomUtil.rand); } /** Returns a random starting id from the entries in this class. */ - public ColorRecord randomStartingColor (Random rand) - { + public ColorRecord randomStartingColor (Random rand) { // figure out our starter ids if we haven't already if (_starters == null) { ArrayList list = Lists.newArrayList(); @@ -164,23 +161,19 @@ public class ColorPository implements Serializable } /** - * Get the default ColorRecord defined for this color class, or - * null if none. + * Get the default ColorRecord defined for this color class, or null if none. */ - public ColorRecord getDefault () - { + public ColorRecord getDefault () { return colors.get(defaultId); } // from interface Comparable - public int compareTo (ClassRecord other) - { + public int compareTo (ClassRecord other) { return name.compareTo(other.name); } @Override - public String toString () - { + public String toString () { return "[id=" + classId + ", name=" + name + ", source=#" + Integer.toString(source.getRGB() & 0xFFFFFF, 16) + ", range=" + StringUtil.toString(range) + @@ -223,16 +216,14 @@ public class ColorPository implements Serializable * to identify a colorization record. This value will always be a positive integer that * fits into 16 bits. */ - public int getColorPrint () - { + public int getColorPrint () { return ((cclass.classId << 8) | colorId); } /** * Returns the data in this record configured as a colorization instance. */ - public Colorization getColorization () - { + public Colorization getColorization () { // if (_zation == null) { // _zation = new Colorization(getColorPrint(), cclass.source, // cclass.range, offsets); @@ -242,14 +233,12 @@ public class ColorPository implements Serializable } // from interface Comparable - public int compareTo (ColorRecord other) - { + public int compareTo (ColorRecord other) { return name.compareTo(other.name); } @Override - public String toString () - { + public String toString () { return "[id=" + colorId + ", name=" + name + ", offsets=" + StringUtil.toString(offsets) + ", starter=" + starter + "]"; } @@ -270,14 +259,13 @@ public class ColorPository implements Serializable return _classes.values().iterator(); } - public Collection getClasses () + public Collection getClasses () { return _classes.values(); } /** - * Returns an array containing the records for the colors in the - * specified class. + * Returns an array containing the records for the colors in the specified class. */ public ColorRecord[] enumerateColors (String className) { @@ -297,8 +285,7 @@ public class ColorPository implements Serializable } /** - * Returns an array containing the ids of the colors in the specified - * class. + * Returns an array containing the ids of the colors in the specified class. */ public int[] enumerateColorIds (String className) { @@ -488,8 +475,7 @@ public class ColorPository implements Serializable } /** - * Loads up a serialized color pository from the supplied resource - * manager. + * Loads up a serialized color pository from the supplied resource manager. */ public static ColorPository loadColorPository (ResourceManager rmgr) { @@ -502,8 +488,7 @@ public class ColorPository implements Serializable } /** - * Loads up a serialized color pository from the supplied resource - * manager. + * Loads up a serialized color pository from the supplied resource manager. */ public static ColorPository loadColorPository (InputStream source) { diff --git a/src/main/java/com/threerings/media/image/Colorization.java b/src/main/java/com/threerings/media/image/Colorization.java index c513eecf..005c6f45 100644 --- a/src/main/java/com/threerings/media/image/Colorization.java +++ b/src/main/java/com/threerings/media/image/Colorization.java @@ -47,8 +47,7 @@ public class Colorization /** * Constructs a colorization record with the specified identifier. */ - public Colorization (int colorizationId, Color rootColor, - float[] range, float[] offsets) + public Colorization (int colorizationId, Color rootColor, float[] range, float[] offsets) { this.colorizationId = colorizationId; this.rootColor = rootColor; @@ -56,8 +55,7 @@ public class Colorization this.offsets = offsets; // compute our HSV and fixed HSV - _hsv = Color.RGBtoHSB(rootColor.getRed(), rootColor.getGreen(), - rootColor.getBlue(), null); + _hsv = Color.RGBtoHSB(rootColor.getRed(), rootColor.getGreen(), rootColor.getBlue(), null); _fhsv = toFixedHSV(_hsv, null); } @@ -70,9 +68,8 @@ public class Colorization } /** - * Adjusts the supplied color by the offsets in this colorization, - * taking the appropriate measures for hue (wrapping it around) and - * saturation and value (clipping). + * Adjusts the supplied color by the offsets in this colorization, taking the appropriate + * measures for hue (wrapping it around) and saturation and value (clipping). * * @return the RGB value of the recolored color. */ @@ -93,12 +90,11 @@ public class Colorization } /** - * Returns true if this colorization matches the supplied color, false - * otherwise. + * Returns true if this colorization matches the supplied color, false otherwise. * * @param hsv the HSV values for the color in question. - * @param fhsv the HSV values converted to fixed point via {@link - * #toFixedHSV} for the color in question. + * @param fhsv the HSV values converted to fixed point via {@link #toFixedHSV} for the color + * in question. */ public boolean matches (float[] hsv, int[] fhsv) { @@ -149,16 +145,14 @@ public class Colorization } /** - * Converts floating point HSV values to a fixed point integer - * representation. + * Converts floating point HSV values to a fixed point integer representation. * * @param hsv the HSV values to be converted. - * @param fhsv the destination array into which the fixed values will - * be stored. If this is null, a new array will be created of the - * appropriate length. + * @param fhsv the destination array into which the fixed values will be stored. If this is + * null, a new array will be created of the appropriate length. * - * @return the fhsv parameter if it was non-null or the - * newly created target array. + * @return the fhsv parameter if it was non-null or the newly created target + * array. */ public static int[] toFixedHSV (float[] hsv, int[] fhsv) { diff --git a/src/main/java/com/threerings/media/image/tools/xml/ColorPositoryParser.java b/src/main/java/com/threerings/media/image/tools/xml/ColorPositoryParser.java index 48c9c86e..3861a85d 100644 --- a/src/main/java/com/threerings/media/image/tools/xml/ColorPositoryParser.java +++ b/src/main/java/com/threerings/media/image/tools/xml/ColorPositoryParser.java @@ -37,8 +37,8 @@ import com.threerings.media.image.ColorPository.ColorRecord; import com.threerings.tools.xml.CompiledConfigParser; /** - * Parses the XML color repository definition and creates a {@link - * ColorPository} instance that reflects its contents. + * Parses the XML color repository definition and creates a {@link ColorPository} instance that + * reflects its contents. */ public class ColorPositoryParser extends CompiledConfigParser { diff --git a/src/main/java/com/threerings/resource/ResourceManager.java b/src/main/java/com/threerings/resource/ResourceManager.java index 9b6441b0..5ad6d74e 100644 --- a/src/main/java/com/threerings/resource/ResourceManager.java +++ b/src/main/java/com/threerings/resource/ResourceManager.java @@ -422,7 +422,7 @@ public class ResourceManager return (File.separatorChar == '/') ? path : path.replace(File.separatorChar, '/'); } catch (IOException e) { - log.warning("Failed to determine resource path [file=" + file + "].", e); + log.warning("Failed to determine resource path", "file", file, e); return null; } } @@ -937,16 +937,14 @@ public class ResourceManager /** Used to unpack bundles on a separate thread. */ protected static class Unpacker extends Thread { - public Unpacker (List bundles, InitObserver obs) - { + public Unpacker (List bundles, InitObserver obs) { _bundles = bundles; _obs = obs; _startTime = System.currentTimeMillis(); } @Override - public void run () - { + public void run () { try { // Tell the observer were starting if (_obs != null) { @@ -998,11 +996,9 @@ public class ResourceManager protected static class ObservedResource { /** The observers listening for modifications to this resource. */ - public WeakObserverList observers = - WeakObserverList.newFastUnsafe(); + public WeakObserverList observers = WeakObserverList.newFastUnsafe(); - public ObservedResource (File file) - { + public ObservedResource (File file) { _file = file; _lastModified = file.lastModified(); } @@ -1015,8 +1011,7 @@ public class ResourceManager * @return true if the list of observers is empty and the resource should be * removed from the observed list, false if it should remain in the list. */ - public boolean checkForModification (String path) - { + public boolean checkForModification (String path) { long newLastModified = _file.lastModified(); if (newLastModified > _lastModified) { _resourceModifiedOp.init(path, _lastModified = newLastModified); @@ -1036,15 +1031,13 @@ public class ResourceManager protected static class ResourceModifiedOp implements ObserverList.ObserverOp { - public void init (String path, long lastModified) - { + public void init (String path, long lastModified) { _path = path; _lastModified = lastModified; } // documentation inherited from interface ObserverOp - public boolean apply (ModificationObserver obs) - { + public boolean apply (ModificationObserver obs) { obs.resourceModified(_path, _lastModified); return true; } diff --git a/src/main/java/com/threerings/tools/xml/CompiledConfigParser.java b/src/main/java/com/threerings/tools/xml/CompiledConfigParser.java index b2fce6f7..c61872a1 100644 --- a/src/main/java/com/threerings/tools/xml/CompiledConfigParser.java +++ b/src/main/java/com/threerings/tools/xml/CompiledConfigParser.java @@ -35,18 +35,16 @@ import com.threerings.util.CompiledConfig; import com.threerings.tools.CompiledConfigTask; /** - * An abstract base implementation of a parser that is used to compile - * configuration definitions into config objects for use by the client and - * server. - * + * An abstract base implementation of a parser that is used to compile configuration definitions + * into config objects for use by the client and server. + * * @see CompiledConfig * @see CompiledConfigTask */ public abstract class CompiledConfigParser { /** - * Parses the supplied configuration file into a serializable - * configuration object. + * Parses the supplied configuration file into a serializable configuration object. */ public Serializable parseConfig (File source) throws IOException, SAXException @@ -60,8 +58,7 @@ public abstract class CompiledConfigParser } /** - * Creates the config object instance that will be populated during - * the parsing process. + * Creates the config object instance that will be populated during the parsing process. */ protected abstract Serializable createConfigObject (); diff --git a/src/main/java/com/threerings/util/CompiledConfig.java b/src/main/java/com/threerings/util/CompiledConfig.java index 30552183..2997b261 100644 --- a/src/main/java/com/threerings/util/CompiledConfig.java +++ b/src/main/java/com/threerings/util/CompiledConfig.java @@ -30,9 +30,8 @@ import java.io.ObjectOutputStream; import java.io.Serializable; /** - * Used to load and store compiled configuration data (generally XML files - * that are parsed into Java object models and then serialized for rapid - * and simple access on the client and server). + * Used to load and store compiled configuration data (generally XML files that are parsed into + * Java object models and then serialized for rapid and simple access on the client and server). */ public class CompiledConfig { @@ -52,8 +51,7 @@ public class CompiledConfig } /** - * Serializes the supplied configuration object to the specified file - * path. + * Serializes the supplied configuration object to the specified file path. */ public static void saveConfig (File target, Serializable config) throws IOException