View Javadoc

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