Prune trailing whitespace & foreachize loops.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@824 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2009-05-23 01:57:36 +00:00
parent 09d081e261
commit ecdf0f2f4a
43 changed files with 182 additions and 184 deletions
@@ -47,8 +47,8 @@ public class DumpBundle
System.exit(-1); System.exit(-1);
} }
for (int i = 0; i < args.length; i++) { for (String arg : args) {
File file = new File(args[i]); File file = new File(arg);
try { try {
ResourceBundle bundle = new FileResourceBundle(file); ResourceBundle bundle = new FileResourceBundle(file);
@@ -69,7 +69,7 @@ public class DumpBundle
dumpTable("components: ", comps); dumpTable("components: ", comps);
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error dumping bundle [path=" + args[i] + System.err.println("Error dumping bundle [path=" + arg +
", error=" + e + "]."); ", error=" + e + "].");
e.printStackTrace(); e.printStackTrace();
} }
@@ -95,8 +95,8 @@ public class ClassRuleSet extends RuleSetBase
public Object parse (String text) { public Object parse (String text) {
String[] orients = StringUtil.parseStringArray(text); String[] orients = StringUtil.parseStringArray(text);
ArrayIntSet oset = new ArrayIntSet(); ArrayIntSet oset = new ArrayIntSet();
for (int ii = 0; ii < orients.length; ii++) { for (String orient : orients) {
oset.add(DirectionUtil.fromShortString(orients[ii])); oset.add(DirectionUtil.fromShortString(orient));
} }
return oset; return oset;
} }
@@ -101,8 +101,8 @@ public class SwissArmyTileSet extends TileSet
{ {
// compute our number of tiles // compute our number of tiles
_numTiles = 0; _numTiles = 0;
for (int i = 0; i < _tileCounts.length; i++) { for (int count : _tileCounts) {
_numTiles += _tileCounts[i]; _numTiles += count;
} }
} }
@@ -49,17 +49,17 @@ public class DumpBundle
System.exit(-1); System.exit(-1);
} }
for (int i = 0; i < args.length; i++) { for (String arg : args) {
// oh the hackery // oh the hackery
if (args[i].equals("-tiles")) { if (arg.equals("-tiles")) {
dumpTiles = true; dumpTiles = true;
continue; continue;
} }
File file = new File(args[i]); File file = new File(arg);
try { try {
TileSetBundle tsb = null; TileSetBundle tsb = null;
if (args[i].endsWith(".jar")) { if (arg.endsWith(".jar")) {
ResourceBundle bundle = new FileResourceBundle(file); ResourceBundle bundle = new FileResourceBundle(file);
tsb = BundleUtil.extractBundle(bundle); tsb = BundleUtil.extractBundle(bundle);
tsb.init(bundle); tsb.init(bundle);
@@ -81,7 +81,7 @@ public class DumpBundle
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error dumping bundle [path=" + args[i] + System.err.println("Error dumping bundle [path=" + arg +
", error=" + e + "]."); ", error=" + e + "].");
e.printStackTrace(); e.printStackTrace();
} }
@@ -71,12 +71,12 @@ public class ModeUtil
// but we only add modes that meet our minimum requirements // but we only add modes that meet our minimum requirements
TreeSet<DisplayMode> mset = new TreeSet<DisplayMode>(mcomp); TreeSet<DisplayMode> mset = new TreeSet<DisplayMode>(mcomp);
for (int i = 0; i < modes.length; i++) { for (DisplayMode mode : modes) {
if (modes[i].getWidth() == width && if (mode.getWidth() == width &&
modes[i].getHeight() == height && mode.getHeight() == height &&
modes[i].getBitDepth() >= minimumDepth && mode.getBitDepth() >= minimumDepth &&
modes[i].getRefreshRate() <= 75) { mode.getRefreshRate() <= 75) {
mset.add(modes[i]); mset.add(mode);
} }
} }
@@ -130,8 +130,7 @@ public class SimpleMisoSceneModel extends MisoSceneModel
public void getObjects (Rectangle region, ObjectSet set) public void getObjects (Rectangle region, ObjectSet set)
{ {
// first look for intersecting interesting objects // first look for intersecting interesting objects
for (int ii = 0; ii < objectInfo.length; ii++) { for (ObjectInfo info : objectInfo) {
ObjectInfo info = objectInfo[ii];
if (region.contains(info.x, info.y)) { if (region.contains(info.x, info.y)) {
set.insert(info); set.insert(info);
} }
@@ -81,8 +81,7 @@ public class SimpleMisoSceneWriter implements NestableWriter
} }
// write our uninteresting object tile information // write our uninteresting object tile information
for (int ii = 0; ii < model.objectInfo.length; ii++) { for (ObjectInfo info : model.objectInfo) {
ObjectInfo info = model.objectInfo[ii];
AttributesImpl attrs = new AttributesImpl(); AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "tileId", "", "", attrs.addAttribute("", "tileId", "", "",
String.valueOf(info.tileId)); String.valueOf(info.tileId));
@@ -96,8 +96,8 @@ public class SparseMisoSceneWriter implements NestableWriter
} }
// write our interesting object tile information // write our interesting object tile information
for (int ii = 0; ii < sect.objectInfo.length; ii++) { for (ObjectInfo element : sect.objectInfo) {
writeInterestingObject(sect.objectInfo[ii], writer); writeInterestingObject(element, writer);
} }
writer.endElement("objects"); writer.endElement("objects");
writer.endElement("section"); writer.endElement("section");
@@ -154,13 +154,13 @@ public class Handler extends URLStreamHandler
String[] bits = StringUtil.split(query, "&"); String[] bits = StringUtil.split(query, "&");
int width = -1, height = -1, tidx = -1; int width = -1, height = -1, tidx = -1;
try { try {
for (int ii = 0; ii < bits.length; ii++) { for (String bit : bits) {
if (bits[ii].startsWith("width=")) { if (bit.startsWith("width=")) {
width = Integer.parseInt(bits[ii].substring(6)); width = Integer.parseInt(bit.substring(6));
} else if (bits[ii].startsWith("height=")) { } else if (bit.startsWith("height=")) {
height = Integer.parseInt(bits[ii].substring(7)); height = Integer.parseInt(bit.substring(7));
} else if (bits[ii].startsWith("tile=")) { } else if (bit.startsWith("tile=")) {
tidx = Integer.parseInt(bits[ii].substring(5)); tidx = Integer.parseInt(bit.substring(5));
} }
} }
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {