package jxl.biff.formula;

class BooleanValue extends Operand implements ParsedThing {
  private boolean value;
  
  public BooleanValue() {}
  
  public BooleanValue(String s) {
    this.value = Boolean.valueOf(s).booleanValue();
  }
  
  public int read(byte[] data, int pos) {
    this.value = (data[pos] == 1);
    return 1;
  }
  
  byte[] getBytes() {
    byte[] data = new byte[2];
    data[0] = Token.BOOL.getCode();
    data[1] = (byte)((this.value == true) ? 1 : 0);
    return data;
  }
  
  public void getString(StringBuffer buf) {
    buf.append((new Boolean(this.value)).toString());
  }
}
