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: * links a series to its position in the series list.
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 SeriesIndexRecord extends Record {
030: public final static short sid = 0x1065;
031: private short field_1_index;
032:
033: public SeriesIndexRecord() {
034:
035: }
036:
037: /**
038: * Constructs a SeriesIndex record and sets its fields appropriately.
039: *
040: * @param in the RecordInputstream to read the record from
041: */
042:
043: public SeriesIndexRecord(RecordInputStream in) {
044: super (in);
045:
046: }
047:
048: /**
049: * Checks the sid matches the expected side for this record
050: *
051: * @param id the expected sid.
052: */
053: protected void validateSid(short id) {
054: if (id != sid) {
055: throw new RecordFormatException("Not a SeriesIndex record");
056: }
057: }
058:
059: protected void fillFields(RecordInputStream in) {
060: field_1_index = in.readShort();
061: }
062:
063: public String toString() {
064: StringBuffer buffer = new StringBuffer();
065:
066: buffer.append("[SINDEX]\n");
067: buffer.append(" .index = ").append("0x")
068: .append(HexDump.toHex(getIndex())).append(" (").append(
069: getIndex()).append(" )");
070: buffer.append(System.getProperty("line.separator"));
071:
072: buffer.append("[/SINDEX]\n");
073: return buffer.toString();
074: }
075:
076: public int serialize(int offset, byte[] data) {
077: int pos = 0;
078:
079: LittleEndian.putShort(data, 0 + offset, sid);
080: LittleEndian.putShort(data, 2 + offset,
081: (short) (getRecordSize() - 4));
082:
083: LittleEndian.putShort(data, 4 + offset + pos, field_1_index);
084:
085: return getRecordSize();
086: }
087:
088: /**
089: * Size of record (exluding 4 byte header)
090: */
091: public int getRecordSize() {
092: return 4 + 2;
093: }
094:
095: public short getSid() {
096: return sid;
097: }
098:
099: public Object clone() {
100: SeriesIndexRecord rec = new SeriesIndexRecord();
101:
102: rec.field_1_index = field_1_index;
103: return rec;
104: }
105:
106: /**
107: * Get the index field for the SeriesIndex record.
108: */
109: public short getIndex() {
110: return field_1_index;
111: }
112:
113: /**
114: * Set the index field for the SeriesIndex record.
115: */
116: public void setIndex(short field_1_index) {
117: this .field_1_index = field_1_index;
118: }
119:
120: } // END OF CLASS
|