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   * Tests a schema.
12   *  
13   * 
14   * @version $Revision$ $Date$
15   */
16  public class SchemaTest implements java.io.Serializable {
17  
18  
19        //--------------------------/
20       //- Class/Member Variables -/
21      //--------------------------/
22  
23      /**
24       * A definition of a single Unit Test testcase.
25       *  
26       */
27      private java.util.List _unitTestCaseList;
28  
29  
30        //----------------/
31       //- Constructors -/
32      //----------------/
33  
34      public SchemaTest() {
35          super();
36          this._unitTestCaseList = new java.util.ArrayList();
37      }
38  
39  
40        //-----------/
41       //- Methods -/
42      //-----------/
43  
44      /**
45       * 
46       * 
47       * @param vUnitTestCase
48       * @throws java.lang.IndexOutOfBoundsException if the index
49       * given is outside the bounds of the collection
50       */
51      public void addUnitTestCase(
52              final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
53      throws java.lang.IndexOutOfBoundsException {
54          this._unitTestCaseList.add(vUnitTestCase);
55      }
56  
57      /**
58       * 
59       * 
60       * @param index
61       * @param vUnitTestCase
62       * @throws java.lang.IndexOutOfBoundsException if the index
63       * given is outside the bounds of the collection
64       */
65      public void addUnitTestCase(
66              final int index,
67              final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
68      throws java.lang.IndexOutOfBoundsException {
69          this._unitTestCaseList.add(index, vUnitTestCase);
70      }
71  
72      /**
73       * Method enumerateUnitTestCase.
74       * 
75       * @return an Enumeration over all possible elements of this
76       * collection
77       */
78      public java.util.Enumeration enumerateUnitTestCase(
79      ) {
80          return java.util.Collections.enumeration(this._unitTestCaseList);
81      }
82  
83      /**
84       * Method getUnitTestCase.
85       * 
86       * @param index
87       * @throws java.lang.IndexOutOfBoundsException if the index
88       * given is outside the bounds of the collection
89       * @return the value of the
90       * org.exolab.castor.tests.framework.testDescriptor.UnitTestCase
91       * at the given index
92       */
93      public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase getUnitTestCase(
94              final int index)
95      throws java.lang.IndexOutOfBoundsException {
96          // check bounds for index
97          if (index < 0 || index >= this._unitTestCaseList.size()) {
98              throw new IndexOutOfBoundsException("getUnitTestCase: Index value '" + index + "' not in range [0.." + (this._unitTestCaseList.size() - 1) + "]");
99          }
100 
101         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase) _unitTestCaseList.get(index);
102     }
103 
104     /**
105      * Method getUnitTestCase.Returns the contents of the
106      * collection in an Array.  <p>Note:  Just in case the
107      * collection contents are changing in another thread, we pass
108      * a 0-length Array of the correct type into the API call. 
109      * This way we <i>know</i> that the Array returned is of
110      * exactly the correct length.
111      * 
112      * @return this collection as an Array
113      */
114     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] getUnitTestCase(
115     ) {
116         org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] array = new org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[0];
117         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[]) this._unitTestCaseList.toArray(array);
118     }
119 
120     /**
121      * Method getUnitTestCaseCount.
122      * 
123      * @return the size of this collection
124      */
125     public int getUnitTestCaseCount(
126     ) {
127         return this._unitTestCaseList.size();
128     }
129 
130     /**
131      * Method isValid.
132      * 
133      * @return true if this object is valid according to the schema
134      */
135     public boolean isValid(
136     ) {
137         try {
138             validate();
139         } catch (org.exolab.castor.xml.ValidationException vex) {
140             return false;
141         }
142         return true;
143     }
144 
145     /**
146      * Method iterateUnitTestCase.
147      * 
148      * @return an Iterator over all possible elements in this
149      * collection
150      */
151     public java.util.Iterator iterateUnitTestCase(
152     ) {
153         return this._unitTestCaseList.iterator();
154     }
155 
156     /**
157      * 
158      * 
159      * @param out
160      * @throws org.exolab.castor.xml.MarshalException if object is
161      * null or if any SAXException is thrown during marshaling
162      * @throws org.exolab.castor.xml.ValidationException if this
163      * object is an invalid instance according to the schema
164      */
165     public void marshal(
166             final java.io.Writer out)
167     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
168         org.exolab.castor.xml.Marshaller.marshal(this, out);
169     }
170 
171     /**
172      * 
173      * 
174      * @param handler
175      * @throws java.io.IOException if an IOException occurs during
176      * marshaling
177      * @throws org.exolab.castor.xml.ValidationException if this
178      * object is an invalid instance according to the schema
179      * @throws org.exolab.castor.xml.MarshalException if object is
180      * null or if any SAXException is thrown during marshaling
181      */
182     public void marshal(
183             final org.xml.sax.ContentHandler handler)
184     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
185         org.exolab.castor.xml.Marshaller.marshal(this, handler);
186     }
187 
188     /**
189      */
190     public void removeAllUnitTestCase(
191     ) {
192         this._unitTestCaseList.clear();
193     }
194 
195     /**
196      * Method removeUnitTestCase.
197      * 
198      * @param vUnitTestCase
199      * @return true if the object was removed from the collection.
200      */
201     public boolean removeUnitTestCase(
202             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase) {
203         boolean removed = _unitTestCaseList.remove(vUnitTestCase);
204         return removed;
205     }
206 
207     /**
208      * Method removeUnitTestCaseAt.
209      * 
210      * @param index
211      * @return the element removed from the collection
212      */
213     public org.exolab.castor.tests.framework.testDescriptor.UnitTestCase removeUnitTestCaseAt(
214             final int index) {
215         java.lang.Object obj = this._unitTestCaseList.remove(index);
216         return (org.exolab.castor.tests.framework.testDescriptor.UnitTestCase) obj;
217     }
218 
219     /**
220      * 
221      * 
222      * @param index
223      * @param vUnitTestCase
224      * @throws java.lang.IndexOutOfBoundsException if the index
225      * given is outside the bounds of the collection
226      */
227     public void setUnitTestCase(
228             final int index,
229             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase vUnitTestCase)
230     throws java.lang.IndexOutOfBoundsException {
231         // check bounds for index
232         if (index < 0 || index >= this._unitTestCaseList.size()) {
233             throw new IndexOutOfBoundsException("setUnitTestCase: Index value '" + index + "' not in range [0.." + (this._unitTestCaseList.size() - 1) + "]");
234         }
235 
236         this._unitTestCaseList.set(index, vUnitTestCase);
237     }
238 
239     /**
240      * 
241      * 
242      * @param vUnitTestCaseArray
243      */
244     public void setUnitTestCase(
245             final org.exolab.castor.tests.framework.testDescriptor.UnitTestCase[] vUnitTestCaseArray) {
246         //-- copy array
247         _unitTestCaseList.clear();
248 
249         for (int i = 0; i < vUnitTestCaseArray.length; i++) {
250                 this._unitTestCaseList.add(vUnitTestCaseArray[i]);
251         }
252     }
253 
254     /**
255      * Method unmarshal.
256      * 
257      * @param reader
258      * @throws org.exolab.castor.xml.MarshalException if object is
259      * null or if any SAXException is thrown during marshaling
260      * @throws org.exolab.castor.xml.ValidationException if this
261      * object is an invalid instance according to the schema
262      * @return the unmarshaled
263      * org.exolab.castor.tests.framework.testDescriptor.SchemaTest
264      */
265     public static org.exolab.castor.tests.framework.testDescriptor.SchemaTest unmarshal(
266             final java.io.Reader reader)
267     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
268         return (org.exolab.castor.tests.framework.testDescriptor.SchemaTest) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.tests.framework.testDescriptor.SchemaTest.class, reader);
269     }
270 
271     /**
272      * 
273      * 
274      * @throws org.exolab.castor.xml.ValidationException if this
275      * object is an invalid instance according to the schema
276      */
277     public void validate(
278     )
279     throws org.exolab.castor.xml.ValidationException {
280         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
281         validator.validate(this);
282     }
283 
284 }