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