src/main/java/ru/alphatech/icfpc/game/Batch.java
author indvdum
Sun, 19 Jun 2011 17:14:19 +0400
changeset 83 5940c7605d03
parent 80 fcdce54b2f25
child 96 8c40512777a1
permissions -rw-r--r--
* merge
     1 package ru.alphatech.icfpc.game;
     2 
     3 import ru.alphatech.icfpc.cards.ICard;
     4 
     5 public class Batch {
     6 	
     7 	public enum OperationType {
     8 		CARD_TO_SLOT,
     9 		SLOT_TO_CARD
    10 	}
    11 	
    12 	OperationType operationType;
    13 	
    14 	public ICard card = null;
    15 	public Slot  slot = null;
    16 	
    17 	public Batch(OperationType type, ICard card, Slot slot){
    18 		this.operationType = type;
    19 		this.card = card;
    20 		this.slot = slot;
    21 	}
    22 
    23 	@Override
    24 	public String toString() {
    25 		if(operationType == null || card == null || slot == null)
    26 			throw new ICFPCException();
    27 		StringBuilder ret = new StringBuilder();
    28 		switch(operationType){
    29 		case CARD_TO_SLOT:
    30 			ret.append("1\n");
    31 			ret.append(card.getName() + "\n");
    32 			ret.append(slot.getId() + "\n");
    33 			break;
    34 		case SLOT_TO_CARD:
    35 			ret.append("2\n");
    36 			ret.append(slot.getId() + "\n");
    37 			ret.append(card.getName() + "\n");
    38 			break;
    39 		}
    40 		return ret.toString();
    41 	}
    42 	
    43 }