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
32 * a position within the associated object's coordinate system
\r
35 * @version $Revision$ $Date$
\r
37 public class Pos extends uk.ac.vamsas.client.Vobject implements
\r
38 java.io.Serializable {
\r
40 // --------------------------/
\r
41 // - Class/Member Variables -/
\r
42 // --------------------------/
\r
50 * keeps track of state for field: _i
\r
52 private boolean _has_i;
\r
54 // ----------------/
\r
55 // - Constructors -/
\r
56 // ----------------/
\r
68 public void deleteI() {
\r
69 this._has_i = false;
\r
73 * Overrides the java.lang.Object.equals method.
\r
76 * @return true if the objects are equal.
\r
78 public boolean equals(final java.lang.Object obj) {
\r
82 if (super.equals(obj) == false)
\r
85 if (obj instanceof Pos) {
\r
87 Pos temp = (Pos) obj;
\r
90 if (this._i != temp._i)
\r
92 if (this._has_i != temp._has_i)
\r
100 * Returns the value of field 'i'.
\r
102 * @return the value of field 'I'.
\r
104 public int getI() {
\r
111 * @return true if at least one I has been added
\r
113 public boolean hasI() {
\r
114 return this._has_i;
\r
118 * Overrides the java.lang.Object.hashCode method.
\r
120 * The following steps came from <b>Effective Java Programming Language
\r
121 * Guide</b> by Joshua Bloch, Chapter 3
\r
123 * @return a hash code value for the object.
\r
125 public int hashCode() {
\r
126 int result = super.hashCode();
\r
129 result = 37 * result + _i;
\r
137 * @return true if this object is valid according to the schema
\r
139 public boolean isValid() {
\r
142 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
152 * @throws org.exolab.castor.xml.MarshalException
\r
153 * if object is null or if any SAXException is thrown during
\r
155 * @throws org.exolab.castor.xml.ValidationException
\r
156 * if this object is an invalid instance according to the schema
\r
158 public void marshal(final java.io.Writer out)
\r
159 throws org.exolab.castor.xml.MarshalException,
\r
160 org.exolab.castor.xml.ValidationException {
\r
161 Marshaller.marshal(this, out);
\r
168 * @throws java.io.IOException
\r
169 * if an IOException occurs during marshaling
\r
170 * @throws org.exolab.castor.xml.ValidationException
\r
171 * if this object is an invalid instance according to the schema
\r
172 * @throws org.exolab.castor.xml.MarshalException
\r
173 * if object is null or if any SAXException is thrown during
\r
176 public void marshal(final org.xml.sax.ContentHandler handler)
\r
177 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
178 org.exolab.castor.xml.ValidationException {
\r
179 Marshaller.marshal(this, handler);
\r
183 * Sets the value of field 'i'.
\r
186 * the value of field 'i'.
\r
188 public void setI(final int i) {
\r
190 this._has_i = true;
\r
194 * Method unmarshal.
\r
197 * @throws org.exolab.castor.xml.MarshalException
\r
198 * if object is null or if any SAXException is thrown during
\r
200 * @throws org.exolab.castor.xml.ValidationException
\r
201 * if this object is an invalid instance according to the schema
\r
202 * @return the unmarshaled uk.ac.vamsas.objects.core.Pos
\r
204 public static uk.ac.vamsas.objects.core.Pos unmarshal(
\r
205 final java.io.Reader reader)
\r
206 throws org.exolab.castor.xml.MarshalException,
\r
207 org.exolab.castor.xml.ValidationException {
\r
208 return (uk.ac.vamsas.objects.core.Pos) Unmarshaller.unmarshal(
\r
209 uk.ac.vamsas.objects.core.Pos.class, reader);
\r
215 * @throws org.exolab.castor.xml.ValidationException
\r
216 * if this object is an invalid instance according to the schema
\r
218 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
219 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
220 validator.validate(this);
\r