KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > read > biff > MulBlankRecord


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.read.biff;
21
22 import common.Logger;
23 import jxl.biff.IntegerHelper;
24 import jxl.biff.RecordData;
25
26 /**
27  * Contains an array of Blank, formatted cells
28  */

29 class MulBlankRecord extends RecordData
30 {
31   /**
32    * The logger
33    */

34   private static Logger logger = Logger.getLogger(MulBlankRecord.class);
35
36   /**
37    * The row containing these numbers
38    */

39   private int row;
40   /**
41    * The first column these rk number occur on
42    */

43   private int colFirst;
44   /**
45    * The last column these blank numbers occur on
46    */

47   private int colLast;
48   /**
49    * The number of blank numbers contained in this record
50    */

51   private int numblanks;
52   /**
53    * The array of xf indices
54    */

55   private int[] xfIndices;
56
57   /**
58    * Constructs the blank records from the raw data
59    *
60    * @param t the raw data
61    */

62   public MulBlankRecord(Record t)
63   {
64     super(t);
65     byte[] data = getRecord().getData();
66     int length = getRecord().getLength();
67     row = IntegerHelper.getInt(data[0], data[1]);
68     colFirst = IntegerHelper.getInt(data[2], data[3]);
69     colLast = IntegerHelper.getInt(data[length - 2], data[length - 1]);
70     numblanks = colLast - colFirst + 1;
71     xfIndices = new int[numblanks];
72
73     readBlanks(data);
74   }
75
76   /**
77    * Reads the blanks from the raw data
78    *
79    * @param data the raw data
80    */

81   private void readBlanks(byte[] data)
82   {
83     int pos = 4;
84     for (int i = 0; i < numblanks; i++)
85     {
86       xfIndices[i] = IntegerHelper.getInt(data[pos], data[pos + 1]);
87       pos += 2;
88     }
89   }
90
91   /**
92    * Accessor for the row
93    *
94    * @return the row of containing these blank numbers
95    */

96   public int getRow()
97   {
98     return row;
99   }
100
101   /**
102    * The first column containing the blank numbers
103    *
104    * @return the first column
105    */

106   public int getFirstColumn()
107   {
108     return colFirst;
109   }
110
111   /**
112    * Accessor for the number of blank values
113    *
114    * @return the number of blank values
115    */

116   public int getNumberOfColumns()
117   {
118     return numblanks;
119   }
120
121   /**
122    * Return a specific formatting index
123    * @param index the cell index in the group
124    * @return the formatting index
125    */

126   public int getXFIndex(int index)
127   {
128     return xfIndices[index];
129   }
130 }
131
132
133
134
135
Popular Tags