ComputerUtilCard: add getMostProminentBasicLandType and a more generic getMostProminentType

change getMostProminentCreatureType to use the generic form too
This commit is contained in:
Hanmac
2016-08-02 11:59:34 +00:00
parent 92a85b6394
commit a11906c21b

View File

@@ -570,6 +570,10 @@ public class ComputerUtilCard {
return maxName; return maxName;
} }
public static String getMostProminentBasicLandType(final CardCollectionView list) {
return getMostProminentType(list, CardType.getBasicTypes());
}
/** /**
* <p> * <p>
* getMostProminentCreatureType. * getMostProminentCreatureType.
@@ -579,6 +583,10 @@ public class ComputerUtilCard {
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public static String getMostProminentCreatureType(final CardCollectionView list) { public static String getMostProminentCreatureType(final CardCollectionView list) {
return getMostProminentType(list, CardType.getAllCreatureTypes());
}
public static String getMostProminentType(final CardCollectionView list, final List<String> valid) {
if (list.size() == 0) { if (list.size() == 0) {
return ""; return "";
} }
@@ -587,7 +595,7 @@ public class ComputerUtilCard {
for (final Card c : list) { for (final Card c : list) {
for (final String var : c.getType()) { for (final String var : c.getType()) {
if (CardType.isACreatureType(var)) { if (valid.contains(var)) {
if (!map.containsKey(var)) { if (!map.containsKey(var)) {
map.put(var, 1); map.put(var, 1);
} else { } else {