ensure switch statements handle all cases
parent
d3de830740
commit
3f446b5324
|
@ -81,7 +81,7 @@ public enum MagicManaType {
|
|||
case Green: return MagicColor.Green;
|
||||
case Red: return MagicColor.Red;
|
||||
case White: return MagicColor.White;
|
||||
default: throw new RuntimeException("No color available for MagicManaType " + this);
|
||||
}
|
||||
throw new RuntimeException("No color available for MagicManaType " + this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public enum MagicSubType {
|
|||
case Swamp: return MagicAbility.Swampwalk;
|
||||
case Mountain: return MagicAbility.Mountainwalk;
|
||||
case Forest: return MagicAbility.Forestwalk;
|
||||
default: throw new RuntimeException("No landwalk ability for MagicSubType " + this);
|
||||
}
|
||||
throw new RuntimeException("No landwalk ability for MagicSubType " + this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ public class MoveCardAction extends MagicAction {
|
|||
case Exile:
|
||||
owner.getExile().addToTop(card);
|
||||
break;
|
||||
default: throw new RuntimeException("Unsupported location for MoveCardAction: " + toLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,6 +123,7 @@ public class MoveCardAction extends MagicAction {
|
|||
case Exile:
|
||||
owner.getExile().remove(card);
|
||||
break;
|
||||
default: throw new RuntimeException("Unsupported location for MoveCardAction: " + toLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public class RemoveCardAction extends MagicAction {
|
|||
case Exile:
|
||||
index=owner.getExile().removeCard(card);
|
||||
break;
|
||||
default: throw new RuntimeException("Unsupported location for RemoveCardAction: " + locationType);
|
||||
}
|
||||
game.setStateCheckRequired();
|
||||
}
|
||||
|
@ -62,6 +63,7 @@ public class RemoveCardAction extends MagicAction {
|
|||
case Exile:
|
||||
owner.getExile().add(index,card);
|
||||
break;
|
||||
default: throw new RuntimeException("Unsupported location for RemoveCardAction: " + locationType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,8 +175,9 @@ public final class MagicImages {
|
|||
return getSmallManaIcon(MagicIcon.MANA_RED);
|
||||
case White:
|
||||
return getSmallManaIcon(MagicIcon.MANA_WHITE);
|
||||
default:
|
||||
throw new RuntimeException("No icon available for MagicManaType " + mtype);
|
||||
}
|
||||
throw new RuntimeException("No icon available for MagicManaType " + mtype);
|
||||
}
|
||||
|
||||
public static ImageIcon getIcon(String manaSymbol) {
|
||||
|
@ -245,20 +246,21 @@ public final class MagicImages {
|
|||
|
||||
public static ImageIcon getIcon(final MagicManaType mtype, final boolean small) {
|
||||
switch (mtype) {
|
||||
case Colorless:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_1) : getBigManaIcon(MagicIcon.MANA_1);
|
||||
case Black:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_BLACK) : getBigManaIcon(MagicIcon.MANA_BLACK);
|
||||
case Blue:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_BLUE) : getBigManaIcon(MagicIcon.MANA_BLUE);
|
||||
case Green:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_GREEN) : getBigManaIcon(MagicIcon.MANA_GREEN);
|
||||
case Red:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_RED) : getBigManaIcon(MagicIcon.MANA_RED);
|
||||
case White:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_WHITE) : getBigManaIcon(MagicIcon.MANA_WHITE);
|
||||
case Colorless:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_1) : getBigManaIcon(MagicIcon.MANA_1);
|
||||
case Black:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_BLACK) : getBigManaIcon(MagicIcon.MANA_BLACK);
|
||||
case Blue:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_BLUE) : getBigManaIcon(MagicIcon.MANA_BLUE);
|
||||
case Green:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_GREEN) : getBigManaIcon(MagicIcon.MANA_GREEN);
|
||||
case Red:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_RED) : getBigManaIcon(MagicIcon.MANA_RED);
|
||||
case White:
|
||||
return small ? getSmallManaIcon(MagicIcon.MANA_WHITE) : getBigManaIcon(MagicIcon.MANA_WHITE);
|
||||
default:
|
||||
throw new RuntimeException("No icon available for MagicManaType " + mtype);
|
||||
}
|
||||
throw new RuntimeException("No icon available for MagicManaType " + mtype);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,19 +154,21 @@ public class DeckChooserDialog extends MagicDialog {
|
|||
|
||||
private JComboBox<String> getDecksCombo(final DeckType deckType) {
|
||||
switch (deckType) {
|
||||
case Random:
|
||||
deckNameCombo = new RandomDecksComboBox("");
|
||||
break;
|
||||
case Preconstructed:
|
||||
deckNameCombo = new PrebuiltDecksComboxBox();
|
||||
break;
|
||||
case Custom:
|
||||
deckNameCombo = new CustomDecksComboxBox();
|
||||
break;
|
||||
case Firemind:
|
||||
FiremindJsonReader.refreshTopDecks();
|
||||
deckNameCombo = new FiremindDecksComboxBox();
|
||||
break;
|
||||
case Random:
|
||||
deckNameCombo = new RandomDecksComboBox("");
|
||||
break;
|
||||
case Preconstructed:
|
||||
deckNameCombo = new PrebuiltDecksComboxBox();
|
||||
break;
|
||||
case Custom:
|
||||
deckNameCombo = new CustomDecksComboxBox();
|
||||
break;
|
||||
case Firemind:
|
||||
FiremindJsonReader.refreshTopDecks();
|
||||
deckNameCombo = new FiremindDecksComboxBox();
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Not a duel deck type: " + deckType);
|
||||
}
|
||||
deckNameCombo.setSelectedItem(defaultDeckName);
|
||||
defaultDeckName = "";
|
||||
|
|
|
@ -183,8 +183,8 @@ public class GameViewerInfo {
|
|||
case EXILE: return aPlayer.exile;
|
||||
case HAND: return aPlayer.hand;
|
||||
case LIBRARY: return aPlayer.library;
|
||||
default: throw new RuntimeException("Invalid MagicPlayerZone : " + aZone);
|
||||
}
|
||||
throw new RuntimeException("Invalid MagicPlayerZone : " + aZone);
|
||||
}
|
||||
|
||||
private MagicCard searchForCardInZone(long magicCardId, MagicPlayerZone zone) {
|
||||
|
|
|
@ -200,6 +200,8 @@ public final class DuelPanel extends JPanel {
|
|||
case OwnersLibrary:
|
||||
sidebarPanel.doHighlightPlayerZone(cardInfo, MagicPlayerZone.LIBRARY, b);
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ public class PlayerZoneViewer extends JPanel implements ChangeListener {
|
|||
case HAND: return MText.get(_S3, player.getName());
|
||||
case GRAVEYARD: return MText.get(_S4, player.getName());
|
||||
case EXILE: return MText.get(_S5, player.getName());
|
||||
default: throw new RuntimeException("Unsupported MagicPlayerZone : " + zone);
|
||||
}
|
||||
throw new RuntimeException("Unsupported MagicPlayerZone : " + zone);
|
||||
}
|
||||
|
||||
private void update(boolean showFullScreen) {
|
||||
|
|
Loading…
Reference in New Issue