2 * This file is part of the Vamsas Client version 0.2.
3 * Copyright 2010 by Jim Procter, Iain Milne, Pierre Marguerite,
4 * Andrew Waterhouse and Dominik Lindner.
6 * Earlier versions have also been incorporated into Jalview version 2.4
7 * since 2008, and TOPALi version 2 since 2007.
9 * The Vamsas Client is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * The Vamsas Client is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
22 package uk.ac.vamsas.objects.core;
24 //---------------------------------/
25 //- Imported classes and packages -/
26 //---------------------------------/
28 import org.exolab.castor.xml.Marshaller;
29 import org.exolab.castor.xml.Unmarshaller;
34 * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
37 public class LockFile extends uk.ac.vamsas.client.Vobject implements
38 java.io.Serializable {
40 // --------------------------/
41 // - Class/Member Variables -/
42 // --------------------------/
45 * internal content storage
47 private java.lang.String _content = "";
63 * Overrides the java.lang.Object.equals method.
66 * @return true if the objects are equal.
68 public boolean equals(final java.lang.Object obj) {
72 if (super.equals(obj) == false)
75 if (obj instanceof LockFile) {
77 LockFile temp = (LockFile) obj;
80 if (this._content != null) {
81 if (temp._content == null)
83 if (this._content != temp._content) {
84 thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);
85 tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);
86 if (thcycle != tmcycle) {
88 org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
92 org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
98 if (!this._content.equals(temp._content)) {
99 org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
100 org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
103 org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
104 org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
107 } else if (temp._content != null)
115 * Returns the value of field 'content'. The field 'content' has the following
116 * description: internal content storage
118 * @return the value of field 'Content'.
120 public java.lang.String getContent() {
121 return this._content;
125 * Overrides the java.lang.Object.hashCode method.
127 * The following steps came from <b>Effective Java Programming Language
128 * Guide</b> by Joshua Bloch, Chapter 3
130 * @return a hash code value for the object.
132 public int hashCode() {
133 int result = super.hashCode();
137 && !org.castor.util.CycleBreaker.startingToCycle(_content)) {
138 result = 37 * result + _content.hashCode();
139 org.castor.util.CycleBreaker.releaseCycleHandle(_content);
148 * @return true if this object is valid according to the schema
150 public boolean isValid() {
153 } catch (org.exolab.castor.xml.ValidationException vex) {
163 * @throws org.exolab.castor.xml.MarshalException
164 * if object is null or if any SAXException is thrown during
166 * @throws org.exolab.castor.xml.ValidationException
167 * if this object is an invalid instance according to the schema
169 public void marshal(final java.io.Writer out)
170 throws org.exolab.castor.xml.MarshalException,
171 org.exolab.castor.xml.ValidationException {
172 Marshaller.marshal(this, out);
179 * @throws java.io.IOException
180 * if an IOException occurs during marshaling
181 * @throws org.exolab.castor.xml.ValidationException
182 * if this object is an invalid instance according to the schema
183 * @throws org.exolab.castor.xml.MarshalException
184 * if object is null or if any SAXException is thrown during
187 public void marshal(final org.xml.sax.ContentHandler handler)
188 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
189 org.exolab.castor.xml.ValidationException {
190 Marshaller.marshal(this, handler);
194 * Sets the value of field 'content'. The field 'content' has the following
195 * description: internal content storage
198 * the value of field 'content'.
200 public void setContent(final java.lang.String content) {
201 this._content = content;
208 * @throws org.exolab.castor.xml.MarshalException
209 * if object is null or if any SAXException is thrown during
211 * @throws org.exolab.castor.xml.ValidationException
212 * if this object is an invalid instance according to the schema
213 * @return the unmarshaled uk.ac.vamsas.objects.core.LockFile
215 public static uk.ac.vamsas.objects.core.LockFile unmarshal(
216 final java.io.Reader reader)
217 throws org.exolab.castor.xml.MarshalException,
218 org.exolab.castor.xml.ValidationException {
219 return (uk.ac.vamsas.objects.core.LockFile) Unmarshaller.unmarshal(
220 uk.ac.vamsas.objects.core.LockFile.class, reader);
226 * @throws org.exolab.castor.xml.ValidationException
227 * if this object is an invalid instance according to the schema
229 public void validate() throws org.exolab.castor.xml.ValidationException {
230 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
231 validator.validate(this);