
/**
 * Write a description of class Value here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Value {
    public static enum Type { INTEGER, STRING }
    
    private Object value;
    private Value.Type type;

    public Value(int num) {
        this.value = new Integer(num);
        this.type = Value.Type.INTEGER;
    }
    
    public Value(String str) {
        this.value = str;
        this.type = Value.Type.STRING;
    }
    
    public Value.Type getType() {
        return this.type;
    }

    public Object getValue() {
        return this.value;
    }
    
    public boolean toBoolean() {
        if (this.type == Value.Type.STRING) {
            return !((String)this.value).equals("\"\"");
        }
        else {
            return ((Integer)this.value) != 0;
        }
    }
    
    public String toString() {
        return this.value.toString();
    }
}
