0bb9fc692fb853c16a01374de249df9a1ad98e74
[jalview.git] / src / jalview / schemabinding / version2 / MapListTo.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  * \r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  * \r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  * \r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.schemabinding.version2;\r
20 \r
21 // ---------------------------------/\r
22 // - Imported classes and packages -/\r
23 // ---------------------------------/\r
24 \r
25 import org.exolab.castor.xml.Marshaller;\r
26 import org.exolab.castor.xml.Unmarshaller;\r
27 \r
28 /**\r
29  * a region from start to end inclusive\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class MapListTo implements java.io.Serializable\r
34 {\r
35 \r
36   // --------------------------/\r
37   // - Class/Member Variables -/\r
38   // --------------------------/\r
39 \r
40   /**\r
41    * Field _start.\r
42    */\r
43   private int _start;\r
44 \r
45   /**\r
46    * keeps track of state for field: _start\r
47    */\r
48   private boolean _has_start;\r
49 \r
50   /**\r
51    * Field _end.\r
52    */\r
53   private int _end;\r
54 \r
55   /**\r
56    * keeps track of state for field: _end\r
57    */\r
58   private boolean _has_end;\r
59 \r
60   // ----------------/\r
61   // - Constructors -/\r
62   // ----------------/\r
63 \r
64   public MapListTo()\r
65   {\r
66     super();\r
67   }\r
68 \r
69   // -----------/\r
70   // - Methods -/\r
71   // -----------/\r
72 \r
73   /**\r
74    */\r
75   public void deleteEnd()\r
76   {\r
77     this._has_end = false;\r
78   }\r
79 \r
80   /**\r
81    */\r
82   public void deleteStart()\r
83   {\r
84     this._has_start = false;\r
85   }\r
86 \r
87   /**\r
88    * Returns the value of field 'end'.\r
89    * \r
90    * @return the value of field 'End'.\r
91    */\r
92   public int getEnd()\r
93   {\r
94     return this._end;\r
95   }\r
96 \r
97   /**\r
98    * Returns the value of field 'start'.\r
99    * \r
100    * @return the value of field 'Start'.\r
101    */\r
102   public int getStart()\r
103   {\r
104     return this._start;\r
105   }\r
106 \r
107   /**\r
108    * Method hasEnd.\r
109    * \r
110    * @return true if at least one End has been added\r
111    */\r
112   public boolean hasEnd()\r
113   {\r
114     return this._has_end;\r
115   }\r
116 \r
117   /**\r
118    * Method hasStart.\r
119    * \r
120    * @return true if at least one Start has been added\r
121    */\r
122   public boolean hasStart()\r
123   {\r
124     return this._has_start;\r
125   }\r
126 \r
127   /**\r
128    * Method isValid.\r
129    * \r
130    * @return true if this object is valid according to the schema\r
131    */\r
132   public boolean isValid()\r
133   {\r
134     try\r
135     {\r
136       validate();\r
137     } catch (org.exolab.castor.xml.ValidationException vex)\r
138     {\r
139       return false;\r
140     }\r
141     return true;\r
142   }\r
143 \r
144   /**\r
145    * \r
146    * \r
147    * @param out\r
148    * @throws org.exolab.castor.xml.MarshalException\r
149    *                 if object is null or if any SAXException is thrown during\r
150    *                 marshaling\r
151    * @throws org.exolab.castor.xml.ValidationException\r
152    *                 if this object is an invalid instance according to the\r
153    *                 schema\r
154    */\r
155   public void marshal(final java.io.Writer out)\r
156           throws org.exolab.castor.xml.MarshalException,\r
157           org.exolab.castor.xml.ValidationException\r
158   {\r
159     Marshaller.marshal(this, out);\r
160   }\r
161 \r
162   /**\r
163    * \r
164    * \r
165    * @param handler\r
166    * @throws java.io.IOException\r
167    *                 if an IOException occurs during marshaling\r
168    * @throws org.exolab.castor.xml.ValidationException\r
169    *                 if this object is an invalid instance according to the\r
170    *                 schema\r
171    * @throws org.exolab.castor.xml.MarshalException\r
172    *                 if object is null or if any SAXException is thrown during\r
173    *                 marshaling\r
174    */\r
175   public void marshal(final org.xml.sax.ContentHandler handler)\r
176           throws java.io.IOException,\r
177           org.exolab.castor.xml.MarshalException,\r
178           org.exolab.castor.xml.ValidationException\r
179   {\r
180     Marshaller.marshal(this, handler);\r
181   }\r
182 \r
183   /**\r
184    * Sets the value of field 'end'.\r
185    * \r
186    * @param end\r
187    *                the value of field 'end'.\r
188    */\r
189   public void setEnd(final int end)\r
190   {\r
191     this._end = end;\r
192     this._has_end = true;\r
193   }\r
194 \r
195   /**\r
196    * Sets the value of field 'start'.\r
197    * \r
198    * @param start\r
199    *                the value of field 'start'.\r
200    */\r
201   public void setStart(final int start)\r
202   {\r
203     this._start = start;\r
204     this._has_start = true;\r
205   }\r
206 \r
207   /**\r
208    * Method unmarshal.\r
209    * \r
210    * @param reader\r
211    * @throws org.exolab.castor.xml.MarshalException\r
212    *                 if object is null or if any SAXException is thrown during\r
213    *                 marshaling\r
214    * @throws org.exolab.castor.xml.ValidationException\r
215    *                 if this object is an invalid instance according to the\r
216    *                 schema\r
217    * @return the unmarshaled jalview.schemabinding.version2.MapListTo\r
218    */\r
219   public static jalview.schemabinding.version2.MapListTo unmarshal(\r
220           final java.io.Reader reader)\r
221           throws org.exolab.castor.xml.MarshalException,\r
222           org.exolab.castor.xml.ValidationException\r
223   {\r
224     return (jalview.schemabinding.version2.MapListTo) Unmarshaller\r
225             .unmarshal(jalview.schemabinding.version2.MapListTo.class,\r
226                     reader);\r
227   }\r
228 \r
229   /**\r
230    * \r
231    * \r
232    * @throws org.exolab.castor.xml.ValidationException\r
233    *                 if this object is an invalid instance according to the\r
234    *                 schema\r
235    */\r
236   public void validate() throws org.exolab.castor.xml.ValidationException\r
237   {\r
238     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
239     validator.validate(this);\r
240   }\r
241 \r
242 }\r