View Javadoc
1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package org.exolab.castor.tests.framework.testDescriptor;
9   
10  /**
11   * Class ExpectedSources.
12   * 
13   * @version $Revision$ $Date$
14   */
15  public class ExpectedSources implements java.io.Serializable {
16  
17  
18        //--------------------------/
19       //- Class/Member Variables -/
20      //--------------------------/
21  
22      /**
23       * Field _expectedSourceList.
24       */
25      private java.util.List _expectedSourceList;
26  
27  
28        //----------------/
29       //- Constructors -/
30      //----------------/
31  
32      public ExpectedSources() {
33          super();
34          this._expectedSourceList = new java.util.ArrayList();
35      }
36  
37  
38        //-----------/
39       //- Methods -/
40      //-----------/
41  
42      /**
43       * 
44       * 
45       * @param vExpectedSource
46       * @throws java.lang.IndexOutOfBoundsException if the index
47       * given is outside the bounds of the collection
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       * @param index
59       * @param vExpectedSource
60       * @throws java.lang.IndexOutOfBoundsException if the index
61       * given is outside the bounds of the collection
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       * Method enumerateExpectedSource.
72       * 
73       * @return an Enumeration over all possible elements of this
74       * collection
75       */
76      public java.util.Enumeration enumerateExpectedSource(
77      ) {
78          return java.util.Collections.enumeration(this._expectedSourceList);
79      }
80  
81      /**
82       * Method getExpectedSource.
83       * 
84       * @param index
85       * @throws java.lang.IndexOutOfBoundsException if the index
86       * given is outside the bounds of the collection
87       * @return the value of the java.lang.String at the given index
88       */
89      public java.lang.String getExpectedSource(
90              final int index)
91      throws java.lang.IndexOutOfBoundsException {
92          // check bounds for index
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      * Method getExpectedSource.Returns the contents of the
102      * collection in an Array.  <p>Note:  Just in case the
103      * collection contents are changing in another thread, we pass
104      * a 0-length Array of the correct type into the API call. 
105      * This way we <i>know</i> that the Array returned is of
106      * exactly the correct length.
107      * 
108      * @return this collection as an Array
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      * Method getExpectedSourceCount.
118      * 
119      * @return the size of this collection
120      */
121     public int getExpectedSourceCount(
122     ) {
123         return this._expectedSourceList.size();
124     }
125 
126     /**
127      * Method isValid.
128      * 
129      * @return true if this object is valid according to the schema
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      * Method iterateExpectedSource.
143      * 
144      * @return an Iterator over all possible elements in this
145      * collection
146      */
147     public java.util.Iterator iterateExpectedSource(
148     ) {
149         return this._expectedSourceList.iterator();
150     }
151 
152     /**
153      * 
154      * 
155      * @param out
156      * @throws org.exolab.castor.xml.MarshalException if object is
157      * null or if any SAXException is thrown during marshaling
158      * @throws org.exolab.castor.xml.ValidationException if this
159      * object is an invalid instance according to the schema
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      * @param handler
171      * @throws java.io.IOException if an IOException occurs during
172      * marshaling
173      * @throws org.exolab.castor.xml.ValidationException if this
174      * object is an invalid instance according to the schema
175      * @throws org.exolab.castor.xml.MarshalException if object is
176      * null or if any SAXException is thrown during marshaling
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      * Method removeExpectedSource.
193      * 
194      * @param vExpectedSource
195      * @return true if the object was removed from the collection.
196      */
197     public boolean removeExpectedSource(
198             final java.lang.String vExpectedSource) {
199         boolean removed = _expectedSourceList.remove(vExpectedSource);
200         return removed;
201     }
202 
203     /**
204      * Method removeExpectedSourceAt.
205      * 
206      * @param index
207      * @return the element removed from the collection
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      * @param index
219      * @param vExpectedSource
220      * @throws java.lang.IndexOutOfBoundsException if the index
221      * given is outside the bounds of the collection
222      */
223     public void setExpectedSource(
224             final int index,
225             final java.lang.String vExpectedSource)
226     throws java.lang.IndexOutOfBoundsException {
227         // check bounds for index
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      * @param vExpectedSourceArray
239      */
240     public void setExpectedSource(
241             final java.lang.String[] vExpectedSourceArray) {
242         //-- copy array
243         _expectedSourceList.clear();
244 
245         for (int i = 0; i < vExpectedSourceArray.length; i++) {
246                 this._expectedSourceList.add(vExpectedSourceArray[i]);
247         }
248     }
249 
250     /**
251      * Method unmarshal.
252      * 
253      * @param reader
254      * @throws org.exolab.castor.xml.MarshalException if object is
255      * null or if any SAXException is thrown during marshaling
256      * @throws org.exolab.castor.xml.ValidationException if this
257      * object is an invalid instance according to the schema
258      * @return the unmarshaled
259      * org.exolab.castor.tests.framework.testDescriptor.ExpectedSources
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      * @throws org.exolab.castor.xml.ValidationException if this
271      * object is an invalid instance according to the schema
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 }