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