forked from External/mage
This commit is contained in:
parent
d73dbfba11
commit
09f78c6240
1 changed files with 19 additions and 1 deletions
|
|
@ -36,6 +36,7 @@ public class TaggerModel extends AbstractTableModel {
|
|||
private int recentSortedColumn;
|
||||
private boolean recentAscending;
|
||||
private Runnable doSort;
|
||||
private int whitelistCount = 0;
|
||||
|
||||
|
||||
public TaggerModel(Runnable sortFn) {
|
||||
|
|
@ -57,8 +58,10 @@ public class TaggerModel extends AbstractTableModel {
|
|||
|
||||
public void clear() {
|
||||
view = TagRepository.instance.getAllTags();
|
||||
filtered.clear();
|
||||
this.whitelist.clear();
|
||||
this.blacklist.clear();
|
||||
fireTableDataChanged();
|
||||
doSort.run();
|
||||
}
|
||||
|
||||
|
|
@ -188,17 +191,32 @@ public class TaggerModel extends AbstractTableModel {
|
|||
|
||||
public Set<String> buildWhitelist() {
|
||||
whitelist.clear();
|
||||
whitelistCount = 0;
|
||||
// whitelists are a bit weird, each one needs to reduce the next
|
||||
Set<String> temp = new HashSet<String>();
|
||||
|
||||
boolean fresh = true;
|
||||
|
||||
for (String key : filtered.keySet()) {
|
||||
temp.clear();
|
||||
if (filtered.get(key)) {
|
||||
whitelistCount++;
|
||||
for (CardInfo card : TagRepository.instance.getCardsByTagId(key)) {
|
||||
whitelist.add(card.getName());
|
||||
temp.add(card.getName());
|
||||
}
|
||||
if (fresh) {
|
||||
whitelist.addAll(temp);
|
||||
} else {
|
||||
whitelist.retainAll(temp);
|
||||
}
|
||||
fresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
return whitelist;
|
||||
}
|
||||
|
||||
|
||||
public Set<String> buildBlacklist() {
|
||||
blacklist.clear();
|
||||
for (String key : filtered.keySet()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue