KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > write > biff > DeltaRecord


1 /*********************************************************************
2 *
3 * Copyright (C) 2002 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl.write.biff;
21
22 import jxl.biff.Type;
23 import jxl.biff.IntegerHelper;
24 import jxl.biff.StringHelper;
25 import jxl.biff.DoubleHelper;
26 import jxl.biff.WritableRecordData;
27
28 /**
29  * Record which stores the maximum change value from the Options
30  * dialog
31  */

32 class DeltaRecord extends WritableRecordData
33 {
34   /**
35    * The binary data
36    */

37   private byte[] data;
38   /**
39    * The number of iterations
40    */

41   private double iterationValue;
42   
43   /**
44    * Constructor
45    *
46    * @param itval
47    */

48   public DeltaRecord(double itval)
49   {
50     super(Type.DELTA);
51     iterationValue = itval;
52
53     data = new byte[8];
54   }
55
56
57   /**
58    * Gets the binary data for writing to the output file
59    *
60    * @return the binary data
61    */

62   public byte[] getData()
63   {
64     DoubleHelper.getIEEEBytes(iterationValue, data, 0);
65
66     /* long val = Double.doubleToLongBits(iterationValue);
67     data[0] = (byte) (val & 0xff);
68     data[1] = (byte) ((val & 0xff00) >> 8);
69     data[2] = (byte) ((val & 0xff0000) >> 16);
70     data[3] = (byte) ((val & 0xff000000) >> 24);
71     data[4] = (byte) ((val & 0xff00000000L) >> 32);
72     data[5] = (byte) ((val & 0xff0000000000L) >> 40);
73     data[6] = (byte) ((val & 0xff000000000000L) >> 48);
74     data[7] = (byte) ((val & 0xff00000000000000L) >> 56) ;
75     */

76
77     return data;
78   }
79 }
80
81
82
Popular Tags