1 16 17 package org.apache.poi.hssf.record.formula; 18 19 import org.apache.poi.util.LittleEndian; 20 import org.apache.poi.hssf.model.Workbook; 21 22 29 30 public class BoolPtg 31 extends Ptg 32 { 33 public final static int SIZE = 2; 34 public final static byte sid = 0x1d; 35 private boolean field_1_value; 36 37 private String val; 38 39 private BoolPtg() { 40 } 42 43 public BoolPtg(byte [] data, int offset) 44 { 45 field_1_value = (data[offset + 1] == 1); 46 } 47 48 49 public BoolPtg(String formulaToken) { 50 field_1_value = (formulaToken.equals("TRUE")); 51 } 52 53 public void setValue(boolean value) 54 { 55 field_1_value = value; 56 } 57 58 public boolean getValue() 59 { 60 return field_1_value; 61 } 62 63 public void writeBytes(byte [] array, int offset) 64 { 65 array[ offset + 0 ] = sid; 66 array[ offset + 1 ] = (byte) (field_1_value ? 1 : 0); 67 } 68 69 public int getSize() 70 { 71 return SIZE; 72 } 73 74 public String toFormulaString(Workbook book) 75 { 76 return field_1_value ? "TRUE" : "FALSE"; 77 } 78 79 public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;} 80 81 public Object clone() { 82 BoolPtg ptg = new BoolPtg(); 83 ptg.field_1_value = field_1_value; 84 return ptg; 85 } 86 } 87 | Popular Tags |