Add in @Overrides across the board, clean up the comments around them some, and remove

unneeded imports.
I've got partially completed patches for narya & vilya, too, but nenya was the 
only one that wound up in a decent state after a friday evening puttering at it,
killing time waiting on other things to finish.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@572 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2008-07-14 18:19:23 +00:00
parent 1df0737bf7
commit 5f1eed7b94
137 changed files with 394 additions and 433 deletions
@@ -192,7 +192,7 @@ public class ObjectTile extends Tile
_constraints = constraints;
}
// documentation inherited
@Override
public void toString (StringBuilder buf)
{
super.toString(buf);
@@ -200,7 +200,7 @@ public class ObjectTileSet extends SwissArmyTileSet
return _zations;
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
@@ -216,7 +216,7 @@ public class ObjectTileSet extends SwissArmyTileSet
buf.append(", constraints=").append(StringUtil.toString(_constraints));
}
// documentation inherited
@Override
protected Colorization[] getColorizations (int tileIndex, Colorizer rizer)
{
Colorization[] zations = null;
@@ -229,13 +229,13 @@ public class ObjectTileSet extends SwissArmyTileSet
return zations;
}
// documentation inherited
@Override
protected Tile createTile ()
{
return new ObjectTile();
}
// documentation inherited
@Override
protected void initTile (Tile tile, int tileIndex, Colorization[] zations)
{
super.initTile(tile, tileIndex, zations);
@@ -38,13 +38,13 @@ import com.samskivert.util.StringUtil;
*/
public class SwissArmyTileSet extends TileSet
{
// documentation inherited
@Override
public int getTileCount ()
{
return _numTiles;
}
// documentation inherited
@Override
public Rectangle computeTileBounds (int tileIndex, Rectangle bounds)
{
// find the row number containing the sought-after tile
@@ -156,7 +156,7 @@ public class SwissArmyTileSet extends TileSet
_gapSize = gapSize;
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
+4 -3
View File
@@ -45,6 +45,7 @@ public class Tile // implements Cloneable
this.zations = zations;
}
@Override
public boolean equals (Object other) {
if (other instanceof Key) {
Key okey = (Key)other;
@@ -56,6 +57,7 @@ public class Tile // implements Cloneable
}
}
@Override
public int hashCode () {
int code = (tileSet == null) ? tileIndex :
(tileSet.hashCode() ^ tileIndex);
@@ -140,9 +142,7 @@ public class Tile // implements Cloneable
// }
// }
/**
* Return a string representation of this tile.
*/
@Override
public String toString ()
{
StringBuilder buf = new StringBuilder("[");
@@ -162,6 +162,7 @@ public class Tile // implements Cloneable
}
/** Decrement total tile memory by our value. */
@Override
protected void finalize ()
{
if (_mirage != null) {
@@ -35,9 +35,6 @@ import com.threerings.media.image.Colorization;
import com.threerings.media.image.Mirage;
import com.threerings.media.image.ImageUtil;
import com.threerings.media.image.BufferedMirage;
import com.threerings.media.util.MultiFrameImage;
import com.threerings.media.util.MultiFrameImageImpl;
import static com.threerings.media.Log.log;
/**
@@ -350,9 +347,7 @@ public abstract class TileSet
}
}
/**
* Generates a string representation of the tileset information.
*/
@Override
public String toString ()
{
StringBuilder buf = new StringBuilder("[");
@@ -42,13 +42,13 @@ import com.threerings.media.tile.util.TileSetTrimmer;
public class TrimmedObjectTileSet extends TileSet
implements RecolorableTileSet
{
// documentation inherited
@Override
public int getTileCount ()
{
return _bounds.length;
}
// documentation inherited
@Override
public Rectangle computeTileBounds (int tileIndex, Rectangle bounds)
{
bounds.setBounds(_bounds[tileIndex]);
@@ -120,7 +120,7 @@ public class TrimmedObjectTileSet extends TileSet
return _ometrics[tileIdx].height;
}
// documentation inherited
@Override
protected Colorization[] getColorizations (int tileIndex, Colorizer rizer)
{
Colorization[] zations = null;
@@ -133,13 +133,13 @@ public class TrimmedObjectTileSet extends TileSet
return zations;
}
// documentation inherited
@Override
protected Tile createTile ()
{
return new ObjectTile();
}
// documentation inherited
@Override
protected void initTile (Tile tile, int tileIndex, Colorization[] zations)
{
super.initTile(tile, tileIndex, zations);
@@ -157,7 +157,7 @@ public class TrimmedObjectTileSet extends TileSet
}
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
@@ -272,7 +272,7 @@ public class TrimmedObjectTileSet extends TileSet
/** The constraints associated with this object. */
public String[] constraints;
/** Generates a string representation of this instance. */
@Override
public String toString ()
{
return StringUtil.fieldsToString(this);
@@ -44,19 +44,19 @@ public class TrimmedTile extends Tile
_tbounds = tbounds;
}
// documentation inherited
@Override
public int getWidth ()
{
return _tbounds.width;
}
// documentation inherited
@Override
public int getHeight ()
{
return _tbounds.height;
}
// documentation inherited
@Override
public void paint (Graphics2D gfx, int x, int y)
{
_mirage.paint(gfx, x + _tbounds.x, y + _tbounds.y);
@@ -71,13 +71,13 @@ public class TrimmedTile extends Tile
tbounds.setBounds(_tbounds.x, _tbounds.y, _mirage.getWidth(), _mirage.getHeight());
}
// documentation inherited
@Override
public boolean hitTest (int x, int y)
{
return super.hitTest(x - _tbounds.x, y - _tbounds.y);
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
buf.append(", tbounds=").append(StringUtil.toString(_tbounds));
@@ -36,26 +36,26 @@ import com.threerings.media.tile.util.TileSetTrimmer;
*/
public class TrimmedTileSet extends TileSet
{
// documentation inherited
@Override
public int getTileCount ()
{
return _obounds.length;
}
// documentation inherited
@Override
public Rectangle computeTileBounds (int tileIndex, Rectangle bounds)
{
bounds.setBounds(_obounds[tileIndex]);
return bounds;
}
// documentation inherited
@Override
protected Tile createTile ()
{
return new TrimmedTile();
}
// documentation inherited
@Override
protected void initTile (Tile tile, int tileIndex, Colorization[] zations)
{
super.initTile(tile, tileIndex, zations);
@@ -34,7 +34,7 @@ import com.threerings.geom.GeomUtil;
*/
public class UniformTileSet extends TileSet
{
// documentation inherited
@Override
public int getTileCount ()
{
BufferedImage tsimg = getRawTileSetImage();
@@ -43,7 +43,7 @@ public class UniformTileSet extends TileSet
return perRow * perCol;
}
// documentation inherited
@Override
public Rectangle computeTileBounds (int tileIndex, Rectangle bounds)
{
BufferedImage tsimg = getRawTileSetImage();
@@ -83,7 +83,7 @@ public class UniformTileSet extends TileSet
return _height;
}
// documentation inherited
@Override
protected void toString (StringBuilder buf)
{
super.toString(buf);
@@ -35,7 +35,6 @@ import javax.imageio.ImageIO;
import org.apache.commons.io.IOUtils;
import com.threerings.util.FileUtil;
import com.threerings.media.tile.ImageProvider;
import com.threerings.media.tile.ObjectTileSet;
import com.threerings.media.tile.TileSet;
@@ -59,7 +58,7 @@ public class DirectoryTileSetBundler extends TileSetBundler
super(configPath);
}
@Override // documentation inherited
@Override
public boolean createBundle (
File target, TileSetBundle bundle, ImageProvider improv, String imageBase, long newestMod)
throws IOException
@@ -164,7 +163,7 @@ public class DirectoryTileSetBundler extends TileSetBundler
}
}
@Override // documentation inherited
@Override
protected boolean skipIfTargetNewer ()
{
// We have to check modification later on a file-by-file basis, so cannot skip.
@@ -23,14 +23,7 @@ package com.threerings.media.tile.bundle.tools;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import com.threerings.media.tile.tools.MapFileTileSetIDBroker;
/**
* Ant task for creating tileset bundles that are placed in a specified directory instead
@@ -46,21 +39,21 @@ public class DirectoryTileSetBundlerTask extends TileSetBundlerTask
_deployDir = deployDir;
}
@Override // documentation inherited
@Override
public void execute () throws BuildException
{
ensureSet(_deployDir, "Must specify the path to which we want to deploy tileset files.");
super.execute();
}
@Override // documentation inherited
@Override
protected TileSetBundler createBundler ()
throws IOException
{
return new DirectoryTileSetBundler(_config);
}
@Override // documentation inherited
@Override
protected String getTargetPath (File fromDir, String path)
{
File xmlFile = new File(path.replace(fromDir.getPath(), _deployDir.getPath()));
@@ -313,6 +313,7 @@ public class TileSetBundler
// create an image provider for loading our tileset images
SimpleCachingImageProvider improv = new SimpleCachingImageProvider() {
@Override
protected BufferedImage loadImage (String path)
throws IOException {
return ImageIO.read(new File(bundleDesc.getParent(), path));
@@ -486,6 +487,7 @@ public class TileSetBundler
this.ruleset = ruleset;
}
@Override
public String toString ()
{
return "[path=" + path + ", ruleset=" + ruleset + "]";
@@ -66,6 +66,7 @@ public class TileSetBundlerTask extends Task
/**
* Performs the actual work of the task.
*/
@Override
public void execute () throws BuildException
{
// make sure everything was set up properly
@@ -60,7 +60,7 @@ import com.threerings.util.DirectionUtil;
*/
public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
{
// documentation inherited
@Override
public void addRuleInstances (Digester digester)
{
super.addRuleInstances(digester);
@@ -68,6 +68,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/objectWidths",
new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] widths = StringUtil.parseIntArray(bodyText);
@@ -78,6 +79,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/objectHeights",
new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] heights = StringUtil.parseIntArray(bodyText);
@@ -87,6 +89,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/xOrigins", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] xorigins = StringUtil.parseIntArray(bodyText);
@@ -96,6 +99,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/yOrigins", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] yorigins = StringUtil.parseIntArray(bodyText);
@@ -106,6 +110,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/priorities",
new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
byte[] prios = StringUtil.parseByteArray(bodyText);
@@ -115,6 +120,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/zations", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
String[] zations = StringUtil.parseStringArray(bodyText);
@@ -124,6 +130,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/xspots", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
short[] xspots = StringUtil.parseShortArray(bodyText);
@@ -133,6 +140,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/yspots", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
short[] yspots = StringUtil.parseShortArray(bodyText);
@@ -142,6 +150,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/sorients", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
ObjectTileSet set = (ObjectTileSet)target;
@@ -167,6 +176,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_path + "/constraints",
new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
String[] constrs = StringUtil.parseStringArray(
@@ -180,7 +190,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
});
}
// documentation inherited
@Override
protected Class getTileSetClass ()
{
return ObjectTileSet.class;
@@ -55,13 +55,14 @@ import static com.threerings.media.Log.log;
*/
public class SwissArmyTileSetRuleSet extends TileSetRuleSet
{
// documentation inherited
@Override
public void addRuleInstances (Digester digester)
{
super.addRuleInstances(digester);
digester.addRule(
_path + "/widths", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] widths = StringUtil.parseIntArray(bodyText);
@@ -71,6 +72,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
digester.addRule(
_path + "/heights", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] heights = StringUtil.parseIntArray(bodyText);
@@ -81,6 +83,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
digester.addRule(
_path + "/tileCounts",
new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] tileCounts = StringUtil.parseIntArray(bodyText);
@@ -90,6 +93,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
digester.addRule(
_path + "/offsetPos", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] values = StringUtil.parseIntArray(bodyText);
@@ -105,6 +109,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
digester.addRule(
_path + "/gapSize", new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
{
int[] values = StringUtil.parseIntArray(bodyText);
@@ -119,7 +124,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
});
}
// documentation inherited
@Override
public boolean isValid (Object target)
{
SwissArmyTileSet set = (SwissArmyTileSet)target;
@@ -149,7 +154,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
return valid;
}
// documentation inherited
@Override
protected Class getTileSetClass ()
{
return SwissArmyTileSet.class;
@@ -83,6 +83,7 @@ public abstract class TileSetRuleSet
* should register themselves relative to the <code>_prefix</code>
* member).
*/
@Override
public void addRuleInstances (Digester digester)
{
// this creates the appropriate instance when we encounter a
@@ -51,7 +51,7 @@ public class UniformTileSetRuleSet extends TileSetRuleSet
_tilesetPath = tilesetPath;
}
// documentation inherited
@Override
public void addRuleInstances (Digester digester)
{
super.addRuleInstances(digester);
@@ -62,7 +62,7 @@ public class UniformTileSetRuleSet extends TileSetRuleSet
new Class[] { java.lang.Integer.TYPE });
}
// documentation inherited
@Override
public boolean isValid (Object target)
{
UniformTileSet set = (UniformTileSet)target;
@@ -85,7 +85,7 @@ public class UniformTileSetRuleSet extends TileSetRuleSet
return valid;
}
// documentation inherited
@Override
protected Class getTileSetClass ()
{
return UniformTileSet.class;