From e2476e37b9246b15cb0f08db83dbfb31aa852fb1 Mon Sep 17 00:00:00 2001 From: melvin Date: Fri, 1 Jul 2011 11:31:53 +0800 Subject: [PATCH] wrapped long lines --- src/magic/model/choice/MagicCardChoice.java | 40 +++++++++++++-------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/magic/model/choice/MagicCardChoice.java b/src/magic/model/choice/MagicCardChoice.java index 5d13f3565b..75e3347de3 100644 --- a/src/magic/model/choice/MagicCardChoice.java +++ b/src/magic/model/choice/MagicCardChoice.java @@ -21,42 +21,51 @@ public class MagicCardChoice extends MagicChoice { private final int amount; public MagicCardChoice(final int amount) { - super(getDescription(amount)); this.amount=amount; } private static final String getDescription(final int amount) { - if (amount==1) { return "Choose a card from your hand."; } else { - return "Choose "+amount+" cards from your hand."; + return "Choose " + amount + " cards from your hand."; } } - private void createOptions(final Collection options,final MagicCardList hand, - final MagicCard cards[],final int count,final int amount,final int index) { + private void createOptions( + final Collection options, + final MagicCardList hand, + final MagicCard cards[], + final int count, + final int amount, + final int index) { - if (count==amount) { + if (count == amount) { options.add(new MagicCardChoiceResult(cards)); return; } - if (index==hand.size()) { + + if (index == hand.size()) { return; } + cards[count]=hand.get(index); createOptions(options,hand,cards,count+1,amount,index+1); createOptions(options,hand,cards,count,amount,index+1); } @Override - public Collection getArtificialOptions(final MagicGame game,final MagicEvent event,final MagicPlayer player,final MagicSource source) { + public Collection getArtificialOptions( + final MagicGame game, + final MagicEvent event, + final MagicPlayer player, + final MagicSource source) { - final List options=new ArrayList(); - final MagicCardList hand=player.getHand(); - final int actualAmount=Math.min(amount,hand.size()); - if (actualAmount>0) { + final List options = new ArrayList(); + final MagicCardList hand = player.getHand(); + final int actualAmount = Math.min(amount,hand.size()); + if (actualAmount > 0) { createOptions(options,hand,new MagicCard[actualAmount],0,actualAmount,0); } else { options.add(new MagicCardChoiceResult()); @@ -65,13 +74,16 @@ public class MagicCardChoice extends MagicChoice { } @Override - public Object[] getPlayerChoiceResults(final GameController controller,final MagicGame game,final MagicPlayer player,final MagicSource source) { + public Object[] getPlayerChoiceResults( + final GameController controller, + final MagicGame game, + final MagicPlayer player, + final MagicSource source) { final MagicCardChoiceResult result=new MagicCardChoiceResult(); final Set validCards=new HashSet(player.getHand()); int actualAmount=Math.min(amount,validCards.size()); for (;actualAmount>0;actualAmount--) { - final String message=result.size()>0?result.toString()+"|"+MESSAGE:MESSAGE; controller.focusViewers(0,-1); controller.disableActionButton(false);