View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: VOTableColumns.java,v 1.14 2007/01/04 16:26:07 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.resource.dataservice;
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.astrogrid.registry.beans.resource.votable.FIELD;
21  import org.exolab.castor.xml.MarshalException;
22  import org.exolab.castor.xml.Marshaller;
23  import org.exolab.castor.xml.Unmarshaller;
24  import org.exolab.castor.xml.ValidationException;
25  import org.xml.sax.ContentHandler;
26  
27  /***
28   * The columns returned in a VOTable.
29   *  
30   *  This element is recommended for use within extensions of
31   *  the Capability element.
32   *  
33   * 
34   * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:07 $
35   */
36  public class VOTableColumns extends org.astrogrid.common.bean.BaseBean 
37  implements java.io.Serializable
38  {
39  
40  
41        //--------------------------/
42       //- Class/Member Variables -/
43      //--------------------------/
44  
45      /***
46       * Field _FIELDList
47       */
48      private java.util.ArrayList _FIELDList;
49  
50  
51        //----------------/
52       //- Constructors -/
53      //----------------/
54  
55      public VOTableColumns() {
56          super();
57          _FIELDList = new ArrayList();
58      } //-- org.astrogrid.registry.beans.resource.dataservice.VOTableColumns()
59  
60  
61        //-----------/
62       //- Methods -/
63      //-----------/
64  
65      /***
66       * Method addFIELD
67       * 
68       * @param vFIELD
69       */
70      public void addFIELD(org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
71          throws java.lang.IndexOutOfBoundsException
72      {
73          _FIELDList.add(vFIELD);
74      } //-- void addFIELD(org.astrogrid.registry.beans.resource.votable.FIELD) 
75  
76      /***
77       * Method addFIELD
78       * 
79       * @param index
80       * @param vFIELD
81       */
82      public void addFIELD(int index, org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
83          throws java.lang.IndexOutOfBoundsException
84      {
85          _FIELDList.add(index, vFIELD);
86      } //-- void addFIELD(int, org.astrogrid.registry.beans.resource.votable.FIELD) 
87  
88      /***
89       * Method clearFIELD
90       */
91      public void clearFIELD()
92      {
93          _FIELDList.clear();
94      } //-- void clearFIELD() 
95  
96      /***
97       * Method enumerateFIELD
98       */
99      public java.util.Enumeration enumerateFIELD()
100     {
101         return new org.exolab.castor.util.IteratorEnumeration(_FIELDList.iterator());
102     } //-- java.util.Enumeration enumerateFIELD() 
103 
104     /***
105      * Note: hashCode() has not been overriden
106      * 
107      * @param obj
108      */
109     public boolean equals(java.lang.Object obj)
110     {
111         if ( this == obj )
112             return true;
113         
114         if (super.equals(obj)==false)
115             return false;
116         
117         if (obj instanceof VOTableColumns) {
118         
119             VOTableColumns temp = (VOTableColumns)obj;
120             if (this._FIELDList != null) {
121                 if (temp._FIELDList == null) return false;
122                 else if (!(this._FIELDList.equals(temp._FIELDList))) 
123                     return false;
124             }
125             else if (temp._FIELDList != null)
126                 return false;
127             return true;
128         }
129         return false;
130     } //-- boolean equals(java.lang.Object) 
131 
132     /***
133      * Method getFIELD
134      * 
135      * @param index
136      */
137     public org.astrogrid.registry.beans.resource.votable.FIELD getFIELD(int index)
138         throws java.lang.IndexOutOfBoundsException
139     {
140         //-- check bounds for index
141         if ((index < 0) || (index > _FIELDList.size())) {
142             throw new IndexOutOfBoundsException();
143         }
144         
145         return (org.astrogrid.registry.beans.resource.votable.FIELD) _FIELDList.get(index);
146     } //-- org.astrogrid.registry.beans.resource.votable.FIELD getFIELD(int) 
147 
148     /***
149      * Method getFIELD
150      */
151     public org.astrogrid.registry.beans.resource.votable.FIELD[] getFIELD()
152     {
153         int size = _FIELDList.size();
154         org.astrogrid.registry.beans.resource.votable.FIELD[] mArray = new org.astrogrid.registry.beans.resource.votable.FIELD[size];
155         for (int index = 0; index < size; index++) {
156             mArray[index] = (org.astrogrid.registry.beans.resource.votable.FIELD) _FIELDList.get(index);
157         }
158         return mArray;
159     } //-- org.astrogrid.registry.beans.resource.votable.FIELD[] getFIELD() 
160 
161     /***
162      * Method getFIELDCount
163      */
164     public int getFIELDCount()
165     {
166         return _FIELDList.size();
167     } //-- int getFIELDCount() 
168 
169     /***
170      * Method isValid
171      */
172     public boolean isValid()
173     {
174         try {
175             validate();
176         }
177         catch (org.exolab.castor.xml.ValidationException vex) {
178             return false;
179         }
180         return true;
181     } //-- boolean isValid() 
182 
183     /***
184      * Method marshal
185      * 
186      * @param out
187      */
188     public void marshal(java.io.Writer out)
189         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
190     {
191         
192         Marshaller.marshal(this, out);
193     } //-- void marshal(java.io.Writer) 
194 
195     /***
196      * Method marshal
197      * 
198      * @param handler
199      */
200     public void marshal(org.xml.sax.ContentHandler handler)
201         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
202     {
203         
204         Marshaller.marshal(this, handler);
205     } //-- void marshal(org.xml.sax.ContentHandler) 
206 
207     /***
208      * Method removeFIELD
209      * 
210      * @param vFIELD
211      */
212     public boolean removeFIELD(org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
213     {
214         boolean removed = _FIELDList.remove(vFIELD);
215         return removed;
216     } //-- boolean removeFIELD(org.astrogrid.registry.beans.resource.votable.FIELD) 
217 
218     /***
219      * Method setFIELD
220      * 
221      * @param index
222      * @param vFIELD
223      */
224     public void setFIELD(int index, org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
225         throws java.lang.IndexOutOfBoundsException
226     {
227         //-- check bounds for index
228         if ((index < 0) || (index > _FIELDList.size())) {
229             throw new IndexOutOfBoundsException();
230         }
231         _FIELDList.set(index, vFIELD);
232     } //-- void setFIELD(int, org.astrogrid.registry.beans.resource.votable.FIELD) 
233 
234     /***
235      * Method setFIELD
236      * 
237      * @param FIELDArray
238      */
239     public void setFIELD(org.astrogrid.registry.beans.resource.votable.FIELD[] FIELDArray)
240     {
241         //-- copy array
242         _FIELDList.clear();
243         for (int i = 0; i < FIELDArray.length; i++) {
244             _FIELDList.add(FIELDArray[i]);
245         }
246     } //-- void setFIELD(org.astrogrid.registry.beans.resource.votable.FIELD) 
247 
248     /***
249      * Method unmarshalVOTableColumns
250      * 
251      * @param reader
252      */
253     public static org.astrogrid.registry.beans.resource.dataservice.VOTableColumns unmarshalVOTableColumns(java.io.Reader reader)
254         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
255     {
256         return (org.astrogrid.registry.beans.resource.dataservice.VOTableColumns) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.dataservice.VOTableColumns.class, reader);
257     } //-- org.astrogrid.registry.beans.resource.dataservice.VOTableColumns unmarshalVOTableColumns(java.io.Reader) 
258 
259     /***
260      * Method validate
261      */
262     public void validate()
263         throws org.exolab.castor.xml.ValidationException
264     {
265         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
266         validator.validate(this);
267     } //-- void validate() 
268 
269 }