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 axis options record provides unit information and other various tidbits about the 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 Andrew C. Oliver(acoliver at apache.org)
028: */
029: public class AxisOptionsRecord extends Record {
030: public final static short sid = 0x1062;
031: private short field_1_minimumCategory;
032: private short field_2_maximumCategory;
033: private short field_3_majorUnitValue;
034: private short field_4_majorUnit;
035: private short field_5_minorUnitValue;
036: private short field_6_minorUnit;
037: private short field_7_baseUnit;
038: private short field_8_crossingPoint;
039: private short field_9_options;
040: private BitField defaultMinimum = BitFieldFactory.getInstance(0x1);
041: private BitField defaultMaximum = BitFieldFactory.getInstance(0x2);
042: private BitField defaultMajor = BitFieldFactory.getInstance(0x4);
043: private BitField defaultMinorUnit = BitFieldFactory
044: .getInstance(0x8);
045: private BitField isDate = BitFieldFactory.getInstance(0x10);
046: private BitField defaultBase = BitFieldFactory.getInstance(0x20);
047: private BitField defaultCross = BitFieldFactory.getInstance(0x40);
048: private BitField defaultDateSettings = BitFieldFactory
049: .getInstance(0x80);
050:
051: public AxisOptionsRecord() {
052:
053: }
054:
055: /**
056: * Constructs a AxisOptions record and sets its fields appropriately.
057: *
058: * @param in the RecordInputstream to read the record from
059: */
060:
061: public AxisOptionsRecord(RecordInputStream in) {
062: super (in);
063:
064: }
065:
066: /**
067: * Checks the sid matches the expected side for this record
068: *
069: * @param id the expected sid.
070: */
071: protected void validateSid(short id) {
072: if (id != sid) {
073: throw new RecordFormatException("Not a AxisOptions record");
074: }
075: }
076:
077: protected void fillFields(RecordInputStream in) {
078: field_1_minimumCategory = in.readShort();
079: field_2_maximumCategory = in.readShort();
080: field_3_majorUnitValue = in.readShort();
081: field_4_majorUnit = in.readShort();
082: field_5_minorUnitValue = in.readShort();
083: field_6_minorUnit = in.readShort();
084: field_7_baseUnit = in.readShort();
085: field_8_crossingPoint = in.readShort();
086: field_9_options = in.readShort();
087: }
088:
089: public String toString() {
090: StringBuffer buffer = new StringBuffer();
091:
092: buffer.append("[AXCEXT]\n");
093: buffer.append(" .minimumCategory = ").append("0x")
094: .append(HexDump.toHex(getMinimumCategory())).append(
095: " (").append(getMinimumCategory()).append(" )");
096: buffer.append(System.getProperty("line.separator"));
097: buffer.append(" .maximumCategory = ").append("0x")
098: .append(HexDump.toHex(getMaximumCategory())).append(
099: " (").append(getMaximumCategory()).append(" )");
100: buffer.append(System.getProperty("line.separator"));
101: buffer.append(" .majorUnitValue = ").append("0x")
102: .append(HexDump.toHex(getMajorUnitValue()))
103: .append(" (").append(getMajorUnitValue()).append(" )");
104: buffer.append(System.getProperty("line.separator"));
105: buffer.append(" .majorUnit = ").append("0x")
106: .append(HexDump.toHex(getMajorUnit())).append(" (")
107: .append(getMajorUnit()).append(" )");
108: buffer.append(System.getProperty("line.separator"));
109: buffer.append(" .minorUnitValue = ").append("0x")
110: .append(HexDump.toHex(getMinorUnitValue()))
111: .append(" (").append(getMinorUnitValue()).append(" )");
112: buffer.append(System.getProperty("line.separator"));
113: buffer.append(" .minorUnit = ").append("0x")
114: .append(HexDump.toHex(getMinorUnit())).append(" (")
115: .append(getMinorUnit()).append(" )");
116: buffer.append(System.getProperty("line.separator"));
117: buffer.append(" .baseUnit = ").append("0x")
118: .append(HexDump.toHex(getBaseUnit())).append(" (")
119: .append(getBaseUnit()).append(" )");
120: buffer.append(System.getProperty("line.separator"));
121: buffer.append(" .crossingPoint = ").append("0x")
122: .append(HexDump.toHex(getCrossingPoint())).append(" (")
123: .append(getCrossingPoint()).append(" )");
124: buffer.append(System.getProperty("line.separator"));
125: buffer.append(" .options = ").append("0x")
126: .append(HexDump.toHex(getOptions())).append(" (")
127: .append(getOptions()).append(" )");
128: buffer.append(System.getProperty("line.separator"));
129: buffer.append(" .defaultMinimum = ").append(
130: isDefaultMinimum()).append('\n');
131: buffer.append(" .defaultMaximum = ").append(
132: isDefaultMaximum()).append('\n');
133: buffer.append(" .defaultMajor = ").append(
134: isDefaultMajor()).append('\n');
135: buffer.append(" .defaultMinorUnit = ").append(
136: isDefaultMinorUnit()).append('\n');
137: buffer.append(" .isDate = ").append(
138: isIsDate()).append('\n');
139: buffer.append(" .defaultBase = ").append(
140: isDefaultBase()).append('\n');
141: buffer.append(" .defaultCross = ").append(
142: isDefaultCross()).append('\n');
143: buffer.append(" .defaultDateSettings = ").append(
144: isDefaultDateSettings()).append('\n');
145:
146: buffer.append("[/AXCEXT]\n");
147: return buffer.toString();
148: }
149:
150: public int serialize(int offset, byte[] data) {
151: int pos = 0;
152:
153: LittleEndian.putShort(data, 0 + offset, sid);
154: LittleEndian.putShort(data, 2 + offset,
155: (short) (getRecordSize() - 4));
156:
157: LittleEndian.putShort(data, 4 + offset + pos,
158: field_1_minimumCategory);
159: LittleEndian.putShort(data, 6 + offset + pos,
160: field_2_maximumCategory);
161: LittleEndian.putShort(data, 8 + offset + pos,
162: field_3_majorUnitValue);
163: LittleEndian.putShort(data, 10 + offset + pos,
164: field_4_majorUnit);
165: LittleEndian.putShort(data, 12 + offset + pos,
166: field_5_minorUnitValue);
167: LittleEndian.putShort(data, 14 + offset + pos,
168: field_6_minorUnit);
169: LittleEndian
170: .putShort(data, 16 + offset + pos, field_7_baseUnit);
171: LittleEndian.putShort(data, 18 + offset + pos,
172: field_8_crossingPoint);
173: LittleEndian.putShort(data, 20 + offset + pos, field_9_options);
174:
175: return getRecordSize();
176: }
177:
178: /**
179: * Size of record (exluding 4 byte header)
180: */
181: public int getRecordSize() {
182: return 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2;
183: }
184:
185: public short getSid() {
186: return sid;
187: }
188:
189: public Object clone() {
190: AxisOptionsRecord rec = new AxisOptionsRecord();
191:
192: rec.field_1_minimumCategory = field_1_minimumCategory;
193: rec.field_2_maximumCategory = field_2_maximumCategory;
194: rec.field_3_majorUnitValue = field_3_majorUnitValue;
195: rec.field_4_majorUnit = field_4_majorUnit;
196: rec.field_5_minorUnitValue = field_5_minorUnitValue;
197: rec.field_6_minorUnit = field_6_minorUnit;
198: rec.field_7_baseUnit = field_7_baseUnit;
199: rec.field_8_crossingPoint = field_8_crossingPoint;
200: rec.field_9_options = field_9_options;
201: return rec;
202: }
203:
204: /**
205: * Get the minimum category field for the AxisOptions record.
206: */
207: public short getMinimumCategory() {
208: return field_1_minimumCategory;
209: }
210:
211: /**
212: * Set the minimum category field for the AxisOptions record.
213: */
214: public void setMinimumCategory(short field_1_minimumCategory) {
215: this .field_1_minimumCategory = field_1_minimumCategory;
216: }
217:
218: /**
219: * Get the maximum category field for the AxisOptions record.
220: */
221: public short getMaximumCategory() {
222: return field_2_maximumCategory;
223: }
224:
225: /**
226: * Set the maximum category field for the AxisOptions record.
227: */
228: public void setMaximumCategory(short field_2_maximumCategory) {
229: this .field_2_maximumCategory = field_2_maximumCategory;
230: }
231:
232: /**
233: * Get the major unit value field for the AxisOptions record.
234: */
235: public short getMajorUnitValue() {
236: return field_3_majorUnitValue;
237: }
238:
239: /**
240: * Set the major unit value field for the AxisOptions record.
241: */
242: public void setMajorUnitValue(short field_3_majorUnitValue) {
243: this .field_3_majorUnitValue = field_3_majorUnitValue;
244: }
245:
246: /**
247: * Get the major unit field for the AxisOptions record.
248: */
249: public short getMajorUnit() {
250: return field_4_majorUnit;
251: }
252:
253: /**
254: * Set the major unit field for the AxisOptions record.
255: */
256: public void setMajorUnit(short field_4_majorUnit) {
257: this .field_4_majorUnit = field_4_majorUnit;
258: }
259:
260: /**
261: * Get the minor unit value field for the AxisOptions record.
262: */
263: public short getMinorUnitValue() {
264: return field_5_minorUnitValue;
265: }
266:
267: /**
268: * Set the minor unit value field for the AxisOptions record.
269: */
270: public void setMinorUnitValue(short field_5_minorUnitValue) {
271: this .field_5_minorUnitValue = field_5_minorUnitValue;
272: }
273:
274: /**
275: * Get the minor unit field for the AxisOptions record.
276: */
277: public short getMinorUnit() {
278: return field_6_minorUnit;
279: }
280:
281: /**
282: * Set the minor unit field for the AxisOptions record.
283: */
284: public void setMinorUnit(short field_6_minorUnit) {
285: this .field_6_minorUnit = field_6_minorUnit;
286: }
287:
288: /**
289: * Get the base unit field for the AxisOptions record.
290: */
291: public short getBaseUnit() {
292: return field_7_baseUnit;
293: }
294:
295: /**
296: * Set the base unit field for the AxisOptions record.
297: */
298: public void setBaseUnit(short field_7_baseUnit) {
299: this .field_7_baseUnit = field_7_baseUnit;
300: }
301:
302: /**
303: * Get the crossing point field for the AxisOptions record.
304: */
305: public short getCrossingPoint() {
306: return field_8_crossingPoint;
307: }
308:
309: /**
310: * Set the crossing point field for the AxisOptions record.
311: */
312: public void setCrossingPoint(short field_8_crossingPoint) {
313: this .field_8_crossingPoint = field_8_crossingPoint;
314: }
315:
316: /**
317: * Get the options field for the AxisOptions record.
318: */
319: public short getOptions() {
320: return field_9_options;
321: }
322:
323: /**
324: * Set the options field for the AxisOptions record.
325: */
326: public void setOptions(short field_9_options) {
327: this .field_9_options = field_9_options;
328: }
329:
330: /**
331: * Sets the default minimum field value.
332: * use the default minimum category
333: */
334: public void setDefaultMinimum(boolean value) {
335: field_9_options = defaultMinimum.setShortBoolean(
336: field_9_options, value);
337: }
338:
339: /**
340: * use the default minimum category
341: * @return the default minimum field value.
342: */
343: public boolean isDefaultMinimum() {
344: return defaultMinimum.isSet(field_9_options);
345: }
346:
347: /**
348: * Sets the default maximum field value.
349: * use the default maximum category
350: */
351: public void setDefaultMaximum(boolean value) {
352: field_9_options = defaultMaximum.setShortBoolean(
353: field_9_options, value);
354: }
355:
356: /**
357: * use the default maximum category
358: * @return the default maximum field value.
359: */
360: public boolean isDefaultMaximum() {
361: return defaultMaximum.isSet(field_9_options);
362: }
363:
364: /**
365: * Sets the default major field value.
366: * use the default major unit
367: */
368: public void setDefaultMajor(boolean value) {
369: field_9_options = defaultMajor.setShortBoolean(field_9_options,
370: value);
371: }
372:
373: /**
374: * use the default major unit
375: * @return the default major field value.
376: */
377: public boolean isDefaultMajor() {
378: return defaultMajor.isSet(field_9_options);
379: }
380:
381: /**
382: * Sets the default minor unit field value.
383: * use the default minor unit
384: */
385: public void setDefaultMinorUnit(boolean value) {
386: field_9_options = defaultMinorUnit.setShortBoolean(
387: field_9_options, value);
388: }
389:
390: /**
391: * use the default minor unit
392: * @return the default minor unit field value.
393: */
394: public boolean isDefaultMinorUnit() {
395: return defaultMinorUnit.isSet(field_9_options);
396: }
397:
398: /**
399: * Sets the isDate field value.
400: * this is a date axis
401: */
402: public void setIsDate(boolean value) {
403: field_9_options = isDate
404: .setShortBoolean(field_9_options, value);
405: }
406:
407: /**
408: * this is a date axis
409: * @return the isDate field value.
410: */
411: public boolean isIsDate() {
412: return isDate.isSet(field_9_options);
413: }
414:
415: /**
416: * Sets the default base field value.
417: * use the default base unit
418: */
419: public void setDefaultBase(boolean value) {
420: field_9_options = defaultBase.setShortBoolean(field_9_options,
421: value);
422: }
423:
424: /**
425: * use the default base unit
426: * @return the default base field value.
427: */
428: public boolean isDefaultBase() {
429: return defaultBase.isSet(field_9_options);
430: }
431:
432: /**
433: * Sets the default cross field value.
434: * use the default crossing point
435: */
436: public void setDefaultCross(boolean value) {
437: field_9_options = defaultCross.setShortBoolean(field_9_options,
438: value);
439: }
440:
441: /**
442: * use the default crossing point
443: * @return the default cross field value.
444: */
445: public boolean isDefaultCross() {
446: return defaultCross.isSet(field_9_options);
447: }
448:
449: /**
450: * Sets the default date settings field value.
451: * use default date setttings for this axis
452: */
453: public void setDefaultDateSettings(boolean value) {
454: field_9_options = defaultDateSettings.setShortBoolean(
455: field_9_options, value);
456: }
457:
458: /**
459: * use default date setttings for this axis
460: * @return the default date settings field value.
461: */
462: public boolean isDefaultDateSettings() {
463: return defaultDateSettings.isSet(field_9_options);
464: }
465:
466: } // END OF CLASS
|