- CheckStyle.

This commit is contained in:
Chris
2012-12-01 21:13:09 +00:00
parent 4b415ea611
commit a9a199518d
6 changed files with 53 additions and 51 deletions

View File

@@ -189,7 +189,7 @@ public enum VDev implements IVDoc<CDev> {
public DevLabel getLblCardToHand() {
return this.lblCardToHand;
}
/** @return {@link forge.gui.match.views.VDev.DevLabel} */
public final DevLabel getLblCardToBattlefield() {
return lblCardToBattlefield;

View File

@@ -45,26 +45,26 @@ public class FDeckChooser extends JPanel {
CUSTOM, /** */
QUESTEVENTS
}
private final QuestController quest = Singletons.getModel().getQuest();
private final JRadioButton radColors = new FRadioButton("Fully random color deck");
private final JRadioButton radThemes = new FRadioButton("Semi-random theme deck");
private final JRadioButton radCustom = new FRadioButton("Custom user deck");
private final JRadioButton radQuests = new FRadioButton("Quest opponent deck");
private final JList lstDecks = new FList();
private final ExperimentalLabel btnRandom = new ExperimentalLabel("Random");
private final JScrollPane scrDecks = new FScrollPane(lstDecks, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
private final FLabel lblDecklist = new FLabel.Builder()
.text("Double click a non-random deck for its decklist.")
.fontSize(12).build();
private final JPanel pnlRadios = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
private final PlayerType playerType;
private final MouseAdapter madDecklist = new MouseAdapter() {
@Override
@@ -76,24 +76,24 @@ public class FDeckChooser extends JPanel {
DeckgenUtil.showDecklist(src);
}
}
};
public FDeckChooser(String titleText, PlayerType pt)
{
};
public FDeckChooser(String titleText, PlayerType pt) {
playerType = pt;
// Radio button panels: Human and AI
final String strRadioConstraints = "w 100%!, h 30px!";
this.setOpaque(false);
// Radio button group: Human
final ButtonGroup grpRadios = new ButtonGroup();
grpRadios.add(radCustom);
grpRadios.add(radQuests);
grpRadios.add(radColors);
grpRadios.add(radThemes);
pnlRadios.setOpaque(false);
pnlRadios.add(new FLabel.Builder().text(titleText)
.fontStyle(Font.BOLD).fontSize(16)
@@ -103,10 +103,10 @@ public class FDeckChooser extends JPanel {
pnlRadios.add(radQuests, strRadioConstraints);
pnlRadios.add(radColors, strRadioConstraints);
pnlRadios.add(radThemes, strRadioConstraints);
pnlRadios.add(btnRandom, "w 200px!, h 30px!, gap 0 0 10px 0, ax center");
pnlRadios.add(btnRandom, "w 200px!, h 30px!, gap 0 0 10px 0, ax center");
}
public void initialize() {
// Radio button event handling
getRadColors().addActionListener(new ActionListener() { @Override
@@ -124,13 +124,13 @@ public class FDeckChooser extends JPanel {
getRadQuests().addActionListener(new ActionListener() { @Override
public void actionPerformed(final ActionEvent arg0) {
updateQuestEvents(); } });
// First run: colors
getRadColors().setSelected(true);
updateColors();
}
/** @return {@link javax.swing.JList} */
public JList getLstDecks() {
return this.lstDecks;
@@ -173,7 +173,7 @@ public class FDeckChooser extends JPanel {
final ExperimentalLabel btn = getBtnRandom();
btn.setCommand(new Command() { @Override public void execute() { lst.setSelectedIndices( DeckgenUtil.randomSelectColors()); } });
btn.setCommand(new Command() { @Override public void execute() { lst.setSelectedIndices(DeckgenUtil.randomSelectColors()); } });
// Init basic two color deck
lst.setSelectedIndices(new int[]{0, 1});
@@ -249,8 +249,8 @@ public class FDeckChooser extends JPanel {
// Init first in list
lst.setSelectedIndex(0);
}
}
/** Generates deck from current list selection(s). */
public Deck getDeck() {
JList lst0 = getLstDecks();
@@ -293,12 +293,12 @@ public class FDeckChooser extends JPanel {
* TODO: Write javadoc for this method.
*/
public void populate() {
this.setLayout(new MigLayout("insets 0, gap 0, flowy, ax right"));
this.add(pnlRadios, "w 100%!, gap 0 0 20px 20px");
this.add(scrDecks, "w 100%!, growy, pushy");
}
}
}

View File

@@ -94,7 +94,7 @@ public final class CardDb {
private final Map<String, Map<String, CardPrinted[]>> allCardsBySet = new Hashtable<String, Map<String, CardPrinted[]>>();
// this is the same list in flat storage
private final List<CardPrinted> allTraditionalCardsFlat = new ArrayList<CardPrinted>();
private final List<CardPrinted> allNonTraditionalCardsFlat = new ArrayList<CardPrinted>();
// Lambda to get rules for selects from list of printed cards
@@ -169,7 +169,7 @@ public final class CardDb {
setMap.put(cardName, cardCopies);
for (int i = 0; i < count; i++) {
lastAdded = CardPrinted.build(card, set, s.getValue().getRarity(), i);
if(lastAdded.isTraditional()) {
if (lastAdded.isTraditional()) {
this.allTraditionalCardsFlat.add(lastAdded);
} else {
this.allNonTraditionalCardsFlat.add(lastAdded);
@@ -220,8 +220,10 @@ public final class CardDb {
* @return true, if is card supported
*/
public boolean isCardSupported(final String cardName0) {
if ( null == cardName0 ) return false; // obviously
if (null == cardName0) {
return false; // obviously
}
final boolean isFoil = this.isFoil(cardName0);
final String cardName = isFoil ? this.removeFoilSuffix(cardName0) : cardName0;
final ImmutablePair<String, String> nameWithSet = CardDb.splitCardName(cardName);
@@ -230,8 +232,8 @@ public final class CardDb {
}
return isCardSupported(nameWithSet.left, nameWithSet.right);
}
public boolean isCardSupported(final String cardName, String setName) {
public boolean isCardSupported(final String cardName, String setName) {
// Set exists?
final Map<String, CardPrinted[]> cardsFromset = this.allCardsBySet.get(setName.toUpperCase());
if (cardsFromset == null) {
@@ -371,7 +373,7 @@ public final class CardDb {
public Iterable<CardPrinted> getAllTraditionalCards() {
return this.allTraditionalCardsFlat;
}
public Iterable<CardPrinted> getAllNonTraditionalCards() {
return this.allNonTraditionalCardsFlat;
}
@@ -409,7 +411,7 @@ public final class CardDb {
if (null == result) {
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
}
}
}
if (isFoil) {

View File

@@ -110,7 +110,7 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
public boolean isFoil() {
return this.foiled;
}
public boolean isTraditional() {
return !getCard().getType().isVanguard();
}
@@ -182,8 +182,8 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
public Integer apply(final CardPrinted from) {
return Integer.valueOf(Singletons.getModel().getEditions().get(from.getEdition()).getIndex());
}
};
};
// Constructor is private. All non-foiled instances are stored in CardDb
private CardPrinted(final CardRules c, final String edition0, final CardRarity rare, final int index, final boolean foil) {
this.card = c;
@@ -322,7 +322,7 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
* Number of filters based on CardPrinted values.
*/
public abstract static class Predicates {
/**
* Type.
* @param t
@@ -440,20 +440,20 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
this.mustContain = shouldContain;
}
}
private static class PredicateType implements Predicate<CardPrinted> {
private final String operand;
@Override
public boolean apply(final CardPrinted card) {
return card.getType().contains(operand);
}
public PredicateType(final String op) {
operand = op;
}
}
private static class PredicateName extends PredicateString<CardPrinted> {
@@ -518,9 +518,9 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
/** The Constant exceptLands. */
public static final Predicate<CardPrinted> EXCEPT_LANDS = Predicates.rarity(false, CardRarity.BasicLand);
public static final Predicate<CardPrinted> NONTRADITIONAL = com.google.common.base.Predicates.or(Predicates.type("Vanguard"),Predicates.type("Scheme"),Predicates.type("Plane"));
public static final Predicate<CardPrinted> NONTRADITIONAL = com.google.common.base.Predicates.or(Predicates.type("Vanguard"), Predicates.type("Scheme"), Predicates.type("Plane"));
public static final Predicate<CardPrinted> TRADITIONAL = com.google.common.base.Predicates.not(Presets.NONTRADITIONAL);
}
}

View File

@@ -49,7 +49,7 @@ public abstract class ItemPredicate {
@Override
public boolean apply(final InventoryItem card) {
return card instanceof TournamentPack && !((TournamentPack)card).isStarterDeck();
return card instanceof TournamentPack && !((TournamentPack) card).isStarterDeck();
}
};
@@ -62,7 +62,7 @@ public abstract class ItemPredicate {
@Override
public boolean apply(final InventoryItem card) {
return card instanceof TournamentPack && ((TournamentPack)card).isStarterDeck();
return card instanceof TournamentPack && ((TournamentPack) card).isStarterDeck();
}
};

View File

@@ -61,7 +61,7 @@ public class TournamentPack extends OpenablePack {
public final boolean isStarterDeck() {
return contents.getCommon() < 30;
}
@Override
public final String getType() {