adjusted visibility of listInSync, removed unused import, removed test that does not test draft rankings anyway

This commit is contained in:
Maxmtg
2013-10-03 08:26:30 +00:00
parent 2f5219615d
commit 01609a1f29
5 changed files with 9 additions and 80 deletions

1
.gitattributes vendored
View File

@@ -15518,7 +15518,6 @@ src/test/java/forge/GuiDownloadPicturesLQTest.java svneol=native#text/plain
src/test/java/forge/GuiDownloadSetPicturesLQTest.java svneol=native#text/plain
src/test/java/forge/GuiProgressBarWindowTest.java svneol=native#text/plain
src/test/java/forge/PanelTest.java svneol=native#text/plain
src/test/java/forge/ReadDraftRankingsTest.java -text
src/test/java/forge/RunTest.java svneol=native#text/plain
src/test/java/forge/TinyTest.java svneol=native#text/plain
src/test/java/forge/card/mana/ManaPartTest.java svneol=native#text/plain

View File

@@ -20,7 +20,6 @@ package forge.gui.toolbox.itemmanager;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@@ -111,12 +111,12 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
return;
}
this.getItems().put(item, Integer.valueOf(this.count(item) + amount));
this.setListInSync(false);
this.isListInSync = false;
}
private void put(final T item, final int amount) {
this.getItems().put(item, amount);
this.setListInSync(false);
this.isListInSync = false;
}
/**
@@ -134,7 +134,7 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
this.add((T) cr);
}
}
this.setListInSync(false);
this.isListInSync = false;
}
/**
@@ -153,7 +153,7 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
this.add((T) e.getKey(), e.getValue());
}
}
this.setListInSync(false);
this.isListInSync = false;
}
/**
@@ -186,7 +186,7 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
} else {
this.getItems().put(item, count - amount);
}
this.setListInSync(false);
this.isListInSync = false;
return true;
}
@@ -222,6 +222,6 @@ public class ItemPool<T extends InventoryItem> extends ItemPoolView<T> {
*/
public void clear() {
this.getItems().clear();
this.setListInSync(false);
this.isListInSync = false;
}
}

View File

@@ -88,7 +88,7 @@ public class ItemPoolView<T extends InventoryItem> implements Iterable<Entry<T,
private final transient List<Entry<T, Integer>> itemsOrdered = new ArrayList<Map.Entry<T, Integer>>();
/** Whether list is in sync. */
private transient boolean isListInSync = false;
protected transient boolean isListInSync = false;
/**
* iterator.
@@ -188,7 +188,7 @@ public class ItemPoolView<T extends InventoryItem> implements Iterable<Entry<T,
* @return List<Entry<T, Integer>>
*/
public final List<Entry<T, Integer>> getOrderedList() {
if (!this.isListInSync()) {
if (!this.isListInSync) {
this.rebuildOrderedList();
}
return this.itemsOrdered;
@@ -201,7 +201,7 @@ public class ItemPoolView<T extends InventoryItem> implements Iterable<Entry<T,
this.itemsOrdered.add(e);
}
}
this.setListInSync(true);
this.isListInSync = true;
}
/**
@@ -238,24 +238,6 @@ public class ItemPoolView<T extends InventoryItem> implements Iterable<Entry<T,
return this.myClass;
}
/**
* Checks if is list in sync.
*
* @return the isListInSync
*/
public boolean isListInSync() {
return this.isListInSync;
}
/**
* Sets the list in sync.
*
* @param isListInSync0
* the isListInSync to set
*/
protected void setListInSync(final boolean isListInSync0) {
this.isListInSync = isListInSync0;
}
/**
* To item list string.

View File

@@ -1,51 +0,0 @@
package forge;
import java.io.File;
import java.util.List;
import junit.framework.Assert;
import org.testng.annotations.Test;
import forge.card.CardRules;
import forge.card.CardRulesReader;
import forge.game.limited.ReadDraftRankings;
import forge.properties.NewConstants;
import forge.util.FileUtil;
/**
* Tests for ReadDraftRankings.
*
*/
@Test(enabled = true)
public class ReadDraftRankingsTest {
/**
* Card test.
*/
@Test(enabled = true)
void test() {
ReadDraftRankings rdr = new ReadDraftRankings();
Assert.assertNotNull(rdr);
CardRulesReader cr = new CardRulesReader();
List<String> cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR + "/g", "garruk_primal_hunter.txt"));
CardRules c = cr.readCard(cardLines);
// Assert.assertEquals(1.0 / 234.0, rdr.getRanking(c.getName(), "M13").doubleValue());
cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR + "/c", "clone.txt"));
c = cr.readCard(cardLines);
// Assert.assertEquals(38.0 / 234.0, rdr.getRanking(c.getName(), "M13").doubleValue());
cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR + "/t", "tamiyo_the_moon_sage.txt"));
c = cr.readCard(cardLines);
// Assert.assertEquals(1.0 / 234.0, rdr.getRanking(c.getName(), "AVR").doubleValue());
// Mikaeus, the Lunarch has a comma in its name in the rankings file
cardLines = FileUtil.readFile(new File(NewConstants.CARD_DATA_DIR + "/m", "mikaeus_the_lunarch.txt"));
c = cr.readCard(cardLines);
// Assert.assertEquals(4.0 / 255.0, rdr.getRanking(c.getName(), "ISD").doubleValue());
}
}