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