1 19 20 package jxl.write.biff; 21 22 import java.text.NumberFormat ; 23 24 import jxl.CellType; 25 import jxl.NumberCell; 26 import jxl.biff.Type; 27 import jxl.biff.DoubleHelper; 28 import jxl.format.CellFormat; 29 30 34 public abstract class NumberRecord extends CellValue 35 { 36 39 private double value; 40 41 48 protected NumberRecord(int c, int r, double val) 49 { 50 super(Type.NUMBER, c, r); 51 value = val; 52 } 53 54 63 protected NumberRecord(int c, int r, double val, CellFormat st) 64 { 65 super(Type.NUMBER, c, r, st); 66 value = val; 67 } 68 69 74 protected NumberRecord(NumberCell nc) 75 { 76 super(Type.NUMBER, nc); 77 value = nc.getValue(); 78 } 79 80 87 protected NumberRecord(int c, int r, NumberRecord nr) 88 { 89 super(Type.NUMBER, c, r, nr); 90 value = nr.value; 91 } 92 93 98 public CellType getType() 99 { 100 return CellType.NUMBER; 101 } 102 103 108 public byte[] getData() 109 { 110 byte[] celldata = super.getData(); 111 byte[] data = new byte[celldata.length + 8]; 112 System.arraycopy(celldata, 0, data, 0, celldata.length); 113 DoubleHelper.getIEEEBytes(value, data, celldata.length); 114 115 return data; 116 } 117 118 125 public String getContents() 126 { 127 return Double.toString(value); 128 } 129 130 135 public double getValue() 136 { 137 return value; 138 } 139 140 145 public void setValue(double val) 146 { 147 value = val; 148 } 149 150 156 public NumberFormat getNumberFormat() 157 { 158 return null; 159 } 160 } 161 162 163 164 | Popular Tags |