From: <bur...@us...> - 2007-11-27 17:35:56
|
Revision: 3286 http://freecol.svn.sourceforge.net/freecol/?rev=3286&view=rev Author: burschik Date: 2007-11-27 09:35:55 -0800 (Tue, 27 Nov 2007) Log Message: ----------- Some Colony and javadoc cleanups. Modified Paths: -------------- freecol/trunk/src/net/sf/freecol/client/control/InGameController.java freecol/trunk/src/net/sf/freecol/client/gui/ImageLibrary.java freecol/trunk/src/net/sf/freecol/client/gui/action/ScaleMapAction.java freecol/trunk/src/net/sf/freecol/common/model/Colony.java freecol/trunk/src/net/sf/freecol/common/model/Market.java freecol/trunk/src/net/sf/freecol/common/model/MarketData.java freecol/trunk/src/net/sf/freecol/server/ai/AIPlayer.java freecol/trunk/src/net/sf/freecol/server/ai/ColonyPlan.java Modified: freecol/trunk/src/net/sf/freecol/client/control/InGameController.java =================================================================== --- freecol/trunk/src/net/sf/freecol/client/control/InGameController.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/client/control/InGameController.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -2296,7 +2296,7 @@ * Changes the work type of this <code>Unit</code>. * * @param unit The <code>Unit</code> - * @param workType The new <code>GoodsType</code> to produce. + * @param improvementType a <code>TileImprovementType</code> value */ public void changeWorkType(Unit unit, TileImprovementType improvementType) { if (freeColClient.getGame().getCurrentPlayer() != freeColClient.getMyPlayer()) { Modified: freecol/trunk/src/net/sf/freecol/client/gui/ImageLibrary.java =================================================================== --- freecol/trunk/src/net/sf/freecol/client/gui/ImageLibrary.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/client/gui/ImageLibrary.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -347,7 +347,7 @@ /** * Returns the scaling factor used when creating this ImageLibrary. - * @return 1 unless {@see #getScaledImageLibrary} was used to create + * @return 1 unless {@link #getScaledImageLibrary} was used to create * this object. */ public float getScalingFactor() { Modified: freecol/trunk/src/net/sf/freecol/client/gui/action/ScaleMapAction.java =================================================================== --- freecol/trunk/src/net/sf/freecol/client/gui/action/ScaleMapAction.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/client/gui/action/ScaleMapAction.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -203,7 +203,7 @@ /** * Scales the current map into the specified size. The current - * map is given by {@link FreeColClient#getGame()#getMap}. + * map is given by {@link FreeColClient#getGame()#getMap()}. * * @param width The width of the resulting map. * @param height The height of the resulting map. Modified: freecol/trunk/src/net/sf/freecol/common/model/Colony.java =================================================================== --- freecol/trunk/src/net/sf/freecol/common/model/Colony.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/common/model/Colony.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -418,16 +418,12 @@ } /** - * Gets an <code>Iterator</code> of every {@link ColonyTile} in this + * Gets a <code>List</code> of every {@link ColonyTile} in this * <code>Colony</code>. * - * @return The <code>Iterator</code>. + * @return The <code>List</code>. * @see ColonyTile */ - public Iterator<ColonyTile> getColonyTileIterator() { - return colonyTiles.iterator(); - } - public List<ColonyTile> getColonyTiles() { return colonyTiles; } @@ -455,9 +451,7 @@ */ public ColonyTile getColonyTile(int x, int y) { Tile t = getTile(x, y); - Iterator<ColonyTile> i = getColonyTileIterator(); - while (i.hasNext()) { - ColonyTile c = i.next(); + for (ColonyTile c : colonyTiles) { if (c.getWorkTile() == t) { return c; } @@ -474,9 +468,7 @@ * @return The <code>ColonyTile</code> */ public ColonyTile getColonyTile(Tile t) { - Iterator<ColonyTile> i = getColonyTileIterator(); - while (i.hasNext()) { - ColonyTile c = i.next(); + for (ColonyTile c : colonyTiles) { if (c.getWorkTile() == t) { return c; } @@ -1095,9 +1087,7 @@ public ColonyTile getVacantColonyTileFor(Unit unit, GoodsType goodsType) { ColonyTile bestPick = null; int highestProduction = 0; - Iterator<ColonyTile> colonyTileIterator = getColonyTileIterator(); - while (colonyTileIterator.hasNext()) { - ColonyTile colonyTile = colonyTileIterator.next(); + for (ColonyTile colonyTile : colonyTiles) { if (colonyTile.canAdd(unit)) { Tile workTile = colonyTile.getWorkTile(); /* @@ -1396,11 +1386,9 @@ // Update all colony tiles private void addColonyTileProduction() { - Iterator<ColonyTile> tileIterator = getColonyTileIterator(); - while (tileIterator.hasNext()) { - ColonyTile tile = tileIterator.next(); - logger.finest("Calling newTurn for colony tile " + tile.toString()); - tile.newTurn(); + for (ColonyTile colonyTile : colonyTiles) { + logger.finest("Calling newTurn for colony tile " + colonyTile.toString()); + colonyTile.newTurn(); } } Modified: freecol/trunk/src/net/sf/freecol/common/model/Market.java =================================================================== --- freecol/trunk/src/net/sf/freecol/common/model/Market.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/common/model/Market.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -342,7 +342,7 @@ /** * Add the given <code>Goods</code> to this <code>Market</code>. * - * @param type a <code>GoodsType</code> value + * @param goodsType a <code>GoodsType</code> value * @param amount The amount of goods. */ public void add(GoodsType goodsType, int amount) { @@ -358,7 +358,7 @@ /** * Remove the given <code>Goods</code> from this <code>Market</code>. - * @param type a <code>GoodsType</code> value + * @param goodsType a <code>GoodsType</code> value * @param amount The amount of goods. */ public void remove(GoodsType goodsType, int amount) { @@ -393,7 +393,7 @@ /** * Gets the price of a given goods when the <code>Player</code> sells. * - * @param goodsIndex The index of the goods. + * @param type a <code>GoodsType</code> value * @param amount The amount of goods. * @return The sale price of the given goods. */ Modified: freecol/trunk/src/net/sf/freecol/common/model/MarketData.java =================================================================== --- freecol/trunk/src/net/sf/freecol/common/model/MarketData.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/common/model/MarketData.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -76,10 +76,14 @@ * Package constructor: This class is only supposed to be constructed * by {@link Market}. * - * @param game The game this object should be created within. */ public MarketData() {} + /** + * Creates a new <code>MarketData</code> instance. + * + * @param goodsType a <code>GoodsType</code> value + */ public MarketData(GoodsType goodsType) { setId(goodsType.getId()); } @@ -239,15 +243,7 @@ * set to <code>false</code>. * * @param out The target stream. - * @param player The <code>Player</code> this XML-representation - * should be made for, or <code>null</code> if - * <code>showAll == true</code>. - * @param showAll Only attributes visible to <code>player</code> - * will be added to the representation if <code>showAll</code> - * is set to <i>false</i>. - * @param toSavedGame If <code>true</code> then information that - * is only needed when saving a game is added. - * @throws XMLStreamException if there are any problems writing + * @exception XMLStreamException if there are any problems writing * to the stream. */ protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException { Modified: freecol/trunk/src/net/sf/freecol/server/ai/AIPlayer.java =================================================================== --- freecol/trunk/src/net/sf/freecol/server/ai/AIPlayer.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/server/ai/AIPlayer.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -593,9 +593,7 @@ while (ci.hasNext()) { AIColony c = ci.next(); ArrayList<Tile> oldWorkTiles = new ArrayList<Tile>(); - Iterator<ColonyTile> it = c.getColony().getColonyTileIterator(); - while (it.hasNext()) { - ColonyTile colonyTile = it.next(); + for (ColonyTile colonyTile : c.getColony().getColonyTiles()) { if (colonyTile.getUnit() != null) { oldWorkTiles.add(colonyTile.getWorkTile()); } @@ -604,9 +602,7 @@ c.rearrangeWorkers(getConnection()); ArrayList<Tile> tilesToUpdate = new ArrayList<Tile>(); - it = c.getColony().getColonyTileIterator(); - while (it.hasNext()) { - ColonyTile colonyTile = it.next(); + for (ColonyTile colonyTile : c.getColony().getColonyTiles()) { boolean isOccupied = colonyTile.getUnit() != null; boolean wasOccupied = oldWorkTiles.remove(colonyTile.getWorkTile()); if (isOccupied != wasOccupied) { Modified: freecol/trunk/src/net/sf/freecol/server/ai/ColonyPlan.java =================================================================== --- freecol/trunk/src/net/sf/freecol/server/ai/ColonyPlan.java 2007-11-27 17:08:36 UTC (rev 3285) +++ freecol/trunk/src/net/sf/freecol/server/ai/ColonyPlan.java 2007-11-27 17:35:55 UTC (rev 3286) @@ -299,9 +299,7 @@ Building townHall = colony.getBuildingForProducing(Goods.BELLS); // Choose the best production for each tile: - Iterator<ColonyTile> colonyTileIterator = getColony().getColonyTileIterator(); - while (colonyTileIterator.hasNext()) { - ColonyTile ct = colonyTileIterator.next(); + for (ColonyTile ct : colony.getColonyTiles()) { if (ct.getWorkTile().getOwningSettlement() != null && ct.getWorkTile().getOwningSettlement() != colony || ct.isColonyCenterTile()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |