diff -r 89f13f209302 -r 19dba9e387ce src/main/java/ru/alphatech/icfpc/game/Batch.java --- a/src/main/java/ru/alphatech/icfpc/game/Batch.java Sun Jun 19 17:53:59 2011 +0400 +++ b/src/main/java/ru/alphatech/icfpc/game/Batch.java Sun Jun 19 18:42:07 2011 +0400 @@ -15,9 +15,31 @@ public Slot slot = null; public Batch(OperationType type, ICard card, Slot slot){ + if(type == null || card == null || slot == null) + throw new ICFPCException("Illegal constructor using!"); this.operationType = type; this.card = card; this.slot = slot; } + + @Override + public String toString() { + if(operationType == null || card == null || slot == null) + throw new ICFPCException(); + StringBuilder ret = new StringBuilder(); + switch(operationType){ + case CARD_TO_SLOT: + ret.append("1\n"); + ret.append(card.getName() + "\n"); + ret.append(slot.getId() + "\n"); + break; + case SLOT_TO_CARD: + ret.append("2\n"); + ret.append(slot.getId() + "\n"); + ret.append(card.getName() + "\n"); + break; + } + return ret.toString(); + } }