2 * This file is part of the Vamsas Client version 0.1.
\r
3 * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
\r
4 * Andrew Waterhouse and Dominik Lindner.
\r
6 * Earlier versions have also been incorporated into Jalview version 2.4
\r
7 * since 2008, and TOPALi version 2 since 2007.
\r
9 * The Vamsas Client is free software: you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation, either version 3 of the License, or
\r
12 * (at your option) any later version.
\r
14 * The Vamsas Client is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public License
\r
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
\r
22 package uk.ac.vamsas.objects.core;
\r
24 //---------------------------------/
\r
25 //- Imported classes and packages -/
\r
26 //---------------------------------/
\r
28 import org.exolab.castor.xml.Marshaller;
\r
29 import org.exolab.castor.xml.Unmarshaller;
\r
34 * @version $Revision$ $Date$
\r
36 public class Range extends uk.ac.vamsas.client.Vobject implements
\r
37 java.io.Serializable {
\r
39 // --------------------------/
\r
40 // - Class/Member Variables -/
\r
41 // --------------------------/
\r
46 private int _seqAStart;
\r
49 * keeps track of state for field: _seqAStart
\r
51 private boolean _has_seqAStart;
\r
56 private int _seqAEnd;
\r
59 * keeps track of state for field: _seqAEnd
\r
61 private boolean _has_seqAEnd;
\r
66 private int _seqBStart;
\r
69 * keeps track of state for field: _seqBStart
\r
71 private boolean _has_seqBStart;
\r
76 private int _seqBEnd;
\r
79 * keeps track of state for field: _seqBEnd
\r
81 private boolean _has_seqBEnd;
\r
83 // ----------------/
\r
84 // - Constructors -/
\r
85 // ----------------/
\r
97 public void deleteSeqAEnd() {
\r
98 this._has_seqAEnd = false;
\r
103 public void deleteSeqAStart() {
\r
104 this._has_seqAStart = false;
\r
109 public void deleteSeqBEnd() {
\r
110 this._has_seqBEnd = false;
\r
115 public void deleteSeqBStart() {
\r
116 this._has_seqBStart = false;
\r
120 * Overrides the java.lang.Object.equals method.
\r
123 * @return true if the objects are equal.
\r
125 public boolean equals(final java.lang.Object obj) {
\r
129 if (super.equals(obj) == false)
\r
132 if (obj instanceof Range) {
\r
134 Range temp = (Range) obj;
\r
135 if (this._seqAStart != temp._seqAStart)
\r
137 if (this._has_seqAStart != temp._has_seqAStart)
\r
139 if (this._seqAEnd != temp._seqAEnd)
\r
141 if (this._has_seqAEnd != temp._has_seqAEnd)
\r
143 if (this._seqBStart != temp._seqBStart)
\r
145 if (this._has_seqBStart != temp._has_seqBStart)
\r
147 if (this._seqBEnd != temp._seqBEnd)
\r
149 if (this._has_seqBEnd != temp._has_seqBEnd)
\r
157 * Returns the value of field 'seqAEnd'.
\r
159 * @return the value of field 'SeqAEnd'.
\r
161 public int getSeqAEnd() {
\r
162 return this._seqAEnd;
\r
166 * Returns the value of field 'seqAStart'.
\r
168 * @return the value of field 'SeqAStart'.
\r
170 public int getSeqAStart() {
\r
171 return this._seqAStart;
\r
175 * Returns the value of field 'seqBEnd'.
\r
177 * @return the value of field 'SeqBEnd'.
\r
179 public int getSeqBEnd() {
\r
180 return this._seqBEnd;
\r
184 * Returns the value of field 'seqBStart'.
\r
186 * @return the value of field 'SeqBStart'.
\r
188 public int getSeqBStart() {
\r
189 return this._seqBStart;
\r
193 * Method hasSeqAEnd.
\r
195 * @return true if at least one SeqAEnd has been added
\r
197 public boolean hasSeqAEnd() {
\r
198 return this._has_seqAEnd;
\r
202 * Method hasSeqAStart.
\r
204 * @return true if at least one SeqAStart has been added
\r
206 public boolean hasSeqAStart() {
\r
207 return this._has_seqAStart;
\r
211 * Method hasSeqBEnd.
\r
213 * @return true if at least one SeqBEnd has been added
\r
215 public boolean hasSeqBEnd() {
\r
216 return this._has_seqBEnd;
\r
220 * Method hasSeqBStart.
\r
222 * @return true if at least one SeqBStart has been added
\r
224 public boolean hasSeqBStart() {
\r
225 return this._has_seqBStart;
\r
229 * Overrides the java.lang.Object.hashCode method.
\r
231 * The following steps came from <b>Effective Java Programming Language
\r
232 * Guide</b> by Joshua Bloch, Chapter 3
\r
234 * @return a hash code value for the object.
\r
236 public int hashCode() {
\r
237 int result = super.hashCode();
\r
240 result = 37 * result + _seqAStart;
\r
241 result = 37 * result + _seqAEnd;
\r
242 result = 37 * result + _seqBStart;
\r
243 result = 37 * result + _seqBEnd;
\r
251 * @return true if this object is valid according to the schema
\r
253 public boolean isValid() {
\r
256 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
266 * @throws org.exolab.castor.xml.MarshalException
\r
267 * if object is null or if any SAXException is thrown during
\r
269 * @throws org.exolab.castor.xml.ValidationException
\r
270 * if this object is an invalid instance according to the schema
\r
272 public void marshal(final java.io.Writer out)
\r
273 throws org.exolab.castor.xml.MarshalException,
\r
274 org.exolab.castor.xml.ValidationException {
\r
275 Marshaller.marshal(this, out);
\r
282 * @throws java.io.IOException
\r
283 * if an IOException occurs during marshaling
\r
284 * @throws org.exolab.castor.xml.ValidationException
\r
285 * if this object is an invalid instance according to the schema
\r
286 * @throws org.exolab.castor.xml.MarshalException
\r
287 * if object is null or if any SAXException is thrown during
\r
290 public void marshal(final org.xml.sax.ContentHandler handler)
\r
291 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
292 org.exolab.castor.xml.ValidationException {
\r
293 Marshaller.marshal(this, handler);
\r
297 * Sets the value of field 'seqAEnd'.
\r
300 * the value of field 'seqAEnd'.
\r
302 public void setSeqAEnd(final int seqAEnd) {
\r
303 this._seqAEnd = seqAEnd;
\r
304 this._has_seqAEnd = true;
\r
308 * Sets the value of field 'seqAStart'.
\r
311 * the value of field 'seqAStart'.
\r
313 public void setSeqAStart(final int seqAStart) {
\r
314 this._seqAStart = seqAStart;
\r
315 this._has_seqAStart = true;
\r
319 * Sets the value of field 'seqBEnd'.
\r
322 * the value of field 'seqBEnd'.
\r
324 public void setSeqBEnd(final int seqBEnd) {
\r
325 this._seqBEnd = seqBEnd;
\r
326 this._has_seqBEnd = true;
\r
330 * Sets the value of field 'seqBStart'.
\r
333 * the value of field 'seqBStart'.
\r
335 public void setSeqBStart(final int seqBStart) {
\r
336 this._seqBStart = seqBStart;
\r
337 this._has_seqBStart = true;
\r
341 * Method unmarshal.
\r
344 * @throws org.exolab.castor.xml.MarshalException
\r
345 * if object is null or if any SAXException is thrown during
\r
347 * @throws org.exolab.castor.xml.ValidationException
\r
348 * if this object is an invalid instance according to the schema
\r
349 * @return the unmarshaled uk.ac.vamsas.objects.core.Range
\r
351 public static uk.ac.vamsas.objects.core.Range unmarshal(
\r
352 final java.io.Reader reader)
\r
353 throws org.exolab.castor.xml.MarshalException,
\r
354 org.exolab.castor.xml.ValidationException {
\r
355 return (uk.ac.vamsas.objects.core.Range) Unmarshaller.unmarshal(
\r
356 uk.ac.vamsas.objects.core.Range.class, reader);
\r
362 * @throws org.exolab.castor.xml.ValidationException
\r
363 * if this object is an invalid instance according to the schema
\r
365 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
366 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
367 validator.validate(this);
\r