001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hssf.record;
019:
020: import org.apache.poi.util.*;
021:
022: /**
023: * The value range record defines the range of the value axis.
024: * NOTE: This source is automatically generated please do not modify this file. Either subclass or
025: * remove the record in src/records/definitions.
026:
027: * @author Glen Stampoultzis (glens at apache.org)
028: */
029: public class ValueRangeRecord extends Record {
030: public final static short sid = 0x101f;
031: private double field_1_minimumAxisValue;
032: private double field_2_maximumAxisValue;
033: private double field_3_majorIncrement;
034: private double field_4_minorIncrement;
035: private double field_5_categoryAxisCross;
036: private short field_6_options;
037: private BitField automaticMinimum = BitFieldFactory
038: .getInstance(0x1);
039: private BitField automaticMaximum = BitFieldFactory
040: .getInstance(0x2);
041: private BitField automaticMajor = BitFieldFactory.getInstance(0x4);
042: private BitField automaticMinor = BitFieldFactory.getInstance(0x8);
043: private BitField automaticCategoryCrossing = BitFieldFactory
044: .getInstance(0x10);
045: private BitField logarithmicScale = BitFieldFactory
046: .getInstance(0x20);
047: private BitField valuesInReverse = BitFieldFactory
048: .getInstance(0x40);
049: private BitField crossCategoryAxisAtMaximum = BitFieldFactory
050: .getInstance(0x80);
051: private BitField reserved = BitFieldFactory.getInstance(0x100);
052:
053: public ValueRangeRecord() {
054:
055: }
056:
057: /**
058: * Constructs a ValueRange record and sets its fields appropriately.
059: *
060: * @param in the RecordInputstream to read the record from
061: */
062:
063: public ValueRangeRecord(RecordInputStream in) {
064: super (in);
065:
066: }
067:
068: /**
069: * Checks the sid matches the expected side for this record
070: *
071: * @param id the expected sid.
072: */
073: protected void validateSid(short id) {
074: if (id != sid) {
075: throw new RecordFormatException("Not a ValueRange record");
076: }
077: }
078:
079: protected void fillFields(RecordInputStream in) {
080: field_1_minimumAxisValue = in.readDouble();
081: field_2_maximumAxisValue = in.readDouble();
082: field_3_majorIncrement = in.readDouble();
083: field_4_minorIncrement = in.readDouble();
084: field_5_categoryAxisCross = in.readDouble();
085: field_6_options = in.readShort();
086:
087: }
088:
089: public String toString() {
090: StringBuffer buffer = new StringBuffer();
091:
092: buffer.append("[VALUERANGE]\n");
093: buffer.append(" .minimumAxisValue = ").append(" (")
094: .append(getMinimumAxisValue()).append(" )");
095: buffer.append(System.getProperty("line.separator"));
096: buffer.append(" .maximumAxisValue = ").append(" (")
097: .append(getMaximumAxisValue()).append(" )");
098: buffer.append(System.getProperty("line.separator"));
099: buffer.append(" .majorIncrement = ").append(" (")
100: .append(getMajorIncrement()).append(" )");
101: buffer.append(System.getProperty("line.separator"));
102: buffer.append(" .minorIncrement = ").append(" (")
103: .append(getMinorIncrement()).append(" )");
104: buffer.append(System.getProperty("line.separator"));
105: buffer.append(" .categoryAxisCross = ").append(" (")
106: .append(getCategoryAxisCross()).append(" )");
107: buffer.append(System.getProperty("line.separator"));
108: buffer.append(" .options = ").append("0x")
109: .append(HexDump.toHex(getOptions())).append(" (")
110: .append(getOptions()).append(" )");
111: buffer.append(System.getProperty("line.separator"));
112: buffer.append(" .automaticMinimum = ").append(
113: isAutomaticMinimum()).append('\n');
114: buffer.append(" .automaticMaximum = ").append(
115: isAutomaticMaximum()).append('\n');
116: buffer.append(" .automaticMajor = ").append(
117: isAutomaticMajor()).append('\n');
118: buffer.append(" .automaticMinor = ").append(
119: isAutomaticMinor()).append('\n');
120: buffer.append(" .automaticCategoryCrossing = ")
121: .append(isAutomaticCategoryCrossing()).append('\n');
122: buffer.append(" .logarithmicScale = ").append(
123: isLogarithmicScale()).append('\n');
124: buffer.append(" .valuesInReverse = ").append(
125: isValuesInReverse()).append('\n');
126: buffer.append(" .crossCategoryAxisAtMaximum = ")
127: .append(isCrossCategoryAxisAtMaximum()).append('\n');
128: buffer.append(" .reserved = ").append(
129: isReserved()).append('\n');
130:
131: buffer.append("[/VALUERANGE]\n");
132: return buffer.toString();
133: }
134:
135: public int serialize(int offset, byte[] data) {
136: int pos = 0;
137:
138: LittleEndian.putShort(data, 0 + offset, sid);
139: LittleEndian.putShort(data, 2 + offset,
140: (short) (getRecordSize() - 4));
141:
142: LittleEndian.putDouble(data, 4 + offset + pos,
143: field_1_minimumAxisValue);
144: LittleEndian.putDouble(data, 12 + offset + pos,
145: field_2_maximumAxisValue);
146: LittleEndian.putDouble(data, 20 + offset + pos,
147: field_3_majorIncrement);
148: LittleEndian.putDouble(data, 28 + offset + pos,
149: field_4_minorIncrement);
150: LittleEndian.putDouble(data, 36 + offset + pos,
151: field_5_categoryAxisCross);
152: LittleEndian.putShort(data, 44 + offset + pos, field_6_options);
153:
154: return getRecordSize();
155: }
156:
157: /**
158: * Size of record (exluding 4 byte header)
159: */
160: public int getRecordSize() {
161: return 4 + 8 + 8 + 8 + 8 + 8 + 2;
162: }
163:
164: public short getSid() {
165: return sid;
166: }
167:
168: public Object clone() {
169: ValueRangeRecord rec = new ValueRangeRecord();
170:
171: rec.field_1_minimumAxisValue = field_1_minimumAxisValue;
172: rec.field_2_maximumAxisValue = field_2_maximumAxisValue;
173: rec.field_3_majorIncrement = field_3_majorIncrement;
174: rec.field_4_minorIncrement = field_4_minorIncrement;
175: rec.field_5_categoryAxisCross = field_5_categoryAxisCross;
176: rec.field_6_options = field_6_options;
177: return rec;
178: }
179:
180: /**
181: * Get the minimum axis value field for the ValueRange record.
182: */
183: public double getMinimumAxisValue() {
184: return field_1_minimumAxisValue;
185: }
186:
187: /**
188: * Set the minimum axis value field for the ValueRange record.
189: */
190: public void setMinimumAxisValue(double field_1_minimumAxisValue) {
191: this .field_1_minimumAxisValue = field_1_minimumAxisValue;
192: }
193:
194: /**
195: * Get the maximum axis value field for the ValueRange record.
196: */
197: public double getMaximumAxisValue() {
198: return field_2_maximumAxisValue;
199: }
200:
201: /**
202: * Set the maximum axis value field for the ValueRange record.
203: */
204: public void setMaximumAxisValue(double field_2_maximumAxisValue) {
205: this .field_2_maximumAxisValue = field_2_maximumAxisValue;
206: }
207:
208: /**
209: * Get the major increment field for the ValueRange record.
210: */
211: public double getMajorIncrement() {
212: return field_3_majorIncrement;
213: }
214:
215: /**
216: * Set the major increment field for the ValueRange record.
217: */
218: public void setMajorIncrement(double field_3_majorIncrement) {
219: this .field_3_majorIncrement = field_3_majorIncrement;
220: }
221:
222: /**
223: * Get the minor increment field for the ValueRange record.
224: */
225: public double getMinorIncrement() {
226: return field_4_minorIncrement;
227: }
228:
229: /**
230: * Set the minor increment field for the ValueRange record.
231: */
232: public void setMinorIncrement(double field_4_minorIncrement) {
233: this .field_4_minorIncrement = field_4_minorIncrement;
234: }
235:
236: /**
237: * Get the category axis cross field for the ValueRange record.
238: */
239: public double getCategoryAxisCross() {
240: return field_5_categoryAxisCross;
241: }
242:
243: /**
244: * Set the category axis cross field for the ValueRange record.
245: */
246: public void setCategoryAxisCross(double field_5_categoryAxisCross) {
247: this .field_5_categoryAxisCross = field_5_categoryAxisCross;
248: }
249:
250: /**
251: * Get the options field for the ValueRange record.
252: */
253: public short getOptions() {
254: return field_6_options;
255: }
256:
257: /**
258: * Set the options field for the ValueRange record.
259: */
260: public void setOptions(short field_6_options) {
261: this .field_6_options = field_6_options;
262: }
263:
264: /**
265: * Sets the automatic minimum field value.
266: * automatic minimum value selected
267: */
268: public void setAutomaticMinimum(boolean value) {
269: field_6_options = automaticMinimum.setShortBoolean(
270: field_6_options, value);
271: }
272:
273: /**
274: * automatic minimum value selected
275: * @return the automatic minimum field value.
276: */
277: public boolean isAutomaticMinimum() {
278: return automaticMinimum.isSet(field_6_options);
279: }
280:
281: /**
282: * Sets the automatic maximum field value.
283: * automatic maximum value selected
284: */
285: public void setAutomaticMaximum(boolean value) {
286: field_6_options = automaticMaximum.setShortBoolean(
287: field_6_options, value);
288: }
289:
290: /**
291: * automatic maximum value selected
292: * @return the automatic maximum field value.
293: */
294: public boolean isAutomaticMaximum() {
295: return automaticMaximum.isSet(field_6_options);
296: }
297:
298: /**
299: * Sets the automatic major field value.
300: * automatic major unit selected
301: */
302: public void setAutomaticMajor(boolean value) {
303: field_6_options = automaticMajor.setShortBoolean(
304: field_6_options, value);
305: }
306:
307: /**
308: * automatic major unit selected
309: * @return the automatic major field value.
310: */
311: public boolean isAutomaticMajor() {
312: return automaticMajor.isSet(field_6_options);
313: }
314:
315: /**
316: * Sets the automatic minor field value.
317: * automatic minor unit selected
318: */
319: public void setAutomaticMinor(boolean value) {
320: field_6_options = automaticMinor.setShortBoolean(
321: field_6_options, value);
322: }
323:
324: /**
325: * automatic minor unit selected
326: * @return the automatic minor field value.
327: */
328: public boolean isAutomaticMinor() {
329: return automaticMinor.isSet(field_6_options);
330: }
331:
332: /**
333: * Sets the automatic category crossing field value.
334: * category crossing point is automatically selected
335: */
336: public void setAutomaticCategoryCrossing(boolean value) {
337: field_6_options = automaticCategoryCrossing.setShortBoolean(
338: field_6_options, value);
339: }
340:
341: /**
342: * category crossing point is automatically selected
343: * @return the automatic category crossing field value.
344: */
345: public boolean isAutomaticCategoryCrossing() {
346: return automaticCategoryCrossing.isSet(field_6_options);
347: }
348:
349: /**
350: * Sets the logarithmic scale field value.
351: * use logarithmic scale
352: */
353: public void setLogarithmicScale(boolean value) {
354: field_6_options = logarithmicScale.setShortBoolean(
355: field_6_options, value);
356: }
357:
358: /**
359: * use logarithmic scale
360: * @return the logarithmic scale field value.
361: */
362: public boolean isLogarithmicScale() {
363: return logarithmicScale.isSet(field_6_options);
364: }
365:
366: /**
367: * Sets the values in reverse field value.
368: * values are reverses in graph
369: */
370: public void setValuesInReverse(boolean value) {
371: field_6_options = valuesInReverse.setShortBoolean(
372: field_6_options, value);
373: }
374:
375: /**
376: * values are reverses in graph
377: * @return the values in reverse field value.
378: */
379: public boolean isValuesInReverse() {
380: return valuesInReverse.isSet(field_6_options);
381: }
382:
383: /**
384: * Sets the cross category axis at maximum field value.
385: * category axis to cross at maximum value
386: */
387: public void setCrossCategoryAxisAtMaximum(boolean value) {
388: field_6_options = crossCategoryAxisAtMaximum.setShortBoolean(
389: field_6_options, value);
390: }
391:
392: /**
393: * category axis to cross at maximum value
394: * @return the cross category axis at maximum field value.
395: */
396: public boolean isCrossCategoryAxisAtMaximum() {
397: return crossCategoryAxisAtMaximum.isSet(field_6_options);
398: }
399:
400: /**
401: * Sets the reserved field value.
402: * reserved, must equal 1 (excel dev. guide says otherwise)
403: */
404: public void setReserved(boolean value) {
405: field_6_options = reserved.setShortBoolean(field_6_options,
406: value);
407: }
408:
409: /**
410: * reserved, must equal 1 (excel dev. guide says otherwise)
411: * @return the reserved field value.
412: */
413: public boolean isReserved() {
414: return reserved.isSet(field_6_options);
415: }
416:
417: } // END OF CLASS
|