akhmetovlz@33: package ru.alphatech.icfpc.game; akhmetovlz@33: akhmetovlz@33: import ru.alphatech.icfpc.cards.ICard; akhmetovlz@33: akhmetovlz@33: public class Batch { akhmetovlz@33: akhmetovlz@33: public enum OperationType { akhmetovlz@33: CARD_TO_SLOT, akhmetovlz@33: SLOT_TO_CARD akhmetovlz@33: } akhmetovlz@33: akhmetovlz@33: OperationType operationType; akhmetovlz@33: akhmetovlz@33: public ICard card = null; akhmetovlz@33: public Slot slot = null; akhmetovlz@33: akhmetovlz@33: public Batch(OperationType type, ICard card, Slot slot){ indvdum@96: if(type == null || card == null || slot == null) indvdum@96: throw new ICFPCException("Illegal constructor using!"); akhmetovlz@33: this.operationType = type; akhmetovlz@33: this.card = card; akhmetovlz@33: this.slot = slot; akhmetovlz@33: } indvdum@80: indvdum@80: @Override indvdum@80: public String toString() { indvdum@80: if(operationType == null || card == null || slot == null) indvdum@80: throw new ICFPCException(); indvdum@80: StringBuilder ret = new StringBuilder(); indvdum@80: switch(operationType){ indvdum@80: case CARD_TO_SLOT: indvdum@80: ret.append("1\n"); indvdum@80: ret.append(card.getName() + "\n"); indvdum@80: ret.append(slot.getId() + "\n"); indvdum@80: break; indvdum@80: case SLOT_TO_CARD: indvdum@80: ret.append("2\n"); indvdum@80: ret.append(slot.getId() + "\n"); indvdum@80: ret.append(card.getName() + "\n"); indvdum@80: break; indvdum@80: } indvdum@80: return ret.toString(); indvdum@80: } akhmetovlz@33: akhmetovlz@33: }