src/main/java/ru/alphatech/icfpc/game/Slot.java
author Azamat S. Kalimoulline <turtle@bazon.ru>
Mon, 20 Jun 2011 02:20:42 +0400
changeset 127 57ee53a3cf56
parent 122 845c89fa268e
permissions -rw-r--r--
Наброски по дебагу.
     1 package ru.alphatech.icfpc.game;
     2 
     3 import ru.alphatech.icfpc.cards.I;
     4 
     5 
     6 public class Slot
     7 {
     8 	private int _vitality = 10000;
     9 
    10 	private IValue _value = new I();
    11 	
    12 	private int id = -1;
    13 	
    14 	public int getId() {
    15 		return id;
    16 	}
    17 
    18 	public Slot(int id){
    19 		if(id < 0 || id > 255)
    20 			throw new ICFPCException();
    21 		this.id = id;
    22 	}
    23 	
    24 	public void setVitality(int vitality)
    25 	{
    26 		_vitality = vitality;
    27 	}
    28 
    29 	public int getVitality()
    30 	{
    31 		return _vitality;	
    32 	}
    33 	
    34 	public boolean isZombie(){
    35 		return _vitality == -1;
    36 	}
    37 	
    38 	public boolean isDead(){
    39 		return _vitality == 0 || _vitality == -1;
    40 	}
    41 
    42 	public IValue getValue()
    43 	{
    44 		return _value;
    45 	}
    46 
    47 	public void putValue(IValue value)
    48 	{
    49 		_value = value;
    50 	}
    51 	
    52 	@Override
    53 	public String toString()
    54 	{
    55 		return getId() + "={" + getVitality() + "," + getValue() + "}";
    56 	}
    57 }