1 19 20 package jxl.biff.formula; 21 22 import common.Logger; 23 24 import jxl.Cell; 25 import jxl.biff.DoubleHelper; 26 27 30 class DoubleValue extends NumberValue implements ParsedThing 31 { 32 35 private static Logger logger = Logger.getLogger(DoubleValue.class); 36 37 40 private double value; 41 42 45 public DoubleValue() 46 { 47 } 48 49 53 DoubleValue(double v) 54 { 55 value = v; 56 } 57 58 61 public DoubleValue(String s) 62 { 63 try 64 { 65 value = Double.parseDouble(s); 66 } 67 catch (NumberFormatException e) 68 { 69 logger.warn(e, e); 70 value = 0; 71 } 72 } 73 74 81 public int read(byte[] data, int pos) 82 { 83 value = DoubleHelper.getIEEEDouble(data, pos); 84 85 return 8; 86 } 87 88 93 byte[] getBytes() 94 { 95 byte[] data = new byte[9]; 96 data[0] = Token.DOUBLE.getCode(); 97 98 DoubleHelper.getIEEEBytes(value, data, 1); 99 100 return data; 101 } 102 103 public double getValue() 104 { 105 return value; 106 } 107 } 108 | Popular Tags |