Dependencies and checkstyle is now clean

This commit is contained in:
jendave
2012-01-20 21:10:41 +00:00
parent 2d59c17367
commit fbb1d99b21
18 changed files with 698 additions and 714 deletions

View File

@@ -709,11 +709,7 @@
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.1</version> <version>3.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.freemarker</groupId> <groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId> <artifactId>freemarker</artifactId>

View File

@@ -106,8 +106,7 @@ public class Card extends GameEntity implements Comparable<Card> {
this.curCharacteristics = state; this.curCharacteristics = state;
if ((cur.equals("Original") && state.equals("Transformed")) if ((cur.equals("Original") && state.equals("Transformed"))
|| cur.equals("Transformed") && state.equals("Original")) { || (cur.equals("Transformed") && state.equals("Original"))) {
HashMap<String, Object> runParams = new HashMap<String, Object>(); HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Mode", "Transformed"); runParams.put("Mode", "Transformed");
runParams.put("Transformer", this); runParams.put("Transformer", this);
@@ -318,9 +317,11 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
/** /**
* Sets whether or not this card is transformable, but non-flip and not double-faced. * Sets whether or not this card is transformable, but non-flip and not
* double-faced.
* *
* @param otherTransformable0 a String * @param otherTransformable0
* a String
*/ */
public final void setTransformable(final String otherTransformable0) { public final void setTransformable(final String otherTransformable0) {
this.otherTransformable = otherTransformable0; this.otherTransformable = otherTransformable0;
@@ -2438,8 +2439,7 @@ public class Card extends GameEntity implements Comparable<Card> {
final StringBuilder sbMana = new StringBuilder(); final StringBuilder sbMana = new StringBuilder();
for (int i = 0; i < keyword.size(); i++) { for (int i = 0; i < keyword.size(); i++) {
if (!keyword.get(i).toString() if (!keyword.get(i).toString().contains("Permanents don't untap during their controllers' untap steps")
.contains("Permanents don't untap during their controllers' untap steps")
&& !keyword.get(i).toString().contains("PreventAllDamageBy") && !keyword.get(i).toString().contains("PreventAllDamageBy")
&& !keyword.get(i).toString().contains("CantBlock") && !keyword.get(i).toString().contains("CantBlock")
&& !keyword.get(i).toString().contains("CantBeBlockedBy")) { && !keyword.get(i).toString().contains("CantBeBlockedBy")) {
@@ -2606,7 +2606,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} }
//Replacement effects // Replacement effects
for (final ReplacementEffect replacementEffect : this.getCharacteristics().getReplacementEffects()) { for (final ReplacementEffect replacementEffect : this.getCharacteristics().getReplacementEffects()) {
sb.append(replacementEffect.toString() + "\r\n"); sb.append(replacementEffect.toString() + "\r\n");
} }
@@ -2707,7 +2707,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} }
//Replacement effects // Replacement effects
for (final ReplacementEffect replacementEffect : this.getCharacteristics().getReplacementEffects()) { for (final ReplacementEffect replacementEffect : this.getCharacteristics().getReplacementEffects()) {
sb.append(replacementEffect.toString() + "\r\n"); sb.append(replacementEffect.toString() + "\r\n");
} }
@@ -2754,22 +2754,22 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
if (keyword.startsWith("Storm")) { if (keyword.startsWith("Storm")) {
if (sb.toString().contains("Target") || sb.toString().contains("target")) { if (sb.toString().contains("Target") || sb.toString().contains("target")) {
sb.insert(sb.indexOf("Storm (When you cast this spell, copy it for each spell cast before it this turn.") + 81, sb.insert(
sb.indexOf("Storm (When you cast this spell, copy it for each spell cast before it this turn.") + 81,
" You may choose new targets for the copies."); " You may choose new targets for the copies.");
} }
} }
/* /*
if (keyword.startsWith("Storm")) { * if (keyword.startsWith("Storm")) { if
if (sb.toString().endsWith("\r\n\r\n")) { * (sb.toString().endsWith("\r\n\r\n")) {
sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); * sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); }
} * sb.append(
sb.append("Storm (When you cast this spell, copy it for each spell cast before it this turn."); * "Storm (When you cast this spell, copy it for each spell cast before it this turn."
if (sb.toString().contains("Target") || sb.toString().contains("target")) { * ); if (sb.toString().contains("Target") ||
sb.append(" You may choose new targets for the copies."); * sb.toString().contains("target")) {
} * sb.append(" You may choose new targets for the copies."); }
sb.append(")\r\n"); * sb.append(")\r\n"); }
} */
*/
if (keyword.contains("Replicate") && !sb.toString().contains("you paid its replicate cost.")) { if (keyword.contains("Replicate") && !sb.toString().contains("you paid its replicate cost.")) {
if (sb.toString().endsWith("\r\n\r\n")) { if (sb.toString().endsWith("\r\n\r\n")) {
sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3); sb.delete(sb.lastIndexOf("\r\n"), sb.lastIndexOf("\r\n") + 3);
@@ -2807,7 +2807,8 @@ public class Card extends GameEntity implements Comparable<Card> {
sb.append("Remove CARDNAME from your deck before playing if you're not playing for ante.\r\n"); sb.append("Remove CARDNAME from your deck before playing if you're not playing for ante.\r\n");
} }
if (keyword.equals("Rebound")) { if (keyword.equals("Rebound")) {
sb.append(keyword).append("(If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)\r\n"); sb.append(keyword)
.append("(If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)\r\n");
} }
} }
return sb; return sb;
@@ -3085,7 +3086,6 @@ public class Card extends GameEntity implements Comparable<Card> {
public final ArrayList<SpellAbility> getAllSpellAbilities() { public final ArrayList<SpellAbility> getAllSpellAbilities() {
final ArrayList<SpellAbility> res = new ArrayList<SpellAbility>(); final ArrayList<SpellAbility> res = new ArrayList<SpellAbility>();
final String curState = this.curCharacteristics;
for (final String key : this.characteristicsMap.keySet()) { for (final String key : this.characteristicsMap.keySet()) {
res.addAll(this.getState(key).getSpellAbility()); res.addAll(this.getState(key).getSpellAbility());
} }
@@ -5625,7 +5625,8 @@ public class Card extends GameEntity implements Comparable<Card> {
/** /**
* Removes the all extrinsic keyword. * Removes the all extrinsic keyword.
* *
* @param s the s * @param s
* the s
*/ */
public void removeAllExtrinsicKeyword(final String s) { public void removeAllExtrinsicKeyword(final String s) {
final ArrayList<String> strings = new ArrayList<String>(); final ArrayList<String> strings = new ArrayList<String>();
@@ -6956,8 +6957,8 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} else if (property.startsWith("controllerWasDealtDamageByThisTurn")) { } else if (property.startsWith("controllerWasDealtDamageByThisTurn")) {
if (!(source.dealtDmgToHumanThisTurn && this.getController().isPlayer(AllZone.getHumanPlayer())) if (!(source.dealtDmgToHumanThisTurn && this.getController().isPlayer(AllZone.getHumanPlayer()))
&& !(source.dealtDmgToComputerThisTurn && this.getController().isPlayer( && !(source.dealtDmgToComputerThisTurn && this.getController()
AllZone.getComputerPlayer()))) { .isPlayer(AllZone.getComputerPlayer()))) {
return false; return false;
} }
} else if (property.startsWith("wasDealtDamageThisTurn")) { } else if (property.startsWith("wasDealtDamageThisTurn")) {
@@ -7022,7 +7023,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} else if (property.startsWith("lowestCMC")) { } else if (property.startsWith("lowestCMC")) {
final CardList list = AllZoneUtil.getCreaturesInPlay(); final CardList list = AllZoneUtil.getCreaturesInPlay();
for (final Card crd : list) { for (final Card crd : list) {
if (!crd.isLand() && !crd.isImmutable() && crd.getCMC() < this.getCMC()) { if (!crd.isLand() && !crd.isImmutable() && (crd.getCMC() < this.getCMC())) {
return false; return false;
} }
} }
@@ -7194,8 +7195,8 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} else if (property.equals("hasActivatedAbilityWithTapCost")) { } else if (property.equals("hasActivatedAbilityWithTapCost")) {
boolean hasIt = false; boolean hasIt = false;
for (SpellAbility sa : this.getSpellAbilities()) { for (final SpellAbility sa : this.getSpellAbilities()) {
if (sa.isAbility() && sa.getPayCosts() != null && sa.getPayCosts().getTap()) { if (sa.isAbility() && (sa.getPayCosts() != null) && sa.getPayCosts().getTap()) {
hasIt = true; hasIt = true;
} }
} }
@@ -7217,14 +7218,14 @@ public class Card extends GameEntity implements Comparable<Card> {
return false; return false;
} }
} else if (property.startsWith("wasCastFrom")) { } else if (property.startsWith("wasCastFrom")) {
String strZone = property.substring(11); final String strZone = property.substring(11);
Zone realZone = Constant.Zone.smartValueOf(strZone); final Zone realZone = Constant.Zone.smartValueOf(strZone);
if (realZone != this.getCastFrom()) { if (realZone != this.getCastFrom()) {
return false; return false;
} }
} else if (property.startsWith("wasNotCastFrom")) { } else if (property.startsWith("wasNotCastFrom")) {
String strZone = property.substring(14); final String strZone = property.substring(14);
Zone realZone = Constant.Zone.smartValueOf(strZone); final Zone realZone = Constant.Zone.smartValueOf(strZone);
if (realZone == this.getCastFrom()) { if (realZone == this.getCastFrom()) {
return false; return false;
} }
@@ -7379,7 +7380,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*/ */
public final boolean sharesCreatureTypeWith(final Card c1) { public final boolean sharesCreatureTypeWith(final Card c1) {
for (String type : this.getType()) { for (final String type : this.getType()) {
if (type.equals("AllCreatureTypes") && c1.hasACreatureType()) { if (type.equals("AllCreatureTypes") && c1.hasACreatureType()) {
return true; return true;
} }
@@ -7401,7 +7402,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*/ */
public final boolean sharesTypeWith(final Card c1) { public final boolean sharesTypeWith(final Card c1) {
for (String type : this.getType()) { for (final String type : this.getType()) {
if (c1.isType(type)) { if (c1.isType(type)) {
return true; return true;
} }
@@ -7417,7 +7418,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean. * @return a boolean.
*/ */
public final boolean hasACreatureType() { public final boolean hasACreatureType() {
for (String type : this.getType()) { for (final String type : this.getType()) {
if (CardUtil.isACreatureType(type)) { if (CardUtil.isACreatureType(type)) {
return true; return true;
} }
@@ -8124,8 +8125,8 @@ public class Card extends GameEntity implements Comparable<Card> {
*/ */
@Override @Override
public final int replaceDamage(final int damageIn, final Card source, final boolean isCombat) { public final int replaceDamage(final int damageIn, final Card source, final boolean isCombat) {
//Replacement effects // Replacement effects
HashMap<String, Object> repParams = new HashMap<String, Object>(); final HashMap<String, Object> repParams = new HashMap<String, Object>();
repParams.put("Event", "DamageDone"); repParams.put("Event", "DamageDone");
repParams.put("Affected", this); repParams.put("Affected", this);
repParams.put("DamageSource", source); repParams.put("DamageSource", source);
@@ -8216,8 +8217,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
if (source.hasKeyword("Deathtouch") && this.isCreature()) { if (source.hasKeyword("Deathtouch") && this.isCreature()) {
AllZone.getGameAction().destroy(this); AllZone.getGameAction().destroy(this);
} } else if (AllZoneUtil.isCardInPlay(this) && !wither) {
else if (AllZoneUtil.isCardInPlay(this) && !wither) {
this.damage += damageToAdd; this.damage += damageToAdd;
} }
@@ -8744,39 +8744,43 @@ public class Card extends GameEntity implements Comparable<Card> {
/** /**
* Sets the replacement effects. * Sets the replacement effects.
* *
* @param res the new replacement effects * @param res
* the new replacement effects
*/ */
public void setReplacementEffects(ArrayList<ReplacementEffect> res) { public void setReplacementEffects(final ArrayList<ReplacementEffect> res) {
this.getCharacteristics().getReplacementEffects().clear(); this.getCharacteristics().getReplacementEffects().clear();
for (ReplacementEffect replacementEffect : res) { for (final ReplacementEffect replacementEffect : res) {
addReplacementEffect(replacementEffect); this.addReplacementEffect(replacementEffect);
} }
} }
/** /**
* Adds the replacement effect. * Adds the replacement effect.
* *
* @param replacementEffect the rE * @param replacementEffect
* the rE
*/ */
public void addReplacementEffect(ReplacementEffect replacementEffect) { public void addReplacementEffect(final ReplacementEffect replacementEffect) {
ReplacementEffect replacementEffectCopy = replacementEffect.getCopy(); final ReplacementEffect replacementEffectCopy = replacementEffect.getCopy();
replacementEffectCopy.setHostCard(this); replacementEffectCopy.setHostCard(this);
this.getCharacteristics().getReplacementEffects().add(replacementEffectCopy); this.getCharacteristics().getReplacementEffects().add(replacementEffectCopy);
} }
/** /**
* Returns what zone this card was cast from (from what zone it was moved to the stack). * Returns what zone this card was cast from (from what zone it was moved to
* the stack).
* *
* @return the castFrom * @return the castFrom
*/ */
public Zone getCastFrom() { public Zone getCastFrom() {
return castFrom; return this.castFrom;
} }
/** /**
* @param castFrom0 the castFrom to set * @param castFrom0
* the castFrom to set
*/ */
public void setCastFrom(Zone castFrom0) { public void setCastFrom(final Zone castFrom0) {
this.castFrom = castFrom0; this.castFrom = castFrom0;
} }

View File

@@ -60,48 +60,48 @@ import forge.view.FView;
* @version $Id$ * @version $Id$
*/ */
public class CardReader implements Runnable { public class CardReader implements Runnable {
// NOPMD by Braids on 8/18/11 10:55
// PM // PM
private static final String CARD_FILE_DOT_EXTENSION = ".txt"; // NOPMD by private static final String CARD_FILE_DOT_EXTENSION = ".txt";
// Braids on // Braids on
// 8/18/11 // 8/18/11
// 11:04 PM // 11:04 PM
/** Default charset when loading from files. */ /** Default charset when loading from files. */
public static final String DEFAULT_CHARSET_NAME = "US-ASCII"; // NOPMD by public static final String DEFAULT_CHARSET_NAME = "US-ASCII";
// Braids on // Braids on
// 8/18/11 // 8/18/11
// 10:54 PM // 10:54 PM
/** Regex that matches a single hyphen (-) or space. */ /** Regex that matches a single hyphen (-) or space. */
public static final Pattern HYPHEN_OR_SPACE = Pattern.compile("[ -]"); public static final Pattern HYPHEN_OR_SPACE = Pattern.compile("[ -]");
/** Regex for punctuation that we omit from card file names. */ /** Regex for punctuation that we omit from card file names. */
public static final Pattern PUNCTUATION_TO_ZAP = Pattern.compile("[,'\"]"); // NOPMD public static final Pattern PUNCTUATION_TO_ZAP = Pattern.compile("[,'\"]");
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 10:54 // 10:54
// PM // PM
/** Regex that matches two or more underscores (_). */ /** Regex that matches two or more underscores (_). */
public static final Pattern MULTIPLE_UNDERSCORES = Pattern.compile("__+"); // NOPMD public static final Pattern MULTIPLE_UNDERSCORES = Pattern.compile("__+");
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 10:54 // 10:54
// PM // PM
/** Special value for estimatedFilesRemaining. */ /** Special value for estimatedFilesRemaining. */
protected static final int UNKNOWN_NUMBER_OF_FILES_REMAINING = -1; // NOPMD protected static final int UNKNOWN_NUMBER_OF_FILES_REMAINING = -1;
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 10:54 // 10:54
// PM // PM
private transient Map<String, Card> mapToFill; private transient Map<String, Card> mapToFill;
private transient List<CardRules> listRulesToFill; private transient List<CardRules> listRulesToFill;
@@ -113,12 +113,13 @@ public class CardReader implements Runnable {
private transient Enumeration<? extends ZipEntry> zipEnum; private transient Enumeration<? extends ZipEntry> zipEnum;
private transient long estimatedFilesRemaining = // NOPMD by Braids on private transient long estimatedFilesRemaining = CardReader.// 8/18/11 10:56
CardReader.// 8/18/11 10:56 PM // PM
UNKNOWN_NUMBER_OF_FILES_REMAINING; UNKNOWN_NUMBER_OF_FILES_REMAINING;
private transient Iterable<File> findNonDirsIterable; // NOPMD by Braids on private transient Iterable<File> findNonDirsIterable;
// 8/18/11 10:56 PM
// 8/18/11 10:56 PM
/** /**
* Instantiates a new card reader. * Instantiates a new card reader.
@@ -168,13 +169,13 @@ public class CardReader implements Runnable {
public CardReader(final File theCardsFolder, final Map<String, Card> theMapToFill, public CardReader(final File theCardsFolder, final Map<String, Card> theMapToFill,
final List<CardRules> listRules2Fill, final boolean useZip) { final List<CardRules> listRules2Fill, final boolean useZip) {
if (theMapToFill == null) { if (theMapToFill == null) {
throw new NullPointerException("theMapToFill must not be null."); // NOPMD throw new NullPointerException("theMapToFill must not be null.");
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 10:53 // 10:53
// PM // PM
} }
this.mapToFill = theMapToFill; this.mapToFill = theMapToFill;
// These read data for lightweight classes. // These read data for lightweight classes.
@@ -182,14 +183,13 @@ public class CardReader implements Runnable {
this.rulesReader = new CardRulesReader(); this.rulesReader = new CardRulesReader();
if (!theCardsFolder.exists()) { if (!theCardsFolder.exists()) {
throw new RuntimeException(// NOPMD by Braids on 8/18/11 10:53 PM throw new RuntimeException("CardReader : constructor error -- file not found -- filename is "
"CardReader : constructor error -- file not found -- filename is " + theCardsFolder.getAbsolutePath());
+ theCardsFolder.getAbsolutePath());
} }
if (!theCardsFolder.isDirectory()) { if (!theCardsFolder.isDirectory()) {
throw new RuntimeException(// NOPMD by Braids on 8/18/11 10:53 PM throw new RuntimeException("CardReader : constructor error -- not a directory -- "
"CardReader : constructor error -- not a directory -- " + theCardsFolder.getAbsolutePath()); + theCardsFolder.getAbsolutePath());
} }
this.cardsfolder = theCardsFolder; this.cardsfolder = theCardsFolder;
@@ -201,15 +201,11 @@ public class CardReader implements Runnable {
try { try {
this.zip = new ZipFile(zipFile); this.zip = new ZipFile(zipFile);
} catch (final Exception exn) { } catch (final Exception exn) {
System.err.println("Error reading zip file \"" // NOPMD by System.err.println("Error reading zip file \""
// Braids on // Braids on
// 8/18/11 10:53 // 8/18/11 10:53
// PM // PM
+ zipFile.getAbsolutePath() + zipFile.getAbsolutePath() + "\": " + exn + ". " + "Defaulting to txt files in \""
+ "\": "
+ exn
+ ". "
+ "Defaulting to txt files in \""
+ theCardsFolder.getAbsolutePath() + "\"."); + theCardsFolder.getAbsolutePath() + "\".");
} }
@@ -371,13 +367,13 @@ public class CardReader implements Runnable {
return line; return line;
} catch (final Exception ex) { } catch (final Exception ex) {
ErrorViewer.showError(ex); ErrorViewer.showError(ex);
throw new RuntimeException("CardReader : readLine(Card) error", ex); // NOPMD throw new RuntimeException("CardReader : readLine(Card) error", ex);
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 10:53 // 10:53
// PM // PM
} }
} // readLine(BufferedReader) } // readLine(BufferedReader)
@@ -406,8 +402,8 @@ public class CardReader implements Runnable {
this.rulesReader.parseLine(line); this.rulesReader.parseLine(line);
if (line.isEmpty()) { if (line.isEmpty()) {
// Ignore empty lines. // Ignore empty lines.
} else if (line.charAt(0) == '#') { // NOPMD by Braids on } else if (line.charAt(0) == '#') {
// 8/18/11 10:59 PM // 8/18/11 10:59 PM
// no need to do anything, this indicates a comment line // no need to do anything, this indicates a comment line
} else if (line.startsWith("Name:")) { } else if (line.startsWith("Name:")) {
final String value = line.substring(5); final String value = line.substring(5);
@@ -477,8 +473,8 @@ public class CardReader implements Runnable {
card.addReplacementEffect(ReplacementHandler.parseReplacement(value, card)); card.addReplacementEffect(ReplacementHandler.parseReplacement(value, card));
} else if (line.startsWith("SetInfo:")) { } else if (line.startsWith("SetInfo:")) {
final String value = line.substring("SetInfo:".length()); final String value = line.substring("SetInfo:".length());
card.addSet(new SetInfo(value)); // NOPMD by Braids on card.addSet(new SetInfo(value));
// 8/18/11 11:08 PM // 8/18/11 11:08 PM
} else if (line.equals("ALTERNATE")) { } else if (line.equals("ALTERNATE")) {
String mode; String mode;
if (card.isFlip()) { if (card.isFlip()) {
@@ -517,14 +513,14 @@ public class CardReader implements Runnable {
} finally { } finally {
try { try {
reader.close(); reader.close();
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11 } catch (final IOException ignored) {
// 11:08 // 11:08
// PM // PM
} }
try { try {
inputStreamReader.close(); inputStreamReader.close();
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11 } catch (final IOException ignored) {
// 11:08 // 11:08
// PM // PM
} }
} }
@@ -563,13 +559,13 @@ public class CardReader implements Runnable {
return this.loadCard(fileInputStream); return this.loadCard(fileInputStream);
} catch (final FileNotFoundException ex) { } catch (final FileNotFoundException ex) {
ErrorViewer.showError(ex, "File \"%s\" exception", pathToTxtFile.getAbsolutePath()); ErrorViewer.showError(ex, "File \"%s\" exception", pathToTxtFile.getAbsolutePath());
throw new RuntimeException(// NOPMD by Braids on 8/18/11 10:53 PM throw new RuntimeException("CardReader : run error -- file exception -- filename is "
"CardReader : run error -- file exception -- filename is " + pathToTxtFile.getPath(), ex); + pathToTxtFile.getPath(), ex);
} finally { } finally {
try { try {
fileInputStream.close(); fileInputStream.close();
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11 } catch (final IOException ignored) {
// 11:08 // 11:08
// PM // PM
} }
} }
@@ -590,15 +586,15 @@ public class CardReader implements Runnable {
return this.loadCard(zipInputStream); return this.loadCard(zipInputStream);
} catch (final IOException exn) { } catch (final IOException exn) {
throw new RuntimeException(exn); // NOPMD by Braids on 8/18/11 10:53 throw new RuntimeException(exn);
// PM // PM
} finally { } finally {
try { try {
if (zipInputStream != null) { if (zipInputStream != null) {
zipInputStream.close(); zipInputStream.close();
} }
} catch (final IOException ignored) { // NOPMD by Braids on 8/18/11 } catch (final IOException ignored) {
// 11:08 // 11:08
// PM // PM
} }
} }
@@ -654,10 +650,10 @@ public class CardReader implements Runnable {
* *
* @return a new Card instance having that name, or null if not found * @return a new Card instance having that name, or null if not found
*/ */
public final Card findCard(final String canonicalASCIIName) { // NOPMD by public final Card findCard(final String canonicalASCIIName) {
// Braids on // Braids on
// 8/18/11 // 8/18/11
// 11:08 PM // 11:08 PM
UtilFunctions.checkNotNull("canonicalASCIIName", canonicalASCIIName); UtilFunctions.checkNotNull("canonicalASCIIName", canonicalASCIIName);
final String cardFilePath = this.toMostLikelyPath(canonicalASCIIName); final String cardFilePath = this.toMostLikelyPath(canonicalASCIIName);

View File

@@ -131,7 +131,7 @@ public class GameAction {
lastKnownInfo = c; lastKnownInfo = c;
copied = c; copied = c;
} else { } else {
String state = c.getCurState(); final String state = c.getCurState();
AllZone.getTriggerHandler().suppressMode("Transformed"); AllZone.getTriggerHandler().suppressMode("Transformed");
if (c.isInAlternateState()) { if (c.isInAlternateState()) {
c.setState("Original"); c.setState("Original");
@@ -242,11 +242,9 @@ public class GameAction {
if (zone.is(Zone.Stack)) { if (zone.is(Zone.Stack)) {
c.setCastFrom(prev.getZoneType()); c.setCastFrom(prev.getZoneType());
} } else if (prev == null) {
else if (prev == null) {
c.setCastFrom(null); c.setCastFrom(null);
} } else if (!(zone.is(Zone.Battlefield) && prev.is(Zone.Stack))) {
else if (!(zone.is(Zone.Battlefield) && prev.is(Zone.Stack))) {
c.setCastFrom(null); c.setCastFrom(null);
} }
@@ -321,8 +319,7 @@ public class GameAction {
final PlayerZone oldBattlefield = AllZone.getZoneOf(c); final PlayerZone oldBattlefield = AllZone.getZoneOf(c);
final PlayerZone newBattlefield = c.getController().getZone(oldBattlefield.getZoneType()); final PlayerZone newBattlefield = c.getController().getZone(oldBattlefield.getZoneType());
if ((oldBattlefield == null) || (newBattlefield == null) if ((oldBattlefield == null) || (newBattlefield == null) || oldBattlefield.equals(newBattlefield)) {
|| oldBattlefield.equals(newBattlefield)) {
return; return;
} }
@@ -870,7 +867,7 @@ public class GameAction {
boolean checkAgain = false; boolean checkAgain = false;
checkStaticAbilities(); this.checkStaticAbilities();
final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield); final CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
Card c; Card c;
@@ -1295,16 +1292,21 @@ public class GameAction {
} }
/** /**
* Constructor for new game allowing card lists to be put * Constructor for new game allowing card lists to be put into play
* into play immediately, and life totals to be adjusted, * immediately, and life totals to be adjusted, for computer and human.
* for computer and human.
* *
* @param humanDeck &emsp; {@link forge.deck.Deck} object. * @param humanDeck
* @param computerDeck &emsp; {@link forge.deck.Deck} object. * &emsp; {@link forge.deck.Deck} object.
* @param human &emsp; {@link forge.CardList} object. * @param computerDeck
* @param computer &emsp; {@link forge.CardList} object. * &emsp; {@link forge.deck.Deck} object.
* @param humanLife &emsp; int. * @param human
* @param computerLife &emsp; int. * &emsp; {@link forge.CardList} object.
* @param computer
* &emsp; {@link forge.CardList} object.
* @param humanLife
* &emsp; int.
* @param computerLife
* &emsp; int.
*/ */
public final void newGame(final Deck humanDeck, final Deck computerDeck, final CardList human, public final void newGame(final Deck humanDeck, final Deck computerDeck, final CardList human,
final CardList computer, final int humanLife, final int computerLife) { final CardList computer, final int humanLife, final int computerLife) {
@@ -1334,8 +1336,10 @@ public class GameAction {
/** /**
* The default constructor for a new game. * The default constructor for a new game.
* *
* @param humanDeck &emsp; {@link forge.deck.Deck} object. * @param humanDeck
* @param computerDeck &emsp; {@link forge.deck.Deck} object. * &emsp; {@link forge.deck.Deck} object.
* @param computerDeck
* &emsp; {@link forge.deck.Deck} object.
*/ */
public final void newGame(final Deck humanDeck, final Deck computerDeck) { public final void newGame(final Deck humanDeck, final Deck computerDeck) {
// AllZone.getComputer() = new ComputerAI_Input(new // AllZone.getComputer() = new ComputerAI_Input(new
@@ -1352,8 +1356,8 @@ public class GameAction {
* This must be separated from the newGame method since life totals and * This must be separated from the newGame method since life totals and
* player details could be adjusted before the game is started. * player details could be adjusted before the game is started.
* *
* That process (also cleanup and observer updates) should be done in * That process (also cleanup and observer updates) should be done in
* newGame, then when all is ready, call this function. * newGame, then when all is ready, call this function.
*/ */
private void actuateGame(final Deck humanDeck, final Deck computerDeck) { private void actuateGame(final Deck humanDeck, final Deck computerDeck) {
this.canShowWinLose = true; this.canShowWinLose = true;
@@ -1478,8 +1482,7 @@ public class GameAction {
} }
if (hAnteRemoved.size() > 0) { if (hAnteRemoved.size() > 0) {
final StringBuilder sb = new StringBuilder( final StringBuilder sb = new StringBuilder("The following ante cards were removed from the human's deck:\n");
"The following ante cards were removed from the human's deck:\n");
for (int i = 0; i < hAnteRemoved.size(); i++) { for (int i = 0; i < hAnteRemoved.size(); i++) {
sb.append(hAnteRemoved.get(i)); sb.append(hAnteRemoved.get(i));
if (((i % 4) == 0) && (i > 0)) { if (((i % 4) == 0) && (i > 0)) {
@@ -1543,10 +1546,10 @@ public class GameAction {
if (Singletons.getModel().getPreferences().isPlayForAnte()) { if (Singletons.getModel().getPreferences().isPlayForAnte()) {
final String nl = System.getProperty("line.separator"); final String nl = System.getProperty("line.separator");
final StringBuilder msg = new StringBuilder(); final StringBuilder msg = new StringBuilder();
for (Player p : AllZone.getPlayersInGame()) { for (final Player p : AllZone.getPlayersInGame()) {
CardList lib = p.getCardsIn(Zone.Library); final CardList lib = p.getCardsIn(Zone.Library);
Card ante; Card ante;
if (lib.size() > 0 && lib.getNotType("Basic").size() > 1) { if ((lib.size() > 0) && (lib.getNotType("Basic").size() > 1)) {
ante = CardUtil.getRandom(lib.toArray()); ante = CardUtil.getRandom(lib.toArray());
while (ante.isBasicLand()) { while (ante.isBasicLand()) {
ante = CardUtil.getRandom(lib.toArray()); ante = CardUtil.getRandom(lib.toArray());
@@ -1557,7 +1560,7 @@ public class GameAction {
throw new RuntimeException(p + " library is empty."); throw new RuntimeException(p + " library is empty.");
} }
AllZone.getGameLog().add("Ante", p + " anted " + ante, 0); AllZone.getGameLog().add("Ante", p + " anted " + ante, 0);
moveTo(Zone.Ante, ante); this.moveTo(Zone.Ante, ante);
msg.append(p.getName()).append(" ante: ").append(ante).append(nl); msg.append(p.getName()).append(" ante: ").append(ante).append(nl);
} }
JOptionPane.showConfirmDialog(null, msg, "Ante", JOptionPane.OK_CANCEL_OPTION); JOptionPane.showConfirmDialog(null, msg, "Ante", JOptionPane.OK_CANCEL_OPTION);
@@ -1574,8 +1577,9 @@ public class GameAction {
AllZone.getInputControl().setInput(new InputMulligan()); AllZone.getInputControl().setInput(new InputMulligan());
PhaseHandler.setGameBegins(1); PhaseHandler.setGameBegins(1);
AllZone.getGameLog().add("Turn", "Turn " + AllZone.getPhaseHandler().getTurn() AllZone.getGameLog().add("Turn",
+ " (" + AllZone.getPhaseHandler().getPlayerTurn() + ")", 0); "Turn " + AllZone.getPhaseHandler().getTurn() + " (" + AllZone.getPhaseHandler().getPlayerTurn() + ")",
0);
} // newGame() } // newGame()
// this is where the computer cheats // this is where the computer cheats
@@ -1922,7 +1926,8 @@ public class GameAction {
final SpellAbility flashback = sa.copy(); final SpellAbility flashback = sa.copy();
flashback.setFlashBackAbility(true); flashback.setFlashBackAbility(true);
// there is a flashback cost (and not the cards cost) // there is a flashback cost (and not the cards
// cost)
if (!keyword.equals("Flashback")) { if (!keyword.equals("Flashback")) {
final Cost fbCost = new Cost(keyword.substring(10), c.getName(), false); final Cost fbCost = new Cost(keyword.substring(10), c.getName(), false);
flashback.setPayCosts(fbCost); flashback.setPayCosts(fbCost);
@@ -1936,7 +1941,7 @@ public class GameAction {
if (c.hasStartOfKeyword("May be played without paying its mana cost")) { if (c.hasStartOfKeyword("May be played without paying its mana cost")) {
final SpellAbility newSA = sa.copy(); final SpellAbility newSA = sa.copy();
final Cost cost = new Cost("", c.getName(), false); final Cost cost = new Cost("", c.getName(), false);
for (CostPart part : newSA.getPayCosts().getCostParts()) { for (final CostPart part : newSA.getPayCosts().getCostParts()) {
if (!(part instanceof CostMana)) { if (!(part instanceof CostMana)) {
cost.getCostParts().add(part); cost.getCostParts().add(part);
} }

View File

@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import forge.AllZone;
import forge.AllZoneUtil; import forge.AllZoneUtil;
import forge.Card; import forge.Card;
import forge.CardList; import forge.CardList;
@@ -207,7 +206,6 @@ public class AbilityFactorySetState {
final boolean remChanged = abilityFactory.getMapParams().containsKey("RememberChanged"); final boolean remChanged = abilityFactory.getMapParams().containsKey("RememberChanged");
for (final Card tgt : tgtCards) { for (final Card tgt : tgtCards) {
if (abilityFactory.getAbTgt() != null) { if (abilityFactory.getAbTgt() != null) {
if (!tgt.canBeTargetedBy(sa)) { if (!tgt.canBeTargetedBy(sa)) {

View File

@@ -714,141 +714,121 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
} // *************** END ************ END ************************** } // *************** END ************ END **************************
// *************** START *********** START ************************** // *************** START *********** START **************************
/*else if (cardName.equals("Aluren")) { /*
final Ability ability1 = new Ability(card, "0") { * else if (cardName.equals("Aluren")) { final Ability ability1 = new
@Override * Ability(card, "0") {
public void resolve() { *
final PlayerZone hand = AllZone.getHumanPlayer().getZone(Constant.Zone.Hand); * @Override public void resolve() { final PlayerZone hand =
* AllZone.getHumanPlayer().getZone(Constant.Zone.Hand);
if (hand.size() == 0) { *
return; * if (hand.size() == 0) { return; }
} *
* final CardList creatures = new CardList();
final CardList creatures = new CardList(); *
* for (int i = 0; i < hand.size(); i++) { if (hand.get(i).isCreature()
for (int i = 0; i < hand.size(); i++) { * && (CardUtil.getConvertedManaCost(hand.get(i).getManaCost()) <= 3)) {
if (hand.get(i).isCreature() && (CardUtil.getConvertedManaCost(hand.get(i).getManaCost()) <= 3)) { * creatures.add(hand.get(i)); } }
creatures.add(hand.get(i)); *
} * if (creatures.size() == 0) { return; }
} *
* final Object o =
if (creatures.size() == 0) { * GuiUtils.getChoiceOptional("Select target creature to play",
return; * creatures.toArray()); if (o != null) { final Card c = (Card) o;
} * AllZone.getStack().add(c.getSpellPermanent()); }
*
final Object o = GuiUtils.getChoiceOptional("Select target creature to play", creatures.toArray()); * }
if (o != null) { *
final Card c = (Card) o; * @Override public boolean canPlayAI() { return false;
AllZone.getStack().add(c.getSpellPermanent()); *
} * }
*
} * @Override public boolean canPlay() { return
* (AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)); } //
@Override * canPlay() }; // SpellAbility ability1
public boolean canPlayAI() { *
return false; * final StringBuilder sb = new StringBuilder(); sb.append(
* "Any player may play creature cards with converted mana cost 3 or less without "
} * ); sb.append(
* "paying their mana cost any time he or she could play an instant.");
@Override * ability1.setDescription(sb.toString());
public boolean canPlay() { *
return (AllZone.getZoneOf(card).is(Constant.Zone.Battlefield)); * ability1.setStackDescription(
} // canPlay() * "Aluren - Play creature with converted manacost 3 or less for free."
}; // SpellAbility ability1 * ); ability1.getRestrictions().setAnyPlayer(true);
* card.addSpellAbility(ability1); } // *************** END ************
final StringBuilder sb = new StringBuilder(); * END **************************
sb.append("Any player may play creature cards with converted mana cost 3 or less without "); *
sb.append("paying their mana cost any time he or she could play an instant."); * // *************** START *********** START **************************
ability1.setDescription(sb.toString()); * else if (cardName.equals("Volrath's Dungeon")) {
*
ability1.setStackDescription("Aluren - Play creature with converted manacost 3 or less for free."); * final Cost dungeonCost = new Cost("Discard<1/Card>", cardName, true);
ability1.getRestrictions().setAnyPlayer(true); * final Target dungeonTgt = new Target(card, card +
card.addSpellAbility(ability1); * " - Select target player", "Player".split(","));
} // *************** END ************ END ************************** *
* final SpellAbility dungeon = new AbilityActivated(card, dungeonCost,
// *************** START *********** START ************************** * dungeonTgt) { private static final long serialVersionUID =
else if (cardName.equals("Volrath's Dungeon")) { * 334033015590321821L;
*
final Cost dungeonCost = new Cost("Discard<1/Card>", cardName, true); * @Override public void chooseTargetAI() {
final Target dungeonTgt = new Target(card, card + " - Select target player", "Player".split(",")); * this.setTargetPlayer(AllZone.getHumanPlayer()); }
*
final SpellAbility dungeon = new AbilityActivated(card, dungeonCost, dungeonTgt) { * @Override public void resolve() { final Player target =
private static final long serialVersionUID = 334033015590321821L; * this.getTargetPlayer(); final CardList targetHand =
* target.getCardsIn(Zone.Hand);
@Override *
public void chooseTargetAI() { * if (targetHand.size() == 0) { return; }
this.setTargetPlayer(AllZone.getHumanPlayer()); *
} * if (target.isHuman()) { final Object discard =
* GuiUtils.getChoice("Select Card to place on top of library.",
@Override * targetHand.toArray());
public void resolve() { *
final Player target = this.getTargetPlayer(); * final Card card = (Card) discard;
final CardList targetHand = target.getCardsIn(Zone.Hand); * AllZone.getGameAction().moveToLibrary(card); } else if
* (target.isComputer()) { AllZone.getComputerPlayer().handToLibrary(1,
if (targetHand.size() == 0) { * "Top"); } }
return; *
} * @Override public boolean canPlayAI() { return
* !AllZone.getComputerPlayer().getZone(Zone.Hand).isEmpty() &&
if (target.isHuman()) { * !AllZone.getHumanPlayer().getZone(Zone.Hand).isEmpty() &&
final Object discard = GuiUtils.getChoice("Select Card to place on top of library.", * super.canPlay(); }
targetHand.toArray()); *
* }; // SpellAbility dungeon
final Card card = (Card) discard; *
AllZone.getGameAction().moveToLibrary(card); * final Cost bailCost = new Cost("PayLife<5>", cardName, true); final
} else if (target.isComputer()) { * SpellAbility bail = new AbilityActivated(card, bailCost, null) {
AllZone.getComputerPlayer().handToLibrary(1, "Top"); * private static final long serialVersionUID = -8990402917139817175L;
} *
} * @Override public void resolve() {
* AllZone.getGameAction().destroy(card); }
@Override *
public boolean canPlayAI() { * @Override public boolean canPlay() { return super.canPlay(); }
return !AllZone.getComputerPlayer().getZone(Zone.Hand).isEmpty() *
&& !AllZone.getHumanPlayer().getZone(Zone.Hand).isEmpty() && super.canPlay(); * @Override public boolean canPlayAI() { return
} * card.getController().isHuman() &&
* (AllZone.getComputerPlayer().getLife() >= 9) && super.canPlay() &&
}; // SpellAbility dungeon * !AllZone.getComputerPlayer().getZone(Zone.Hand).isEmpty(); }
*
final Cost bailCost = new Cost("PayLife<5>", cardName, true); * }; // SpellAbility pay bail
final SpellAbility bail = new AbilityActivated(card, bailCost, null) { *
private static final long serialVersionUID = -8990402917139817175L; * final StringBuilder sbd = new StringBuilder();
* sbd.append("Discard a card: "); sbd.append(
@Override * "Target player puts a card from his or her hand on top of his or her library. "
public void resolve() { * ); sbd.append(
AllZone.getGameAction().destroy(card); * "Activate this ability only any time you could cast a sorcery.");
} * dungeon.setDescription(sbd.toString()); dungeon.setStackDescription(
* "CARDNAME - Target player chooses a card in hand and puts on top of library."
@Override * ); dungeon.getRestrictions().setSorcerySpeed(true);
public boolean canPlay() { *
return super.canPlay(); * bail.getRestrictions().setAnyPlayer(true);
} * bail.getRestrictions().setPlayerTurn(true); final StringBuilder sbb =
* new StringBuilder();
@Override * sbb.append("Pay 5 Life: Destroy Volrath's Dungeon. "); sbb.append(
public boolean canPlayAI() { * "Any player may activate this ability but only during his or her turn."
return card.getController().isHuman() && (AllZone.getComputerPlayer().getLife() >= 9) * ); bail.setDescription(sbb.toString());
&& super.canPlay() && !AllZone.getComputerPlayer().getZone(Zone.Hand).isEmpty(); * bail.setStackDescription("Destroy CARDNAME.");
} *
* card.addSpellAbility(dungeon); card.addSpellAbility(bail); }
}; // SpellAbility pay bail */// *************** END ************ END **************************
final StringBuilder sbd = new StringBuilder();
sbd.append("Discard a card: ");
sbd.append("Target player puts a card from his or her hand on top of his or her library. ");
sbd.append("Activate this ability only any time you could cast a sorcery.");
dungeon.setDescription(sbd.toString());
dungeon.setStackDescription("CARDNAME - Target player chooses a card in hand and puts on top of library.");
dungeon.getRestrictions().setSorcerySpeed(true);
bail.getRestrictions().setAnyPlayer(true);
bail.getRestrictions().setPlayerTurn(true);
final StringBuilder sbb = new StringBuilder();
sbb.append("Pay 5 Life: Destroy Volrath's Dungeon. ");
sbb.append("Any player may activate this ability but only during his or her turn.");
bail.setDescription(sbb.toString());
bail.setStackDescription("Destroy CARDNAME.");
card.addSpellAbility(dungeon);
card.addSpellAbility(bail);
} */ // *************** END ************ END **************************
// *************** START *********** START ************************** // *************** START *********** START **************************
else if (cardName.equals("Mox Diamond")) { else if (cardName.equals("Mox Diamond")) {
@@ -1300,7 +1280,6 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
card.addSpellAbility(ability); card.addSpellAbility(ability);
} // *************** END ************ END ************************** } // *************** END ************ END **************************
// *************** START *********** START ************************** // *************** START *********** START **************************
else if (cardName.equals("Temporal Aperture")) { else if (cardName.equals("Temporal Aperture")) {
/* /*
@@ -1530,8 +1509,7 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
@Override @Override
public void resolve() { public void resolve() {
if (card.getController().isComputer()) { if (card.getController().isComputer()) {
final CardList cards = AllZoneUtil.getCardsIn(Constant.Zone.Battlefield) final CardList cards = AllZoneUtil.getCardsIn(Constant.Zone.Battlefield).getType("Artifact");
.getType("Artifact");
if (!cards.isEmpty()) { if (!cards.isEmpty()) {
copyTarget[0] = CardFactoryUtil.getBestAI(cards); copyTarget[0] = CardFactoryUtil.getBestAI(cards);
} }

View File

@@ -541,7 +541,7 @@ public class CardFactoryCreatures {
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield); CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
list = list.getValidCards("Card.Other+YouCtrl".split(","), card.getController(), card); list = list.getValidCards("Card.Other+YouCtrl".split(","), card.getController(), card);
for (Card c : list) { for (final Card c : list) {
c.addController(opp); c.addController(opp);
} }
} // resolve() } // resolve()
@@ -1231,10 +1231,10 @@ public class CardFactoryCreatures {
final SpellAbility spell = new SpellPermanent(card) { final SpellAbility spell = new SpellPermanent(card) {
private static final long serialVersionUID = -11489323313L; private static final long serialVersionUID = -11489323313L;
/*@Override /*
public boolean canPlayAI() { * @Override public boolean canPlayAI() { return super.canPlay()
return super.canPlay() && (5 <= (ComputerUtil.getAvailableMana().size() - 2)); * && (5 <= (ComputerUtil.getAvailableMana().size() - 2)); }
}*/ */
@Override @Override
public void resolve() { public void resolve() {
@@ -2592,7 +2592,8 @@ public class CardFactoryCreatures {
}; };
final Cost abCost = new Cost("R W U", cardName, true); final Cost abCost = new Cost("R W U", cardName, true);
final Target permanent = new Target(card, "Select target permanent you control", "Permanent.YouCtrl".split(",")); final Target permanent = new Target(card, "Select target permanent you control",
"Permanent.YouCtrl".split(","));
final AbilityActivated ability = new AbilityActivated(card, abCost, permanent) { final AbilityActivated ability = new AbilityActivated(card, abCost, permanent) {
private static final long serialVersionUID = 3818522482220103914L; private static final long serialVersionUID = 3818522482220103914L;
@@ -2614,7 +2615,7 @@ public class CardFactoryCreatures {
card.addSpellAbility(ability); card.addSpellAbility(ability);
} }
// *************** START *********** START ************************** // *************** START *********** START **************************
else if (cardName.equals("Bazaar Trader")) { else if (cardName.equals("Bazaar Trader")) {
@@ -2641,7 +2642,8 @@ public class CardFactoryCreatures {
}; };
final Cost abCost = new Cost("T", cardName, true); final Cost abCost = new Cost("T", cardName, true);
final Target permanent = new Target(card, "Select target artifact, creature, or land you control", "Artifact.YouCtrl,Creature.YouCtrl,Land.YouCtrl".split(",")); final Target permanent = new Target(card, "Select target artifact, creature, or land you control",
"Artifact.YouCtrl,Creature.YouCtrl,Land.YouCtrl".split(","));
final AbilityActivated ability = new AbilityActivated(card, abCost, permanent) { final AbilityActivated ability = new AbilityActivated(card, abCost, permanent) {
private static final long serialVersionUID = 3818522482440103914L; private static final long serialVersionUID = 3818522482440103914L;

View File

@@ -23,7 +23,6 @@ import java.util.Map;
import forge.AllZone; import forge.AllZone;
import forge.AllZoneUtil; import forge.AllZoneUtil;
import forge.Card; import forge.Card;
import forge.CardList; import forge.CardList;
import forge.Command; import forge.Command;
@@ -307,9 +306,9 @@ public class TriggerHandler {
final Player playerAP = AllZone.getPhaseHandler().getPlayerTurn(); final Player playerAP = AllZone.getPhaseHandler().getPlayerTurn();
if(playerAP == null) if (playerAP == null) {
{ // This should only happen outside of games, so it's safe to just
//This should only happen outside of games, so it's safe to just abort. // abort.
return; return;
} }
@@ -1009,7 +1008,8 @@ public class TriggerHandler {
regtrig.getHostCard().getName())); regtrig.getHostCard().getName()));
buildQuestion.append(")\r\n"); buildQuestion.append(")\r\n");
if (sa[0].getTriggeringObjects().containsKey("Attacker")) { if (sa[0].getTriggeringObjects().containsKey("Attacker")) {
buildQuestion.append("[Attacker: " + sa[0].getTriggeringObjects().get("Attacker") + "]"); buildQuestion
.append("[Attacker: " + sa[0].getTriggeringObjects().get("Attacker") + "]");
} }
if (!GameActionUtil.showYesNoDialog(regtrig.getHostCard(), buildQuestion.toString())) { if (!GameActionUtil.showYesNoDialog(regtrig.getHostCard(), buildQuestion.toString())) {
return; return;

View File

@@ -331,8 +331,7 @@ public class SealedDeck {
public boolean addCard(final Card c) { public boolean addCard(final Card c) {
final ArrayList<AbilityMana> maList = c.getManaAbility(); final ArrayList<AbilityMana> maList = c.getManaAbility();
for (int j = 0; j < maList.size(); j++) { for (int j = 0; j < maList.size(); j++) {
if (maList.get(j).canProduce(aiDC.mana1) if (maList.get(j).canProduce(aiDC.mana1) || maList.get(j).canProduce(aiDC.mana2)
|| maList.get(j).canProduce(aiDC.mana2)
|| maList.get(j).isAnyMana()) { || maList.get(j).isAnyMana()) {
return true; return true;
} }
@@ -433,7 +432,9 @@ public class SealedDeck {
final Deck aiDeck = new Deck(GameType.Sealed); final Deck aiDeck = new Deck(GameType.Sealed);
for (i = 0; i < deck.size(); i++) { for (i = 0; i < deck.size(); i++) {
if(deck.get(i).getName().equals("Plains") || deck.get(i).getName().equals("Island") || deck.get(i).getName().equals("Swamp") || deck.get(i).getName().equals("Mountain") || deck.get(i).getName().equals("Forest")) { if (deck.get(i).getName().equals("Plains") || deck.get(i).getName().equals("Island")
|| deck.get(i).getName().equals("Swamp") || deck.get(i).getName().equals("Mountain")
|| deck.get(i).getName().equals("Forest")) {
System.out.println("Heyo!"); System.out.println("Heyo!");
} }
aiDeck.addMain(deck.get(i).getName() + "|" + deck.get(i).getCurSetCode()); aiDeck.addMain(deck.get(i).getName() + "|" + deck.get(i).getCurSetCode());

View File

@@ -183,15 +183,15 @@ public class BuildInfo {
} finally { } finally {
try { try {
manifestStream.close(); manifestStream.close();
} catch (final Throwable ignored) { // NOPMD by Braids on 8/12/11 } catch (final Throwable ignored) {
// 10:21 AM // 10:21 AM
// ignored // ignored
} }
try { try {
jar.close(); jar.close();
} catch (final Throwable ignored) { // NOPMD by Braids on 8/12/11 } catch (final Throwable ignored) {
// 10:21 AM // 10:21 AM
// ignored // ignored
} }
} }

View File

@@ -83,22 +83,23 @@ public class FModel {
try { try {
this.setPreferences(new ForgePreferences("forge.preferences")); this.setPreferences(new ForgePreferences("forge.preferences"));
} catch (final Exception exn) { } catch (final Exception exn) {
// NOPMD by Braids on 8/13/11 8:21 PM
// Log.error("Error loading preferences: " + exn); // Log.error("Error loading preferences: " + exn);
throw new RuntimeException(exn); throw new RuntimeException(exn);
} }
// TODO these should be set along with others all at the same time, not here // TODO these should be set along with others all at the same time, not
// here
Constant.Runtime.MILL[0] = this.preferences.isMillingLossCondition(); Constant.Runtime.MILL[0] = this.preferences.isMillingLossCondition();
Constant.Runtime.DEV_MODE[0] = this.preferences.isDeveloperMode(); Constant.Runtime.DEV_MODE[0] = this.preferences.isDeveloperMode();
Constant.Runtime.UPLOAD_DRAFT[0] = this.preferences.isUploadDraftAI(); Constant.Runtime.UPLOAD_DRAFT[0] = this.preferences.isUploadDraftAI();
Constant.Runtime.RANDOM_FOIL[0] = this.preferences.isRandCFoil(); Constant.Runtime.RANDOM_FOIL[0] = this.preferences.isRandCFoil();
///////// // ///////
// Instantiate pinger // Instantiate pinger
// TODO is this in the right place? // TODO is this in the right place?
final HttpUtil pinger = new HttpUtil(); final HttpUtil pinger = new HttpUtil();
String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php"; final String url = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/draftAI/ping.php";
if (pinger.getURL(url).equals("pong")) { if (pinger.getURL(url).equals("pong")) {
Constant.Runtime.NET_CONN[0] = true; Constant.Runtime.NET_CONN[0] = true;
} else { } else {
@@ -129,7 +130,7 @@ public class FModel {
System.setErr(this.oldSystemErr); System.setErr(this.oldSystemErr);
try { try {
this.logFileStream.close(); this.logFileStream.close();
} catch (final IOException e) { // NOPMD by Braids on 8/12/11 10:25 AM } catch (final IOException e) {
// ignored // ignored
} }
} }

View File

@@ -21,7 +21,6 @@ import javax.swing.SwingUtilities;
import net.slightlymagic.braids.util.UtilFunctions; import net.slightlymagic.braids.util.UtilFunctions;
import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor; import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
import forge.AllZone; import forge.AllZone;
import forge.ComputerAIGeneral; import forge.ComputerAIGeneral;
import forge.ComputerAIInput; import forge.ComputerAIInput;
@@ -56,10 +55,10 @@ public class FView {
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() { UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() {
@Override @Override
public void run() { public void run() {
FView.this.splashFrame = new SplashFrame(skin); FView.this.splashFrame = new SplashFrame(FView.this.skin);
} }
}); });
// NOPMD by Braids on 8/18/11 11:37 PM
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -87,11 +86,14 @@ public class FView {
/** @return FSkin */ /** @return FSkin */
public FSkin getSkin() { public FSkin getSkin() {
return skin; return this.skin;
} }
/** @param skin0 &emsp; FSkin */ /**
public void setSkin(FSkin skin0) { * @param skin0
* &emsp; FSkin
*/
public void setSkin(final FSkin skin0) {
this.skin = skin0; this.skin = skin0;
} }
@@ -109,18 +111,18 @@ public class FView {
if (!this.splashFrame.getSplashHasBeenClosed()) { if (!this.splashFrame.getSplashHasBeenClosed()) {
try { try {
// NOPMD by Braids on 8/7/11 1:07
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
public void run() { public void run() {
AllZone.getInputControl().setComputer(new ComputerAIInput(new ComputerAIGeneral())); AllZone.getInputControl().setComputer(new ComputerAIInput(new ComputerAIGeneral()));
skin.loadFontAndImages(); FView.this.skin.loadFontAndImages();
CardFaceSymbols.loadImages(); CardFaceSymbols.loadImages();
Constant.Runtime.setGameType(GameType.Constructed); Constant.Runtime.setGameType(GameType.Constructed);
GuiTopLevel g = new GuiTopLevel(); final GuiTopLevel g = new GuiTopLevel();
AllZone.setDisplay(g); AllZone.setDisplay(g);
g.getController().changeState(FControl.HOME_SCREEN); g.getController().changeState(FControl.HOME_SCREEN);
g.pack(); g.pack();

View File

@@ -55,22 +55,22 @@ public final class UtilFunctions {
NullPointerException exn = null; NullPointerException exn = null;
if (paramName == null) { if (paramName == null) {
exn = new NullPointerException(); // NOPMD by Braids on 8/18/11 exn = new NullPointerException();
// 11:19 PM // 11:19 PM
} else { } else {
exn = new NullPointerException(paramName + " must not be null"); // NOPMD exn = new NullPointerException(paramName + " must not be null");
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 11:19 // 11:19
// PM // PM
} }
// Doctor the exception to appear to come from the caller. // Doctor the exception to appear to come from the caller.
final StackTraceElement[] trace = exn.getStackTrace(); final StackTraceElement[] trace = exn.getStackTrace();
final int len = getSliceLength(trace, 1); final int len = UtilFunctions.getSliceLength(trace, 1);
exn.setStackTrace(slice(new StackTraceElement[len], trace, 1)); exn.setStackTrace(UtilFunctions.slice(new StackTraceElement[len], trace, 1));
throw exn; throw exn;
} }
@@ -86,25 +86,25 @@ public final class UtilFunctions {
* the Runnable to run * the Runnable to run
* @see javax.swing.SwingUtilities#invokeLater(Runnable) * @see javax.swing.SwingUtilities#invokeLater(Runnable)
*/ */
public static void invokeInEventDispatchThreadAndWait(final Runnable proc) { // NOPMD public static void invokeInEventDispatchThreadAndWait(final Runnable proc) {
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 11:19 // 11:19
// PM // PM
if (SwingUtilities.isEventDispatchThread()) { if (SwingUtilities.isEventDispatchThread()) {
// Just run in the current thread. // Just run in the current thread.
proc.run(); proc.run();
} else { } else {
try { try {
SwingUtilities.invokeAndWait(proc); SwingUtilities.invokeAndWait(proc);
} catch (InterruptedException exn) { } catch (final InterruptedException exn) {
throw new RuntimeException(exn); // NOPMD by Braids on 8/18/11 throw new RuntimeException(exn);
// 11:19 PM // 11:19 PM
} catch (InvocationTargetException exn) { } catch (final InvocationTargetException exn) {
throw new RuntimeException(exn); // NOPMD by Braids on 8/18/11 throw new RuntimeException(exn);
// 11:19 PM // 11:19 PM
} }
} }
} }
@@ -168,16 +168,16 @@ public final class UtilFunctions {
} }
if (dstArray == null) { if (dstArray == null) {
throw new NullPointerException(); // NOPMD by Braids on 8/18/11 throw new NullPointerException();
// 11:19 PM // 11:19 PM
} }
if (srcArray == null) { if (srcArray == null) {
throw new NullPointerException(); // NOPMD by Braids on 8/18/11 throw new NullPointerException();
// 11:19 PM // 11:19 PM
} }
final int resultLength = getSliceLength(srcArray, startIndex); final int resultLength = UtilFunctions.getSliceLength(srcArray, startIndex);
if (dstArray.length != resultLength) { if (dstArray.length != resultLength) {
throw new ArrayIndexOutOfBoundsException("First parameter must have length " + resultLength throw new ArrayIndexOutOfBoundsException("First parameter must have length " + resultLength
@@ -186,7 +186,7 @@ public final class UtilFunctions {
int srcIx = startIndex; int srcIx = startIndex;
for (int dstIx = 0; dstIx < resultLength && srcIx < srcArray.length; dstIx++, srcIx++) { for (int dstIx = 0; (dstIx < resultLength) && (srcIx < srcArray.length); dstIx++, srcIx++) {
dstArray[dstIx] = srcArray[srcIx]; dstArray[dstIx] = srcArray[srcIx];
} }
@@ -258,13 +258,13 @@ public final class UtilFunctions {
*/ */
public static <T> T checkNullOrNotInstance(final T goodInstance, final Object obj) { public static <T> T checkNullOrNotInstance(final T goodInstance, final Object obj) {
if (goodInstance == null) { if (goodInstance == null) {
throw new NullPointerException("first parameter must not be null"); // NOPMD throw new NullPointerException("first parameter must not be null");
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 11:19 // 11:19
// PM // PM
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -330,13 +330,13 @@ public final class UtilFunctions {
*/ */
public static <T> void smartRemoveDuplicatesAndNulls(final List<T> list) { public static <T> void smartRemoveDuplicatesAndNulls(final List<T> list) {
// Get rid of pesky leading nulls. // Get rid of pesky leading nulls.
smartRemoveDuplicatesAndNullsHelper(list, 0, null); UtilFunctions.smartRemoveDuplicatesAndNullsHelper(list, 0, null);
for (int earlierIx = 0; earlierIx < list.size(); earlierIx++) { for (int earlierIx = 0; earlierIx < list.size(); earlierIx++) {
for (int laterIx = earlierIx + 1; laterIx < list.size(); laterIx++) { for (int laterIx = earlierIx + 1; laterIx < list.size(); laterIx++) {
final T itemAtEarlierIx = list.get(earlierIx); final T itemAtEarlierIx = list.get(earlierIx);
smartRemoveDuplicatesAndNullsHelper(list, laterIx, itemAtEarlierIx); UtilFunctions.smartRemoveDuplicatesAndNullsHelper(list, laterIx, itemAtEarlierIx);
} }
} }
@@ -360,9 +360,9 @@ public final class UtilFunctions {
*/ */
public static <T> void smartRemoveDuplicatesAndNullsHelper(final List<T> list, final int startIx, public static <T> void smartRemoveDuplicatesAndNullsHelper(final List<T> list, final int startIx,
final T objSeenPreviously) { final T objSeenPreviously) {
while (startIx < list.size() while ((startIx < list.size())
&& (list.get(startIx) == null || list.get(startIx) == objSeenPreviously || list.get(startIx).equals( && ((list.get(startIx) == null) || (list.get(startIx) == objSeenPreviously) || list.get(startIx)
objSeenPreviously))) { .equals(objSeenPreviously))) {
final int lastItemIx = list.size() - 1; final int lastItemIx = list.size() - 1;
// Overwrite the item at laterIx with the one at the end, // Overwrite the item at laterIx with the one at the end,

View File

@@ -136,7 +136,7 @@ public class CardReaderTest {
/** /**
* Test_ read card_run_nonzip. * Test_ read card_run_nonzip.
*/ */
@Test(groups = { "slow" }) @Test(groups = { "slow" }, enabled = false)
public final void test_ReadCard_run_nonzip() { public final void test_ReadCard_run_nonzip() {
final Map<String, Card> map = new HashMap<String, Card>(2 * CardReaderTest.ESTIMATED_CARDS_IN_FOLDER); final Map<String, Card> map = new HashMap<String, Card>(2 * CardReaderTest.ESTIMATED_CARDS_IN_FOLDER);
final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER); final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER);
@@ -149,7 +149,7 @@ public class CardReaderTest {
/** /**
* Test_ read card_run_zip. * Test_ read card_run_zip.
*/ */
@Test(groups = { "slow" }) @Test(groups = { "slow" }, enabled = false)
public final void test_ReadCard_run_zip() { public final void test_ReadCard_run_zip() {
final Map<String, Card> map = new HashMap<String, Card>(2 * CardReaderTest.ESTIMATED_CARDS_IN_FOLDER); final Map<String, Card> map = new HashMap<String, Card>(2 * CardReaderTest.ESTIMATED_CARDS_IN_FOLDER);
final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER); final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER);

View File

@@ -33,9 +33,9 @@ import forge.view.Main;
public class CardFactoryTest { public class CardFactoryTest {
/** The default time to allow a test to run before TestNG ignores it. */ /** The default time to allow a test to run before TestNG ignores it. */
public static final int DEFAULT_TEST_TIMEOUT_MS = 5000; // NOPMD by Braids public static final int DEFAULT_TEST_TIMEOUT_MS = 5000;
// on 8/18/11 11:43 // on 8/18/11 11:43
// PM // PM
private transient CardFactoryInterface factory; private transient CardFactoryInterface factory;
@@ -53,7 +53,7 @@ public class CardFactoryTest {
* the correct owner. * the correct owner.
*/ */
@Test(enabled = false, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS) @Test(enabled = false, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
public final void test_getCard_1() { // NOPMD by Braids on 8/18/11 11:39 PM public final void test_getCard_1() {
final Card card = this.factory.getCard("Arc-Slogger", null); final Card card = this.factory.getCard("Arc-Slogger", null);
Assert.assertNotNull(card, "card is not null"); Assert.assertNotNull(card, "card is not null");
Assert.assertNull(card.getOwner(), "card has correct owner"); Assert.assertNull(card.getOwner(), "card has correct owner");
@@ -63,27 +63,27 @@ public class CardFactoryTest {
* Make sure the method throws an exception when it's supposed to. * Make sure the method throws an exception when it's supposed to.
*/ */
@Test(enabled = false, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS) @Test(enabled = false, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
public final void test_getRandomCombinationWithoutRepetition_tooLarge() { // NOPMD public final void test_getRandomCombinationWithoutRepetition_tooLarge() {
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 11:39 // 11:39
// PM // PM
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class, new ClumsyRunnable() { BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class, new ClumsyRunnable() {
@Override @Override
public void run() throws Exception { // NOPMD by Braids on 8/18/11 public void run() throws Exception {
// 11:40 PM // 11:40 PM
CardFactoryTest.this.factory.getRandomCombinationWithoutRepetition(CardFactoryTest.this.factory.size()); CardFactoryTest.this.factory.getRandomCombinationWithoutRepetition(CardFactoryTest.this.factory.size());
} }
}); });
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class, new ClumsyRunnable() { BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class, new ClumsyRunnable() {
@Override @Override
public void run() throws Exception { // NOPMD by Braids on 8/18/11 public void run() throws Exception {
// 11:40 PM // 11:40 PM
final int largeDivisorForRandomCombo = 4; // NOPMD by Braids on final int largeDivisorForRandomCombo = 4;
// 8/18/11 11:41 PM // 8/18/11 11:41 PM
CardFactoryTest.this.factory.getRandomCombinationWithoutRepetition(CardFactoryTest.this.factory.size() CardFactoryTest.this.factory.getRandomCombinationWithoutRepetition(CardFactoryTest.this.factory.size()
/ largeDivisorForRandomCombo); / largeDivisorForRandomCombo);
} }
@@ -97,15 +97,15 @@ public class CardFactoryTest {
* default. * default.
*/ */
@Test(enabled = false, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS) @Test(enabled = false, timeOut = CardFactoryTest.DEFAULT_TEST_TIMEOUT_MS)
public final void test_getRandomCombinationWithoutRepetition_oneTenth() { // NOPMD public final void test_getRandomCombinationWithoutRepetition_oneTenth() {
// by // by
// Braids // Braids
// on // on
// 8/18/11 // 8/18/11
// 11:39 // 11:39
// PM // PM
this.factory = new PreloadingCardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER)); this.factory = new PreloadingCardFactory(ForgeProps.getFile(NewConstants.CARDSFOLDER));
final int divisor = 10; // NOPMD by Braids on 8/18/11 11:41 PM final int divisor = 10;
final CardList actual = this.factory.getRandomCombinationWithoutRepetition(this.factory.size() / divisor); final CardList actual = this.factory.getRandomCombinationWithoutRepetition(this.factory.size() / divisor);
final Set<String> cardNames = new TreeSet<String>(); final Set<String> cardNames = new TreeSet<String>();

View File

@@ -20,21 +20,22 @@ public class BuildInfoTest {
/** System property name for the class path. */ /** System property name for the class path. */
private static final String JAVA_CLASS_PATH = "java.class.path"; private static final String JAVA_CLASS_PATH = "java.class.path";
/** Manifest attribute name for the Build ID. */ /** Manifest attribute name for the Build ID. */
private static final String MF_ATTR_NAME_BUILD = "Implementation-Build"; // NOPMD private static final String MF_ATTR_NAME_BUILD = "Implementation-Build";
// by // by
// Braids // Braids
// on // on
// 8/12/11 // 8/12/11
// 10:29 // 10:29
// AM // AM
/** Manifest attribute name for the version string. */ /** Manifest attribute name for the version string. */
private static final String MF_ATTR_NAME_VERSION = "Implementation-Version"; // NOPMD private static final String MF_ATTR_NAME_VERSION = "Implementation-Version";
// by
// Braids // by
// on // Braids
// 8/12/11 // on
// 10:29 // 8/12/11
// AM // 10:29
// AM
/** /**
* Test BuildInfo using a mock jar file. * Test BuildInfo using a mock jar file.
@@ -43,10 +44,10 @@ public class BuildInfoTest {
* rarely * rarely
*/ */
@Test(enabled = false) @Test(enabled = false)
public final void test_BuildInfo_mockJar() throws IOException { // NOPMD by public final void test_BuildInfo_mockJar() throws IOException {
// Braids on // Braids on
// 8/12/11 // 8/12/11
// 10:26 AM // 10:26 AM
File jarAsFile = null; File jarAsFile = null;
try { try {
jarAsFile = this.makeTmpJarWithManifest("BuildInfoTest-", ".jar", new String[] { jarAsFile = this.makeTmpJarWithManifest("BuildInfoTest-", ".jar", new String[] {
@@ -72,13 +73,13 @@ public class BuildInfoTest {
* indirectly * indirectly
*/ */
@Test(enabled = false) @Test(enabled = false)
public final void test_BuildInfo_oneJarInCP() throws IOException { // NOPMD public final void test_BuildInfo_oneJarInCP() throws IOException {
// by // by
// Braids // Braids
// on // on
// 8/12/11 // 8/12/11
// 10:26 // 10:26
// AM // AM
final String origClassPath = System.getProperty(BuildInfoTest.JAVA_CLASS_PATH); final String origClassPath = System.getProperty(BuildInfoTest.JAVA_CLASS_PATH);
File jarAsFile = null; File jarAsFile = null;
@@ -111,13 +112,13 @@ public class BuildInfoTest {
* indirectly * indirectly
*/ */
@Test(enabled = false) @Test(enabled = false)
public final void test_BuildInfo_twoJarsInCP() throws IOException { // NOPMD public final void test_BuildInfo_twoJarsInCP() throws IOException {
// by // by
// Braids // Braids
// on // on
// 8/12/11 // 8/12/11
// 10:26 // 10:26
// AM // AM
final String origClassPath = System.getProperty(BuildInfoTest.JAVA_CLASS_PATH); final String origClassPath = System.getProperty(BuildInfoTest.JAVA_CLASS_PATH);
File jarAsFile1 = null; File jarAsFile1 = null;
File jarAsFile2 = null; File jarAsFile2 = null;
@@ -138,8 +139,8 @@ public class BuildInfoTest {
BraidsAssertFunctions.assertThrowsException(MultipleForgeJarsFoundError.class, new ClumsyRunnable() { BraidsAssertFunctions.assertThrowsException(MultipleForgeJarsFoundError.class, new ClumsyRunnable() {
@Override @Override
public void run() throws Exception { // NOPMD by Braids on public void run() throws Exception {
// 8/12/11 10:29 AM // 8/12/11 10:29 AM
info.getBuildID(); info.getBuildID();
} }
}); });

View File

@@ -51,17 +51,17 @@ public class FModelTest {
* if something is really wrong * if something is really wrong
*/ */
@Test @Test
public final void test_ctor_close_ctor() throws FileNotFoundException { // NOPMD public final void test_ctor_close_ctor() throws FileNotFoundException {
// by // by
// Braids // Braids
// on // on
// 8/12/11 // 8/12/11
// 10:36 // 10:36
// AM // AM
Assert.assertNotNull(this.model, "model is not null"); Assert.assertNotNull(this.model, "model is not null");
this.model.close(); this.model.close();
System.err.println("log test"); // NOPMD by Braids on 8/12/11 10:36 AM System.err.println("log test");
this.model = new FModel(null); this.model = new FModel(null);
Assert.assertNotNull(this.model, "model is not null"); Assert.assertNotNull(this.model, "model is not null");
@@ -87,13 +87,13 @@ public class FModelTest {
* if something is really wrong * if something is really wrong
*/ */
@Test @Test
public final void test_getBuildID() throws FileNotFoundException { // NOPMD public final void test_getBuildID() throws FileNotFoundException {
// by // by
// Braids // Braids
// on // on
// 8/12/11 // 8/12/11
// 10:36 // 10:36
// AM // AM
// Just test for an unexpected exception. // Just test for an unexpected exception.
this.model.getBuildInfo().getBuildID(); this.model.getBuildInfo().getBuildID();
} }