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