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 Mapping extends uk.ac.vamsas.objects.core.MapList implements
\r
37 java.io.Serializable {
\r
39 // --------------------------/
\r
40 // - Class/Member Variables -/
\r
41 // --------------------------/
\r
44 * object to which the mapping is being mapped
\r
47 private java.lang.Object _onto;
\r
49 // ----------------/
\r
50 // - Constructors -/
\r
51 // ----------------/
\r
62 * Overrides the java.lang.Object.equals method.
\r
65 * @return true if the objects are equal.
\r
67 public boolean equals(final java.lang.Object obj) {
\r
71 if (super.equals(obj) == false)
\r
74 if (obj instanceof Mapping) {
\r
76 Mapping temp = (Mapping) obj;
\r
77 if (this._onto != null) {
\r
78 if (temp._onto == null)
\r
80 else if (!(this._onto.equals(temp._onto)))
\r
82 } else if (temp._onto != null)
\r
90 * Returns the value of field 'onto'. The field 'onto' has the following
\r
91 * description: object to which the mapping is being mapped
\r
94 * @return the value of field 'Onto'.
\r
96 public java.lang.Object getOnto() {
\r
101 * Overrides the java.lang.Object.hashCode method.
\r
103 * The following steps came from <b>Effective Java Programming Language
\r
104 * Guide</b> by Joshua Bloch, Chapter 3
\r
106 * @return a hash code value for the object.
\r
108 public int hashCode() {
\r
109 int result = super.hashCode();
\r
112 if (_onto != null) {
\r
113 result = 37 * result + _onto.hashCode();
\r
122 * @return true if this object is valid according to the schema
\r
124 public boolean isValid() {
\r
127 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
137 * @throws org.exolab.castor.xml.MarshalException
\r
138 * if object is null or if any SAXException is thrown during
\r
140 * @throws org.exolab.castor.xml.ValidationException
\r
141 * if this object is an invalid instance according to the schema
\r
143 public void marshal(final java.io.Writer out)
\r
144 throws org.exolab.castor.xml.MarshalException,
\r
145 org.exolab.castor.xml.ValidationException {
\r
146 Marshaller.marshal(this, out);
\r
153 * @throws java.io.IOException
\r
154 * if an IOException occurs during marshaling
\r
155 * @throws org.exolab.castor.xml.ValidationException
\r
156 * if this object is an invalid instance according to the schema
\r
157 * @throws org.exolab.castor.xml.MarshalException
\r
158 * if object is null or if any SAXException is thrown during
\r
161 public void marshal(final org.xml.sax.ContentHandler handler)
\r
162 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
163 org.exolab.castor.xml.ValidationException {
\r
164 Marshaller.marshal(this, handler);
\r
168 * Sets the value of field 'onto'. The field 'onto' has the following
\r
169 * description: object to which the mapping is being mapped
\r
173 * the value of field 'onto'.
\r
175 public void setOnto(final java.lang.Object onto) {
\r
180 * Method unmarshal.
\r
183 * @throws org.exolab.castor.xml.MarshalException
\r
184 * if object is null or if any SAXException is thrown during
\r
186 * @throws org.exolab.castor.xml.ValidationException
\r
187 * if this object is an invalid instance according to the schema
\r
188 * @return the unmarshaled uk.ac.vamsas.objects.core.MapList
\r
190 public static uk.ac.vamsas.objects.core.MapList unmarshal(
\r
191 final java.io.Reader reader)
\r
192 throws org.exolab.castor.xml.MarshalException,
\r
193 org.exolab.castor.xml.ValidationException {
\r
194 return (uk.ac.vamsas.objects.core.MapList) Unmarshaller.unmarshal(
\r
195 uk.ac.vamsas.objects.core.Mapping.class, reader);
\r
201 * @throws org.exolab.castor.xml.ValidationException
\r
202 * if this object is an invalid instance according to the schema
\r
204 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
205 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
206 validator.validate(this);
\r