1
2
3
4
5
6
7
8 package org.exolab.castor.tests.framework.testDescriptor;
9
10
11
12
13
14
15 public class ExpectedSources implements java.io.Serializable {
16
17
18
19
20
21
22
23
24
25 private java.util.List _expectedSourceList;
26
27
28
29
30
31
32 public ExpectedSources() {
33 super();
34 this._expectedSourceList = new java.util.ArrayList();
35 }
36
37
38
39
40
41
42
43
44
45
46
47
48
49 public void addExpectedSource(
50 final java.lang.String vExpectedSource)
51 throws java.lang.IndexOutOfBoundsException {
52 this._expectedSourceList.add(vExpectedSource);
53 }
54
55
56
57
58
59
60
61
62
63 public void addExpectedSource(
64 final int index,
65 final java.lang.String vExpectedSource)
66 throws java.lang.IndexOutOfBoundsException {
67 this._expectedSourceList.add(index, vExpectedSource);
68 }
69
70
71
72
73
74
75
76 public java.util.Enumeration enumerateExpectedSource(
77 ) {
78 return java.util.Collections.enumeration(this._expectedSourceList);
79 }
80
81
82
83
84
85
86
87
88
89 public java.lang.String getExpectedSource(
90 final int index)
91 throws java.lang.IndexOutOfBoundsException {
92
93 if (index < 0 || index >= this._expectedSourceList.size()) {
94 throw new IndexOutOfBoundsException("getExpectedSource: Index value '" + index + "' not in range [0.." + (this._expectedSourceList.size() - 1) + "]");
95 }
96
97 return (java.lang.String) _expectedSourceList.get(index);
98 }
99
100
101
102
103
104
105
106
107
108
109
110 public java.lang.String[] getExpectedSource(
111 ) {
112 java.lang.String[] array = new java.lang.String[0];
113 return (java.lang.String[]) this._expectedSourceList.toArray(array);
114 }
115
116
117
118
119
120
121 public int getExpectedSourceCount(
122 ) {
123 return this._expectedSourceList.size();
124 }
125
126
127
128
129
130
131 public boolean isValid(
132 ) {
133 try {
134 validate();
135 } catch (org.exolab.castor.xml.ValidationException vex) {
136 return false;
137 }
138 return true;
139 }
140
141
142
143
144
145
146
147 public java.util.Iterator iterateExpectedSource(
148 ) {
149 return this._expectedSourceList.iterator();
150 }
151
152
153
154
155
156
157
158
159
160
161 public void marshal(
162 final java.io.Writer out)
163 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
164 org.exolab.castor.xml.Marshaller.marshal(this, out);
165 }
166
167
168
169
170
171
172
173
174
175
176
177
178 public void marshal(
179 final org.xml.sax.ContentHandler handler)
180 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
181 org.exolab.castor.xml.Marshaller.marshal(this, handler);
182 }
183
184
185
186 public void removeAllExpectedSource(
187 ) {
188 this._expectedSourceList.clear();
189 }
190
191
192
193
194
195
196
197 public boolean removeExpectedSource(
198 final java.lang.String vExpectedSource) {
199 boolean removed = _expectedSourceList.remove(vExpectedSource);
200 return removed;
201 }
202
203
204
205
206
207
208
209 public java.lang.String removeExpectedSourceAt(
210 final int index) {
211 java.lang.Object obj = this._expectedSourceList.remove(index);
212 return (java.lang.String) obj;
213 }
214
215
216
217
218
219
220
221
222
223 public void setExpectedSource(
224 final int index,
225 final java.lang.String vExpectedSource)
226 throws java.lang.IndexOutOfBoundsException {
227
228 if (index < 0 || index >= this._expectedSourceList.size()) {
229 throw new IndexOutOfBoundsException("setExpectedSource: Index value '" + index + "' not in range [0.." + (this._expectedSourceList.size() - 1) + "]");
230 }
231
232 this._expectedSourceList.set(index, vExpectedSource);
233 }
234
235
236
237
238
239
240 public void setExpectedSource(
241 final java.lang.String[] vExpectedSourceArray) {
242
243 _expectedSourceList.clear();
244
245 for (int i = 0; i < vExpectedSourceArray.length; i++) {
246 this._expectedSourceList.add(vExpectedSourceArray[i]);
247 }
248 }
249
250
251
252
253
254
255
256
257
258
259
260
261 public static org.exolab.castor.tests.framework.testDescriptor.ExpectedSources unmarshal(
262 final java.io.Reader reader)
263 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
264 return (org.exolab.castor.tests.framework.testDescriptor.ExpectedSources) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.tests.framework.testDescriptor.ExpectedSources.class, reader);
265 }
266
267
268
269
270
271
272
273 public void validate(
274 )
275 throws org.exolab.castor.xml.ValidationException {
276 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
277 validator.validate(this);
278 }
279
280 }