From: Erik V. <ev...@us...> - 2008-12-11 20:12:24
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20930/rails/game Modified Files: Tile.java StartPacket.java PublicCertificate.java Log Message: Cleanups, annotations, formatting. Index: StartPacket.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartPacket.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** StartPacket.java 4 Jun 2008 19:00:31 -0000 1.11 --- StartPacket.java 11 Dec 2008 20:12:07 -0000 1.12 *************** *** 26,29 **** --- 26,30 ---- * The start packet name. Usually the default name "Ïnitial" is used. */ + @SuppressWarnings("unused") private String name; // For identification if there is more than one. /** The name of the class that implements the Start Round for this packet. */ *************** *** 47,51 **** * Constructor. Only takes the packet and class named. Actual initialisation * is done in <b>configureFromXML()</b>. ! * * @param name The start packet name. * @param roundClassName The StartRound class name. --- 48,52 ---- * Constructor. Only takes the packet and class named. Actual initialisation * is done in <b>configureFromXML()</b>. ! * * @param name The start packet name. * @param roundClassName The StartRound class name. *************** *** 60,64 **** * Configure the start packet from the contents of a <StartPacket> XML * element. ! * * @param element The <StartPacket> Element object. * @throws ConfigurationException if anything goes wrong. --- 61,65 ---- * Configure the start packet from the contents of a <StartPacket> XML * element. ! * * @param element The <StartPacket> Element object. * @throws ConfigurationException if anything goes wrong. *************** *** 136,150 **** /** * Get the start packet with as given name. ! * * @param name The start packet name. * @return The start packet (or null if it does not exist). */ public static StartPacket getStartPacket(String name) { ! return (StartPacket) packets.get(name); } /** * Get the start packet with the default name. ! * * @return The default start packet (or null if it does not exist). */ --- 137,151 ---- /** * Get the start packet with as given name. ! * * @param name The start packet name. * @return The start packet (or null if it does not exist). */ public static StartPacket getStartPacket(String name) { ! return packets.get(name); } /** * Get the start packet with the default name. ! * * @return The default start packet (or null if it does not exist). */ *************** *** 155,159 **** /** * Get the items of this start packet. ! * * @return The List of start items. */ --- 156,160 ---- /** * Get the items of this start packet. ! * * @return The List of start items. */ *************** *** 163,167 **** public StartItem getItem(int index) { ! return (StartItem) items.get(index); } --- 164,168 ---- public StartItem getItem(int index) { ! return items.get(index); } *************** *** 169,178 **** * Get the first start item. This one often gets a special treatment (price * reduction). ! * * @return first item */ public StartItem getFirstItem() { if (!items.isEmpty()) { ! return (StartItem) items.get(0); } else { return null; --- 170,179 ---- * Get the first start item. This one often gets a special treatment (price * reduction). ! * * @return first item */ public StartItem getFirstItem() { if (!items.isEmpty()) { ! return items.get(0); } else { return null; *************** *** 183,187 **** * Get the first start item that has not yet been sold. In many cases this * is the only item that can be bought immediately. ! * * @return first unsold item */ --- 184,188 ---- * Get the first start item that has not yet been sold. In many cases this * is the only item that can be bought immediately. ! * * @return first unsold item */ *************** *** 195,199 **** /** * Get all not yet sold start items. ! * * @return A List of all unsold items. */ --- 196,200 ---- /** * Get all not yet sold start items. ! * * @return A List of all unsold items. */ *************** *** 210,214 **** /** * Check if all items have bene sold. ! * * @return True if all items have been sold. */ --- 211,215 ---- /** * Check if all items have bene sold. ! * * @return True if all items have been sold. */ *************** *** 222,226 **** /** * Get the name of the StartRound class that will sell out this packet. ! * * @return StartRound subclass name. */ --- 223,227 ---- /** * Get the name of the StartRound class that will sell out this packet. ! * * @return StartRound subclass name. */ Index: Tile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Tile.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Tile.java 29 Nov 2008 20:01:33 -0000 1.24 --- Tile.java 11 Dec 2008 20:12:07 -0000 1.25 *************** *** 32,36 **** // Upgrade instances private String upgradesString = ""; ! private final List[] tracksPerSide = new ArrayList[6]; // N.B. Cannot parametrise collection array private Map<Integer, List<Track>> tracksPerStation = null; --- 32,37 ---- // Upgrade instances private String upgradesString = ""; ! @SuppressWarnings("unchecked") ! private final List[] tracksPerSide = new ArrayList[6]; // N.B. Cannot parametrise collection array private Map<Integer, List<Track>> tracksPerStation = null; *************** *** 258,266 **** } ! // Set reposition base tokens flag // (valid for all upgrades although attribute of one) relayBaseTokensOnUpgrade = upgradeTag.getAttributeAsBoolean( ! "relayBaseTokens", relayBaseTokensOnUpgrade); } --- 259,267 ---- } ! // Set reposition base tokens flag // (valid for all upgrades although attribute of one) relayBaseTokensOnUpgrade = upgradeTag.getAttributeAsBoolean( ! "relayBaseTokens", relayBaseTokensOnUpgrade); } *************** *** 338,342 **** * Get the valid upgrades if this tile on a certain hex (restrictions per * hex have not yet been implemented). ! * * @param hex The MapHex to be upgraded. * @return A List of valid upgrade TileI objects. --- 339,343 ---- * Get the valid upgrades if this tile on a certain hex (restrictions per * hex have not yet been implemented). ! * * @param hex The MapHex to be upgraded. * @return A List of valid upgrade TileI objects. *************** *** 451,455 **** * processed at the first usage, because Tiles are initialised before * the Map. ! * * @author Erik Vos */ --- 452,456 ---- * processed at the first usage, because Tiles are initialised before * the Map. ! * * @author Erik Vos */ *************** *** 462,470 **** protected boolean isAllowedForHex(MapHex hex, String phaseName) { ! if (allowedPhases != null && !allowedPhases.contains(phaseName)) { return false; } ! if (hexes != null) convertHexString(); --- 463,471 ---- protected boolean isAllowedForHex(MapHex hex, String phaseName) { ! if (allowedPhases != null && !allowedPhases.contains(phaseName)) { return false; } ! if (hexes != null) convertHexString(); *************** *** 477,481 **** } } ! protected TileI getTile() { return tile; --- 478,482 ---- } } ! protected TileI getTile() { return tile; *************** *** 485,493 **** this.hexes = hexes; } ! protected void setPhases (String phases) { allowedPhases = Arrays.asList(phases.split(",")); } ! private void convertHexString() { --- 486,494 ---- this.hexes = hexes; } ! protected void setPhases (String phases) { allowedPhases = Arrays.asList(phases.split(",")); } ! private void convertHexString() { Index: PublicCertificate.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCertificate.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PublicCertificate.java 2 Nov 2008 19:52:48 -0000 1.11 --- PublicCertificate.java 11 Dec 2008 20:12:07 -0000 1.12 *************** *** 17,22 **** /** * Share percentage represented by this certificate - * - * @deprecated */ protected int shares; --- 17,20 ---- *************** *** 92,96 **** /** * Get the number of shares that this certificate represents. ! * * @return The number of shares. */ --- 90,94 ---- /** * Get the number of shares that this certificate represents. ! * * @return The number of shares. */ *************** *** 102,106 **** * Get the percentage of ownership that this certificate represents. This is * equal to the number of shares * the share unit. ! * * @return The share percentage. */ --- 100,104 ---- * Get the percentage of ownership that this certificate represents. This is * equal to the number of shares * the share unit. ! * * @return The share percentage. */ *************** *** 111,115 **** /** * Get the current price of this certificate. ! * * @return The current certificate price. */ --- 109,113 ---- /** * Get the current price of this certificate. ! * * @return The current certificate price. */ *************** *** 185,188 **** --- 183,187 ---- } + @Override protected Object clone() { try { *************** *** 201,205 **** * Two certificates are "equal" if they both belong to the same company, * represent the same share percentage, and are not a president share. ! * * @param cert Public company certificate to compare with. * @return True if the certs are "equal" in the defined sense. --- 200,204 ---- * Two certificates are "equal" if they both belong to the same company, * represent the same share percentage, and are not a president share. ! * * @param cert Public company certificate to compare with. * @return True if the certs are "equal" in the defined sense. *************** *** 210,213 **** --- 209,213 ---- } + @Override public String toString() { return "PublicCertificate: " + getName(); |