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: TabularSkyService.java,v 1.2 2007/01/04 16:26:25 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.v10.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.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   * A service that interacts with one or more specified tables
28   *  having some coverage of the sky, time, and/or frequency.
29   *  
30   *  A table with sky coverage typically have columns that give
31   *  longitude-latitude positions in some coordinate system. 
32   *  
33   * 
34   * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:25 $
35   */
36  public class TabularSkyService extends org.astrogrid.registry.beans.v10.resource.dataservice.SkyService 
37  implements java.io.Serializable
38  {
39  
40  
41        //--------------------------/
42       //- Class/Member Variables -/
43      //--------------------------/
44  
45      /***
46       * a description of a table and its columns.
47       *  
48       */
49      private java.util.ArrayList _tableList;
50  
51  
52        //----------------/
53       //- Constructors -/
54      //----------------/
55  
56      public TabularSkyService() {
57          super();
58          _tableList = new ArrayList();
59      } //-- org.astrogrid.registry.beans.v10.resource.dataservice.TabularSkyService()
60  
61  
62        //-----------/
63       //- Methods -/
64      //-----------/
65  
66      /***
67       * Method addTable
68       * 
69       * @param vTable
70       */
71      public void addTable(org.astrogrid.registry.beans.v10.resource.dataservice.Table vTable)
72          throws java.lang.IndexOutOfBoundsException
73      {
74          _tableList.add(vTable);
75      } //-- void addTable(org.astrogrid.registry.beans.v10.resource.dataservice.Table) 
76  
77      /***
78       * Method addTable
79       * 
80       * @param index
81       * @param vTable
82       */
83      public void addTable(int index, org.astrogrid.registry.beans.v10.resource.dataservice.Table vTable)
84          throws java.lang.IndexOutOfBoundsException
85      {
86          _tableList.add(index, vTable);
87      } //-- void addTable(int, org.astrogrid.registry.beans.v10.resource.dataservice.Table) 
88  
89      /***
90       * Method clearTable
91       */
92      public void clearTable()
93      {
94          _tableList.clear();
95      } //-- void clearTable() 
96  
97      /***
98       * Method enumerateTable
99       */
100     public java.util.Enumeration enumerateTable()
101     {
102         return new org.exolab.castor.util.IteratorEnumeration(_tableList.iterator());
103     } //-- java.util.Enumeration enumerateTable() 
104 
105     /***
106      * Note: hashCode() has not been overriden
107      * 
108      * @param obj
109      */
110     public boolean equals(java.lang.Object obj)
111     {
112         if ( this == obj )
113             return true;
114         
115         if (super.equals(obj)==false)
116             return false;
117         
118         if (obj instanceof TabularSkyService) {
119         
120             TabularSkyService temp = (TabularSkyService)obj;
121             if (this._tableList != null) {
122                 if (temp._tableList == null) return false;
123                 else if (!(this._tableList.equals(temp._tableList))) 
124                     return false;
125             }
126             else if (temp._tableList != null)
127                 return false;
128             return true;
129         }
130         return false;
131     } //-- boolean equals(java.lang.Object) 
132 
133     /***
134      * Method getTable
135      * 
136      * @param index
137      */
138     public org.astrogrid.registry.beans.v10.resource.dataservice.Table getTable(int index)
139         throws java.lang.IndexOutOfBoundsException
140     {
141         //-- check bounds for index
142         if ((index < 0) || (index > _tableList.size())) {
143             throw new IndexOutOfBoundsException();
144         }
145         
146         return (org.astrogrid.registry.beans.v10.resource.dataservice.Table) _tableList.get(index);
147     } //-- org.astrogrid.registry.beans.v10.resource.dataservice.Table getTable(int) 
148 
149     /***
150      * Method getTable
151      */
152     public org.astrogrid.registry.beans.v10.resource.dataservice.Table[] getTable()
153     {
154         int size = _tableList.size();
155         org.astrogrid.registry.beans.v10.resource.dataservice.Table[] mArray = new org.astrogrid.registry.beans.v10.resource.dataservice.Table[size];
156         for (int index = 0; index < size; index++) {
157             mArray[index] = (org.astrogrid.registry.beans.v10.resource.dataservice.Table) _tableList.get(index);
158         }
159         return mArray;
160     } //-- org.astrogrid.registry.beans.v10.resource.dataservice.Table[] getTable() 
161 
162     /***
163      * Method getTableCount
164      */
165     public int getTableCount()
166     {
167         return _tableList.size();
168     } //-- int getTableCount() 
169 
170     /***
171      * Method isValid
172      */
173     public boolean isValid()
174     {
175         try {
176             validate();
177         }
178         catch (org.exolab.castor.xml.ValidationException vex) {
179             return false;
180         }
181         return true;
182     } //-- boolean isValid() 
183 
184     /***
185      * Method marshal
186      * 
187      * @param out
188      */
189     public void marshal(java.io.Writer out)
190         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
191     {
192         
193         Marshaller.marshal(this, out);
194     } //-- void marshal(java.io.Writer) 
195 
196     /***
197      * Method marshal
198      * 
199      * @param handler
200      */
201     public void marshal(org.xml.sax.ContentHandler handler)
202         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
203     {
204         
205         Marshaller.marshal(this, handler);
206     } //-- void marshal(org.xml.sax.ContentHandler) 
207 
208     /***
209      * Method removeTable
210      * 
211      * @param vTable
212      */
213     public boolean removeTable(org.astrogrid.registry.beans.v10.resource.dataservice.Table vTable)
214     {
215         boolean removed = _tableList.remove(vTable);
216         return removed;
217     } //-- boolean removeTable(org.astrogrid.registry.beans.v10.resource.dataservice.Table) 
218 
219     /***
220      * Method setTable
221      * 
222      * @param index
223      * @param vTable
224      */
225     public void setTable(int index, org.astrogrid.registry.beans.v10.resource.dataservice.Table vTable)
226         throws java.lang.IndexOutOfBoundsException
227     {
228         //-- check bounds for index
229         if ((index < 0) || (index > _tableList.size())) {
230             throw new IndexOutOfBoundsException();
231         }
232         _tableList.set(index, vTable);
233     } //-- void setTable(int, org.astrogrid.registry.beans.v10.resource.dataservice.Table) 
234 
235     /***
236      * Method setTable
237      * 
238      * @param tableArray
239      */
240     public void setTable(org.astrogrid.registry.beans.v10.resource.dataservice.Table[] tableArray)
241     {
242         //-- copy array
243         _tableList.clear();
244         for (int i = 0; i < tableArray.length; i++) {
245             _tableList.add(tableArray[i]);
246         }
247     } //-- void setTable(org.astrogrid.registry.beans.v10.resource.dataservice.Table) 
248 
249     /***
250      * Method unmarshalTabularSkyService
251      * 
252      * @param reader
253      */
254     public static org.astrogrid.registry.beans.v10.resource.dataservice.TabularSkyService unmarshalTabularSkyService(java.io.Reader reader)
255         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
256     {
257         return (org.astrogrid.registry.beans.v10.resource.dataservice.TabularSkyService) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.dataservice.TabularSkyService.class, reader);
258     } //-- org.astrogrid.registry.beans.v10.resource.dataservice.TabularSkyService unmarshalTabularSkyService(java.io.Reader) 
259 
260     /***
261      * Method validate
262      */
263     public void validate()
264         throws org.exolab.castor.xml.ValidationException
265     {
266         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
267         validator.validate(this);
268     } //-- void validate() 
269 
270 }