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 series record describes the overall data for a series.
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 SeriesRecord extends Record {
030: public final static short sid = 0x1003;
031: private short field_1_categoryDataType;
032: public final static short CATEGORY_DATA_TYPE_DATES = 0;
033: public final static short CATEGORY_DATA_TYPE_NUMERIC = 1;
034: public final static short CATEGORY_DATA_TYPE_SEQUENCE = 2;
035: public final static short CATEGORY_DATA_TYPE_TEXT = 3;
036: private short field_2_valuesDataType;
037: public final static short VALUES_DATA_TYPE_DATES = 0;
038: public final static short VALUES_DATA_TYPE_NUMERIC = 1;
039: public final static short VALUES_DATA_TYPE_SEQUENCE = 2;
040: public final static short VALUES_DATA_TYPE_TEXT = 3;
041: private short field_3_numCategories;
042: private short field_4_numValues;
043: private short field_5_bubbleSeriesType;
044: public final static short BUBBLE_SERIES_TYPE_DATES = 0;
045: public final static short BUBBLE_SERIES_TYPE_NUMERIC = 1;
046: public final static short BUBBLE_SERIES_TYPE_SEQUENCE = 2;
047: public final static short BUBBLE_SERIES_TYPE_TEXT = 3;
048: private short field_6_numBubbleValues;
049:
050: public SeriesRecord() {
051:
052: }
053:
054: /**
055: * Constructs a Series record and sets its fields appropriately.
056: *
057: * @param in the RecordInputstream to read the record from
058: */
059:
060: public SeriesRecord(RecordInputStream in) {
061: super (in);
062:
063: }
064:
065: /**
066: * Checks the sid matches the expected side for this record
067: *
068: * @param id the expected sid.
069: */
070: protected void validateSid(short id) {
071: if (id != sid) {
072: throw new RecordFormatException("Not a Series record");
073: }
074: }
075:
076: protected void fillFields(RecordInputStream in) {
077: field_1_categoryDataType = in.readShort();
078: field_2_valuesDataType = in.readShort();
079: field_3_numCategories = in.readShort();
080: field_4_numValues = in.readShort();
081: field_5_bubbleSeriesType = in.readShort();
082: field_6_numBubbleValues = in.readShort();
083:
084: }
085:
086: public String toString() {
087: StringBuffer buffer = new StringBuffer();
088:
089: buffer.append("[SERIES]\n");
090: buffer.append(" .categoryDataType = ").append("0x")
091: .append(HexDump.toHex(getCategoryDataType())).append(
092: " (").append(getCategoryDataType())
093: .append(" )");
094: buffer.append(System.getProperty("line.separator"));
095: buffer.append(" .valuesDataType = ").append("0x")
096: .append(HexDump.toHex(getValuesDataType()))
097: .append(" (").append(getValuesDataType()).append(" )");
098: buffer.append(System.getProperty("line.separator"));
099: buffer.append(" .numCategories = ").append("0x")
100: .append(HexDump.toHex(getNumCategories())).append(" (")
101: .append(getNumCategories()).append(" )");
102: buffer.append(System.getProperty("line.separator"));
103: buffer.append(" .numValues = ").append("0x")
104: .append(HexDump.toHex(getNumValues())).append(" (")
105: .append(getNumValues()).append(" )");
106: buffer.append(System.getProperty("line.separator"));
107: buffer.append(" .bubbleSeriesType = ").append("0x")
108: .append(HexDump.toHex(getBubbleSeriesType())).append(
109: " (").append(getBubbleSeriesType())
110: .append(" )");
111: buffer.append(System.getProperty("line.separator"));
112: buffer.append(" .numBubbleValues = ").append("0x")
113: .append(HexDump.toHex(getNumBubbleValues())).append(
114: " (").append(getNumBubbleValues()).append(" )");
115: buffer.append(System.getProperty("line.separator"));
116:
117: buffer.append("[/SERIES]\n");
118: return buffer.toString();
119: }
120:
121: public int serialize(int offset, byte[] data) {
122: int pos = 0;
123:
124: LittleEndian.putShort(data, 0 + offset, sid);
125: LittleEndian.putShort(data, 2 + offset,
126: (short) (getRecordSize() - 4));
127:
128: LittleEndian.putShort(data, 4 + offset + pos,
129: field_1_categoryDataType);
130: LittleEndian.putShort(data, 6 + offset + pos,
131: field_2_valuesDataType);
132: LittleEndian.putShort(data, 8 + offset + pos,
133: field_3_numCategories);
134: LittleEndian.putShort(data, 10 + offset + pos,
135: field_4_numValues);
136: LittleEndian.putShort(data, 12 + offset + pos,
137: field_5_bubbleSeriesType);
138: LittleEndian.putShort(data, 14 + offset + pos,
139: field_6_numBubbleValues);
140:
141: return getRecordSize();
142: }
143:
144: /**
145: * Size of record (exluding 4 byte header)
146: */
147: public int getRecordSize() {
148: return 4 + 2 + 2 + 2 + 2 + 2 + 2;
149: }
150:
151: public short getSid() {
152: return sid;
153: }
154:
155: public Object clone() {
156: SeriesRecord rec = new SeriesRecord();
157:
158: rec.field_1_categoryDataType = field_1_categoryDataType;
159: rec.field_2_valuesDataType = field_2_valuesDataType;
160: rec.field_3_numCategories = field_3_numCategories;
161: rec.field_4_numValues = field_4_numValues;
162: rec.field_5_bubbleSeriesType = field_5_bubbleSeriesType;
163: rec.field_6_numBubbleValues = field_6_numBubbleValues;
164: return rec;
165: }
166:
167: /**
168: * Get the category data type field for the Series record.
169: *
170: * @return One of
171: * CATEGORY_DATA_TYPE_DATES
172: * CATEGORY_DATA_TYPE_NUMERIC
173: * CATEGORY_DATA_TYPE_SEQUENCE
174: * CATEGORY_DATA_TYPE_TEXT
175: */
176: public short getCategoryDataType() {
177: return field_1_categoryDataType;
178: }
179:
180: /**
181: * Set the category data type field for the Series record.
182: *
183: * @param field_1_categoryDataType
184: * One of
185: * CATEGORY_DATA_TYPE_DATES
186: * CATEGORY_DATA_TYPE_NUMERIC
187: * CATEGORY_DATA_TYPE_SEQUENCE
188: * CATEGORY_DATA_TYPE_TEXT
189: */
190: public void setCategoryDataType(short field_1_categoryDataType) {
191: this .field_1_categoryDataType = field_1_categoryDataType;
192: }
193:
194: /**
195: * Get the values data type field for the Series record.
196: *
197: * @return One of
198: * VALUES_DATA_TYPE_DATES
199: * VALUES_DATA_TYPE_NUMERIC
200: * VALUES_DATA_TYPE_SEQUENCE
201: * VALUES_DATA_TYPE_TEXT
202: */
203: public short getValuesDataType() {
204: return field_2_valuesDataType;
205: }
206:
207: /**
208: * Set the values data type field for the Series record.
209: *
210: * @param field_2_valuesDataType
211: * One of
212: * VALUES_DATA_TYPE_DATES
213: * VALUES_DATA_TYPE_NUMERIC
214: * VALUES_DATA_TYPE_SEQUENCE
215: * VALUES_DATA_TYPE_TEXT
216: */
217: public void setValuesDataType(short field_2_valuesDataType) {
218: this .field_2_valuesDataType = field_2_valuesDataType;
219: }
220:
221: /**
222: * Get the num categories field for the Series record.
223: */
224: public short getNumCategories() {
225: return field_3_numCategories;
226: }
227:
228: /**
229: * Set the num categories field for the Series record.
230: */
231: public void setNumCategories(short field_3_numCategories) {
232: this .field_3_numCategories = field_3_numCategories;
233: }
234:
235: /**
236: * Get the num values field for the Series record.
237: */
238: public short getNumValues() {
239: return field_4_numValues;
240: }
241:
242: /**
243: * Set the num values field for the Series record.
244: */
245: public void setNumValues(short field_4_numValues) {
246: this .field_4_numValues = field_4_numValues;
247: }
248:
249: /**
250: * Get the bubble series type field for the Series record.
251: *
252: * @return One of
253: * BUBBLE_SERIES_TYPE_DATES
254: * BUBBLE_SERIES_TYPE_NUMERIC
255: * BUBBLE_SERIES_TYPE_SEQUENCE
256: * BUBBLE_SERIES_TYPE_TEXT
257: */
258: public short getBubbleSeriesType() {
259: return field_5_bubbleSeriesType;
260: }
261:
262: /**
263: * Set the bubble series type field for the Series record.
264: *
265: * @param field_5_bubbleSeriesType
266: * One of
267: * BUBBLE_SERIES_TYPE_DATES
268: * BUBBLE_SERIES_TYPE_NUMERIC
269: * BUBBLE_SERIES_TYPE_SEQUENCE
270: * BUBBLE_SERIES_TYPE_TEXT
271: */
272: public void setBubbleSeriesType(short field_5_bubbleSeriesType) {
273: this .field_5_bubbleSeriesType = field_5_bubbleSeriesType;
274: }
275:
276: /**
277: * Get the num bubble values field for the Series record.
278: */
279: public short getNumBubbleValues() {
280: return field_6_numBubbleValues;
281: }
282:
283: /**
284: * Set the num bubble values field for the Series record.
285: */
286: public void setNumBubbleValues(short field_6_numBubbleValues) {
287: this .field_6_numBubbleValues = field_6_numBubbleValues;
288: }
289:
290: } // END OF CLASS
|