KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > record > SeriesListRecord


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19
20 package org.apache.poi.hssf.record;
21
22
23
24 import org.apache.poi.util.*;
25
26 /**
27  * The series list record defines the series displayed as an overlay to the main chart record.
28  * NOTE: This source is automatically generated please do not modify this file. Either subclass or
29  * remove the record in src/records/definitions.
30
31  * @author Glen Stampoultzis (glens at apache.org)
32  */

33 public class SeriesListRecord
34     extends Record
35 {
36     public final static short sid = 0x1016;
37     private short[] field_1_seriesNumbers;
38
39
40     public SeriesListRecord()
41     {
42
43     }
44
45     /**
46      * Constructs a SeriesList record and sets its fields appropriately.
47      *
48      * @param id id must be 0x1016 or an exception
49      * will be throw upon validation
50      * @param size size the size of the data area of the record
51      * @param data data of the record (should not contain sid/len)
52      */

53
54     public SeriesListRecord(short id, short size, byte [] data)
55     {
56         super(id, size, data);
57     
58     }
59
60     /**
61      * Constructs a SeriesList record and sets its fields appropriately.
62      *
63      * @param id id must be 0x1016 or an exception
64      * will be throw upon validation
65      * @param size size the size of the data area of the record
66      * @param data data of the record (should not contain sid/len)
67      * @param offset of the record's data
68      */

69
70     public SeriesListRecord(short id, short size, byte [] data, int offset)
71     {
72         super(id, size, data, offset);
73     
74     }
75
76     /**
77      * Checks the sid matches the expected side for this record
78      *
79      * @param id the expected sid.
80      */

81     protected void validateSid(short id)
82     {
83         if (id != sid)
84         {
85             throw new RecordFormatException("Not a SeriesList record");
86         }
87     }
88
89     protected void fillFields(byte [] data, short size, int offset)
90     {
91
92         int pos = 0;
93         field_1_seriesNumbers = LittleEndian.getShortArray(data, pos + 0x0 + offset);
94
95     }
96
97     public String JavaDoc toString()
98     {
99         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
100
101         buffer.append("[SERIESLIST]\n");
102         buffer.append(" .seriesNumbers = ")
103             .append(" (").append( getSeriesNumbers() ).append(" )");
104         buffer.append(System.getProperty("line.separator"));
105
106         buffer.append("[/SERIESLIST]\n");
107         return buffer.toString();
108     }
109
110     public int serialize(int offset, byte[] data)
111     {
112         int pos = 0;
113
114         LittleEndian.putShort(data, 0 + offset, sid);
115         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
116
117         LittleEndian.putShortArray(data, 4 + offset + pos, field_1_seriesNumbers);
118
119         return getRecordSize();
120     }
121
122     /**
123      * Size of record (exluding 4 byte header)
124      */

125     public int getRecordSize()
126     {
127         return 4 + field_1_seriesNumbers.length * 2 + 2;
128     }
129
130     public short getSid()
131     {
132         return this.sid;
133     }
134
135     public Object JavaDoc clone() {
136         SeriesListRecord rec = new SeriesListRecord();
137     
138         rec.field_1_seriesNumbers = field_1_seriesNumbers;
139         return rec;
140     }
141
142
143
144
145     /**
146      * Get the series numbers field for the SeriesList record.
147      */

148     public short[] getSeriesNumbers()
149     {
150         return field_1_seriesNumbers;
151     }
152
153     /**
154      * Set the series numbers field for the SeriesList record.
155      */

156     public void setSeriesNumbers(short[] field_1_seriesNumbers)
157     {
158         this.field_1_seriesNumbers = field_1_seriesNumbers;
159     }
160
161
162 } // END OF CLASS
163

164
165
166
167
Popular Tags