1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 36 37 public class CalcCountRecord 38 extends Record 39 { 40 public final static short sid = 0xC; 41 private short field_1_iterations; 42 43 public CalcCountRecord() 44 { 45 } 46 47 55 56 public CalcCountRecord(short id, short size, byte [] data) 57 { 58 super(id, size, data); 59 } 60 61 69 70 public CalcCountRecord(short id, short size, byte [] data, int offset) 71 { 72 super(id, size, data, offset); 73 } 74 75 protected void validateSid(short id) 76 { 77 if (id != sid) 78 { 79 throw new RecordFormatException("NOT An Calc Count RECORD"); 80 } 81 } 82 83 protected void fillFields(byte [] data, short size, int offset) 84 { 85 field_1_iterations = LittleEndian.getShort(data, 0 + offset); 86 } 87 88 92 93 public void setIterations(short iterations) 94 { 95 field_1_iterations = iterations; 96 } 97 98 102 103 public short getIterations() 104 { 105 return field_1_iterations; 106 } 107 108 public String toString() 109 { 110 StringBuffer buffer = new StringBuffer (); 111 112 buffer.append("[CALCCOUNT]\n"); 113 buffer.append(" .iterations = ") 114 .append(Integer.toHexString(getIterations())).append("\n"); 115 buffer.append("[/CALCCOUNT]\n"); 116 return buffer.toString(); 117 } 118 119 public int serialize(int offset, byte [] data) 120 { 121 LittleEndian.putShort(data, 0 + offset, sid); 122 LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); 123 LittleEndian.putShort(data, 4 + offset, getIterations()); 124 return getRecordSize(); 125 } 126 127 public int getRecordSize() 128 { 129 return 6; 130 } 131 132 public short getSid() 133 { 134 return this.sid; 135 } 136 137 public Object clone() { 138 CalcCountRecord rec = new CalcCountRecord(); 139 rec.field_1_iterations = field_1_iterations; 140 return rec; 141 } 142 } 143 | Popular Tags |