- CheckStyle.

This commit is contained in:
Chris
2012-06-05 21:50:59 +00:00
parent e32ba2ee11
commit afa99e7bde
12 changed files with 61 additions and 57 deletions

View File

@@ -70,7 +70,7 @@ public class ManaCostShard {
/** A bitmask to represent any mana symbol as an integer. */
public abstract static class Atom {
public static final int COLORLESS = 1 << 0;
/** The Constant WHITE. */
public static final int WHITE = 1 << 1;
@@ -109,9 +109,9 @@ public class ManaCostShard {
* I choose the latter, because memory for boxed objects will be taken from
* heap, while unboxed values will lay on stack, which is faster
*/
public static final ManaCostShard COLORLESS = new ManaCostShard(Atom.COLORLESS, "1");
/** The Constant X. */
public static final ManaCostShard X = new ManaCostShard(Atom.IS_X, "X");
@@ -340,11 +340,11 @@ public class ManaCostShard {
public boolean isSnow() {
return (this.shard & Atom.IS_SNOW) != 0;
}
public boolean isMonoColor() {
int colormask = this.shard & (Atom.WHITE | Atom.BLUE | Atom.BLACK | Atom.RED | Atom.GREEN);
return BinaryUtil.bitCount(colormask) == 1;
}
/**

View File

@@ -250,8 +250,8 @@ public abstract class SpellAbility {
public void setManaCost(final String cost) {
this.manaCost = cost;
}
}
/**
* <p>
* Getter for the field <code>additionalManaCost</code>.

View File

@@ -66,7 +66,7 @@ public class StaticAbilityCostChange {
//modify the cost here
return originalCost;
}
/**
* Applies applyReduceCostAbility ability.
*

View File

@@ -522,17 +522,22 @@ public class BoosterDraftAI {
// count each mana symbol in the mana cost
for (ManaCostShard shard : mc.getShards()) {
byte mask = shard.getColorMask();
if ((mask & CardColor.WHITE) > 0 )
if ((mask & CardColor.WHITE) > 0) {
clrCnts[0].setCount(clrCnts[0].getCount() + 1);
if ((mask & CardColor.BLUE) > 0 )
}
if ((mask & CardColor.BLUE) > 0) {
clrCnts[1].setCount(clrCnts[1].getCount() + 1);
if ((mask & CardColor.BLACK) > 0 )
}
if ((mask & CardColor.BLACK) > 0) {
clrCnts[2].setCount(clrCnts[2].getCount() + 1);
if ((mask & CardColor.RED) > 0 )
}
if ((mask & CardColor.RED) > 0) {
clrCnts[3].setCount(clrCnts[3].getCount() + 1);
if ((mask & CardColor.GREEN) > 0 )
}
if ((mask & CardColor.GREEN) > 0) {
clrCnts[4].setCount(clrCnts[4].getCount() + 1);
}
}
}

View File

@@ -360,17 +360,22 @@ public class SealedDeck {
// count each mana symbol in the mana cost
for (ManaCostShard shard : mc.getShards()) {
byte mask = shard.getColorMask();
if ((mask & CardColor.WHITE) > 0 )
if ((mask & CardColor.WHITE) > 0) {
clrCnts[0].setCount(clrCnts[0].getCount() + 1);
if ((mask & CardColor.BLUE) > 0 )
}
if ((mask & CardColor.BLUE) > 0) {
clrCnts[1].setCount(clrCnts[1].getCount() + 1);
if ((mask & CardColor.BLACK) > 0 )
}
if ((mask & CardColor.BLACK) > 0) {
clrCnts[2].setCount(clrCnts[2].getCount() + 1);
if ((mask & CardColor.RED) > 0 )
}
if ((mask & CardColor.RED) > 0) {
clrCnts[3].setCount(clrCnts[3].getCount() + 1);
if ((mask & CardColor.GREEN) > 0 )
}
if ((mask & CardColor.GREEN) > 0) {
clrCnts[4].setCount(clrCnts[4].getCount() + 1);
}
}
}

View File

@@ -180,7 +180,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
public final boolean contains(final Card c) {
return this.getCardList().contains(c);
}
/*
* (non-Javadoc)
*
@@ -194,7 +194,6 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
}
return index;
}
/**
* Removes the.

View File

@@ -156,7 +156,7 @@ interface IPlayerZone {
* @return position
*/
Integer getPosition(Card c);
/**
* isEmpty returns true if given zone contains no cards.
*

View File

@@ -1376,7 +1376,7 @@ public class MagicStack extends MyObservable {
public final void clearSimultaneousStack() {
this.simultaneousStackEntryList.clear();
}
/**
* <p>
* addSimultaneousStackEntry.

View File

@@ -148,7 +148,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
private Integer getCardValue(final InventoryItem card) {
if (card instanceof CardPrinted) {
String ns = card.getName() + "|" + ((CardPrinted) card).getEdition();
if (this.mapPrices.containsKey(ns)) {
return this.mapPrices.get(ns);
} else if (card instanceof CardPrinted) {

View File

@@ -137,8 +137,7 @@ public class CardFaceSymbols {
if (manaCost.isEmpty()) {
return;
}
final int genericManaCost = manaCost.getGenericCost();
final boolean hasGeneric = (genericManaCost > 0) || manaCost.isPureGeneric();
final List<ManaCostShard> shards = manaCost.getShards();
@@ -234,7 +233,7 @@ public class CardFaceSymbols {
*/
public static int getWidth(final CardManaCost manaCost) {
int width = manaCost.getShards().size();
if ( manaCost.getGenericCost() > 0 || ( manaCost.getGenericCost() == 0 && width == 0 ) );
if (manaCost.getGenericCost() > 0 || (manaCost.getGenericCost() == 0 && width == 0));
width++;
/*

View File

@@ -32,20 +32,19 @@ import javax.swing.filechooser.FileNameExtensionFilter;
*/
@SuppressWarnings("serial")
public class SaveOpenDialog extends JPanel {
private JFileChooser fc;
/**
* Enum to contain information for filetype filtering in the open/save dialog.
* Add more entries to enum as needed.
*
*
*
*
*/
public enum Filetypes {
LAYOUT ("Layout File", "xml"),
DECK ("Deck File", "dck");
private final String TypeName;
private final String TypeExtension;
Filetypes(String Name, String Extension) {
@@ -53,16 +52,15 @@ public class SaveOpenDialog extends JPanel {
this.TypeExtension = Extension;
}
}
/**
*
* constructor for a save or open dialog
* constructor for a save or open dialog.
*/
public SaveOpenDialog() {
fc = new JFileChooser();
}
/**
* Shows the open dialog for files. If no file selected, returns null. Pass null
* to Type to allow all files to be viewed/opened.
@@ -73,14 +71,13 @@ public class SaveOpenDialog extends JPanel {
*/
public File OpenDialog(final File defFileName, final Filetypes type) {
fc.setCurrentDirectory(defFileName);
if (type!=null) {
if (type != null) {
fc.setAcceptAllFileFilterUsed(false);
final FileFilter filter = new FileNameExtensionFilter(type.TypeName, type.TypeExtension);
fc.addChoosableFileFilter(filter);
}
int RetValue = fc.showOpenDialog(getParent());
if (RetValue == JFileChooser.APPROVE_OPTION) {
final File RetFile = fc.getSelectedFile();
@@ -88,7 +85,7 @@ public class SaveOpenDialog extends JPanel {
}
return null;
}
/**
* Shows the save dialog.
*
@@ -100,31 +97,30 @@ public class SaveOpenDialog extends JPanel {
public File SaveDialog(final File defFileName, final Filetypes type) {
File RetFile = defFileName;
fc.setCurrentDirectory(defFileName);
/* set the file filter if desired */
if (type!=null) {
if (type != null) {
fc.setAcceptAllFileFilterUsed(false);
final FileFilter filter = new FileNameExtensionFilter(type.TypeName, type.TypeExtension);
fc.addChoosableFileFilter(filter);
}
int RetValue = fc.showSaveDialog(getParent());
/* user picked save */
if (RetValue == JFileChooser.APPROVE_OPTION) {
RetFile = fc.getSelectedFile();
/* Adds extension if it is known and not given */
if (type!=null & !(RetFile.getAbsolutePath().endsWith(type.TypeExtension))) {
RetFile = new File(RetFile.getAbsolutePath()+"."+type.TypeExtension);
if (type != null & !(RetFile.getAbsolutePath().endsWith(type.TypeExtension))) {
RetFile = new File(RetFile.getAbsolutePath() + "." + type.TypeExtension);
}
return RetFile;
}
/* user picked cancel */
return null;
}
}
}

View File

@@ -41,8 +41,8 @@ public class MyObservable extends Observable {
this.notifyObservers();
if (Singletons.getModel() == null) { return; }
PhaseHandler phases = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler phases = Singletons.getModel().getGameState().getPhaseHandler();
if ((phases != null) && phases.isNeedToNextPhase()) {
if (phases.isNeedToNextPhaseInit()) {
// this is used.