eef2ff7b1e4d1d6197339dff4684eecb57fdd99c
[vamsas.git] / src / org / vamsas / objects / core / AppData.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package org.vamsas.objects.core;
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.Enumeration;
19 import java.util.Vector;
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 AppData.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class AppData extends org.vamsas.client.object 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _appDataChoice
42      */
43     private org.vamsas.objects.core.AppDataChoice _appDataChoice;
44
45     /**
46      * Field _userList
47      */
48     private java.util.Vector _userList;
49
50
51       //----------------/
52      //- Constructors -/
53     //----------------/
54
55     public AppData() 
56      {
57         super();
58         _userList = new Vector();
59     } //-- org.vamsas.objects.core.AppData()
60
61
62       //-----------/
63      //- Methods -/
64     //-----------/
65
66     /**
67      * Method addUser
68      * 
69      * 
70      * 
71      * @param vUser
72      */
73     public void addUser(org.vamsas.objects.core.User vUser)
74         throws java.lang.IndexOutOfBoundsException
75     {
76         _userList.addElement(vUser);
77     } //-- void addUser(org.vamsas.objects.core.User) 
78
79     /**
80      * Method addUser
81      * 
82      * 
83      * 
84      * @param index
85      * @param vUser
86      */
87     public void addUser(int index, org.vamsas.objects.core.User vUser)
88         throws java.lang.IndexOutOfBoundsException
89     {
90         _userList.insertElementAt(vUser, index);
91     } //-- void addUser(int, org.vamsas.objects.core.User) 
92
93     /**
94      * Method enumerateUser
95      * 
96      * 
97      * 
98      * @return Enumeration
99      */
100     public java.util.Enumeration enumerateUser()
101     {
102         return _userList.elements();
103     } //-- java.util.Enumeration enumerateUser() 
104
105     /**
106      * Note: hashCode() has not been overriden
107      * 
108      * @param obj
109      * @return boolean
110      */
111     public boolean equals(java.lang.Object obj)
112     {
113         if ( this == obj )
114             return true;
115         
116         if (super.equals(obj)==false)
117             return false;
118         
119         if (obj instanceof AppData) {
120         
121             AppData temp = (AppData)obj;
122             if (this._appDataChoice != null) {
123                 if (temp._appDataChoice == null) return false;
124                 else if (!(this._appDataChoice.equals(temp._appDataChoice))) 
125                     return false;
126             }
127             else if (temp._appDataChoice != null)
128                 return false;
129             if (this._userList != null) {
130                 if (temp._userList == null) return false;
131                 else if (!(this._userList.equals(temp._userList))) 
132                     return false;
133             }
134             else if (temp._userList != null)
135                 return false;
136             return true;
137         }
138         return false;
139     } //-- boolean equals(java.lang.Object) 
140
141     /**
142      * Returns the value of field 'appDataChoice'.
143      * 
144      * @return AppDataChoice
145      * @return the value of field 'appDataChoice'.
146      */
147     public org.vamsas.objects.core.AppDataChoice getAppDataChoice()
148     {
149         return this._appDataChoice;
150     } //-- org.vamsas.objects.core.AppDataChoice getAppDataChoice() 
151
152     /**
153      * Method getUser
154      * 
155      * 
156      * 
157      * @param index
158      * @return User
159      */
160     public org.vamsas.objects.core.User getUser(int index)
161         throws java.lang.IndexOutOfBoundsException
162     {
163         //-- check bounds for index
164         if ((index < 0) || (index > _userList.size())) {
165             throw new IndexOutOfBoundsException("getUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
166         }
167         
168         return (org.vamsas.objects.core.User) _userList.elementAt(index);
169     } //-- org.vamsas.objects.core.User getUser(int) 
170
171     /**
172      * Method getUser
173      * 
174      * 
175      * 
176      * @return User
177      */
178     public org.vamsas.objects.core.User[] getUser()
179     {
180         int size = _userList.size();
181         org.vamsas.objects.core.User[] mArray = new org.vamsas.objects.core.User[size];
182         for (int index = 0; index < size; index++) {
183             mArray[index] = (org.vamsas.objects.core.User) _userList.elementAt(index);
184         }
185         return mArray;
186     } //-- org.vamsas.objects.core.User[] getUser() 
187
188     /**
189      * Method getUserCount
190      * 
191      * 
192      * 
193      * @return int
194      */
195     public int getUserCount()
196     {
197         return _userList.size();
198     } //-- int getUserCount() 
199
200     /**
201      * Method isValid
202      * 
203      * 
204      * 
205      * @return boolean
206      */
207     public boolean isValid()
208     {
209         try {
210             validate();
211         }
212         catch (org.exolab.castor.xml.ValidationException vex) {
213             return false;
214         }
215         return true;
216     } //-- boolean isValid() 
217
218     /**
219      * Method marshal
220      * 
221      * 
222      * 
223      * @param out
224      */
225     public void marshal(java.io.Writer out)
226         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
227     {
228         
229         Marshaller.marshal(this, out);
230     } //-- void marshal(java.io.Writer) 
231
232     /**
233      * Method marshal
234      * 
235      * 
236      * 
237      * @param handler
238      */
239     public void marshal(org.xml.sax.ContentHandler handler)
240         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
241     {
242         
243         Marshaller.marshal(this, handler);
244     } //-- void marshal(org.xml.sax.ContentHandler) 
245
246     /**
247      * Method removeAllUser
248      * 
249      */
250     public void removeAllUser()
251     {
252         _userList.removeAllElements();
253     } //-- void removeAllUser() 
254
255     /**
256      * Method removeUser
257      * 
258      * 
259      * 
260      * @param index
261      * @return User
262      */
263     public org.vamsas.objects.core.User removeUser(int index)
264     {
265         java.lang.Object obj = _userList.elementAt(index);
266         _userList.removeElementAt(index);
267         return (org.vamsas.objects.core.User) obj;
268     } //-- org.vamsas.objects.core.User removeUser(int) 
269
270     /**
271      * Sets the value of field 'appDataChoice'.
272      * 
273      * @param appDataChoice the value of field 'appDataChoice'.
274      */
275     public void setAppDataChoice(org.vamsas.objects.core.AppDataChoice appDataChoice)
276     {
277         this._appDataChoice = appDataChoice;
278     } //-- void setAppDataChoice(org.vamsas.objects.core.AppDataChoice) 
279
280     /**
281      * Method setUser
282      * 
283      * 
284      * 
285      * @param index
286      * @param vUser
287      */
288     public void setUser(int index, org.vamsas.objects.core.User vUser)
289         throws java.lang.IndexOutOfBoundsException
290     {
291         //-- check bounds for index
292         if ((index < 0) || (index > _userList.size())) {
293             throw new IndexOutOfBoundsException("setUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
294         }
295         _userList.setElementAt(vUser, index);
296     } //-- void setUser(int, org.vamsas.objects.core.User) 
297
298     /**
299      * Method setUser
300      * 
301      * 
302      * 
303      * @param userArray
304      */
305     public void setUser(org.vamsas.objects.core.User[] userArray)
306     {
307         //-- copy array
308         _userList.removeAllElements();
309         for (int i = 0; i < userArray.length; i++) {
310             _userList.addElement(userArray[i]);
311         }
312     } //-- void setUser(org.vamsas.objects.core.User) 
313
314     /**
315      * Method unmarshal
316      * 
317      * 
318      * 
319      * @param reader
320      * @return AppData
321      */
322     public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)
323         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
324     {
325         return (org.vamsas.objects.core.AppData) Unmarshaller.unmarshal(org.vamsas.objects.core.AppData.class, reader);
326     } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) 
327
328     /**
329      * Method validate
330      * 
331      */
332     public void validate()
333         throws org.exolab.castor.xml.ValidationException
334     {
335         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
336         validator.validate(this);
337     } //-- void validate() 
338
339 }