- CheckStyle.

This commit is contained in:
Chris
2012-02-18 21:41:16 +00:00
parent efe6adc243
commit aeb44f00f0
3 changed files with 22 additions and 17 deletions

View File

@@ -12,14 +12,14 @@ import forge.util.IHasName;
public abstract class DeckBase implements IHasName, Serializable, Comparable<DeckBase> { public abstract class DeckBase implements IHasName, Serializable, Comparable<DeckBase> {
private static final long serialVersionUID = -7538150536939660052L; private static final long serialVersionUID = -7538150536939660052L;
// gameType is from Constant.GameType, like GameType.Regular // gameType is from Constant.GameType, like GameType.Regular
private final String name; private final String name;
private String comment = null; private String comment = null;
public DeckBase(String name0) { public DeckBase(String name0) {
name = name0; name = name0;
} }
@Override @Override
public int compareTo(final DeckBase d) { public int compareTo(final DeckBase d) {
return this.getName().compareTo(d.getName()); return this.getName().compareTo(d.getName());
@@ -33,15 +33,15 @@ public abstract class DeckBase implements IHasName, Serializable, Comparable<Dec
return this.getName().equals(d.getName()); return this.getName().equals(d.getName());
} }
return false; return false;
} }
@Override @Override
public String getName() { public String getName() {
return this.name; return this.name;
} }
public abstract ItemPoolView<CardPrinted> getCardPool(); public abstract ItemPoolView<CardPrinted> getCardPool();
public void setComment(final String comment) { public void setComment(final String comment) {
this.comment = comment; this.comment = comment;
} }
@@ -56,9 +56,9 @@ public abstract class DeckBase implements IHasName, Serializable, Comparable<Dec
public String getComment() { public String getComment() {
return this.comment; return this.comment;
} }
protected abstract DeckBase newInstance(String name0); protected abstract DeckBase newInstance(String name0);
protected void cloneFieldsTo(DeckBase clone) { protected void cloneFieldsTo(DeckBase clone) {
clone.comment = this.comment; clone.comment = this.comment;
} }

View File

@@ -26,7 +26,7 @@ import forge.item.CardPrinted;
import forge.item.ItemPool; import forge.item.ItemPool;
/** /**
* Deck section * Deck section.
* *
*/ */
public class DeckSection extends ItemPool<CardPrinted> { public class DeckSection extends ItemPool<CardPrinted> {
@@ -37,7 +37,7 @@ public class DeckSection extends ItemPool<CardPrinted> {
public DeckSection() { public DeckSection() {
super(CardPrinted.class); super(CardPrinted.class);
} }
public DeckSection(Iterable<Entry<CardPrinted, Integer>> cards) { public DeckSection(Iterable<Entry<CardPrinted, Integer>> cards) {
this(); this();
addAll(cards); addAll(cards);
@@ -80,8 +80,8 @@ public class DeckSection extends ItemPool<CardPrinted> {
*/ */
public void add(final String cardName, final String setCode, int amount) { public void add(final String cardName, final String setCode, int amount) {
this.add(CardDb.instance().getCard(cardName, setCode), amount); this.add(CardDb.instance().getCard(cardName, setCode), amount);
} }
/** /**
* Adds the. * Adds the.
* *

View File

@@ -21,7 +21,7 @@ public class DeckSet extends DeckBase implements IHasName {
private static final long serialVersionUID = -1628725522049635829L; private static final long serialVersionUID = -1628725522049635829L;
private Deck humanDeck; private Deck humanDeck;
private List<Deck> aiDecks = new ArrayList<Deck>(); private List<Deck> aiDecks = new ArrayList<Deck>();
public final Deck getHumanDeck() { public final Deck getHumanDeck() {
return humanDeck; return humanDeck;
} }
@@ -29,8 +29,12 @@ public class DeckSet extends DeckBase implements IHasName {
return aiDecks; return aiDecks;
} }
public final void setHumanDeck(Deck humanDeck) { this.humanDeck = humanDeck; } public final void setHumanDeck(Deck humanDeck) { this.humanDeck = humanDeck; }
public final void addAiDeck(Deck aiDeck) { if ( aiDeck != null ) this.aiDecks.add(aiDeck); } public final void addAiDeck(Deck aiDeck) {
if (aiDeck != null) {
this.aiDecks.add(aiDeck);
}
}
@Override @Override
public ItemPoolView<CardPrinted> getCardPool() { public ItemPoolView<CardPrinted> getCardPool() {
@@ -38,8 +42,9 @@ public class DeckSet extends DeckBase implements IHasName {
} }
public void addAiDecks(Deck[] computer) { public void addAiDecks(Deck[] computer) {
for(int i = 0; i < computer.length; i++) for (int i = 0; i < computer.length; i++) {
aiDecks.add(computer[i]); aiDecks.add(computer[i]);
}
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.deck.DeckBase#newInstance(java.lang.String) * @see forge.deck.DeckBase#newInstance(java.lang.String)
@@ -48,5 +53,5 @@ public class DeckSet extends DeckBase implements IHasName {
protected DeckBase newInstance(String name0) { protected DeckBase newInstance(String name0) {
return new DeckSet(name0); return new DeckSet(name0);
} }
} }