Fixes a problem of parsing large colorless costs (All the big Eldrazi creatures).

This commit is contained in:
maurer.it 2011-01-10 14:22:25 -05:00
parent 6fcce4ab8b
commit 7fbd807991

View file

@ -189,7 +189,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
String[] symbols = mana.split("^\\{|\\}\\{|\\}$");
for (String symbol: symbols) {
if (symbol.length() > 0) {
if (symbol.length() == 1) {
if (symbol.length() == 1 || isNumeric(symbol)) {
if (Character.isDigit(symbol.charAt(0))) {
this.add((T)new GenericManaCost(Integer.valueOf(symbol)));
}
@ -213,6 +213,16 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
}
}
private boolean isNumeric ( String symbol ) {
try {
Integer.parseInt(symbol);
return true;
}
catch ( NumberFormatException e ) {
return false;
}
}
@Override
public List<String> getSymbols() {
List<String> symbols = new ArrayList<String>();