1 /*
2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1.2.1</a>, using an XML
4 * Schema.
5 * $Id$
6 */
7
8 package org.sourceforge.mbeanmonitoring.report.castor;
9
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18 * Class Stat.
19 *
20 * @version $Revision$ $Date$
21 */
22 public class Stat implements java.io.Serializable {
23
24
25 //--------------------------/
26 //- Class/Member Variables -/
27 //--------------------------/
28
29 /**
30 * Field _name.
31 */
32 private java.lang.String _name;
33
34 /**
35 * Field _methodStatList.
36 */
37 private java.util.Vector _methodStatList;
38
39
40 //----------------/
41 //- Constructors -/
42 //----------------/
43
44 public Stat() {
45 super();
46 this._methodStatList = new java.util.Vector();
47 }
48
49
50 //-----------/
51 //- Methods -/
52 //-----------/
53
54 /**
55 *
56 *
57 * @param vMethodStat
58 * @throws java.lang.IndexOutOfBoundsException if the index
59 * given is outside the bounds of the collection
60 */
61 public void addMethodStat(
62 final org.sourceforge.mbeanmonitoring.report.castor.MethodStat vMethodStat)
63 throws java.lang.IndexOutOfBoundsException {
64 this._methodStatList.addElement(vMethodStat);
65 }
66
67 /**
68 *
69 *
70 * @param index
71 * @param vMethodStat
72 * @throws java.lang.IndexOutOfBoundsException if the index
73 * given is outside the bounds of the collection
74 */
75 public void addMethodStat(
76 final int index,
77 final org.sourceforge.mbeanmonitoring.report.castor.MethodStat vMethodStat)
78 throws java.lang.IndexOutOfBoundsException {
79 this._methodStatList.add(index, vMethodStat);
80 }
81
82 /**
83 * Method enumerateMethodStat.
84 *
85 * @return an Enumeration over all
86 * org.sourceforge.mbeanmonitoring.report.castor.MethodStat
87 * elements
88 */
89 public java.util.Enumeration enumerateMethodStat(
90 ) {
91 return this._methodStatList.elements();
92 }
93
94 /**
95 * Method getMethodStat.
96 *
97 * @param index
98 * @throws java.lang.IndexOutOfBoundsException if the index
99 * given is outside the bounds of the collection
100 * @return the value of the
101 * org.sourceforge.mbeanmonitoring.report.castor.MethodStat at
102 * the given index
103 */
104 public org.sourceforge.mbeanmonitoring.report.castor.MethodStat getMethodStat(
105 final int index)
106 throws java.lang.IndexOutOfBoundsException {
107 // check bounds for index
108 if (index < 0 || index >= this._methodStatList.size()) {
109 throw new IndexOutOfBoundsException("getMethodStat: Index value '" + index + "' not in range [0.." + (this._methodStatList.size() - 1) + "]");
110 }
111
112 return (org.sourceforge.mbeanmonitoring.report.castor.MethodStat) _methodStatList.get(index);
113 }
114
115 /**
116 * Method getMethodStat.Returns the contents of the collection
117 * in an Array. <p>Note: Just in case the collection contents
118 * are changing in another thread, we pass a 0-length Array of
119 * the correct type into the API call. This way we <i>know</i>
120 * that the Array returned is of exactly the correct length.
121 *
122 * @return this collection as an Array
123 */
124 public org.sourceforge.mbeanmonitoring.report.castor.MethodStat[] getMethodStat(
125 ) {
126 org.sourceforge.mbeanmonitoring.report.castor.MethodStat[] array = new org.sourceforge.mbeanmonitoring.report.castor.MethodStat[0];
127 return (org.sourceforge.mbeanmonitoring.report.castor.MethodStat[]) this._methodStatList.toArray(array);
128 }
129
130 /**
131 * Method getMethodStatCount.
132 *
133 * @return the size of this collection
134 */
135 public int getMethodStatCount(
136 ) {
137 return this._methodStatList.size();
138 }
139
140 /**
141 * Returns the value of field 'name'.
142 *
143 * @return the value of field 'Name'.
144 */
145 public java.lang.String getName(
146 ) {
147 return this._name;
148 }
149
150 /**
151 * Method isValid.
152 *
153 * @return true if this object is valid according to the schema
154 */
155 public boolean isValid(
156 ) {
157 try {
158 validate();
159 } catch (org.exolab.castor.xml.ValidationException vex) {
160 return false;
161 }
162 return true;
163 }
164
165 /**
166 *
167 *
168 * @param out
169 * @throws org.exolab.castor.xml.MarshalException if object is
170 * null or if any SAXException is thrown during marshaling
171 * @throws org.exolab.castor.xml.ValidationException if this
172 * object is an invalid instance according to the schema
173 */
174 public void marshal(
175 final java.io.Writer out)
176 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
177 Marshaller.marshal(this, out);
178 }
179
180 /**
181 *
182 *
183 * @param handler
184 * @throws java.io.IOException if an IOException occurs during
185 * marshaling
186 * @throws org.exolab.castor.xml.ValidationException if this
187 * object is an invalid instance according to the schema
188 * @throws org.exolab.castor.xml.MarshalException if object is
189 * null or if any SAXException is thrown during marshaling
190 */
191 public void marshal(
192 final org.xml.sax.ContentHandler handler)
193 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
194 Marshaller.marshal(this, handler);
195 }
196
197 /**
198 */
199 public void removeAllMethodStat(
200 ) {
201 this._methodStatList.clear();
202 }
203
204 /**
205 * Method removeMethodStat.
206 *
207 * @param vMethodStat
208 * @return true if the object was removed from the collection.
209 */
210 public boolean removeMethodStat(
211 final org.sourceforge.mbeanmonitoring.report.castor.MethodStat vMethodStat) {
212 boolean removed = _methodStatList.remove(vMethodStat);
213 return removed;
214 }
215
216 /**
217 * Method removeMethodStatAt.
218 *
219 * @param index
220 * @return the element removed from the collection
221 */
222 public org.sourceforge.mbeanmonitoring.report.castor.MethodStat removeMethodStatAt(
223 final int index) {
224 java.lang.Object obj = this._methodStatList.remove(index);
225 return (org.sourceforge.mbeanmonitoring.report.castor.MethodStat) obj;
226 }
227
228 /**
229 *
230 *
231 * @param index
232 * @param vMethodStat
233 * @throws java.lang.IndexOutOfBoundsException if the index
234 * given is outside the bounds of the collection
235 */
236 public void setMethodStat(
237 final int index,
238 final org.sourceforge.mbeanmonitoring.report.castor.MethodStat vMethodStat)
239 throws java.lang.IndexOutOfBoundsException {
240 // check bounds for index
241 if (index < 0 || index >= this._methodStatList.size()) {
242 throw new IndexOutOfBoundsException("setMethodStat: Index value '" + index + "' not in range [0.." + (this._methodStatList.size() - 1) + "]");
243 }
244
245 this._methodStatList.set(index, vMethodStat);
246 }
247
248 /**
249 *
250 *
251 * @param vMethodStatArray
252 */
253 public void setMethodStat(
254 final org.sourceforge.mbeanmonitoring.report.castor.MethodStat[] vMethodStatArray) {
255 //-- copy array
256 _methodStatList.clear();
257
258 for (int i = 0; i < vMethodStatArray.length; i++) {
259 this._methodStatList.add(vMethodStatArray[i]);
260 }
261 }
262
263 /**
264 * Sets the value of field 'name'.
265 *
266 * @param name the value of field 'name'.
267 */
268 public void setName(
269 final java.lang.String name) {
270 this._name = name;
271 }
272
273 /**
274 * Method unmarshal.
275 *
276 * @param reader
277 * @throws org.exolab.castor.xml.MarshalException if object is
278 * null or if any SAXException is thrown during marshaling
279 * @throws org.exolab.castor.xml.ValidationException if this
280 * object is an invalid instance according to the schema
281 * @return the unmarshaled
282 * org.sourceforge.mbeanmonitoring.report.castor.Stat
283 */
284 public static org.sourceforge.mbeanmonitoring.report.castor.Stat unmarshal(
285 final java.io.Reader reader)
286 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
287 return (org.sourceforge.mbeanmonitoring.report.castor.Stat) Unmarshaller.unmarshal(org.sourceforge.mbeanmonitoring.report.castor.Stat.class, reader);
288 }
289
290 /**
291 *
292 *
293 * @throws org.exolab.castor.xml.ValidationException if this
294 * object is an invalid instance according to the schema
295 */
296 public void validate(
297 )
298 throws org.exolab.castor.xml.ValidationException {
299 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
300 validator.validate(this);
301 }
302
303 }