2 * This file is part of the Vamsas Client version 0.2.
\r
3 * Copyright 2010 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 MapList extends uk.ac.vamsas.client.Vobject implements
\r
37 java.io.Serializable {
\r
39 // --------------------------/
\r
40 // - Class/Member Variables -/
\r
41 // --------------------------/
\r
44 * Offset to first position in dataset sequence record that start position on
\r
47 private long _from = 0;
\r
50 * keeps track of state for field: _from
\r
52 private boolean _has_from;
\r
55 * Offset to last position in dataset sequence record that end position on
\r
58 private long _to = 0;
\r
61 * keeps track of state for field: _to
\r
63 private boolean _has_to;
\r
66 * Offset to first position in database entry that first (or offset) position
\r
67 * in sequence maps to
\r
69 private long _start;
\r
72 * keeps track of state for field: _start
\r
74 private boolean _has_start;
\r
77 * Offset to last position in database entry that last (offset) position in
\r
83 * keeps track of state for field: _end
\r
85 private boolean _has_end;
\r
87 // ----------------/
\r
88 // - Constructors -/
\r
89 // ----------------/
\r
101 public void deleteEnd() {
\r
102 this._has_end = false;
\r
107 public void deleteFrom() {
\r
108 this._has_from = false;
\r
113 public void deleteStart() {
\r
114 this._has_start = false;
\r
119 public void deleteTo() {
\r
120 this._has_to = false;
\r
124 * Overrides the java.lang.Object.equals method.
\r
127 * @return true if the objects are equal.
\r
129 public boolean equals(final java.lang.Object obj) {
\r
133 if (super.equals(obj) == false)
\r
136 if (obj instanceof MapList) {
\r
138 MapList temp = (MapList) obj;
\r
139 if (this._from != temp._from)
\r
141 if (this._has_from != temp._has_from)
\r
143 if (this._to != temp._to)
\r
145 if (this._has_to != temp._has_to)
\r
147 if (this._start != temp._start)
\r
149 if (this._has_start != temp._has_start)
\r
151 if (this._end != temp._end)
\r
153 if (this._has_end != temp._has_end)
\r
161 * Returns the value of field 'end'. The field 'end' has the following
\r
162 * description: Offset to last position in database entry that last (offset)
\r
163 * position in sequence maps to
\r
165 * @return the value of field 'End'.
\r
167 public long getEnd() {
\r
172 * Returns the value of field 'from'. The field 'from' has the following
\r
173 * description: Offset to first position in dataset sequence record that start
\r
174 * position on 'onto' maps to
\r
176 * @return the value of field 'From'.
\r
178 public long getFrom() {
\r
183 * Returns the value of field 'start'. The field 'start' has the following
\r
184 * description: Offset to first position in database entry that first (or
\r
185 * offset) position in sequence maps to
\r
187 * @return the value of field 'Start'.
\r
189 public long getStart() {
\r
190 return this._start;
\r
194 * Returns the value of field 'to'. The field 'to' has the following
\r
195 * description: Offset to last position in dataset sequence record that end
\r
196 * position on 'onto' maps to
\r
198 * @return the value of field 'To'.
\r
200 public long getTo() {
\r
207 * @return true if at least one End has been added
\r
209 public boolean hasEnd() {
\r
210 return this._has_end;
\r
216 * @return true if at least one From has been added
\r
218 public boolean hasFrom() {
\r
219 return this._has_from;
\r
225 * @return true if at least one Start has been added
\r
227 public boolean hasStart() {
\r
228 return this._has_start;
\r
234 * @return true if at least one To has been added
\r
236 public boolean hasTo() {
\r
237 return this._has_to;
\r
241 * Overrides the java.lang.Object.hashCode method.
\r
243 * The following steps came from <b>Effective Java Programming Language
\r
244 * Guide</b> by Joshua Bloch, Chapter 3
\r
246 * @return a hash code value for the object.
\r
248 public int hashCode() {
\r
249 int result = super.hashCode();
\r
252 result = 37 * result + (int) (_from ^ (_from >>> 32));
\r
253 result = 37 * result + (int) (_to ^ (_to >>> 32));
\r
254 result = 37 * result + (int) (_start ^ (_start >>> 32));
\r
255 result = 37 * result + (int) (_end ^ (_end >>> 32));
\r
263 * @return true if this object is valid according to the schema
\r
265 public boolean isValid() {
\r
268 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
278 * @throws org.exolab.castor.xml.MarshalException
\r
279 * if object is null or if any SAXException is thrown during
\r
281 * @throws org.exolab.castor.xml.ValidationException
\r
282 * if this object is an invalid instance according to the schema
\r
284 public void marshal(final java.io.Writer out)
\r
285 throws org.exolab.castor.xml.MarshalException,
\r
286 org.exolab.castor.xml.ValidationException {
\r
287 Marshaller.marshal(this, out);
\r
294 * @throws java.io.IOException
\r
295 * if an IOException occurs during marshaling
\r
296 * @throws org.exolab.castor.xml.ValidationException
\r
297 * if this object is an invalid instance according to the schema
\r
298 * @throws org.exolab.castor.xml.MarshalException
\r
299 * if object is null or if any SAXException is thrown during
\r
302 public void marshal(final org.xml.sax.ContentHandler handler)
\r
303 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
304 org.exolab.castor.xml.ValidationException {
\r
305 Marshaller.marshal(this, handler);
\r
309 * Sets the value of field 'end'. The field 'end' has the following
\r
310 * description: Offset to last position in database entry that last (offset)
\r
311 * position in sequence maps to
\r
314 * the value of field 'end'.
\r
316 public void setEnd(final long end) {
\r
318 this._has_end = true;
\r
322 * Sets the value of field 'from'. The field 'from' has the following
\r
323 * description: Offset to first position in dataset sequence record that start
\r
324 * position on 'onto' maps to
\r
327 * the value of field 'from'.
\r
329 public void setFrom(final long from) {
\r
331 this._has_from = true;
\r
335 * Sets the value of field 'start'. The field 'start' has the following
\r
336 * description: Offset to first position in database entry that first (or
\r
337 * offset) position in sequence maps to
\r
340 * the value of field 'start'.
\r
342 public void setStart(final long start) {
\r
343 this._start = start;
\r
344 this._has_start = true;
\r
348 * Sets the value of field 'to'. The field 'to' has the following description:
\r
349 * Offset to last position in dataset sequence record that end position on
\r
353 * the value of field 'to'.
\r
355 public void setTo(final long to) {
\r
357 this._has_to = true;
\r
361 * Method unmarshal.
\r
364 * @throws org.exolab.castor.xml.MarshalException
\r
365 * if object is null or if any SAXException is thrown during
\r
367 * @throws org.exolab.castor.xml.ValidationException
\r
368 * if this object is an invalid instance according to the schema
\r
369 * @return the unmarshaled uk.ac.vamsas.objects.core.MapList
\r
371 public static uk.ac.vamsas.objects.core.MapList unmarshal(
\r
372 final java.io.Reader reader)
\r
373 throws org.exolab.castor.xml.MarshalException,
\r
374 org.exolab.castor.xml.ValidationException {
\r
375 return (uk.ac.vamsas.objects.core.MapList) Unmarshaller.unmarshal(
\r
376 uk.ac.vamsas.objects.core.MapList.class, reader);
\r
382 * @throws org.exolab.castor.xml.ValidationException
\r
383 * if this object is an invalid instance according to the schema
\r
385 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
386 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
387 validator.validate(this);
\r