src/main/java/ru/alphatech/icfpc/game/Batch.java
changeset 98 19dba9e387ce
parent 96 8c40512777a1
equal deleted inserted replaced
97:89f13f209302 98:19dba9e387ce
    13 	
    13 	
    14 	public ICard card = null;
    14 	public ICard card = null;
    15 	public Slot  slot = null;
    15 	public Slot  slot = null;
    16 	
    16 	
    17 	public Batch(OperationType type, ICard card, Slot slot){
    17 	public Batch(OperationType type, ICard card, Slot slot){
       
    18 		if(type == null || card == null || slot == null)
       
    19 			throw new ICFPCException("Illegal constructor using!");
    18 		this.operationType = type;
    20 		this.operationType = type;
    19 		this.card = card;
    21 		this.card = card;
    20 		this.slot = slot;
    22 		this.slot = slot;
    21 	}
    23 	}
       
    24 
       
    25 	@Override
       
    26 	public String toString() {
       
    27 		if(operationType == null || card == null || slot == null)
       
    28 			throw new ICFPCException();
       
    29 		StringBuilder ret = new StringBuilder();
       
    30 		switch(operationType){
       
    31 		case CARD_TO_SLOT:
       
    32 			ret.append("1\n");
       
    33 			ret.append(card.getName() + "\n");
       
    34 			ret.append(slot.getId() + "\n");
       
    35 			break;
       
    36 		case SLOT_TO_CARD:
       
    37 			ret.append("2\n");
       
    38 			ret.append(slot.getId() + "\n");
       
    39 			ret.append(card.getName() + "\n");
       
    40 			break;
       
    41 		}
       
    42 		return ret.toString();
       
    43 	}
    22 	
    44 	
    23 }
    45 }