KickJava   Java API By Example, From Geeks To Geeks.

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


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 value range record defines the range of the value axis.
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 ValueRangeRecord
34     extends Record
35 {
36     public final static short sid = 0x101f;
37     private double field_1_minimumAxisValue;
38     private double field_2_maximumAxisValue;
39     private double field_3_majorIncrement;
40     private double field_4_minorIncrement;
41     private double field_5_categoryAxisCross;
42     private short field_6_options;
43     private BitField automaticMinimum = new BitField(0x1);
44     private BitField automaticMaximum = new BitField(0x2);
45     private BitField automaticMajor = new BitField(0x4);
46     private BitField automaticMinor = new BitField(0x8);
47     private BitField automaticCategoryCrossing = new BitField(0x10);
48     private BitField logarithmicScale = new BitField(0x20);
49     private BitField valuesInReverse = new BitField(0x40);
50     private BitField crossCategoryAxisAtMaximum = new BitField(0x80);
51     private BitField reserved = new BitField(0x100);
52
53
54     public ValueRangeRecord()
55     {
56
57     }
58
59     /**
60      * Constructs a ValueRange record and sets its fields appropriately.
61      *
62      * @param id id must be 0x101f or an exception
63      * will be throw upon validation
64      * @param size size the size of the data area of the record
65      * @param data data of the record (should not contain sid/len)
66      */

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

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

95     protected void validateSid(short id)
96     {
97         if (id != sid)
98         {
99             throw new RecordFormatException("Not a ValueRange record");
100         }
101     }
102
103     protected void fillFields(byte [] data, short size, int offset)
104     {
105
106         int pos = 0;
107         field_1_minimumAxisValue = LittleEndian.getDouble(data, pos + 0x0 + offset);
108         field_2_maximumAxisValue = LittleEndian.getDouble(data, pos + 0x8 + offset);
109         field_3_majorIncrement = LittleEndian.getDouble(data, pos + 0x10 + offset);
110         field_4_minorIncrement = LittleEndian.getDouble(data, pos + 0x18 + offset);
111         field_5_categoryAxisCross = LittleEndian.getDouble(data, pos + 0x20 + offset);
112         field_6_options = LittleEndian.getShort(data, pos + 0x28 + offset);
113
114     }
115
116     public String JavaDoc toString()
117     {
118         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
119
120         buffer.append("[VALUERANGE]\n");
121         buffer.append(" .minimumAxisValue = ")
122             .append(" (").append( getMinimumAxisValue() ).append(" )");
123         buffer.append(System.getProperty("line.separator"));
124         buffer.append(" .maximumAxisValue = ")
125             .append(" (").append( getMaximumAxisValue() ).append(" )");
126         buffer.append(System.getProperty("line.separator"));
127         buffer.append(" .majorIncrement = ")
128             .append(" (").append( getMajorIncrement() ).append(" )");
129         buffer.append(System.getProperty("line.separator"));
130         buffer.append(" .minorIncrement = ")
131             .append(" (").append( getMinorIncrement() ).append(" )");
132         buffer.append(System.getProperty("line.separator"));
133         buffer.append(" .categoryAxisCross = ")
134             .append(" (").append( getCategoryAxisCross() ).append(" )");
135         buffer.append(System.getProperty("line.separator"));
136         buffer.append(" .options = ")
137             .append("0x").append(HexDump.toHex( getOptions ()))
138             .append(" (").append( getOptions() ).append(" )");
139         buffer.append(System.getProperty("line.separator"));
140         buffer.append(" .automaticMinimum = ").append(isAutomaticMinimum()).append('\n');
141         buffer.append(" .automaticMaximum = ").append(isAutomaticMaximum()).append('\n');
142         buffer.append(" .automaticMajor = ").append(isAutomaticMajor()).append('\n');
143         buffer.append(" .automaticMinor = ").append(isAutomaticMinor()).append('\n');
144         buffer.append(" .automaticCategoryCrossing = ").append(isAutomaticCategoryCrossing()).append('\n');
145         buffer.append(" .logarithmicScale = ").append(isLogarithmicScale()).append('\n');
146         buffer.append(" .valuesInReverse = ").append(isValuesInReverse()).append('\n');
147         buffer.append(" .crossCategoryAxisAtMaximum = ").append(isCrossCategoryAxisAtMaximum()).append('\n');
148         buffer.append(" .reserved = ").append(isReserved()).append('\n');
149
150         buffer.append("[/VALUERANGE]\n");
151         return buffer.toString();
152     }
153
154     public int serialize(int offset, byte[] data)
155     {
156         int pos = 0;
157
158         LittleEndian.putShort(data, 0 + offset, sid);
159         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
160
161         LittleEndian.putDouble(data, 4 + offset + pos, field_1_minimumAxisValue);
162         LittleEndian.putDouble(data, 12 + offset + pos, field_2_maximumAxisValue);
163         LittleEndian.putDouble(data, 20 + offset + pos, field_3_majorIncrement);
164         LittleEndian.putDouble(data, 28 + offset + pos, field_4_minorIncrement);
165         LittleEndian.putDouble(data, 36 + offset + pos, field_5_categoryAxisCross);
166         LittleEndian.putShort(data, 44 + offset + pos, field_6_options);
167
168         return getRecordSize();
169     }
170
171     /**
172      * Size of record (exluding 4 byte header)
173      */

174     public int getRecordSize()
175     {
176         return 4 + 8 + 8 + 8 + 8 + 8 + 2;
177     }
178
179     public short getSid()
180     {
181         return this.sid;
182     }
183
184     public Object JavaDoc clone() {
185         ValueRangeRecord rec = new ValueRangeRecord();
186     
187         rec.field_1_minimumAxisValue = field_1_minimumAxisValue;
188         rec.field_2_maximumAxisValue = field_2_maximumAxisValue;
189         rec.field_3_majorIncrement = field_3_majorIncrement;
190         rec.field_4_minorIncrement = field_4_minorIncrement;
191         rec.field_5_categoryAxisCross = field_5_categoryAxisCross;
192         rec.field_6_options = field_6_options;
193         return rec;
194     }
195
196
197
198
199     /**
200      * Get the minimum axis value field for the ValueRange record.
201      */

202     public double getMinimumAxisValue()
203     {
204         return field_1_minimumAxisValue;
205     }
206
207     /**
208      * Set the minimum axis value field for the ValueRange record.
209      */

210     public void setMinimumAxisValue(double field_1_minimumAxisValue)
211     {
212         this.field_1_minimumAxisValue = field_1_minimumAxisValue;
213     }
214
215     /**
216      * Get the maximum axis value field for the ValueRange record.
217      */

218     public double getMaximumAxisValue()
219     {
220         return field_2_maximumAxisValue;
221     }
222
223     /**
224      * Set the maximum axis value field for the ValueRange record.
225      */

226     public void setMaximumAxisValue(double field_2_maximumAxisValue)
227     {
228         this.field_2_maximumAxisValue = field_2_maximumAxisValue;
229     }
230
231     /**
232      * Get the major increment field for the ValueRange record.
233      */

234     public double getMajorIncrement()
235     {
236         return field_3_majorIncrement;
237     }
238
239     /**
240      * Set the major increment field for the ValueRange record.
241      */

242     public void setMajorIncrement(double field_3_majorIncrement)
243     {
244         this.field_3_majorIncrement = field_3_majorIncrement;
245     }
246
247     /**
248      * Get the minor increment field for the ValueRange record.
249      */

250     public double getMinorIncrement()
251     {
252         return field_4_minorIncrement;
253     }
254
255     /**
256      * Set the minor increment field for the ValueRange record.
257      */

258     public void setMinorIncrement(double field_4_minorIncrement)
259     {
260         this.field_4_minorIncrement = field_4_minorIncrement;
261     }
262
263     /**
264      * Get the category axis cross field for the ValueRange record.
265      */

266     public double getCategoryAxisCross()
267     {
268         return field_5_categoryAxisCross;
269     }
270
271     /**
272      * Set the category axis cross field for the ValueRange record.
273      */

274     public void setCategoryAxisCross(double field_5_categoryAxisCross)
275     {
276         this.field_5_categoryAxisCross = field_5_categoryAxisCross;
277     }
278
279     /**
280      * Get the options field for the ValueRange record.
281      */

282     public short getOptions()
283     {
284         return field_6_options;
285     }
286
287     /**
288      * Set the options field for the ValueRange record.
289      */

290     public void setOptions(short field_6_options)
291     {
292         this.field_6_options = field_6_options;
293     }
294
295     /**
296      * Sets the automatic minimum field value.
297      * automatic minimum value selected
298      */

299     public void setAutomaticMinimum(boolean value)
300     {
301         field_6_options = automaticMinimum.setShortBoolean(field_6_options, value);
302     }
303
304     /**
305      * automatic minimum value selected
306      * @return the automatic minimum field value.
307      */

308     public boolean isAutomaticMinimum()
309     {
310         return automaticMinimum.isSet(field_6_options);
311     }
312
313     /**
314      * Sets the automatic maximum field value.
315      * automatic maximum value selected
316      */

317     public void setAutomaticMaximum(boolean value)
318     {
319         field_6_options = automaticMaximum.setShortBoolean(field_6_options, value);
320     }
321
322     /**
323      * automatic maximum value selected
324      * @return the automatic maximum field value.
325      */

326     public boolean isAutomaticMaximum()
327     {
328         return automaticMaximum.isSet(field_6_options);
329     }
330
331     /**
332      * Sets the automatic major field value.
333      * automatic major unit selected
334      */

335     public void setAutomaticMajor(boolean value)
336     {
337         field_6_options = automaticMajor.setShortBoolean(field_6_options, value);
338     }
339
340     /**
341      * automatic major unit selected
342      * @return the automatic major field value.
343      */

344     public boolean isAutomaticMajor()
345     {
346         return automaticMajor.isSet(field_6_options);
347     }
348
349     /**
350      * Sets the automatic minor field value.
351      * automatic minor unit selected
352      */

353     public void setAutomaticMinor(boolean value)
354     {
355         field_6_options = automaticMinor.setShortBoolean(field_6_options, value);
356     }
357
358     /**
359      * automatic minor unit selected
360      * @return the automatic minor field value.
361      */

362     public boolean isAutomaticMinor()
363     {
364         return automaticMinor.isSet(field_6_options);
365     }
366
367     /**
368      * Sets the automatic category crossing field value.
369      * category crossing point is automatically selected
370      */

371     public void setAutomaticCategoryCrossing(boolean value)
372     {
373         field_6_options = automaticCategoryCrossing.setShortBoolean(field_6_options, value);
374     }
375
376     /**
377      * category crossing point is automatically selected
378      * @return the automatic category crossing field value.
379      */

380     public boolean isAutomaticCategoryCrossing()
381     {
382         return automaticCategoryCrossing.isSet(field_6_options);
383     }
384
385     /**
386      * Sets the logarithmic scale field value.
387      * use logarithmic scale
388      */

389     public void setLogarithmicScale(boolean value)
390     {
391         field_6_options = logarithmicScale.setShortBoolean(field_6_options, value);
392     }
393
394     /**
395      * use logarithmic scale
396      * @return the logarithmic scale field value.
397      */

398     public boolean isLogarithmicScale()
399     {
400         return logarithmicScale.isSet(field_6_options);
401     }
402
403     /**
404      * Sets the values in reverse field value.
405      * values are reverses in graph
406      */

407     public void setValuesInReverse(boolean value)
408     {
409         field_6_options = valuesInReverse.setShortBoolean(field_6_options, value);
410     }
411
412     /**
413      * values are reverses in graph
414      * @return the values in reverse field value.
415      */

416     public boolean isValuesInReverse()
417     {
418         return valuesInReverse.isSet(field_6_options);
419     }
420
421     /**
422      * Sets the cross category axis at maximum field value.
423      * category axis to cross at maximum value
424      */

425     public void setCrossCategoryAxisAtMaximum(boolean value)
426     {
427         field_6_options = crossCategoryAxisAtMaximum.setShortBoolean(field_6_options, value);
428     }
429
430     /**
431      * category axis to cross at maximum value
432      * @return the cross category axis at maximum field value.
433      */

434     public boolean isCrossCategoryAxisAtMaximum()
435     {
436         return crossCategoryAxisAtMaximum.isSet(field_6_options);
437     }
438
439     /**
440      * Sets the reserved field value.
441      * reserved, must equal 1 (excel dev. guide says otherwise)
442      */

443     public void setReserved(boolean value)
444     {
445         field_6_options = reserved.setShortBoolean(field_6_options, value);
446     }
447
448     /**
449      * reserved, must equal 1 (excel dev. guide says otherwise)
450      * @return the reserved field value.
451      */

452     public boolean isReserved()
453     {
454         return reserved.isSet(field_6_options);
455     }
456
457
458 } // END OF CLASS
459

460
461
462
463
Popular Tags