checkstyle

This commit is contained in:
jendave
2011-12-12 21:04:07 +00:00
parent 79a3a3ca32
commit ad50e13428
11 changed files with 112 additions and 106 deletions

1
.gitattributes vendored
View File

@@ -10753,6 +10753,7 @@ src/main/java/forge/control/ControlMatchUI.java -text
src/main/java/forge/control/ControlWinLose.java -text
src/main/java/forge/control/home/ControlConstructed.java -text
src/main/java/forge/control/home/ControlQuest.java -text
src/main/java/forge/control/home/package-info.java -text svneol=native#text/plain
src/main/java/forge/control/match/ControlDetail.java -text
src/main/java/forge/control/match/ControlDock.java -text
src/main/java/forge/control/match/ControlField.java -text

View File

@@ -1446,7 +1446,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} else {
this.counters.put(counterName, Integer.valueOf(n));
}
// Run triggers
final Map<String, Object> runParams = new TreeMap<String, Object>();
runParams.put("Card", this);

View File

@@ -562,7 +562,7 @@ public class CardListUtil {
return cmc;
} // sumCMC
// Get the average converted mana cost of a card list
/**
* <p>
@@ -577,7 +577,7 @@ public class CardListUtil {
return sumCMC(c) / c.size();
}
}
/**
*

View File

@@ -1334,8 +1334,8 @@ public final class GameActionUtil {
}
}
// is a card of a certain type/color present?
if (specialConditions.contains("isPresent")) {
if (specialConditions.contains("isPresent")) {
final String requirements = specialConditions.replaceAll("isPresent ", "");
CardList cardsinPlay = AllZoneUtil.getCardsIn(Zone.Battlefield);
final String[] conditions = requirements.split(",");

View File

@@ -260,12 +260,12 @@ public class AbilityFactoryMana {
final HashMap<String, String> params = af.getMapParams();
final Card card = af.getHostCard();
if (!AbilityFactory.checkConditional(sa)) {
AbilityFactoryMana.doDrawback(af, abMana, card);
return;
}
// Spells are not undoable
abMana.setUndoable(af.isAbility() && abMana.isUndoable());

View File

@@ -2692,13 +2692,13 @@ public class CardFactoryUtil {
m, source);
}
}
if (sq[0].contains("LandsPlayed")) {
if (players.size() > 0) {
return CardFactoryUtil.doXMath(players.get(0).getNumLandsPlayed(), m, source);
}
}
if (sq[0].contains("CardsDrawn")) {
if (players.size() > 0) {
return CardFactoryUtil.doXMath(players.get(0).getNumDrawnThisTurn(), m, source);
@@ -2960,7 +2960,7 @@ public class CardFactoryUtil {
if (sq[0].contains("YourDamageThisTurn")) {
return CardFactoryUtil.doXMath(c.getController().getAssignedDamage(), m, c);
}
if (sq[0].contains("YourLandsPlayed")) {
return CardFactoryUtil.doXMath(c.getController().getNumLandsPlayed(), m, c);
}

View File

@@ -0,0 +1,3 @@
/** Controller (as in model-view-controller) for Forge. */
package forge.control.home;

View File

@@ -608,10 +608,10 @@ public class MultiLineLabelUI extends BasicLabelUI implements ComponentListener
* Sets the label ui.
*
* @param labelUI
* the labelUI to set
* the new label ui
*/
public static void setLabelUI(final LabelUI labelUI0) {
MultiLineLabelUI.labelUI = labelUI0;
public static void setLabelUI(final LabelUI labelUI) {
MultiLineLabelUI.labelUI = labelUI;
}
/**

View File

@@ -56,8 +56,7 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
* @see #MultiPhaseProgressMonitorWithETA(String,int,long,float,float[])
*/
public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases,
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec)
{
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec) {
this(neoTitle, numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, null);
}
@@ -88,8 +87,7 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
* @see BaseProgressMonitor#BaseProgressMonitor(int,long,float,float[])
*/
public MultiPhaseProgressMonitorWithETA(final String neoTitle, final int numPhases,
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec,
final float[] phaseWeights) {
final long totalUnitsFirstPhase, final float minUIUpdateIntervalSec, final float[] phaseWeights) {
super(numPhases, totalUnitsFirstPhase, minUIUpdateIntervalSec, phaseWeights);
if (!SwingUtilities.isEventDispatchThread()) {
@@ -114,65 +112,67 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
System.out.println("Initializing...");
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final int totalUnitsFirstPhase = 5000;
final MultiPhaseProgressMonitorWithETA monitor = new MultiPhaseProgressMonitorWithETA(
"Testing 2 phases", 2, totalUnitsFirstPhase, 1.0f, new float[] { 2, 1 });
final SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
@Override
public void run() {
public Object doInBackground() {
final int totalUnitsFirstPhase = 5000;
final MultiPhaseProgressMonitorWithETA monitor = new MultiPhaseProgressMonitorWithETA(
"Testing 2 phases", 2, totalUnitsFirstPhase, 1.0f, new float[] { 2, 1 });
System.out.println("Running...");
final SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {
@Override
public Object doInBackground() {
for (int i = 0; i <= totalUnitsFirstPhase; i++) {
monitor.incrementUnitsCompletedThisPhase(1);
System.out.println("Running...");
System.out.print("\ri = " + i);
for (int i = 0; i <= totalUnitsFirstPhase; i++) {
monitor.incrementUnitsCompletedThisPhase(1);
System.out.print("\ri = " + i);
try {
Thread.sleep(1);
} catch (final InterruptedException ignored) {
// blank
}
}
System.out.println();
final int totalUnitsSecondPhase = 2000;
monitor.markCurrentPhaseAsComplete(totalUnitsSecondPhase);
for (int i = 0; i <= totalUnitsSecondPhase; i++) {
monitor.incrementUnitsCompletedThisPhase(1);
System.out.print("\ri = " + i);
try {
Thread.sleep(1);
} catch (final InterruptedException ignored) {
// blank
}
}
monitor.markCurrentPhaseAsComplete(0);
System.out.println();
System.out.println("Done!");
return null;
try {
Thread.sleep(1);
} catch (final InterruptedException ignored) {
// blank
}
}
System.out.println();
};
final int totalUnitsSecondPhase = 2000;
monitor.markCurrentPhaseAsComplete(totalUnitsSecondPhase);
worker.execute();
for (int i = 0; i <= totalUnitsSecondPhase; i++) {
monitor.incrementUnitsCompletedThisPhase(1);
System.out.print("\ri = " + i);
try {
Thread.sleep(1);
} catch (final InterruptedException ignored) {
// blank
}
}
monitor.markCurrentPhaseAsComplete(0);
System.out.println();
System.out.println("Done!");
return null;
}
});
};
worker.execute();
}
});
}
/**
* @param numUnits cannot be higher than Integer.MAX_VALUE
*
* Sets the total units this phase.
*
* @param numUnits
* cannot be higher than Integer.MAX_VALUE
* @see net.slightlymagic.braids.util.progress_monitor.ProgressMonitor#setTotalUnitsThisPhase(long)
*/
@Override
@@ -186,42 +186,44 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
if (numUnits > 0) {
// dialog must exist before we exit this method.
UtilFunctions.invokeInEventDispatchThreadAndWait(new Runnable() {
@Override
public void run() {
// (Re)create the progress bar.
if (MultiPhaseProgressMonitorWithETA.this.dialog != null) {
MultiPhaseProgressMonitorWithETA.this.dialog.dispose();
MultiPhaseProgressMonitorWithETA.this.dialog = null;
}
@Override
public void run() {
// (Re)create the progress bar.
if (MultiPhaseProgressMonitorWithETA.this.dialog != null) {
MultiPhaseProgressMonitorWithETA.this.dialog.dispose();
MultiPhaseProgressMonitorWithETA.this.dialog = null;
}
MultiPhaseProgressMonitorWithETA.this.dialog = new GuiProgressBarWindow();
}
});
MultiPhaseProgressMonitorWithETA.this.dialog = new GuiProgressBarWindow();
}
});
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MultiPhaseProgressMonitorWithETA.this.dialog
.setTitle(MultiPhaseProgressMonitorWithETA.this.title);
MultiPhaseProgressMonitorWithETA.this.dialog
.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
MultiPhaseProgressMonitorWithETA.this.dialog.setVisible(true);
MultiPhaseProgressMonitorWithETA.this.dialog.setResizable(true);
MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar().setIndeterminate(false);
MultiPhaseProgressMonitorWithETA.this.dialog.setProgressRange(0, (int) numUnits);
MultiPhaseProgressMonitorWithETA.this.dialog.reset();
@Override
public void run() {
MultiPhaseProgressMonitorWithETA.this.dialog.setTitle(MultiPhaseProgressMonitorWithETA.this.title);
MultiPhaseProgressMonitorWithETA.this.dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
MultiPhaseProgressMonitorWithETA.this.dialog.setVisible(true);
MultiPhaseProgressMonitorWithETA.this.dialog.setResizable(true);
MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar().setIndeterminate(false);
MultiPhaseProgressMonitorWithETA.this.dialog.setProgressRange(0, (int) numUnits);
MultiPhaseProgressMonitorWithETA.this.dialog.reset();
final JProgressBar bar = MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar();
bar.setString("");
bar.setStringPainted(true);
bar.setValue(0);
}
});
final JProgressBar bar = MultiPhaseProgressMonitorWithETA.this.dialog.getProgressBar();
bar.setString("");
bar.setStringPainted(true);
bar.setValue(0);
}
});
}
/**
* Increment units completed this phase.
*
* @param numUnits
* the num units
* @see net.slightlymagic.braids.util.progress_monitor.ProgressMonitor#incrementUnitsCompletedThisPhase(long)
*/
@Override
@@ -229,13 +231,13 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
super.incrementUnitsCompletedThisPhase(numUnits);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (int i = 0; i < numUnits; i++) {
MultiPhaseProgressMonitorWithETA.this.dialog.increment();
}
}
});
@Override
public void run() {
for (int i = 0; i < numUnits; i++) {
MultiPhaseProgressMonitorWithETA.this.dialog.increment();
}
}
});
if (this.shouldUpdateUI()) {
@@ -300,11 +302,11 @@ public class MultiPhaseProgressMonitorWithETA extends BaseProgressMonitor {
@Override
public final void dispose() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MultiPhaseProgressMonitorWithETA.this.getDialog().dispose();
}
});
@Override
public void run() {
MultiPhaseProgressMonitorWithETA.this.getDialog().dispose();
}
});
}
/**

View File

@@ -122,8 +122,8 @@ public class CardPanel extends JPanel implements CardContainer {
* @param connectedCard
* the connectedCard to set
*/
public void setConnectedCard(final CardPanel connectedCard0) {
this.connectedCard = connectedCard0;
public void setConnectedCard(final CardPanel connectedCard) {
this.connectedCard = connectedCard;
}
// ~

View File

@@ -125,7 +125,7 @@ public class HomeTopLevel extends FPanel {
btnEditor = new FButton();
btnEditor.setText("Deck Editor");
btnExit = new FButton();
btnExit.setAction(new AbstractAction() {
public void actionPerformed(ActionEvent arg0) { exit(); }