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: * This record refers to a category or series axis and is used to specify label/tickmark frequency.
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 CategorySeriesAxisRecord extends Record {
030: public final static short sid = 0x1020;
031: private short field_1_crossingPoint;
032: private short field_2_labelFrequency;
033: private short field_3_tickMarkFrequency;
034: private short field_4_options;
035: private BitField valueAxisCrossing = BitFieldFactory
036: .getInstance(0x1);
037: private BitField crossesFarRight = BitFieldFactory.getInstance(0x2);
038: private BitField reversed = BitFieldFactory.getInstance(0x4);
039:
040: public CategorySeriesAxisRecord() {
041:
042: }
043:
044: /**
045: * Constructs a CategorySeriesAxis record and sets its fields appropriately.
046: *
047: * @param in the RecordInputstream to read the record from
048: */
049:
050: public CategorySeriesAxisRecord(RecordInputStream in) {
051: super (in);
052:
053: }
054:
055: /**
056: * Checks the sid matches the expected side for this record
057: *
058: * @param id the expected sid.
059: */
060: protected void validateSid(short id) {
061: if (id != sid) {
062: throw new RecordFormatException(
063: "Not a CategorySeriesAxis record");
064: }
065: }
066:
067: protected void fillFields(RecordInputStream in) {
068: field_1_crossingPoint = in.readShort();
069: field_2_labelFrequency = in.readShort();
070: field_3_tickMarkFrequency = in.readShort();
071: field_4_options = in.readShort();
072: }
073:
074: public String toString() {
075: StringBuffer buffer = new StringBuffer();
076:
077: buffer.append("[CATSERRANGE]\n");
078: buffer.append(" .crossingPoint = ").append("0x")
079: .append(HexDump.toHex(getCrossingPoint())).append(" (")
080: .append(getCrossingPoint()).append(" )");
081: buffer.append(System.getProperty("line.separator"));
082: buffer.append(" .labelFrequency = ").append("0x")
083: .append(HexDump.toHex(getLabelFrequency()))
084: .append(" (").append(getLabelFrequency()).append(" )");
085: buffer.append(System.getProperty("line.separator"));
086: buffer.append(" .tickMarkFrequency = ").append("0x")
087: .append(HexDump.toHex(getTickMarkFrequency())).append(
088: " (").append(getTickMarkFrequency()).append(
089: " )");
090: buffer.append(System.getProperty("line.separator"));
091: buffer.append(" .options = ").append("0x")
092: .append(HexDump.toHex(getOptions())).append(" (")
093: .append(getOptions()).append(" )");
094: buffer.append(System.getProperty("line.separator"));
095: buffer.append(" .valueAxisCrossing = ").append(
096: isValueAxisCrossing()).append('\n');
097: buffer.append(" .crossesFarRight = ").append(
098: isCrossesFarRight()).append('\n');
099: buffer.append(" .reversed = ").append(
100: isReversed()).append('\n');
101:
102: buffer.append("[/CATSERRANGE]\n");
103: return buffer.toString();
104: }
105:
106: public int serialize(int offset, byte[] data) {
107: int pos = 0;
108:
109: LittleEndian.putShort(data, 0 + offset, sid);
110: LittleEndian.putShort(data, 2 + offset,
111: (short) (getRecordSize() - 4));
112:
113: LittleEndian.putShort(data, 4 + offset + pos,
114: field_1_crossingPoint);
115: LittleEndian.putShort(data, 6 + offset + pos,
116: field_2_labelFrequency);
117: LittleEndian.putShort(data, 8 + offset + pos,
118: field_3_tickMarkFrequency);
119: LittleEndian.putShort(data, 10 + offset + pos, field_4_options);
120:
121: return getRecordSize();
122: }
123:
124: /**
125: * Size of record (exluding 4 byte header)
126: */
127: public int getRecordSize() {
128: return 4 + 2 + 2 + 2 + 2;
129: }
130:
131: public short getSid() {
132: return sid;
133: }
134:
135: public Object clone() {
136: CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord();
137:
138: rec.field_1_crossingPoint = field_1_crossingPoint;
139: rec.field_2_labelFrequency = field_2_labelFrequency;
140: rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency;
141: rec.field_4_options = field_4_options;
142: return rec;
143: }
144:
145: /**
146: * Get the crossing point field for the CategorySeriesAxis record.
147: */
148: public short getCrossingPoint() {
149: return field_1_crossingPoint;
150: }
151:
152: /**
153: * Set the crossing point field for the CategorySeriesAxis record.
154: */
155: public void setCrossingPoint(short field_1_crossingPoint) {
156: this .field_1_crossingPoint = field_1_crossingPoint;
157: }
158:
159: /**
160: * Get the label frequency field for the CategorySeriesAxis record.
161: */
162: public short getLabelFrequency() {
163: return field_2_labelFrequency;
164: }
165:
166: /**
167: * Set the label frequency field for the CategorySeriesAxis record.
168: */
169: public void setLabelFrequency(short field_2_labelFrequency) {
170: this .field_2_labelFrequency = field_2_labelFrequency;
171: }
172:
173: /**
174: * Get the tick mark frequency field for the CategorySeriesAxis record.
175: */
176: public short getTickMarkFrequency() {
177: return field_3_tickMarkFrequency;
178: }
179:
180: /**
181: * Set the tick mark frequency field for the CategorySeriesAxis record.
182: */
183: public void setTickMarkFrequency(short field_3_tickMarkFrequency) {
184: this .field_3_tickMarkFrequency = field_3_tickMarkFrequency;
185: }
186:
187: /**
188: * Get the options field for the CategorySeriesAxis record.
189: */
190: public short getOptions() {
191: return field_4_options;
192: }
193:
194: /**
195: * Set the options field for the CategorySeriesAxis record.
196: */
197: public void setOptions(short field_4_options) {
198: this .field_4_options = field_4_options;
199: }
200:
201: /**
202: * Sets the value axis crossing field value.
203: * set true to indicate axis crosses between categories and false to cross axis midway
204: */
205: public void setValueAxisCrossing(boolean value) {
206: field_4_options = valueAxisCrossing.setShortBoolean(
207: field_4_options, value);
208: }
209:
210: /**
211: * set true to indicate axis crosses between categories and false to cross axis midway
212: * @return the value axis crossing field value.
213: */
214: public boolean isValueAxisCrossing() {
215: return valueAxisCrossing.isSet(field_4_options);
216: }
217:
218: /**
219: * Sets the crosses far right field value.
220: * axis crosses at the far right
221: */
222: public void setCrossesFarRight(boolean value) {
223: field_4_options = crossesFarRight.setShortBoolean(
224: field_4_options, value);
225: }
226:
227: /**
228: * axis crosses at the far right
229: * @return the crosses far right field value.
230: */
231: public boolean isCrossesFarRight() {
232: return crossesFarRight.isSet(field_4_options);
233: }
234:
235: /**
236: * Sets the reversed field value.
237: * categories are displayed in reverse order
238: */
239: public void setReversed(boolean value) {
240: field_4_options = reversed.setShortBoolean(field_4_options,
241: value);
242: }
243:
244: /**
245: * categories are displayed in reverse order
246: * @return the reversed field value.
247: */
248: public boolean isReversed() {
249: return reversed.isSet(field_4_options);
250: }
251:
252: } // END OF CLASS
|