KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > record > SeriesRecord


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19
20 package org.apache.poi.hssf.record;
21
22
23
24 import org.apache.poi.util.*;
25
26 /**
27  * The series record describes the overall data for a series.
28  * NOTE: This source is automatically generated please do not modify this file. Either subclass or
29  * remove the record in src/records/definitions.
30
31  * @author Glen Stampoultzis (glens at apache.org)
32  */

33 public class SeriesRecord
34     extends Record
35 {
36     public final static short sid = 0x1003;
37     private short field_1_categoryDataType;
38     public final static short CATEGORY_DATA_TYPE_DATES = 0;
39     public final static short CATEGORY_DATA_TYPE_NUMERIC = 1;
40     public final static short CATEGORY_DATA_TYPE_SEQUENCE = 2;
41     public final static short CATEGORY_DATA_TYPE_TEXT = 3;
42     private short field_2_valuesDataType;
43     public final static short VALUES_DATA_TYPE_DATES = 0;
44     public final static short VALUES_DATA_TYPE_NUMERIC = 1;
45     public final static short VALUES_DATA_TYPE_SEQUENCE = 2;
46     public final static short VALUES_DATA_TYPE_TEXT = 3;
47     private short field_3_numCategories;
48     private short field_4_numValues;
49     private short field_5_bubbleSeriesType;
50     public final static short BUBBLE_SERIES_TYPE_DATES = 0;
51     public final static short BUBBLE_SERIES_TYPE_NUMERIC = 1;
52     public final static short BUBBLE_SERIES_TYPE_SEQUENCE = 2;
53     public final static short BUBBLE_SERIES_TYPE_TEXT = 3;
54     private short field_6_numBubbleValues;
55
56
57     public SeriesRecord()
58     {
59
60     }
61
62     /**
63      * Constructs a Series record and sets its fields appropriately.
64      *
65      * @param id id must be 0x1003 or an exception
66      * will be throw upon validation
67      * @param size size the size of the data area of the record
68      * @param data data of the record (should not contain sid/len)
69      */

70
71     public SeriesRecord(short id, short size, byte [] data)
72     {
73         super(id, size, data);
74     
75     }
76
77     /**
78      * Constructs a Series record and sets its fields appropriately.
79      *
80      * @param id id must be 0x1003 or an exception
81      * will be throw upon validation
82      * @param size size the size of the data area of the record
83      * @param data data of the record (should not contain sid/len)
84      * @param offset of the record's data
85      */

86
87     public SeriesRecord(short id, short size, byte [] data, int offset)
88     {
89         super(id, size, data, offset);
90     
91     }
92
93     /**
94      * Checks the sid matches the expected side for this record
95      *
96      * @param id the expected sid.
97      */

98     protected void validateSid(short id)
99     {
100         if (id != sid)
101         {
102             throw new RecordFormatException("Not a Series record");
103         }
104     }
105
106     protected void fillFields(byte [] data, short size, int offset)
107     {
108
109         int pos = 0;
110         field_1_categoryDataType = LittleEndian.getShort(data, pos + 0x0 + offset);
111         field_2_valuesDataType = LittleEndian.getShort(data, pos + 0x2 + offset);
112         field_3_numCategories = LittleEndian.getShort(data, pos + 0x4 + offset);
113         field_4_numValues = LittleEndian.getShort(data, pos + 0x6 + offset);
114         field_5_bubbleSeriesType = LittleEndian.getShort(data, pos + 0x8 + offset);
115         field_6_numBubbleValues = LittleEndian.getShort(data, pos + 0xa + offset);
116
117     }
118
119     public String JavaDoc toString()
120     {
121         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
122
123         buffer.append("[SERIES]\n");
124         buffer.append(" .categoryDataType = ")
125             .append("0x").append(HexDump.toHex( getCategoryDataType ()))
126             .append(" (").append( getCategoryDataType() ).append(" )");
127         buffer.append(System.getProperty("line.separator"));
128         buffer.append(" .valuesDataType = ")
129             .append("0x").append(HexDump.toHex( getValuesDataType ()))
130             .append(" (").append( getValuesDataType() ).append(" )");
131         buffer.append(System.getProperty("line.separator"));
132         buffer.append(" .numCategories = ")
133             .append("0x").append(HexDump.toHex( getNumCategories ()))
134             .append(" (").append( getNumCategories() ).append(" )");
135         buffer.append(System.getProperty("line.separator"));
136         buffer.append(" .numValues = ")
137             .append("0x").append(HexDump.toHex( getNumValues ()))
138             .append(" (").append( getNumValues() ).append(" )");
139         buffer.append(System.getProperty("line.separator"));
140         buffer.append(" .bubbleSeriesType = ")
141             .append("0x").append(HexDump.toHex( getBubbleSeriesType ()))
142             .append(" (").append( getBubbleSeriesType() ).append(" )");
143         buffer.append(System.getProperty("line.separator"));
144         buffer.append(" .numBubbleValues = ")
145             .append("0x").append(HexDump.toHex( getNumBubbleValues ()))
146             .append(" (").append( getNumBubbleValues() ).append(" )");
147         buffer.append(System.getProperty("line.separator"));
148
149         buffer.append("[/SERIES]\n");
150         return buffer.toString();
151     }
152
153     public int serialize(int offset, byte[] data)
154     {
155         int pos = 0;
156
157         LittleEndian.putShort(data, 0 + offset, sid);
158         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
159
160         LittleEndian.putShort(data, 4 + offset + pos, field_1_categoryDataType);
161         LittleEndian.putShort(data, 6 + offset + pos, field_2_valuesDataType);
162         LittleEndian.putShort(data, 8 + offset + pos, field_3_numCategories);
163         LittleEndian.putShort(data, 10 + offset + pos, field_4_numValues);
164         LittleEndian.putShort(data, 12 + offset + pos, field_5_bubbleSeriesType);
165         LittleEndian.putShort(data, 14 + offset + pos, field_6_numBubbleValues);
166
167         return getRecordSize();
168     }
169
170     /**
171      * Size of record (exluding 4 byte header)
172      */

173     public int getRecordSize()
174     {
175         return 4 + 2 + 2 + 2 + 2 + 2 + 2;
176     }
177
178     public short getSid()
179     {
180         return this.sid;
181     }
182
183     public Object JavaDoc clone() {
184         SeriesRecord rec = new SeriesRecord();
185     
186         rec.field_1_categoryDataType = field_1_categoryDataType;
187         rec.field_2_valuesDataType = field_2_valuesDataType;
188         rec.field_3_numCategories = field_3_numCategories;
189         rec.field_4_numValues = field_4_numValues;
190         rec.field_5_bubbleSeriesType = field_5_bubbleSeriesType;
191         rec.field_6_numBubbleValues = field_6_numBubbleValues;
192         return rec;
193     }
194
195
196
197
198     /**
199      * Get the category data type field for the Series record.
200      *
201      * @return One of
202      * CATEGORY_DATA_TYPE_DATES
203      * CATEGORY_DATA_TYPE_NUMERIC
204      * CATEGORY_DATA_TYPE_SEQUENCE
205      * CATEGORY_DATA_TYPE_TEXT
206      */

207     public short getCategoryDataType()
208     {
209         return field_1_categoryDataType;
210     }
211
212     /**
213      * Set the category data type field for the Series record.
214      *
215      * @param field_1_categoryDataType
216      * One of
217      * CATEGORY_DATA_TYPE_DATES
218      * CATEGORY_DATA_TYPE_NUMERIC
219      * CATEGORY_DATA_TYPE_SEQUENCE
220      * CATEGORY_DATA_TYPE_TEXT
221      */

222     public void setCategoryDataType(short field_1_categoryDataType)
223     {
224         this.field_1_categoryDataType = field_1_categoryDataType;
225     }
226
227     /**
228      * Get the values data type field for the Series record.
229      *
230      * @return One of
231      * VALUES_DATA_TYPE_DATES
232      * VALUES_DATA_TYPE_NUMERIC
233      * VALUES_DATA_TYPE_SEQUENCE
234      * VALUES_DATA_TYPE_TEXT
235      */

236     public short getValuesDataType()
237     {
238         return field_2_valuesDataType;
239     }
240
241     /**
242      * Set the values data type field for the Series record.
243      *
244      * @param field_2_valuesDataType
245      * One of
246      * VALUES_DATA_TYPE_DATES
247      * VALUES_DATA_TYPE_NUMERIC
248      * VALUES_DATA_TYPE_SEQUENCE
249      * VALUES_DATA_TYPE_TEXT
250      */

251     public void setValuesDataType(short field_2_valuesDataType)
252     {
253         this.field_2_valuesDataType = field_2_valuesDataType;
254     }
255
256     /**
257      * Get the num categories field for the Series record.
258      */

259     public short getNumCategories()
260     {
261         return field_3_numCategories;
262     }
263
264     /**
265      * Set the num categories field for the Series record.
266      */

267     public void setNumCategories(short field_3_numCategories)
268     {
269         this.field_3_numCategories = field_3_numCategories;
270     }
271
272     /**
273      * Get the num values field for the Series record.
274      */

275     public short getNumValues()
276     {
277         return field_4_numValues;
278     }
279
280     /**
281      * Set the num values field for the Series record.
282      */

283     public void setNumValues(short field_4_numValues)
284     {
285         this.field_4_numValues = field_4_numValues;
286     }
287
288     /**
289      * Get the bubble series type field for the Series record.
290      *
291      * @return One of
292      * BUBBLE_SERIES_TYPE_DATES
293      * BUBBLE_SERIES_TYPE_NUMERIC
294      * BUBBLE_SERIES_TYPE_SEQUENCE
295      * BUBBLE_SERIES_TYPE_TEXT
296      */

297     public short getBubbleSeriesType()
298     {
299         return field_5_bubbleSeriesType;
300     }
301
302     /**
303      * Set the bubble series type field for the Series record.
304      *
305      * @param field_5_bubbleSeriesType
306      * One of
307      * BUBBLE_SERIES_TYPE_DATES
308      * BUBBLE_SERIES_TYPE_NUMERIC
309      * BUBBLE_SERIES_TYPE_SEQUENCE
310      * BUBBLE_SERIES_TYPE_TEXT
311      */

312     public void setBubbleSeriesType(short field_5_bubbleSeriesType)
313     {
314         this.field_5_bubbleSeriesType = field_5_bubbleSeriesType;
315     }
316
317     /**
318      * Get the num bubble values field for the Series record.
319      */

320     public short getNumBubbleValues()
321     {
322         return field_6_numBubbleValues;
323     }
324
325     /**
326      * Set the num bubble values field for the Series record.
327      */

328     public void setNumBubbleValues(short field_6_numBubbleValues)
329     {
330         this.field_6_numBubbleValues = field_6_numBubbleValues;
331     }
332
333
334 } // END OF CLASS
335

336
337
338
339
Popular Tags