Prune trailing whitespace & foreachize loops.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@840 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Dave Hoover
2009-05-23 02:00:23 +00:00
parent 3c5c5e6ba5
commit cf1ad4ac4d
12 changed files with 43 additions and 45 deletions
@@ -114,8 +114,8 @@ public class LobbyRegistry
if (lmgrs == null || lmgrs.length == 0) { if (lmgrs == null || lmgrs.length == 0) {
log.warning("No lobbies specified in config file (via '" + LOBIDS_KEY + "' parameter)."); log.warning("No lobbies specified in config file (via '" + LOBIDS_KEY + "' parameter).");
} else { } else {
for (int i = 0; i < lmgrs.length; i++) { for (String lmgr : lmgrs) {
loadLobby(lmgrs[i]); loadLobby(lmgr);
} }
} }
} }
@@ -376,8 +376,8 @@ public class Table
int[][] teams = tconfig.teamMemberIndices; int[][] teams = tconfig.teamMemberIndices;
for (int[] team : teams) { for (int[] team : teams) {
int teamCount = 0; int teamCount = 0;
for (int jj=0; jj < team.length; jj++) { for (int element : team) {
if (players[team[jj]] != null) { if (players[element] != null) {
teamCount++; teamCount++;
} }
} }
@@ -355,9 +355,9 @@ public class TableManager
// clear out all matching entries in the boid map // clear out all matching entries in the boid map
if (table.bodyOids != null) { if (table.bodyOids != null) {
for (int ii = 0; ii < table.bodyOids.length; ii++) { for (int bodyOid : table.bodyOids) {
if (table.bodyOids[ii] != 0) { if (bodyOid != 0) {
notePlayerRemoved(table.bodyOids[ii]); notePlayerRemoved(bodyOid);
} }
} }
} }
@@ -471,9 +471,9 @@ public class TableManager
if (table.bodyOids != null) { if (table.bodyOids != null) {
// clear the player to table mappings as this game is underway // clear the player to table mappings as this game is underway
for (int ii = 0; ii < table.bodyOids.length; ii++) { for (int bodyOid : table.bodyOids) {
if (table.bodyOids[ii] != 0) { if (bodyOid != 0) {
notePlayerRemoved(table.bodyOids[ii]); notePlayerRemoved(bodyOid);
} }
} }
} }
@@ -63,15 +63,15 @@ public class ModifyObjectsUpdate extends SceneUpdate
// wipe out the objects that need to go // wipe out the objects that need to go
if (removed != null) { if (removed != null) {
for (int ii = 0; ii < removed.length; ii++) { for (ObjectInfo element : removed) {
mmodel.removeObject(removed[ii]); mmodel.removeObject(element);
} }
} }
// add the new objects // add the new objects
if (added != null) { if (added != null) {
for (int ii = 0; ii < added.length; ii++) { for (ObjectInfo element : added) {
mmodel.addObject(added[ii]); mmodel.addObject(element);
} }
} }
} }
@@ -55,9 +55,9 @@ public class StageMisoSceneModel extends SparseMisoSceneModel
*/ */
public static StageMisoSceneModel getSceneModel (SceneModel model) public static StageMisoSceneModel getSceneModel (SceneModel model)
{ {
for (int ii = 0; ii < model.auxModels.length; ii++) { for (AuxModel auxModel : model.auxModels) {
if (model.auxModels[ii] instanceof StageMisoSceneModel) { if (auxModel instanceof StageMisoSceneModel) {
return (StageMisoSceneModel)model.auxModels[ii]; return (StageMisoSceneModel)auxModel;
} }
} }
return null; return null;
@@ -162,8 +162,7 @@ public class ViewerFrame extends ManagedJFrame
SpotSceneModel ssmodel = SpotSceneModel.getSceneModel(model); SpotSceneModel ssmodel = SpotSceneModel.getSceneModel(model);
Location defloc = null; Location defloc = null;
// find the default entrance to this scene // find the default entrance to this scene
for (int ii = 0; ii < ssmodel.portals.length; ii++) { for (Portal port : ssmodel.portals) {
Portal port = ssmodel.portals[ii];
if (port.portalId == ssmodel.defaultEntranceId) { if (port.portalId == ssmodel.defaultEntranceId) {
defloc = port.getOppLocation(); defloc = port.getOppLocation();
break; break;
@@ -64,10 +64,8 @@ public class ViewerScenePanel extends StageScenePanel
_charmgr = charmgr; _charmgr = charmgr;
// create the character descriptors // create the character descriptors
_descUser = CastUtil.getRandomDescriptor( _descUser = CastUtil.getRandomDescriptor("female", ctx.getComponentRepository());
"female", ctx.getComponentRepository()); _descDecoy = CastUtil.getRandomDescriptor("male", ctx.getComponentRepository());
_descDecoy = CastUtil.getRandomDescriptor(
"male", ctx.getComponentRepository());
// create the manipulable sprite // create the manipulable sprite
_sprite = createSprite(_descUser); _sprite = createSprite(_descUser);
@@ -87,8 +85,8 @@ public class ViewerScenePanel extends StageScenePanel
_sprite.setLocation(defpos.x, defpos.y); _sprite.setLocation(defpos.x, defpos.y);
if (_decoys != null) { if (_decoys != null) {
for (int ii = 0; ii < _decoys.length; ii++) { for (CharacterSprite decoy : _decoys) {
_decoys[ii].setLocation(defpos.x, defpos.y); decoy.setLocation(defpos.x, defpos.y);
} }
createDecoyPaths(); createDecoyPaths();
} }
@@ -144,9 +142,9 @@ public class ViewerScenePanel extends StageScenePanel
protected void createDecoyPaths () protected void createDecoyPaths ()
{ {
if (_decoys != null) { if (_decoys != null) {
for (int ii = 0; ii < _decoys.length; ii++) { for (CharacterSprite decoy : _decoys) {
if (_decoys[ii] != null) { if (decoy != null) {
createRandomPath(_decoys[ii]); createRandomPath(decoy);
} }
} }
} }
@@ -177,8 +175,8 @@ public class ViewerScenePanel extends StageScenePanel
case MouseEvent.BUTTON2_MASK: case MouseEvent.BUTTON2_MASK:
if (_decoys != null) { if (_decoys != null) {
for (int ii = 0; ii < _decoys.length; ii++) { for (CharacterSprite decoy : _decoys) {
createPath(_decoys[ii], x, y); createPath(decoy, x, y);
} }
} }
break; break;
@@ -66,11 +66,11 @@ public class StageSceneWriter extends SceneWriter
if (sscene.defaultColors != null) { if (sscene.defaultColors != null) {
writer.startElement("zations"); writer.startElement("zations");
int[] keys = sscene.defaultColors.getKeys(); int[] keys = sscene.defaultColors.getKeys();
for (int ii=0, nn=keys.length; ii < nn; ii++) { for (int key : keys) {
int value = sscene.defaultColors.get(keys[ii]); int value = sscene.defaultColors.get(key);
AttributesImpl attrs = new AttributesImpl(); AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "classId", "", "", attrs.addAttribute("", "classId", "", "",
String.valueOf(keys[ii])); String.valueOf(key));
attrs.addAttribute("", "colorId", "", "", attrs.addAttribute("", "colorId", "", "",
String.valueOf(value)); String.valueOf(value));
writer.emptyElement("", "zation", "", attrs); writer.emptyElement("", "zation", "", attrs);
@@ -36,8 +36,8 @@ public class ByteStringSetStat extends StringSetStat
throws IOException throws IOException
{ {
out.writeByte(_values.length); out.writeByte(_values.length);
for (int ii = 0; ii < _values.length; ii++) { for (String value : _values) {
out.writeByte((byte)aux.getStringCode(_type, _values[ii])); out.writeByte((byte)aux.getStringCode(_type, value));
} }
} }
@@ -36,8 +36,8 @@ public class IntStringSetStat extends StringSetStat
throws IOException throws IOException
{ {
out.writeInt(_values.length); out.writeInt(_values.length);
for (int ii = 0; ii < _values.length; ii++) { for (String value : _values) {
out.writeInt(aux.getStringCode(_type, _values[ii])); out.writeInt(aux.getStringCode(_type, value));
} }
} }
@@ -36,8 +36,8 @@ public class ShortStringSetStat extends StringSetStat
throws IOException throws IOException
{ {
out.writeShort(_values.length); out.writeShort(_values.length);
for (int ii = 0; ii < _values.length; ii++) { for (String value : _values) {
out.writeShort((short)aux.getStringCode(_type, _values[ii])); out.writeShort((short)aux.getStringCode(_type, value));
} }
} }
@@ -31,6 +31,7 @@ import com.megginson.sax.DataWriter;
import com.threerings.tools.xml.NestableWriter; import com.threerings.tools.xml.NestableWriter;
import com.threerings.whirled.spot.data.Location; import com.threerings.whirled.spot.data.Location;
import com.threerings.whirled.spot.data.Portal;
import com.threerings.whirled.spot.data.SpotSceneModel; import com.threerings.whirled.spot.data.SpotSceneModel;
import com.threerings.whirled.spot.tools.EditablePortal; import com.threerings.whirled.spot.tools.EditablePortal;
@@ -70,8 +71,8 @@ public class SpotSceneWriter
throws SAXException throws SAXException
{ {
// write out the portal info // write out the portal info
for (int ii = 0; ii < model.portals.length; ii++) { for (Portal portal : model.portals) {
EditablePortal port = (EditablePortal)model.portals[ii]; EditablePortal port = (EditablePortal)portal;
AttributesImpl attrs = new AttributesImpl(); AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "portalId", "", "", attrs.addAttribute("", "portalId", "", "",
String.valueOf(port.portalId)); String.valueOf(port.portalId));
@@ -90,13 +91,13 @@ public class SpotSceneWriter
// more sophisticated could be done // more sophisticated could be done
Class<?> clazz = portalLoc.getClass(); Class<?> clazz = portalLoc.getClass();
Field[] fields = clazz.getFields(); Field[] fields = clazz.getFields();
for (int ii=0; ii < fields.length; ii++) { for (Field field : fields) {
try { try {
attrs.addAttribute("", fields[ii].getName(), "", "", attrs.addAttribute("", field.getName(), "", "",
String.valueOf(fields[ii].get(portalLoc))); String.valueOf(field.get(portalLoc)));
} catch (IllegalAccessException iae) { } catch (IllegalAccessException iae) {
log.warning("Unable to write portal field, skipping " + log.warning("Unable to write portal field, skipping " +
"[field=" + fields[ii].getName() + ", e=" + iae + "]."); "[field=" + field.getName() + ", e=" + iae + "].");
} }
} }
} }