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