1
2
3
4
5
6
7
8 package fr.in2p3.jsaga.adaptor.schema.data.emulator;
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
28
29
30
31 public class DirectoryType extends fr.in2p3.jsaga.adaptor.schema.data.emulator.EntryType
32 implements java.io.Serializable
33 {
34
35
36
37
38
39
40
41
42
43 private java.util.ArrayList _directoryList;
44
45
46
47
48 private java.util.ArrayList _fileList;
49
50
51
52
53
54
55 public DirectoryType()
56 {
57 super();
58 _directoryList = new ArrayList();
59 _fileList = new ArrayList();
60 }
61
62
63
64
65
66
67
68
69
70
71
72
73
74 public void addDirectory(fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory vDirectory)
75 throws java.lang.IndexOutOfBoundsException
76 {
77 _directoryList.add(vDirectory);
78 }
79
80
81
82
83
84
85
86
87
88 public void addDirectory(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory vDirectory)
89 throws java.lang.IndexOutOfBoundsException
90 {
91 _directoryList.add(index, vDirectory);
92 }
93
94
95
96
97
98
99
100
101 public void addFile(fr.in2p3.jsaga.adaptor.schema.data.emulator.File vFile)
102 throws java.lang.IndexOutOfBoundsException
103 {
104 _fileList.add(vFile);
105 }
106
107
108
109
110
111
112
113
114
115 public void addFile(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.File vFile)
116 throws java.lang.IndexOutOfBoundsException
117 {
118 _fileList.add(index, vFile);
119 }
120
121
122
123
124
125 public void clearDirectory()
126 {
127 _directoryList.clear();
128 }
129
130
131
132
133
134 public void clearFile()
135 {
136 _fileList.clear();
137 }
138
139
140
141
142
143
144
145
146 public java.util.Enumeration enumerateDirectory()
147 {
148 return new org.exolab.castor.util.IteratorEnumeration(_directoryList.iterator());
149 }
150
151
152
153
154
155
156
157
158 public java.util.Enumeration enumerateFile()
159 {
160 return new org.exolab.castor.util.IteratorEnumeration(_fileList.iterator());
161 }
162
163
164
165
166
167
168
169
170
171 public fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory getDirectory(int index)
172 throws java.lang.IndexOutOfBoundsException
173 {
174
175 if ((index < 0) || (index > _directoryList.size())) {
176 throw new IndexOutOfBoundsException();
177 }
178
179 return (fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory) _directoryList.get(index);
180 }
181
182
183
184
185
186
187
188
189 public fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory[] getDirectory()
190 {
191 int size = _directoryList.size();
192 fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory[] mArray = new fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory[size];
193 for (int index = 0; index < size; index++) {
194 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory) _directoryList.get(index);
195 }
196 return mArray;
197 }
198
199
200
201
202
203
204
205
206 public int getDirectoryCount()
207 {
208 return _directoryList.size();
209 }
210
211
212
213
214
215
216
217
218
219 public fr.in2p3.jsaga.adaptor.schema.data.emulator.File getFile(int index)
220 throws java.lang.IndexOutOfBoundsException
221 {
222
223 if ((index < 0) || (index > _fileList.size())) {
224 throw new IndexOutOfBoundsException();
225 }
226
227 return (fr.in2p3.jsaga.adaptor.schema.data.emulator.File) _fileList.get(index);
228 }
229
230
231
232
233
234
235
236
237 public fr.in2p3.jsaga.adaptor.schema.data.emulator.File[] getFile()
238 {
239 int size = _fileList.size();
240 fr.in2p3.jsaga.adaptor.schema.data.emulator.File[] mArray = new fr.in2p3.jsaga.adaptor.schema.data.emulator.File[size];
241 for (int index = 0; index < size; index++) {
242 mArray[index] = (fr.in2p3.jsaga.adaptor.schema.data.emulator.File) _fileList.get(index);
243 }
244 return mArray;
245 }
246
247
248
249
250
251
252
253
254 public int getFileCount()
255 {
256 return _fileList.size();
257 }
258
259
260
261
262
263
264
265
266 public boolean isValid()
267 {
268 try {
269 validate();
270 }
271 catch (org.exolab.castor.xml.ValidationException vex) {
272 return false;
273 }
274 return true;
275 }
276
277
278
279
280
281
282
283
284 public void marshal(java.io.Writer out)
285 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
286 {
287
288 Marshaller.marshal(this, out);
289 }
290
291
292
293
294
295
296
297
298 public void marshal(org.xml.sax.ContentHandler handler)
299 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
300 {
301
302 Marshaller.marshal(this, handler);
303 }
304
305
306
307
308
309
310
311
312
313 public boolean removeDirectory(fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory vDirectory)
314 {
315 boolean removed = _directoryList.remove(vDirectory);
316 return removed;
317 }
318
319
320
321
322
323
324
325
326
327 public boolean removeFile(fr.in2p3.jsaga.adaptor.schema.data.emulator.File vFile)
328 {
329 boolean removed = _fileList.remove(vFile);
330 return removed;
331 }
332
333
334
335
336
337
338
339
340
341 public void setDirectory(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory vDirectory)
342 throws java.lang.IndexOutOfBoundsException
343 {
344
345 if ((index < 0) || (index > _directoryList.size())) {
346 throw new IndexOutOfBoundsException();
347 }
348 _directoryList.set(index, vDirectory);
349 }
350
351
352
353
354
355
356
357
358 public void setDirectory(fr.in2p3.jsaga.adaptor.schema.data.emulator.Directory[] directoryArray)
359 {
360
361 _directoryList.clear();
362 for (int i = 0; i < directoryArray.length; i++) {
363 _directoryList.add(directoryArray[i]);
364 }
365 }
366
367
368
369
370
371
372
373
374
375 public void setFile(int index, fr.in2p3.jsaga.adaptor.schema.data.emulator.File vFile)
376 throws java.lang.IndexOutOfBoundsException
377 {
378
379 if ((index < 0) || (index > _fileList.size())) {
380 throw new IndexOutOfBoundsException();
381 }
382 _fileList.set(index, vFile);
383 }
384
385
386
387
388
389
390
391
392 public void setFile(fr.in2p3.jsaga.adaptor.schema.data.emulator.File[] fileArray)
393 {
394
395 _fileList.clear();
396 for (int i = 0; i < fileArray.length; i++) {
397 _fileList.add(fileArray[i]);
398 }
399 }
400
401
402
403
404
405
406
407
408
409 public static java.lang.Object unmarshal(java.io.Reader reader)
410 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
411 {
412 return (fr.in2p3.jsaga.adaptor.schema.data.emulator.DirectoryType) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.data.emulator.DirectoryType.class, reader);
413 }
414
415
416
417
418
419 public void validate()
420 throws org.exolab.castor.xml.ValidationException
421 {
422 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
423 validator.validate(this);
424 }
425
426 }