import java.io.BufferedReader;
import java.io.IOException;
import java.util.StringTokenizer;
import util.file.InvalidFileFormatException;
import util.log.Log;
import misc.Separators;
class CurrencyProto extends ItemProto {
    int kind;
    int value;
    CurrencyProto(int zoneBase, int itemId, BufferedReader itemFile)
	throws InvalidFileFormatException {
	super(zoneBase, itemId, itemFile);
	Log.debug("Moeda: " + getName());
	try {
	    StringTokenizer tok = new StringTokenizer(itemFile.readLine());
	    if (!tok.hasMoreTokens())
		throw new InvalidFileFormatException();
	    kind = Integer.parseInt(tok.nextToken());
	    if (!tok.hasMoreTokens())
		throw new InvalidFileFormatException();
	    value = Integer.parseInt(tok.nextToken());
	}
	catch(IOException e) {
	    throw new InvalidFileFormatException();
	}
	catch(NumberFormatException e) {
	    throw new InvalidFileFormatException();
	}
	
    }
    protected void finalize() {
	super.finalize();
    }
    int getProtoType() {
	return Item.T_CURRENCY;
    }
    Item create() {
	return new Currency(this);
    }
    ////////////
    // Sheetable
    public String getSheet() {
	return super.getSheet() + Separators.NL + "Tipo: " + kind + "  Valor: " + value;
    }
    // Sheetable
    ////////////
}