1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.v10.cea;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import java.util.ArrayList;
19 import java.util.Enumeration;
20 import org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition;
21 import org.exolab.castor.xml.MarshalException;
22 import org.exolab.castor.xml.Marshaller;
23 import org.exolab.castor.xml.Unmarshaller;
24 import org.exolab.castor.xml.ValidationException;
25 import org.xml.sax.ContentHandler;
26
27 /***
28 * Class Parameters.
29 *
30 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:31 $
31 */
32 public class Parameters extends org.astrogrid.common.bean.BaseBean
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * Field _parameterDefinitionList
43 */
44 private java.util.ArrayList _parameterDefinitionList;
45
46
47
48
49
50
51 public Parameters() {
52 super();
53 _parameterDefinitionList = new ArrayList();
54 }
55
56
57
58
59
60
61 /***
62 * Method addParameterDefinition
63 *
64 * @param vParameterDefinition
65 */
66 public void addParameterDefinition(org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition vParameterDefinition)
67 throws java.lang.IndexOutOfBoundsException
68 {
69 _parameterDefinitionList.add(vParameterDefinition);
70 }
71
72 /***
73 * Method addParameterDefinition
74 *
75 * @param index
76 * @param vParameterDefinition
77 */
78 public void addParameterDefinition(int index, org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition vParameterDefinition)
79 throws java.lang.IndexOutOfBoundsException
80 {
81 _parameterDefinitionList.add(index, vParameterDefinition);
82 }
83
84 /***
85 * Method clearParameterDefinition
86 */
87 public void clearParameterDefinition()
88 {
89 _parameterDefinitionList.clear();
90 }
91
92 /***
93 * Method enumerateParameterDefinition
94 */
95 public java.util.Enumeration enumerateParameterDefinition()
96 {
97 return new org.exolab.castor.util.IteratorEnumeration(_parameterDefinitionList.iterator());
98 }
99
100 /***
101 * Note: hashCode() has not been overriden
102 *
103 * @param obj
104 */
105 public boolean equals(java.lang.Object obj)
106 {
107 if ( this == obj )
108 return true;
109
110 if (super.equals(obj)==false)
111 return false;
112
113 if (obj instanceof Parameters) {
114
115 Parameters temp = (Parameters)obj;
116 if (this._parameterDefinitionList != null) {
117 if (temp._parameterDefinitionList == null) return false;
118 else if (!(this._parameterDefinitionList.equals(temp._parameterDefinitionList)))
119 return false;
120 }
121 else if (temp._parameterDefinitionList != null)
122 return false;
123 return true;
124 }
125 return false;
126 }
127
128 /***
129 * Method getParameterDefinition
130 *
131 * @param index
132 */
133 public org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition getParameterDefinition(int index)
134 throws java.lang.IndexOutOfBoundsException
135 {
136
137 if ((index < 0) || (index > _parameterDefinitionList.size())) {
138 throw new IndexOutOfBoundsException();
139 }
140
141 return (org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition) _parameterDefinitionList.get(index);
142 }
143
144 /***
145 * Method getParameterDefinition
146 */
147 public org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition[] getParameterDefinition()
148 {
149 int size = _parameterDefinitionList.size();
150 org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition[] mArray = new org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition[size];
151 for (int index = 0; index < size; index++) {
152 mArray[index] = (org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition) _parameterDefinitionList.get(index);
153 }
154 return mArray;
155 }
156
157 /***
158 * Method getParameterDefinitionCount
159 */
160 public int getParameterDefinitionCount()
161 {
162 return _parameterDefinitionList.size();
163 }
164
165 /***
166 * Method isValid
167 */
168 public boolean isValid()
169 {
170 try {
171 validate();
172 }
173 catch (org.exolab.castor.xml.ValidationException vex) {
174 return false;
175 }
176 return true;
177 }
178
179 /***
180 * Method marshal
181 *
182 * @param out
183 */
184 public void marshal(java.io.Writer out)
185 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
186 {
187
188 Marshaller.marshal(this, out);
189 }
190
191 /***
192 * Method marshal
193 *
194 * @param handler
195 */
196 public void marshal(org.xml.sax.ContentHandler handler)
197 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
198 {
199
200 Marshaller.marshal(this, handler);
201 }
202
203 /***
204 * Method removeParameterDefinition
205 *
206 * @param vParameterDefinition
207 */
208 public boolean removeParameterDefinition(org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition vParameterDefinition)
209 {
210 boolean removed = _parameterDefinitionList.remove(vParameterDefinition);
211 return removed;
212 }
213
214 /***
215 * Method setParameterDefinition
216 *
217 * @param index
218 * @param vParameterDefinition
219 */
220 public void setParameterDefinition(int index, org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition vParameterDefinition)
221 throws java.lang.IndexOutOfBoundsException
222 {
223
224 if ((index < 0) || (index > _parameterDefinitionList.size())) {
225 throw new IndexOutOfBoundsException();
226 }
227 _parameterDefinitionList.set(index, vParameterDefinition);
228 }
229
230 /***
231 * Method setParameterDefinition
232 *
233 * @param parameterDefinitionArray
234 */
235 public void setParameterDefinition(org.astrogrid.applications.beans.v1.parameters.BaseParameterDefinition[] parameterDefinitionArray)
236 {
237
238 _parameterDefinitionList.clear();
239 for (int i = 0; i < parameterDefinitionArray.length; i++) {
240 _parameterDefinitionList.add(parameterDefinitionArray[i]);
241 }
242 }
243
244 /***
245 * Method unmarshalParameters
246 *
247 * @param reader
248 */
249 public static org.astrogrid.registry.beans.v10.cea.Parameters unmarshalParameters(java.io.Reader reader)
250 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
251 {
252 return (org.astrogrid.registry.beans.v10.cea.Parameters) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.cea.Parameters.class, reader);
253 }
254
255 /***
256 * Method validate
257 */
258 public void validate()
259 throws org.exolab.castor.xml.ValidationException
260 {
261 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
262 validator.validate(this);
263 }
264
265 }