\r
Source Code Contributions\r
uk.ac.vamsas.utils.Trees and trees: Re-licenced as LGPL from the Jalview program normally available as GPL\r
-org.apache.tools.zip : Modified under the terms of the Apache 2 licence and re-distributed as LGPL (see LICENCE-apache-tools-zip).\r
+org.apache.tools.zip : Modified under the terms of the Apache 2 licence and re-distributed as LGPL (see LICENCE-apache-tools-zip and org.apache.tools.zip.ZipFile class source).\r
\r
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
--- /dev/null
+The VAMSAS Client\r
+=================\r
+\r
+This is an LGPLed Java implementation of the VAMSAS framework for \r
+bioinformatics application data exchange interoperation. \r
+VAMSAS is a pseudo-acronym, and is short for 'Visualization and Analysis \r
+of Molecular Sequences, Alignments and Structures'. \r
+The client is the product of an eScience research project funded by the\r
+UK Biotechnology and Biological Sciences Research Council which\r
+aimed to enable interoperation between visualization and analysis tools\r
+that deal with DNA, protein sequences, alignments, and molecular structures.\r
+\r
+The framework model is language independent - but this \r
+java prototype was developed for incorporation in the \r
+three sister programs (Jalview, TOPALi and AstexViewer@EBI-MSD)\r
+involved in the vamsas project (http://www.vamsas.ac.uk).\r
+\r
+Directory structure and Build Notes\r
+-----------------------------------\r
+Java source lives under src, runtime dependencies under lib and resources,\r
+compile time dependencies (which need to be added to the ant build classpath) \r
+reside in tools, and license details for dependencies are described in CONTRIB.\r
+Ant 1.7 has been verified to work with the provided build.xml.\r
+\r
+API and schema documentation can be found under the docs directory, \r
+along with a variety of (not entirely up to date) notes made during \r
+the development of the code. The schemas directory contains the vamsas document\r
+XML model, plus a couple of legacy XML documents. The demo directory also contains \r
+some older demonstration data. Finally, the test directory is made conspicuous via\r
+its emptiness (sorry!). \r
+\r
+A documented demonstration client (uk.ac.vamsas.test.ExampleApplication) based\r
+on the Jalview/VAMSAS control logic shows how the VAMSAS client code is intended \r
+to be used, but it does not yet demonstrate all aspects of the interchange model.\r
+ \r
+For more information, please contact me, or any of the other developers \r
+directly, or via their program's own email discussion list.\r
+\r
+Jim Procter.\r
+7th May 2009.\r
+\r
+The other VAMSAS coders: Dominik Lindner, Pierre Marguerite, Iain Milne, Andrew Waterhouse.\r
+The VAMSAS project researchers: Geoff Barton, David Martin, David Marshall, Tom Oldfield, Frank Wright.\r
<?xml version="1.0"?>
+<!--
+ This file is part of the Vamsas Client version 0.1.
+ Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ Andrew Waterhouse and Dominik Lindner.
+
+ Earlier versions have also been incorporated into Jalview version 2.4
+ since 2008, and TOPALi version 2 since 2007.
+
+ The Vamsas Client is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Vamsas Client is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
+ -->
<project name="vamsas-client" default="build" basedir=".">
<target name="init">
<property name="vamsasClient.jar" value="vamsas-client.jar" />
<property name="vamsasClientDoc.jar" value="vamsas-client-docs.jar" />
<property name="vamsasClientSource.jar" value="vamsas-client-src-doc.jar" />
- <property name="vamsas.schema" value="schemas/vamsas.xsd" />
+ <property name="vamsasSchemaDocs.jar" value="vamsas-schema-and-doc.jar" />
+ <property name="vamsas.schema" value="schemas/vamsas.xsd" />
<property name="vamsas.doc.schema" value="schemas/vamsasDocument.xsd" />
<property name="vamsas.schema.package" value="uk.ac.vamsas.objects.core" />
<property name="vamsas.schema.package.src" value="uk/ac/vamsas/objects/core" />
<fileset dir="${resourceDir}" />
<fileset dir="${basedir}">
<include name="LICENS*"/>
+ <include name="COPYING*"/>
<include name="CONTRIB"/>
<include name="README"/>
</fileset>
<fileset dir="${outputDir}">
<exclude name="cache*/**"/>
<include name="**/*" />
- <exclude name="*.jar.*" />
+ <exclude name="*.jar.*" />
<exclude name="**/*.jar" />
<exclude name="**/*.jar.*" />
<exclude name="*.java"/>
<jar destfile="${packageDir}/${vamsasClientDoc.jar}">
<fileset dir="docs/api">
<include name="**/*"/>
+ </fileset>
+ <fileset dir="${basedir}">
<include name="README"/>
<include name="CONTRIB"/>
<include name="LICEN*"/>
+ <include name="COPYING*"/>
</fileset>
</jar>
+ <jar destfile="${packageDir}/${vamsasSchemaDocs.jar}">
+ <fileset dir="${basedir}/schemas">
+ <include name="*.xsd"/>
+ </fileset>
+ <fileset dir="${basedir}/docs/schema">
+ <include name="**/*"/>
+ </fileset>
+ <fileset dir="${basedir}">
+ <include name="COPYING*"/>
+ </fileset>
+ </jar>
<jar destfile="${packageDir}/${vamsasClientSource.jar}">
<fileset dir="${basedir}">
<include name="src/**/*.java"/>
<include name="README"/>
<include name="CONTRIB"/>
<include name="LICEN*"/>
+ <include name="COPYING*"/>
<include name="*.eclipse*"/>
<include name="*.launch"/>
<include name="build.xml"/>
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file is part of the Vamsas Client version 0.1.
+ Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ Andrew Waterhouse and Dominik Lindner.
+
+ Earlier versions have also been incorporated into Jalview version 2.4
+ since 2008, and TOPALi version 2 since 2007.
+
+ The Vamsas Client is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Vamsas Client is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
+ -->
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by MSD (EMBL OUTSTATION THE EBI WELLCOME TRUST GENOME CAMPUS) -->
<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file is part of the Vamsas Client version 0.1.
+ Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ Andrew Waterhouse and Dominik Lindner.
+
+ Earlier versions have also been incorporated into Jalview version 2.4
+ since 2008, and TOPALi version 2 since 2007.
+
+ The Vamsas Client is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ The Vamsas Client is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
+-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vdoc="http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument" xmlns:vamsas="http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes" targetNamespace="http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument" elementFormDefault="qualified">
<xs:import namespace="http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes" schemaLocation="vamsas.xsd"/>
<xs:element name="VamsasDocument" nillable="false">
</xs:sequence>
</xs:complexType>
</xs:element>
-</xs:schema>
\ No newline at end of file
+</xs:schema>
import java.util.zip.ZipException;
/**
- * Adds Unix file permission and UID/GID fields as well as symbolic
- * link handling.
- *
- * <p>This class uses the ASi extra field in the format:
+ * Adds Unix file permission and UID/GID fields as well as symbolic link
+ * handling.
+ *
+ * <p>
+ * This class uses the ASi extra field in the format:
+ *
* <pre>
* Value Size Description
* ----- ---- -----------
* GID Short group ID
* (var.) variable symbolic link filename
* </pre>
+ *
* taken from appnote.iz (Info-ZIP note, 981119) found at <a
- * href="ftp://ftp.uu.net/pub/archiving/zip/doc/">ftp://ftp.uu.net/pub/archiving/zip/doc/</a></p>
-
- *
- * <p>Short is two bytes and Long is four bytes in big endian byte and
- * word order, device numbers are currently not supported.</p>
- *
+ * href="ftp://ftp.uu.net/pub/archiving/zip/doc/"
+ * >ftp://ftp.uu.net/pub/archiving/zip/doc/</a>
+ * </p>
+ *
+ *
+ * <p>
+ * Short is two bytes and Long is four bytes in big endian byte and word order,
+ * device numbers are currently not supported.
+ * </p>
+ *
*/
public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable {
- private static final ZipShort HEADER_ID = new ZipShort(0x756E);
-
- /**
- * Standard Unix stat(2) file mode.
- *
- * @since 1.1
- */
- private int mode = 0;
- /**
- * User ID.
- *
- * @since 1.1
- */
- private int uid = 0;
- /**
- * Group ID.
- *
- * @since 1.1
- */
- private int gid = 0;
- /**
- * File this entry points to, if it is a symbolic link.
- *
- * <p>empty string - if entry is not a symbolic link.</p>
- *
- * @since 1.1
- */
- private String link = "";
- /**
- * Is this an entry for a directory?
- *
- * @since 1.1
- */
- private boolean dirFlag = false;
-
- /**
- * Instance used to calculate checksums.
- *
- * @since 1.1
- */
- private CRC32 crc = new CRC32();
-
- /** Constructor for AsiExtraField. */
- public AsiExtraField() {
- }
-
- /**
- * The Header-ID.
- * @return the value for the header id for this extrafield
- * @since 1.1
- */
- public ZipShort getHeaderId() {
- return HEADER_ID;
- }
-
- /**
- * Length of the extra field in the local file data - without
- * Header-ID or length specifier.
- * @return a <code>ZipShort</code> for the length of the data of this extra field
- * @since 1.1
- */
- public ZipShort getLocalFileDataLength() {
- return new ZipShort(4 // CRC
- + 2 // Mode
- + 4 // SizDev
- + 2 // UID
- + 2 // GID
- + getLinkedFile().getBytes().length);
- }
-
- /**
- * Delegate to local file data.
- * @return the centralDirectory length
- * @since 1.1
- */
- public ZipShort getCentralDirectoryLength() {
- return getLocalFileDataLength();
- }
-
- /**
- * The actual data to put into local file data - without Header-ID
- * or length specifier.
- * @return get the data
- * @since 1.1
- */
- public byte[] getLocalFileDataData() {
- // CRC will be added later
- byte[] data = new byte[getLocalFileDataLength().getValue() - 4];
- System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2);
-
- byte[] linkArray = getLinkedFile().getBytes();
- System.arraycopy(ZipLong.getBytes(linkArray.length),
- 0, data, 2, 4);
-
- System.arraycopy(ZipShort.getBytes(getUserId()),
- 0, data, 6, 2);
- System.arraycopy(ZipShort.getBytes(getGroupId()),
- 0, data, 8, 2);
-
- System.arraycopy(linkArray, 0, data, 10, linkArray.length);
-
- crc.reset();
- crc.update(data);
- long checksum = crc.getValue();
-
- byte[] result = new byte[data.length + 4];
- System.arraycopy(ZipLong.getBytes(checksum), 0, result, 0, 4);
- System.arraycopy(data, 0, result, 4, data.length);
- return result;
- }
-
- /**
- * Delegate to local file data.
- * @return the local file data
- * @since 1.1
- */
- public byte[] getCentralDirectoryData() {
- return getLocalFileDataData();
- }
-
- /**
- * Set the user id.
- * @param uid the user id
- * @since 1.1
- */
- public void setUserId(int uid) {
- this.uid = uid;
- }
-
- /**
- * Get the user id.
- * @return the user id
- * @since 1.1
- */
- public int getUserId() {
- return uid;
+ private static final ZipShort HEADER_ID = new ZipShort(0x756E);
+
+ /**
+ * Standard Unix stat(2) file mode.
+ *
+ * @since 1.1
+ */
+ private int mode = 0;
+
+ /**
+ * User ID.
+ *
+ * @since 1.1
+ */
+ private int uid = 0;
+
+ /**
+ * Group ID.
+ *
+ * @since 1.1
+ */
+ private int gid = 0;
+
+ /**
+ * File this entry points to, if it is a symbolic link.
+ *
+ * <p>
+ * empty string - if entry is not a symbolic link.
+ * </p>
+ *
+ * @since 1.1
+ */
+ private String link = "";
+
+ /**
+ * Is this an entry for a directory?
+ *
+ * @since 1.1
+ */
+ private boolean dirFlag = false;
+
+ /**
+ * Instance used to calculate checksums.
+ *
+ * @since 1.1
+ */
+ private CRC32 crc = new CRC32();
+
+ /** Constructor for AsiExtraField. */
+ public AsiExtraField() {
+ }
+
+ /**
+ * The Header-ID.
+ *
+ * @return the value for the header id for this extrafield
+ * @since 1.1
+ */
+ public ZipShort getHeaderId() {
+ return HEADER_ID;
+ }
+
+ /**
+ * Length of the extra field in the local file data - without Header-ID or
+ * length specifier.
+ *
+ * @return a <code>ZipShort</code> for the length of the data of this extra
+ * field
+ * @since 1.1
+ */
+ public ZipShort getLocalFileDataLength() {
+ return new ZipShort(4 // CRC
+ + 2 // Mode
+ + 4 // SizDev
+ + 2 // UID
+ + 2 // GID
+ + getLinkedFile().getBytes().length);
+ }
+
+ /**
+ * Delegate to local file data.
+ *
+ * @return the centralDirectory length
+ * @since 1.1
+ */
+ public ZipShort getCentralDirectoryLength() {
+ return getLocalFileDataLength();
+ }
+
+ /**
+ * The actual data to put into local file data - without Header-ID or length
+ * specifier.
+ *
+ * @return get the data
+ * @since 1.1
+ */
+ public byte[] getLocalFileDataData() {
+ // CRC will be added later
+ byte[] data = new byte[getLocalFileDataLength().getValue() - 4];
+ System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2);
+
+ byte[] linkArray = getLinkedFile().getBytes();
+ System.arraycopy(ZipLong.getBytes(linkArray.length), 0, data, 2, 4);
+
+ System.arraycopy(ZipShort.getBytes(getUserId()), 0, data, 6, 2);
+ System.arraycopy(ZipShort.getBytes(getGroupId()), 0, data, 8, 2);
+
+ System.arraycopy(linkArray, 0, data, 10, linkArray.length);
+
+ crc.reset();
+ crc.update(data);
+ long checksum = crc.getValue();
+
+ byte[] result = new byte[data.length + 4];
+ System.arraycopy(ZipLong.getBytes(checksum), 0, result, 0, 4);
+ System.arraycopy(data, 0, result, 4, data.length);
+ return result;
+ }
+
+ /**
+ * Delegate to local file data.
+ *
+ * @return the local file data
+ * @since 1.1
+ */
+ public byte[] getCentralDirectoryData() {
+ return getLocalFileDataData();
+ }
+
+ /**
+ * Set the user id.
+ *
+ * @param uid
+ * the user id
+ * @since 1.1
+ */
+ public void setUserId(int uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * Get the user id.
+ *
+ * @return the user id
+ * @since 1.1
+ */
+ public int getUserId() {
+ return uid;
+ }
+
+ /**
+ * Set the group id.
+ *
+ * @param gid
+ * the group id
+ * @since 1.1
+ */
+ public void setGroupId(int gid) {
+ this.gid = gid;
+ }
+
+ /**
+ * Get the group id.
+ *
+ * @return the group id
+ * @since 1.1
+ */
+ public int getGroupId() {
+ return gid;
+ }
+
+ /**
+ * Indicate that this entry is a symbolic link to the given filename.
+ *
+ * @param name
+ * Name of the file this entry links to, empty String if it is not a
+ * symbolic link.
+ *
+ * @since 1.1
+ */
+ public void setLinkedFile(String name) {
+ link = name;
+ mode = getMode(mode);
+ }
+
+ /**
+ * Name of linked file
+ *
+ * @return name of the file this entry links to if it is a symbolic link, the
+ * empty string otherwise.
+ *
+ * @since 1.1
+ */
+ public String getLinkedFile() {
+ return link;
+ }
+
+ /**
+ * Is this entry a symbolic link?
+ *
+ * @return true if this is a symbolic link
+ * @since 1.1
+ */
+ public boolean isLink() {
+ return getLinkedFile().length() != 0;
+ }
+
+ /**
+ * File mode of this file.
+ *
+ * @param mode
+ * the file mode
+ * @since 1.1
+ */
+ public void setMode(int mode) {
+ this.mode = getMode(mode);
+ }
+
+ /**
+ * File mode of this file.
+ *
+ * @return the file mode
+ * @since 1.1
+ */
+ public int getMode() {
+ return mode;
+ }
+
+ /**
+ * Indicate whether this entry is a directory.
+ *
+ * @param dirFlag
+ * if true, this entry is a directory
+ * @since 1.1
+ */
+ public void setDirectory(boolean dirFlag) {
+ this.dirFlag = dirFlag;
+ mode = getMode(mode);
+ }
+
+ /**
+ * Is this entry a directory?
+ *
+ * @return true if this entry is a directory
+ * @since 1.1
+ */
+ public boolean isDirectory() {
+ return dirFlag && !isLink();
+ }
+
+ /**
+ * Populate data from this array as if it was in local file data.
+ *
+ * @param data
+ * an array of bytes
+ * @param offset
+ * the start offset
+ * @param length
+ * the number of bytes in the array from offset
+ * @since 1.1
+ * @throws ZipException
+ * on error
+ */
+ public void parseFromLocalFileData(byte[] data, int offset, int length)
+ throws ZipException {
+
+ long givenChecksum = ZipLong.getValue(data, offset);
+ byte[] tmp = new byte[length - 4];
+ System.arraycopy(data, offset + 4, tmp, 0, length - 4);
+ crc.reset();
+ crc.update(tmp);
+ long realChecksum = crc.getValue();
+ if (givenChecksum != realChecksum) {
+ throw new ZipException("bad CRC checksum "
+ + Long.toHexString(givenChecksum) + " instead of "
+ + Long.toHexString(realChecksum));
}
- /**
- * Set the group id.
- * @param gid the group id
- * @since 1.1
- */
- public void setGroupId(int gid) {
- this.gid = gid;
- }
-
- /**
- * Get the group id.
- * @return the group id
- * @since 1.1
- */
- public int getGroupId() {
- return gid;
- }
-
- /**
- * Indicate that this entry is a symbolic link to the given filename.
- *
- * @param name Name of the file this entry links to, empty String
- * if it is not a symbolic link.
- *
- * @since 1.1
- */
- public void setLinkedFile(String name) {
- link = name;
- mode = getMode(mode);
- }
-
- /**
- * Name of linked file
- *
- * @return name of the file this entry links to if it is a
- * symbolic link, the empty string otherwise.
- *
- * @since 1.1
- */
- public String getLinkedFile() {
- return link;
- }
-
- /**
- * Is this entry a symbolic link?
- * @return true if this is a symbolic link
- * @since 1.1
- */
- public boolean isLink() {
- return getLinkedFile().length() != 0;
- }
+ int newMode = ZipShort.getValue(tmp, 0);
+ byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
+ uid = ZipShort.getValue(tmp, 6);
+ gid = ZipShort.getValue(tmp, 8);
- /**
- * File mode of this file.
- * @param mode the file mode
- * @since 1.1
- */
- public void setMode(int mode) {
- this.mode = getMode(mode);
+ if (linkArray.length == 0) {
+ link = "";
+ } else {
+ System.arraycopy(tmp, 10, linkArray, 0, linkArray.length);
+ link = new String(linkArray);
}
-
- /**
- * File mode of this file.
- * @return the file mode
- * @since 1.1
- */
- public int getMode() {
- return mode;
- }
-
- /**
- * Indicate whether this entry is a directory.
- * @param dirFlag if true, this entry is a directory
- * @since 1.1
- */
- public void setDirectory(boolean dirFlag) {
- this.dirFlag = dirFlag;
- mode = getMode(mode);
- }
-
- /**
- * Is this entry a directory?
- * @return true if this entry is a directory
- * @since 1.1
- */
- public boolean isDirectory() {
- return dirFlag && !isLink();
- }
-
- /**
- * Populate data from this array as if it was in local file data.
- * @param data an array of bytes
- * @param offset the start offset
- * @param length the number of bytes in the array from offset
- * @since 1.1
- * @throws ZipException on error
- */
- public void parseFromLocalFileData(byte[] data, int offset, int length)
- throws ZipException {
-
- long givenChecksum = ZipLong.getValue(data, offset);
- byte[] tmp = new byte[length - 4];
- System.arraycopy(data, offset + 4, tmp, 0, length - 4);
- crc.reset();
- crc.update(tmp);
- long realChecksum = crc.getValue();
- if (givenChecksum != realChecksum) {
- throw new ZipException("bad CRC checksum "
- + Long.toHexString(givenChecksum)
- + " instead of "
- + Long.toHexString(realChecksum));
- }
-
- int newMode = ZipShort.getValue(tmp, 0);
- byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
- uid = ZipShort.getValue(tmp, 6);
- gid = ZipShort.getValue(tmp, 8);
-
- if (linkArray.length == 0) {
- link = "";
- } else {
- System.arraycopy(tmp, 10, linkArray, 0, linkArray.length);
- link = new String(linkArray);
- }
- setDirectory((newMode & DIR_FLAG) != 0);
- setMode(newMode);
- }
-
- /**
- * Get the file mode for given permissions with the correct file type.
- * @param mode the mode
- * @return the type with the mode
- * @since 1.1
- */
- protected int getMode(int mode) {
- int type = FILE_FLAG;
- if (isLink()) {
- type = LINK_FLAG;
- } else if (isDirectory()) {
- type = DIR_FLAG;
- }
- return type | (mode & PERM_MASK);
+ setDirectory((newMode & DIR_FLAG) != 0);
+ setMode(newMode);
+ }
+
+ /**
+ * Get the file mode for given permissions with the correct file type.
+ *
+ * @param mode
+ * the mode
+ * @return the type with the mode
+ * @since 1.1
+ */
+ protected int getMode(int mode) {
+ int type = FILE_FLAG;
+ if (isLink()) {
+ type = LINK_FLAG;
+ } else if (isDirectory()) {
+ type = DIR_FLAG;
}
+ return type | (mode & PERM_MASK);
+ }
}
/**
* ZipExtraField related methods
- *
+ *
*/
public class ExtraFieldUtils {
- /**
- * Static registry of known extra fields.
- *
- * @since 1.1
- */
- private static Hashtable implementations;
+ /**
+ * Static registry of known extra fields.
+ *
+ * @since 1.1
+ */
+ private static Hashtable implementations;
+
+ static {
+ implementations = new Hashtable();
+ register(AsiExtraField.class);
+ register(JarMarker.class);
+ }
- static {
- implementations = new Hashtable();
- register(AsiExtraField.class);
- register(JarMarker.class);
+ /**
+ * Register a ZipExtraField implementation.
+ *
+ * <p>
+ * The given class must have a no-arg constructor and implement the
+ * {@link ZipExtraField ZipExtraField interface}.
+ * </p>
+ *
+ * @param c
+ * the class to register
+ *
+ * @since 1.1
+ */
+ public static void register(Class c) {
+ try {
+ ZipExtraField ze = (ZipExtraField) c.newInstance();
+ implementations.put(ze.getHeaderId(), c);
+ } catch (ClassCastException cc) {
+ throw new RuntimeException(c + " doesn\'t implement ZipExtraField");
+ } catch (InstantiationException ie) {
+ throw new RuntimeException(c + " is not a concrete class");
+ } catch (IllegalAccessException ie) {
+ throw new RuntimeException(c + "\'s no-arg constructor is not public");
}
+ }
- /**
- * Register a ZipExtraField implementation.
- *
- * <p>The given class must have a no-arg constructor and implement
- * the {@link ZipExtraField ZipExtraField interface}.</p>
- * @param c the class to register
- *
- * @since 1.1
- */
- public static void register(Class c) {
- try {
- ZipExtraField ze = (ZipExtraField) c.newInstance();
- implementations.put(ze.getHeaderId(), c);
- } catch (ClassCastException cc) {
- throw new RuntimeException(c + " doesn\'t implement ZipExtraField");
- } catch (InstantiationException ie) {
- throw new RuntimeException(c + " is not a concrete class");
- } catch (IllegalAccessException ie) {
- throw new RuntimeException(c + "\'s no-arg constructor is not public");
- }
+ /**
+ * Create an instance of the approriate ExtraField, falls back to
+ * {@link UnrecognizedExtraField UnrecognizedExtraField}.
+ *
+ * @param headerId
+ * the header identifier
+ * @return an instance of the appropiate ExtraField
+ * @exception InstantiationException
+ * if unable to instantiate the class
+ * @exception IllegalAccessException
+ * if not allowed to instatiate the class
+ * @since 1.1
+ */
+ public static ZipExtraField createExtraField(ZipShort headerId)
+ throws InstantiationException, IllegalAccessException {
+ Class c = (Class) implementations.get(headerId);
+ if (c != null) {
+ return (ZipExtraField) c.newInstance();
}
+ UnrecognizedExtraField u = new UnrecognizedExtraField();
+ u.setHeaderId(headerId);
+ return u;
+ }
- /**
- * Create an instance of the approriate ExtraField, falls back to
- * {@link UnrecognizedExtraField UnrecognizedExtraField}.
- * @param headerId the header identifier
- * @return an instance of the appropiate ExtraField
- * @exception InstantiationException if unable to instantiate the class
- * @exception IllegalAccessException if not allowed to instatiate the class
- * @since 1.1
- */
- public static ZipExtraField createExtraField(ZipShort headerId)
- throws InstantiationException, IllegalAccessException {
- Class c = (Class) implementations.get(headerId);
- if (c != null) {
- return (ZipExtraField) c.newInstance();
- }
- UnrecognizedExtraField u = new UnrecognizedExtraField();
- u.setHeaderId(headerId);
- return u;
+ /**
+ * Split the array into ExtraFields and populate them with the give data.
+ *
+ * @param data
+ * an array of bytes
+ * @return an array of ExtraFields
+ * @since 1.1
+ * @throws ZipException
+ * on error
+ */
+ public static ZipExtraField[] parse(byte[] data) throws ZipException {
+ Vector v = new Vector();
+ int start = 0;
+ while (start <= data.length - 4) {
+ ZipShort headerId = new ZipShort(data, start);
+ int length = (new ZipShort(data, start + 2)).getValue();
+ if (start + 4 + length > data.length) {
+ throw new ZipException("data starting at " + start
+ + " is in unknown format");
+ }
+ try {
+ ZipExtraField ze = createExtraField(headerId);
+ ze.parseFromLocalFileData(data, start + 4, length);
+ v.addElement(ze);
+ } catch (InstantiationException ie) {
+ throw new ZipException(ie.getMessage());
+ } catch (IllegalAccessException iae) {
+ throw new ZipException(iae.getMessage());
+ }
+ start += (length + 4);
+ }
+ if (start != data.length) { // array not exhausted
+ throw new ZipException("data starting at " + start
+ + " is in unknown format");
}
- /**
- * Split the array into ExtraFields and populate them with the
- * give data.
- * @param data an array of bytes
- * @return an array of ExtraFields
- * @since 1.1
- * @throws ZipException on error
- */
- public static ZipExtraField[] parse(byte[] data) throws ZipException {
- Vector v = new Vector();
- int start = 0;
- while (start <= data.length - 4) {
- ZipShort headerId = new ZipShort(data, start);
- int length = (new ZipShort(data, start + 2)).getValue();
- if (start + 4 + length > data.length) {
- throw new ZipException("data starting at " + start
- + " is in unknown format");
- }
- try {
- ZipExtraField ze = createExtraField(headerId);
- ze.parseFromLocalFileData(data, start + 4, length);
- v.addElement(ze);
- } catch (InstantiationException ie) {
- throw new ZipException(ie.getMessage());
- } catch (IllegalAccessException iae) {
- throw new ZipException(iae.getMessage());
- }
- start += (length + 4);
- }
- if (start != data.length) { // array not exhausted
- throw new ZipException("data starting at " + start
- + " is in unknown format");
- }
+ ZipExtraField[] result = new ZipExtraField[v.size()];
+ v.copyInto(result);
+ return result;
+ }
- ZipExtraField[] result = new ZipExtraField[v.size()];
- v.copyInto(result);
- return result;
+ /**
+ * Merges the local file data fields of the given ZipExtraFields.
+ *
+ * @param data
+ * an array of ExtraFiles
+ * @return an array of bytes
+ * @since 1.1
+ */
+ public static byte[] mergeLocalFileDataData(ZipExtraField[] data) {
+ int sum = 4 * data.length;
+ for (int i = 0; i < data.length; i++) {
+ sum += data[i].getLocalFileDataLength().getValue();
}
-
- /**
- * Merges the local file data fields of the given ZipExtraFields.
- * @param data an array of ExtraFiles
- * @return an array of bytes
- * @since 1.1
- */
- public static byte[] mergeLocalFileDataData(ZipExtraField[] data) {
- int sum = 4 * data.length;
- for (int i = 0; i < data.length; i++) {
- sum += data[i].getLocalFileDataLength().getValue();
- }
- byte[] result = new byte[sum];
- int start = 0;
- for (int i = 0; i < data.length; i++) {
- System.arraycopy(data[i].getHeaderId().getBytes(),
- 0, result, start, 2);
- System.arraycopy(data[i].getLocalFileDataLength().getBytes(),
- 0, result, start + 2, 2);
- byte[] local = data[i].getLocalFileDataData();
- System.arraycopy(local, 0, result, start + 4, local.length);
- start += (local.length + 4);
- }
- return result;
+ byte[] result = new byte[sum];
+ int start = 0;
+ for (int i = 0; i < data.length; i++) {
+ System.arraycopy(data[i].getHeaderId().getBytes(), 0, result, start, 2);
+ System.arraycopy(data[i].getLocalFileDataLength().getBytes(), 0, result,
+ start + 2, 2);
+ byte[] local = data[i].getLocalFileDataData();
+ System.arraycopy(local, 0, result, start + 4, local.length);
+ start += (local.length + 4);
}
+ return result;
+ }
- /**
- * Merges the central directory fields of the given ZipExtraFields.
- * @param data an array of ExtraFields
- * @return an array of bytes
- * @since 1.1
- */
- public static byte[] mergeCentralDirectoryData(ZipExtraField[] data) {
- int sum = 4 * data.length;
- for (int i = 0; i < data.length; i++) {
- sum += data[i].getCentralDirectoryLength().getValue();
- }
- byte[] result = new byte[sum];
- int start = 0;
- for (int i = 0; i < data.length; i++) {
- System.arraycopy(data[i].getHeaderId().getBytes(),
- 0, result, start, 2);
- System.arraycopy(data[i].getCentralDirectoryLength().getBytes(),
- 0, result, start + 2, 2);
- byte[] local = data[i].getCentralDirectoryData();
- System.arraycopy(local, 0, result, start + 4, local.length);
- start += (local.length + 4);
- }
- return result;
+ /**
+ * Merges the central directory fields of the given ZipExtraFields.
+ *
+ * @param data
+ * an array of ExtraFields
+ * @return an array of bytes
+ * @since 1.1
+ */
+ public static byte[] mergeCentralDirectoryData(ZipExtraField[] data) {
+ int sum = 4 * data.length;
+ for (int i = 0; i < data.length; i++) {
+ sum += data[i].getCentralDirectoryLength().getValue();
+ }
+ byte[] result = new byte[sum];
+ int start = 0;
+ for (int i = 0; i < data.length; i++) {
+ System.arraycopy(data[i].getHeaderId().getBytes(), 0, result, start, 2);
+ System.arraycopy(data[i].getCentralDirectoryLength().getBytes(), 0,
+ result, start + 2, 2);
+ byte[] local = data[i].getCentralDirectoryData();
+ System.arraycopy(local, 0, result, start + 4, local.length);
+ start += (local.length + 4);
}
+ return result;
+ }
}
import java.util.zip.ZipException;
/**
- * If this extra field is added as the very first extra field of the
- * archive, Solaris will consider it an executable jar file.
- *
+ * If this extra field is added as the very first extra field of the archive,
+ * Solaris will consider it an executable jar file.
+ *
* @since Ant 1.6.3
*/
public final class JarMarker implements ZipExtraField {
- private static final ZipShort ID = new ZipShort(0xCAFE);
- private static final ZipShort NULL = new ZipShort(0);
- private static final byte[] NO_BYTES = new byte[0];
- private static final JarMarker DEFAULT = new JarMarker();
+ private static final ZipShort ID = new ZipShort(0xCAFE);
- /** No-arg constructor */
- public JarMarker() {
- // empty
- }
+ private static final ZipShort NULL = new ZipShort(0);
- /**
- * Since JarMarker is stateless we can always use the same instance.
- * @return the DEFAULT jarmaker.
- */
- public static JarMarker getInstance() {
- return DEFAULT;
- }
+ private static final byte[] NO_BYTES = new byte[0];
- /**
- * The Header-ID.
- * @return the header id
- */
- public ZipShort getHeaderId() {
- return ID;
- }
+ private static final JarMarker DEFAULT = new JarMarker();
- /**
- * Length of the extra field in the local file data - without
- * Header-ID or length specifier.
- * @return 0
- */
- public ZipShort getLocalFileDataLength() {
- return NULL;
- }
+ /** No-arg constructor */
+ public JarMarker() {
+ // empty
+ }
- /**
- * Length of the extra field in the central directory - without
- * Header-ID or length specifier.
- * @return 0
- */
- public ZipShort getCentralDirectoryLength() {
- return NULL;
- }
+ /**
+ * Since JarMarker is stateless we can always use the same instance.
+ *
+ * @return the DEFAULT jarmaker.
+ */
+ public static JarMarker getInstance() {
+ return DEFAULT;
+ }
- /**
- * The actual data to put into local file data - without Header-ID
- * or length specifier.
- * @return the data
- * @since 1.1
- */
- public byte[] getLocalFileDataData() {
- return NO_BYTES;
- }
+ /**
+ * The Header-ID.
+ *
+ * @return the header id
+ */
+ public ZipShort getHeaderId() {
+ return ID;
+ }
- /**
- * The actual data to put central directory - without Header-ID or
- * length specifier.
- * @return the data
- */
- public byte[] getCentralDirectoryData() {
- return NO_BYTES;
- }
+ /**
+ * Length of the extra field in the local file data - without Header-ID or
+ * length specifier.
+ *
+ * @return 0
+ */
+ public ZipShort getLocalFileDataLength() {
+ return NULL;
+ }
+
+ /**
+ * Length of the extra field in the central directory - without Header-ID or
+ * length specifier.
+ *
+ * @return 0
+ */
+ public ZipShort getCentralDirectoryLength() {
+ return NULL;
+ }
+
+ /**
+ * The actual data to put into local file data - without Header-ID or length
+ * specifier.
+ *
+ * @return the data
+ * @since 1.1
+ */
+ public byte[] getLocalFileDataData() {
+ return NO_BYTES;
+ }
+
+ /**
+ * The actual data to put central directory - without Header-ID or length
+ * specifier.
+ *
+ * @return the data
+ */
+ public byte[] getCentralDirectoryData() {
+ return NO_BYTES;
+ }
- /**
- * Populate data from this array as if it was in local file data.
- * @param data an array of bytes
- * @param offset the start offset
- * @param length the number of bytes in the array from offset
- *
- * @throws ZipException on error
- */
- public void parseFromLocalFileData(byte[] data, int offset, int length)
- throws ZipException {
- if (length != 0) {
- throw new ZipException("JarMarker doesn't expect any data");
- }
+ /**
+ * Populate data from this array as if it was in local file data.
+ *
+ * @param data
+ * an array of bytes
+ * @param offset
+ * the start offset
+ * @param length
+ * the number of bytes in the array from offset
+ *
+ * @throws ZipException
+ * on error
+ */
+ public void parseFromLocalFileData(byte[] data, int offset, int length)
+ throws ZipException {
+ if (length != 0) {
+ throw new ZipException("JarMarker doesn't expect any data");
}
+ }
}
/**
* Constants from stat.h on Unix systems.
- *
+ *
*/
public interface UnixStat {
- /**
- * Bits used for permissions (and sticky bit)
- *
- * @since 1.1
- */
- int PERM_MASK = 07777;
- /**
- * Indicates symbolic links.
- *
- * @since 1.1
- */
- int LINK_FLAG = 0120000;
- /**
- * Indicates plain files.
- *
- * @since 1.1
- */
- int FILE_FLAG = 0100000;
- /**
- * Indicates directories.
- *
- * @since 1.1
- */
- int DIR_FLAG = 040000;
+ /**
+ * Bits used for permissions (and sticky bit)
+ *
+ * @since 1.1
+ */
+ int PERM_MASK = 07777;
+
+ /**
+ * Indicates symbolic links.
+ *
+ * @since 1.1
+ */
+ int LINK_FLAG = 0120000;
+
+ /**
+ * Indicates plain files.
+ *
+ * @since 1.1
+ */
+ int FILE_FLAG = 0100000;
+
+ /**
+ * Indicates directories.
+ *
+ * @since 1.1
+ */
+ int DIR_FLAG = 040000;
+
+ // ----------------------------------------------------------
+ // somewhat arbitrary choices that are quite common for shared
+ // installations
+ // -----------------------------------------------------------
+
+ /**
+ * Default permissions for symbolic links.
+ *
+ * @since 1.1
+ */
+ int DEFAULT_LINK_PERM = 0777;
- // ----------------------------------------------------------
- // somewhat arbitrary choices that are quite common for shared
- // installations
- // -----------------------------------------------------------
+ /**
+ * Default permissions for directories.
+ *
+ * @since 1.1
+ */
+ int DEFAULT_DIR_PERM = 0755;
- /**
- * Default permissions for symbolic links.
- *
- * @since 1.1
- */
- int DEFAULT_LINK_PERM = 0777;
- /**
- * Default permissions for directories.
- *
- * @since 1.1
- */
- int DEFAULT_DIR_PERM = 0755;
- /**
- * Default permissions for plain files.
- *
- * @since 1.1
- */
- int DEFAULT_FILE_PERM = 0644;
+ /**
+ * Default permissions for plain files.
+ *
+ * @since 1.1
+ */
+ int DEFAULT_FILE_PERM = 0644;
}
package org.apache.tools.zip;
/**
- * Simple placeholder for all those extra fields we don't want to deal
- * with.
- *
- * <p>Assumes local file data and central directory entries are
- * identical - unless told the opposite.</p>
- *
+ * Simple placeholder for all those extra fields we don't want to deal with.
+ *
+ * <p>
+ * Assumes local file data and central directory entries are identical - unless
+ * told the opposite.
+ * </p>
+ *
*/
public class UnrecognizedExtraField implements ZipExtraField {
- /**
- * The Header-ID.
- *
- * @since 1.1
- */
- private ZipShort headerId;
+ /**
+ * The Header-ID.
+ *
+ * @since 1.1
+ */
+ private ZipShort headerId;
- /**
- * Set the header id.
- * @param headerId the header id to use
- */
- public void setHeaderId(ZipShort headerId) {
- this.headerId = headerId;
- }
+ /**
+ * Set the header id.
+ *
+ * @param headerId
+ * the header id to use
+ */
+ public void setHeaderId(ZipShort headerId) {
+ this.headerId = headerId;
+ }
- /**
- * Get the header id.
- * @return the header id
- */
- public ZipShort getHeaderId() {
- return headerId;
- }
+ /**
+ * Get the header id.
+ *
+ * @return the header id
+ */
+ public ZipShort getHeaderId() {
+ return headerId;
+ }
- /**
- * Extra field data in local file data - without
- * Header-ID or length specifier.
- *
- * @since 1.1
- */
- private byte[] localData;
+ /**
+ * Extra field data in local file data - without Header-ID or length
+ * specifier.
+ *
+ * @since 1.1
+ */
+ private byte[] localData;
- /**
- * Set the extra field data in the local file data -
- * without Header-ID or length specifier.
- * @param data the field data to use
- */
- public void setLocalFileDataData(byte[] data) {
- localData = data;
- }
+ /**
+ * Set the extra field data in the local file data - without Header-ID or
+ * length specifier.
+ *
+ * @param data
+ * the field data to use
+ */
+ public void setLocalFileDataData(byte[] data) {
+ localData = data;
+ }
- /**
- * Get the length of the local data.
- * @return the length of the local data
- */
- public ZipShort getLocalFileDataLength() {
- return new ZipShort(localData.length);
- }
+ /**
+ * Get the length of the local data.
+ *
+ * @return the length of the local data
+ */
+ public ZipShort getLocalFileDataLength() {
+ return new ZipShort(localData.length);
+ }
- /**
- * Get the local data.
- * @return the local data
- */
- public byte[] getLocalFileDataData() {
- return localData;
- }
+ /**
+ * Get the local data.
+ *
+ * @return the local data
+ */
+ public byte[] getLocalFileDataData() {
+ return localData;
+ }
- /**
- * Extra field data in central directory - without
- * Header-ID or length specifier.
- *
- * @since 1.1
- */
- private byte[] centralData;
+ /**
+ * Extra field data in central directory - without Header-ID or length
+ * specifier.
+ *
+ * @since 1.1
+ */
+ private byte[] centralData;
- /**
- * Set the extra field data in central directory.
- * @param data the data to use
- */
- public void setCentralDirectoryData(byte[] data) {
- centralData = data;
- }
+ /**
+ * Set the extra field data in central directory.
+ *
+ * @param data
+ * the data to use
+ */
+ public void setCentralDirectoryData(byte[] data) {
+ centralData = data;
+ }
- /**
- * Get the central data length.
- * If there is no central data, get the local file data length.
- * @return the central data length
- */
- public ZipShort getCentralDirectoryLength() {
- if (centralData != null) {
- return new ZipShort(centralData.length);
- }
- return getLocalFileDataLength();
+ /**
+ * Get the central data length. If there is no central data, get the local
+ * file data length.
+ *
+ * @return the central data length
+ */
+ public ZipShort getCentralDirectoryLength() {
+ if (centralData != null) {
+ return new ZipShort(centralData.length);
}
+ return getLocalFileDataLength();
+ }
- /**
- * Get the central data.
- * @return the central data if present, else return the local file data
- */
- public byte[] getCentralDirectoryData() {
- if (centralData != null) {
- return centralData;
- }
- return getLocalFileDataData();
+ /**
+ * Get the central data.
+ *
+ * @return the central data if present, else return the local file data
+ */
+ public byte[] getCentralDirectoryData() {
+ if (centralData != null) {
+ return centralData;
}
+ return getLocalFileDataData();
+ }
- /**
- * @param data the array of bytes.
- * @param offset the source location in the data array.
- * @param length the number of bytes to use in the data array.
- * @see ZipExtraField#parseFromLocalFileData(byte[], int, int)
- */
- public void parseFromLocalFileData(byte[] data, int offset, int length) {
- byte[] tmp = new byte[length];
- System.arraycopy(data, offset, tmp, 0, length);
- setLocalFileDataData(tmp);
- }
+ /**
+ * @param data
+ * the array of bytes.
+ * @param offset
+ * the source location in the data array.
+ * @param length
+ * the number of bytes to use in the data array.
+ * @see ZipExtraField#parseFromLocalFileData(byte[], int, int)
+ */
+ public void parseFromLocalFileData(byte[] data, int offset, int length) {
+ byte[] tmp = new byte[length];
+ System.arraycopy(data, offset, tmp, 0, length);
+ setLocalFileDataData(tmp);
+ }
}
import java.util.zip.ZipException;
/**
- * Extension that adds better handling of extra fields and provides
- * access to the internal and external file attributes.
- *
+ * Extension that adds better handling of extra fields and provides access to
+ * the internal and external file attributes.
+ *
*/
public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable {
- private static final int PLATFORM_UNIX = 3;
- private static final int PLATFORM_FAT = 0;
-
- private int internalAttributes = 0;
- private int platform = PLATFORM_FAT;
- private long externalAttributes = 0;
- private Vector/*<ZipExtraField>*/ extraFields = null;
- private String name = null;
-
- /**
- * Creates a new zip entry with the specified name.
- * @param name the name of the entry
- * @since 1.1
- */
- public ZipEntry(String name) {
- super(name);
- }
-
- /**
- * Creates a new zip entry with fields taken from the specified zip entry.
- * @param entry the entry to get fields from
- * @since 1.1
- * @throws ZipException on error
- */
- public ZipEntry(java.util.zip.ZipEntry entry) throws ZipException {
- super(entry);
- byte[] extra = entry.getExtra();
- if (extra != null) {
- setExtraFields(ExtraFieldUtils.parse(extra));
- } else {
- // initializes extra data to an empty byte array
- setExtra();
- }
- }
-
- /**
- * Creates a new zip entry with fields taken from the specified zip entry.
- * @param entry the entry to get fields from
- * @throws ZipException on error
- * @since 1.1
- */
- public ZipEntry(ZipEntry entry) throws ZipException {
- this((java.util.zip.ZipEntry) entry);
- setInternalAttributes(entry.getInternalAttributes());
- setExternalAttributes(entry.getExternalAttributes());
- setExtraFields(entry.getExtraFields());
- }
-
- /**
- * @since 1.9
- */
- protected ZipEntry() {
- super("");
- }
-
- /**
- * Overwrite clone.
- * @return a cloned copy of this ZipEntry
- * @since 1.1
- */
- public Object clone() {
- ZipEntry e = (ZipEntry) super.clone();
-
- e.extraFields = extraFields != null ? (Vector) extraFields.clone() : null;
- e.setInternalAttributes(getInternalAttributes());
- e.setExternalAttributes(getExternalAttributes());
- e.setExtraFields(getExtraFields());
- return e;
- }
-
- /**
- * Retrieves the internal file attributes.
- *
- * @return the internal file attributes
- * @since 1.1
- */
- public int getInternalAttributes() {
- return internalAttributes;
- }
-
- /**
- * Sets the internal file attributes.
- * @param value an <code>int</code> value
- * @since 1.1
- */
- public void setInternalAttributes(int value) {
- internalAttributes = value;
- }
-
- /**
- * Retrieves the external file attributes.
- * @return the external file attributes
- * @since 1.1
- */
- public long getExternalAttributes() {
- return externalAttributes;
- }
-
- /**
- * Sets the external file attributes.
- * @param value an <code>long</code> value
- * @since 1.1
- */
- public void setExternalAttributes(long value) {
- externalAttributes = value;
- }
-
- /**
- * Sets Unix permissions in a way that is understood by Info-Zip's
- * unzip command.
- * @param mode an <code>int</code> value
- * @since Ant 1.5.2
- */
- public void setUnixMode(int mode) {
- setExternalAttributes((mode << 16)
- // MS-DOS read-only attribute
- | ((mode & 0200) == 0 ? 1 : 0)
- // MS-DOS directory flag
- | (isDirectory() ? 0x10 : 0));
- platform = PLATFORM_UNIX;
- }
-
- /**
- * Unix permission.
- * @return the unix permissions
- * @since Ant 1.6
- */
- public int getUnixMode() {
- return (int) ((getExternalAttributes() >> 16) & 0xFFFF);
- }
-
- /**
- * Platform specification to put into the "version made
- * by" part of the central file header.
- *
- * @return 0 (MS-DOS FAT) unless {@link #setUnixMode setUnixMode}
- * has been called, in which case 3 (Unix) will be returned.
- *
- * @since Ant 1.5.2
- */
- public int getPlatform() {
- return platform;
- }
-
- /**
- * Set the platform (UNIX or FAT).
- * @param platform an <code>int</code> value - 0 is FAT, 3 is UNIX
- * @since 1.9
- */
- protected void setPlatform(int platform) {
- this.platform = platform;
- }
-
- /**
- * Replaces all currently attached extra fields with the new array.
- * @param fields an array of extra fields
- * @since 1.1
- */
- public void setExtraFields(ZipExtraField[] fields) {
- extraFields = new Vector();
- for (int i = 0; i < fields.length; i++) {
- extraFields.addElement(fields[i]);
- }
- setExtra();
- }
-
- /**
- * Retrieves extra fields.
- * @return an array of the extra fields
- * @since 1.1
- */
- public ZipExtraField[] getExtraFields() {
- if (extraFields == null) {
- return new ZipExtraField[0];
- }
- ZipExtraField[] result = new ZipExtraField[extraFields.size()];
- extraFields.copyInto(result);
- return result;
- }
-
- /**
- * Adds an extra fields - replacing an already present extra field
- * of the same type.
- * @param ze an extra field
- * @since 1.1
- */
- public void addExtraField(ZipExtraField ze) {
- if (extraFields == null) {
- extraFields = new Vector();
- }
- ZipShort type = ze.getHeaderId();
- boolean done = false;
- for (int i = 0, fieldsSize = extraFields.size(); !done && i < fieldsSize; i++) {
- if (((ZipExtraField) extraFields.elementAt(i)).getHeaderId().equals(type)) {
- extraFields.setElementAt(ze, i);
- done = true;
- }
- }
- if (!done) {
- extraFields.addElement(ze);
- }
- setExtra();
- }
-
- /**
- * Remove an extra fields.
- * @param type the type of extra field to remove
- * @since 1.1
- */
- public void removeExtraField(ZipShort type) {
- if (extraFields == null) {
- extraFields = new Vector();
- }
- boolean done = false;
- for (int i = 0, fieldsSize = extraFields.size(); !done && i < fieldsSize; i++) {
- if (((ZipExtraField) extraFields.elementAt(i)).getHeaderId().equals(type)) {
- extraFields.removeElementAt(i);
- done = true;
- }
- }
- if (!done) {
- throw new java.util.NoSuchElementException();
- }
- setExtra();
+ private static final int PLATFORM_UNIX = 3;
+
+ private static final int PLATFORM_FAT = 0;
+
+ private int internalAttributes = 0;
+
+ private int platform = PLATFORM_FAT;
+
+ private long externalAttributes = 0;
+
+ private Vector/* <ZipExtraField> */extraFields = null;
+
+ private String name = null;
+
+ /**
+ * Creates a new zip entry with the specified name.
+ *
+ * @param name
+ * the name of the entry
+ * @since 1.1
+ */
+ public ZipEntry(String name) {
+ super(name);
+ }
+
+ /**
+ * Creates a new zip entry with fields taken from the specified zip entry.
+ *
+ * @param entry
+ * the entry to get fields from
+ * @since 1.1
+ * @throws ZipException
+ * on error
+ */
+ public ZipEntry(java.util.zip.ZipEntry entry) throws ZipException {
+ super(entry);
+ byte[] extra = entry.getExtra();
+ if (extra != null) {
+ setExtraFields(ExtraFieldUtils.parse(extra));
+ } else {
+ // initializes extra data to an empty byte array
+ setExtra();
}
-
- /**
- * Throws an Exception if extra data cannot be parsed into extra fields.
- * @param extra an array of bytes to be parsed into extra fields
- * @throws RuntimeException if the bytes cannot be parsed
- * @since 1.1
- * @throws RuntimeException on error
- */
- public void setExtra(byte[] extra) throws RuntimeException {
- try {
- setExtraFields(ExtraFieldUtils.parse(extra));
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- }
+ }
+
+ /**
+ * Creates a new zip entry with fields taken from the specified zip entry.
+ *
+ * @param entry
+ * the entry to get fields from
+ * @throws ZipException
+ * on error
+ * @since 1.1
+ */
+ public ZipEntry(ZipEntry entry) throws ZipException {
+ this((java.util.zip.ZipEntry) entry);
+ setInternalAttributes(entry.getInternalAttributes());
+ setExternalAttributes(entry.getExternalAttributes());
+ setExtraFields(entry.getExtraFields());
+ }
+
+ /**
+ * @since 1.9
+ */
+ protected ZipEntry() {
+ super("");
+ }
+
+ /**
+ * Overwrite clone.
+ *
+ * @return a cloned copy of this ZipEntry
+ * @since 1.1
+ */
+ public Object clone() {
+ ZipEntry e = (ZipEntry) super.clone();
+
+ e.extraFields = extraFields != null ? (Vector) extraFields.clone() : null;
+ e.setInternalAttributes(getInternalAttributes());
+ e.setExternalAttributes(getExternalAttributes());
+ e.setExtraFields(getExtraFields());
+ return e;
+ }
+
+ /**
+ * Retrieves the internal file attributes.
+ *
+ * @return the internal file attributes
+ * @since 1.1
+ */
+ public int getInternalAttributes() {
+ return internalAttributes;
+ }
+
+ /**
+ * Sets the internal file attributes.
+ *
+ * @param value
+ * an <code>int</code> value
+ * @since 1.1
+ */
+ public void setInternalAttributes(int value) {
+ internalAttributes = value;
+ }
+
+ /**
+ * Retrieves the external file attributes.
+ *
+ * @return the external file attributes
+ * @since 1.1
+ */
+ public long getExternalAttributes() {
+ return externalAttributes;
+ }
+
+ /**
+ * Sets the external file attributes.
+ *
+ * @param value
+ * an <code>long</code> value
+ * @since 1.1
+ */
+ public void setExternalAttributes(long value) {
+ externalAttributes = value;
+ }
+
+ /**
+ * Sets Unix permissions in a way that is understood by Info-Zip's unzip
+ * command.
+ *
+ * @param mode
+ * an <code>int</code> value
+ * @since Ant 1.5.2
+ */
+ public void setUnixMode(int mode) {
+ setExternalAttributes((mode << 16)
+ // MS-DOS read-only attribute
+ | ((mode & 0200) == 0 ? 1 : 0)
+ // MS-DOS directory flag
+ | (isDirectory() ? 0x10 : 0));
+ platform = PLATFORM_UNIX;
+ }
+
+ /**
+ * Unix permission.
+ *
+ * @return the unix permissions
+ * @since Ant 1.6
+ */
+ public int getUnixMode() {
+ return (int) ((getExternalAttributes() >> 16) & 0xFFFF);
+ }
+
+ /**
+ * Platform specification to put into the "version made by" part of
+ * the central file header.
+ *
+ * @return 0 (MS-DOS FAT) unless {@link #setUnixMode setUnixMode} has been
+ * called, in which case 3 (Unix) will be returned.
+ *
+ * @since Ant 1.5.2
+ */
+ public int getPlatform() {
+ return platform;
+ }
+
+ /**
+ * Set the platform (UNIX or FAT).
+ *
+ * @param platform
+ * an <code>int</code> value - 0 is FAT, 3 is UNIX
+ * @since 1.9
+ */
+ protected void setPlatform(int platform) {
+ this.platform = platform;
+ }
+
+ /**
+ * Replaces all currently attached extra fields with the new array.
+ *
+ * @param fields
+ * an array of extra fields
+ * @since 1.1
+ */
+ public void setExtraFields(ZipExtraField[] fields) {
+ extraFields = new Vector();
+ for (int i = 0; i < fields.length; i++) {
+ extraFields.addElement(fields[i]);
}
-
- /**
- * Unfortunately {@link java.util.zip.ZipOutputStream
- * java.util.zip.ZipOutputStream} seems to access the extra data
- * directly, so overriding getExtra doesn't help - we need to
- * modify super's data directly.
- *
- * @since 1.1
- */
- protected void setExtra() {
- super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getExtraFields()));
+ setExtra();
+ }
+
+ /**
+ * Retrieves extra fields.
+ *
+ * @return an array of the extra fields
+ * @since 1.1
+ */
+ public ZipExtraField[] getExtraFields() {
+ if (extraFields == null) {
+ return new ZipExtraField[0];
}
-
- /**
- * Retrieves the extra data for the local file data.
- * @return the extra data for local file
- * @since 1.1
- */
- public byte[] getLocalFileDataExtra() {
- byte[] extra = getExtra();
- return extra != null ? extra : new byte[0];
+ ZipExtraField[] result = new ZipExtraField[extraFields.size()];
+ extraFields.copyInto(result);
+ return result;
+ }
+
+ /**
+ * Adds an extra fields - replacing an already present extra field of the same
+ * type.
+ *
+ * @param ze
+ * an extra field
+ * @since 1.1
+ */
+ public void addExtraField(ZipExtraField ze) {
+ if (extraFields == null) {
+ extraFields = new Vector();
}
-
- /**
- * Retrieves the extra data for the central directory.
- * @return the central directory extra data
- * @since 1.1
- */
- public byte[] getCentralDirectoryExtra() {
- return ExtraFieldUtils.mergeCentralDirectoryData(getExtraFields());
+ ZipShort type = ze.getHeaderId();
+ boolean done = false;
+ for (int i = 0, fieldsSize = extraFields.size(); !done && i < fieldsSize; i++) {
+ if (((ZipExtraField) extraFields.elementAt(i)).getHeaderId().equals(type)) {
+ extraFields.setElementAt(ze, i);
+ done = true;
+ }
}
-
- /**
- * Make this class work in JDK 1.1 like a 1.2 class.
- *
- * <p>This either stores the size for later usage or invokes
- * setCompressedSize via reflection.</p>
- * @param size the size to use
- * @deprecated since 1.7.
- * Use setCompressedSize directly.
- * @since 1.2
- */
- public void setComprSize(long size) {
- setCompressedSize(size);
+ if (!done) {
+ extraFields.addElement(ze);
}
-
- /**
- * Get the name of the entry.
- * @return the entry name
- * @since 1.9
- */
- public String getName() {
- return name == null ? super.getName() : name;
+ setExtra();
+ }
+
+ /**
+ * Remove an extra fields.
+ *
+ * @param type
+ * the type of extra field to remove
+ * @since 1.1
+ */
+ public void removeExtraField(ZipShort type) {
+ if (extraFields == null) {
+ extraFields = new Vector();
}
-
- /**
- * Is this entry a directory?
- * @return true if the entry is a directory
- * @since 1.10
- */
- public boolean isDirectory() {
- return getName().endsWith("/");
+ boolean done = false;
+ for (int i = 0, fieldsSize = extraFields.size(); !done && i < fieldsSize; i++) {
+ if (((ZipExtraField) extraFields.elementAt(i)).getHeaderId().equals(type)) {
+ extraFields.removeElementAt(i);
+ done = true;
+ }
}
-
- /**
- * Set the name of the entry.
- * @param name the name to use
- */
- protected void setName(String name) {
- this.name = name;
+ if (!done) {
+ throw new java.util.NoSuchElementException();
}
-
- /**
- * Get the hashCode of the entry.
- * This uses the name as the hashcode.
- * @return a hashcode.
- * @since Ant 1.7
- */
- public int hashCode() {
- // this method has severe consequences on performance. We cannot rely
- // on the super.hashCode() method since super.getName() always return
- // the empty string in the current implemention (there's no setter)
- // so it is basically draining the performance of a hashmap lookup
- return getName().hashCode();
- }
-
- /**
- * The equality method. In this case, the implementation returns 'this == o'
- * which is basically the equals method of the Object class.
- * @param o the object to compare to
- * @return true if this object is the same as <code>o</code>
- * @since Ant 1.7
- */
- public boolean equals(Object o) {
- return (this == o);
+ setExtra();
+ }
+
+ /**
+ * Throws an Exception if extra data cannot be parsed into extra fields.
+ *
+ * @param extra
+ * an array of bytes to be parsed into extra fields
+ * @throws RuntimeException
+ * if the bytes cannot be parsed
+ * @since 1.1
+ * @throws RuntimeException
+ * on error
+ */
+ public void setExtra(byte[] extra) throws RuntimeException {
+ try {
+ setExtraFields(ExtraFieldUtils.parse(extra));
+ } catch (Exception e) {
+ throw new RuntimeException(e.getMessage());
}
+ }
+
+ /**
+ * Unfortunately {@link java.util.zip.ZipOutputStream
+ * java.util.zip.ZipOutputStream} seems to access the extra data directly, so
+ * overriding getExtra doesn't help - we need to modify super's data directly.
+ *
+ * @since 1.1
+ */
+ protected void setExtra() {
+ super.setExtra(ExtraFieldUtils.mergeLocalFileDataData(getExtraFields()));
+ }
+
+ /**
+ * Retrieves the extra data for the local file data.
+ *
+ * @return the extra data for local file
+ * @since 1.1
+ */
+ public byte[] getLocalFileDataExtra() {
+ byte[] extra = getExtra();
+ return extra != null ? extra : new byte[0];
+ }
+
+ /**
+ * Retrieves the extra data for the central directory.
+ *
+ * @return the central directory extra data
+ * @since 1.1
+ */
+ public byte[] getCentralDirectoryExtra() {
+ return ExtraFieldUtils.mergeCentralDirectoryData(getExtraFields());
+ }
+
+ /**
+ * Make this class work in JDK 1.1 like a 1.2 class.
+ *
+ * <p>
+ * This either stores the size for later usage or invokes setCompressedSize
+ * via reflection.
+ * </p>
+ *
+ * @param size
+ * the size to use
+ * @deprecated since 1.7. Use setCompressedSize directly.
+ * @since 1.2
+ */
+ public void setComprSize(long size) {
+ setCompressedSize(size);
+ }
+
+ /**
+ * Get the name of the entry.
+ *
+ * @return the entry name
+ * @since 1.9
+ */
+ public String getName() {
+ return name == null ? super.getName() : name;
+ }
+
+ /**
+ * Is this entry a directory?
+ *
+ * @return true if the entry is a directory
+ * @since 1.10
+ */
+ public boolean isDirectory() {
+ return getName().endsWith("/");
+ }
+
+ /**
+ * Set the name of the entry.
+ *
+ * @param name
+ * the name to use
+ */
+ protected void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the hashCode of the entry. This uses the name as the hashcode.
+ *
+ * @return a hashcode.
+ * @since Ant 1.7
+ */
+ public int hashCode() {
+ // this method has severe consequences on performance. We cannot rely
+ // on the super.hashCode() method since super.getName() always return
+ // the empty string in the current implemention (there's no setter)
+ // so it is basically draining the performance of a hashmap lookup
+ return getName().hashCode();
+ }
+
+ /**
+ * The equality method. In this case, the implementation returns 'this == o'
+ * which is basically the equals method of the Object class.
+ *
+ * @param o
+ * the object to compare to
+ * @return true if this object is the same as <code>o</code>
+ * @since Ant 1.7
+ */
+ public boolean equals(Object o) {
+ return (this == o);
+ }
}
/**
* General format of extra field data.
- *
- * <p>Extra fields usually appear twice per file, once in the local
- * file data and once in the central directory. Usually they are the
- * same, but they don't have to be. {@link
- * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will
- * only use the local file data in both places.</p>
- *
+ *
+ * <p>
+ * Extra fields usually appear twice per file, once in the local file data and
+ * once in the central directory. Usually they are the same, but they don't have
+ * to be. {@link java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream}
+ * will only use the local file data in both places.
+ * </p>
+ *
*/
public interface ZipExtraField {
- /**
- * The Header-ID.
- * @return the header id
- * @since 1.1
- */
- ZipShort getHeaderId();
+ /**
+ * The Header-ID.
+ *
+ * @return the header id
+ * @since 1.1
+ */
+ ZipShort getHeaderId();
- /**
- * Length of the extra field in the local file data - without
- * Header-ID or length specifier.
- * @return the length of the field in the local file data
- * @since 1.1
- */
- ZipShort getLocalFileDataLength();
+ /**
+ * Length of the extra field in the local file data - without Header-ID or
+ * length specifier.
+ *
+ * @return the length of the field in the local file data
+ * @since 1.1
+ */
+ ZipShort getLocalFileDataLength();
- /**
- * Length of the extra field in the central directory - without
- * Header-ID or length specifier.
- * @return the length of the field in the central directory
- * @since 1.1
- */
- ZipShort getCentralDirectoryLength();
+ /**
+ * Length of the extra field in the central directory - without Header-ID or
+ * length specifier.
+ *
+ * @return the length of the field in the central directory
+ * @since 1.1
+ */
+ ZipShort getCentralDirectoryLength();
- /**
- * The actual data to put into local file data - without Header-ID
- * or length specifier.
- * @return the data
- * @since 1.1
- */
- byte[] getLocalFileDataData();
+ /**
+ * The actual data to put into local file data - without Header-ID or length
+ * specifier.
+ *
+ * @return the data
+ * @since 1.1
+ */
+ byte[] getLocalFileDataData();
- /**
- * The actual data to put central directory - without Header-ID or
- * length specifier.
- * @return the data
- * @since 1.1
- */
- byte[] getCentralDirectoryData();
+ /**
+ * The actual data to put central directory - without Header-ID or length
+ * specifier.
+ *
+ * @return the data
+ * @since 1.1
+ */
+ byte[] getCentralDirectoryData();
- /**
- * Populate data from this array as if it was in local file data.
- * @param data an array of bytes
- * @param offset the start offset
- * @param length the number of bytes in the array from offset
- *
- * @since 1.1
- * @throws ZipException on error
- */
- void parseFromLocalFileData(byte[] data, int offset, int length)
- throws ZipException;
+ /**
+ * Populate data from this array as if it was in local file data.
+ *
+ * @param data
+ * an array of bytes
+ * @param offset
+ * the start offset
+ * @param length
+ * the number of bytes in the array from offset
+ *
+ * @since 1.1
+ * @throws ZipException
+ * on error
+ */
+ void parseFromLocalFileData(byte[] data, int offset, int length)
+ throws ZipException;
}
/**
* Replacement for <code>java.util.ZipFile</code>.
- *
- * <p>This class adds support for file name encodings other than UTF-8
- * (which is required to work on ZIP files created by native zip tools
- * and is able to skip a preamble like the one found in self
- * extracting archives. Furthermore it returns instances of
- * <code>org.apache.tools.zip.ZipEntry</code> instead of
- * <code>java.util.zip.ZipEntry</code>.</p>
- *
- * <p>It doesn't extend <code>java.util.zip.ZipFile</code> as it would
- * have to reimplement all methods anyway. Like
- * <code>java.util.ZipFile</code>, it uses RandomAccessFile under the
- * covers and supports compressed and uncompressed entries.</p>
- * <p>For the VAMSAS library, a new constructor was added to pass in
- * existing RandomAccessFile directly. This allows the ZIPped data input
- * from a file locked under the <code>java.nio.FileChannel.Lock</code>
- * mechanism.</p>
- * <p>The method signatures mimic the ones of
- * <code>java.util.zip.ZipFile</code>, with a couple of exceptions:
- *
+ *
+ * <p>
+ * This class adds support for file name encodings other than UTF-8 (which is
+ * required to work on ZIP files created by native zip tools and is able to skip
+ * a preamble like the one found in self extracting archives. Furthermore it
+ * returns instances of <code>org.apache.tools.zip.ZipEntry</code> instead of
+ * <code>java.util.zip.ZipEntry</code>.
+ * </p>
+ *
+ * <p>
+ * It doesn't extend <code>java.util.zip.ZipFile</code> as it would have to
+ * reimplement all methods anyway. Like <code>java.util.ZipFile</code>, it uses
+ * RandomAccessFile under the covers and supports compressed and uncompressed
+ * entries.
+ * </p>
+ * <p>
+ * Contribution from Jim Procter (VAMSAS Library)<br>
+ * For the VAMSAS library, a new constructor was added to pass in existing
+ * RandomAccessFile directly. This allows the ZIPped data input from a file
+ * locked under the <code>java.nio.FileChannel.Lock</code> mechanism.
+ * </p>
+ * <p>
+ * The method signatures mimic the ones of <code>java.util.zip.ZipFile</code>,
+ * with a couple of exceptions:
+ *
* <ul>
- * <li>There is no getName method.</li>
- * <li>entries has been renamed to getEntries.</li>
- * <li>getEntries and getEntry return
- * <code>org.apache.tools.zip.ZipEntry</code> instances.</li>
- * <li>close is allowed to throw IOException.</li>
+ * <li>There is no getName method.</li>
+ * <li>entries has been renamed to getEntries.</li>
+ * <li>getEntries and getEntry return <code>org.apache.tools.zip.ZipEntry</code>
+ * instances.</li>
+ * <li>close is allowed to throw IOException.</li>
* </ul>
- *
+ *
*/
public class ZipFile {
- /**
- * Maps ZipEntrys to Longs, recording the offsets of the local
- * file headers.
- */
- private Hashtable entries = new Hashtable(509);
-
- /**
- * Maps String to ZipEntrys, name -> actual entry.
- */
- private Hashtable nameMap = new Hashtable(509);
-
- private static final class OffsetEntry {
- private long headerOffset = -1;
- private long dataOffset = -1;
- }
-
- /**
- * The encoding to use for filenames and the file comment.
- *
- * <p>For a list of possible values see <a
- * href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html">http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
- * Defaults to the platform's default character encoding.</p>
- */
- private String encoding = null;
-
- /**
- * The actual data source.
- */
- private RandomAccessFile archive;
-
- /**
- * Opens the given file for reading, assuming the platform's
- * native encoding for file names.
- *
- * @param f the archive.
- *
- * @throws IOException if an error occurs while reading the file.
- */
- public ZipFile(File f) throws IOException {
- this(f, null);
- }
-
- /**
- * Opens the given file for reading, assuming the platform's
- * native encoding for file names.
- *
- * @param name name of the archive.
- *
- * @throws IOException if an error occurs while reading the file.
- */
- public ZipFile(String name) throws IOException {
- this(new File(name), null);
- }
-
- /**
- * Opens the given file for reading, assuming the specified
- * encoding for file names.
- *
- * @param name name of the archive.
- * @param encoding the encoding to use for file names
- *
- * @throws IOException if an error occurs while reading the file.
- */
- public ZipFile(String name, String encoding) throws IOException {
- this(new File(name), encoding);
- }
-
- /**
- * Opens the given file for reading, assuming the specified
- * encoding for file names.
- *
- * @param f the archive.
- * @param encoding the encoding to use for file names
- *
- * @throws IOException if an error occurs while reading the file.
- */
- public ZipFile(File f, String encoding) throws IOException {
- this(new RandomAccessFile(f, "r"), encoding);
+ /**
+ * Maps ZipEntrys to Longs, recording the offsets of the local file headers.
+ */
+ private Hashtable entries = new Hashtable(509);
+
+ /**
+ * Maps String to ZipEntrys, name -> actual entry.
+ */
+ private Hashtable nameMap = new Hashtable(509);
+
+ private static final class OffsetEntry {
+ private long headerOffset = -1;
+
+ private long dataOffset = -1;
+ }
+
+ /**
+ * The encoding to use for filenames and the file comment.
+ *
+ * <p>
+ * For a list of possible values see <a
+ * href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html"
+ * >http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
+ * Defaults to the platform's default character encoding.
+ * </p>
+ */
+ private String encoding = null;
+
+ /**
+ * The actual data source.
+ */
+ private RandomAccessFile archive;
+
+ /**
+ * Opens the given file for reading, assuming the platform's native encoding
+ * for file names.
+ *
+ * @param f
+ * the archive.
+ *
+ * @throws IOException
+ * if an error occurs while reading the file.
+ */
+ public ZipFile(File f) throws IOException {
+ this(f, null);
+ }
+
+ /**
+ * Opens the given file for reading, assuming the platform's native encoding
+ * for file names.
+ *
+ * @param name
+ * name of the archive.
+ *
+ * @throws IOException
+ * if an error occurs while reading the file.
+ */
+ public ZipFile(String name) throws IOException {
+ this(new File(name), null);
+ }
+
+ /**
+ * Opens the given file for reading, assuming the specified encoding for file
+ * names.
+ *
+ * @param name
+ * name of the archive.
+ * @param encoding
+ * the encoding to use for file names
+ *
+ * @throws IOException
+ * if an error occurs while reading the file.
+ */
+ public ZipFile(String name, String encoding) throws IOException {
+ this(new File(name), encoding);
+ }
+
+ /**
+ * Opens the given file for reading, assuming the specified encoding for file
+ * names.
+ *
+ * @param f
+ * the archive.
+ * @param encoding
+ * the encoding to use for file names
+ *
+ * @throws IOException
+ * if an error occurs while reading the file.
+ */
+ public ZipFile(File f, String encoding) throws IOException {
+ this(new RandomAccessFile(f, "r"), encoding);
+ }
+
+ /**
+ * Read an archive from the given random access file
+ *
+ * @param rafile
+ * the archive as a readable random access file
+ * @throws IOException
+ */
+ public ZipFile(RandomAccessFile rafile) throws IOException {
+ this(rafile, null);
+ }
+
+ /**
+ * Read an archive from the given random access file, assuming the specified
+ * encoding for file names.
+ *
+ * @param readablearchive
+ * the archive opened as a readable random access file
+ * @param encoding
+ * the encoding to use for file names
+ *
+ * @throws IOException
+ * if an error occurs while reading the file.
+ */
+ public ZipFile(RandomAccessFile readablearchive, String encoding)
+ throws IOException {
+ this.encoding = encoding;
+ archive = readablearchive;
+ try {
+ populateFromCentralDirectory();
+ resolveLocalFileHeaderData();
+ } catch (IOException e) {
+ try {
+ archive.close();
+ } catch (IOException e2) {
+ // swallow, throw the original exception instead
+ }
+ throw e;
}
- /**
- * Read an archive from the given random access file
- *
- * @param rafile the archive as a readable random access file
- * @throws IOException
- */
- public ZipFile(RandomAccessFile rafile) throws IOException
- {
- this (rafile, null);
+ }
+
+ /**
+ * The encoding to use for filenames and the file comment.
+ *
+ * @return null if using the platform's default character encoding.
+ */
+ public String getEncoding() {
+ return encoding;
+ }
+
+ /**
+ * Closes the archive.
+ *
+ * @throws IOException
+ * if an error occurs closing the archive.
+ */
+ public void close() throws IOException {
+ archive.close();
+ }
+
+ /**
+ * close a zipfile quietly; throw no io fault, do nothing on a null parameter
+ *
+ * @param zipfile
+ * file to close, can be null
+ */
+ public static void closeQuietly(ZipFile zipfile) {
+ if (zipfile != null) {
+ try {
+ zipfile.close();
+ } catch (IOException e) {
+ // ignore
+ }
}
- /**
- * Read an archive from the given random access file, assuming the specified
- * encoding for file names.
- *
- * @param readablearchive the archive opened as a readable random access file
- * @param encoding the encoding to use for file names
- *
- * @throws IOException if an error occurs while reading the file.
- */
- public ZipFile(RandomAccessFile readablearchive, String encoding) throws IOException
- {
- this.encoding = encoding;
- archive = readablearchive;
- try {
- populateFromCentralDirectory();
- resolveLocalFileHeaderData();
- } catch (IOException e) {
- try {
- archive.close();
- } catch (IOException e2) {
- // swallow, throw the original exception instead
- }
- throw e;
- }
+ }
+
+ /**
+ * Returns all entries.
+ *
+ * @return all entries as {@link ZipEntry} instances
+ */
+ public Enumeration getEntries() {
+ return entries.keys();
+ }
+
+ /**
+ * Returns a named entry - or <code>null</code> if no entry by that name
+ * exists.
+ *
+ * @param name
+ * name of the entry.
+ * @return the ZipEntry corresponding to the given name - or <code>null</code>
+ * if not present.
+ */
+ public ZipEntry getEntry(String name) {
+ return (ZipEntry) nameMap.get(name);
+ }
+
+ /**
+ * Returns an InputStream for reading the contents of the given entry.
+ *
+ * @param ze
+ * the entry to get the stream for.
+ * @return a stream to read the entry from.
+ * @throws IOException
+ * if unable to create an input stream from the zipenty
+ * @throws ZipException
+ * if the zipentry has an unsupported compression method
+ */
+ public InputStream getInputStream(ZipEntry ze) throws IOException,
+ ZipException {
+ OffsetEntry offsetEntry = (OffsetEntry) entries.get(ze);
+ if (offsetEntry == null) {
+ return null;
}
- /**
- * The encoding to use for filenames and the file comment.
- *
- * @return null if using the platform's default character encoding.
- */
- public String getEncoding() {
- return encoding;
+ long start = offsetEntry.dataOffset;
+ BoundedInputStream bis = new BoundedInputStream(start, ze
+ .getCompressedSize());
+ switch (ze.getMethod()) {
+ case ZipEntry.STORED:
+ return bis;
+ case ZipEntry.DEFLATED:
+ bis.addDummy();
+ return new InflaterInputStream(bis, new Inflater(true));
+ default:
+ throw new ZipException("Found unsupported compression method "
+ + ze.getMethod());
}
-
- /**
- * Closes the archive.
- * @throws IOException if an error occurs closing the archive.
- */
- public void close() throws IOException {
- archive.close();
+ }
+
+ private static final int CFH_LEN =
+ /* version made by */2
+ /* version needed to extract */+ 2
+ /* general purpose bit flag */+ 2
+ /* compression method */+ 2
+ /* last mod file time */+ 2
+ /* last mod file date */+ 2
+ /* crc-32 */+ 4
+ /* compressed size */+ 4
+ /* uncompressed size */+ 4
+ /* filename length */+ 2
+ /* extra field length */+ 2
+ /* file comment length */+ 2
+ /* disk number start */+ 2
+ /* internal file attributes */+ 2
+ /* external file attributes */+ 4
+ /* relative offset of local header */+ 4;
+
+ /**
+ * Reads the central directory of the given archive and populates the internal
+ * tables with ZipEntry instances.
+ *
+ * <p>
+ * The ZipEntrys will know all data that can be obtained from the central
+ * directory alone, but not the data that requires the local file header or
+ * additional data to be read.
+ * </p>
+ */
+ private void populateFromCentralDirectory() throws IOException {
+ positionAtCentralDirectory();
+
+ byte[] cfh = new byte[CFH_LEN];
+
+ byte[] signatureBytes = new byte[4];
+ archive.readFully(signatureBytes);
+ long sig = ZipLong.getValue(signatureBytes);
+ final long cfhSig = ZipLong.getValue(ZipOutputStream.CFH_SIG);
+ while (sig == cfhSig) {
+ archive.readFully(cfh);
+ int off = 0;
+ ZipEntry ze = new ZipEntry();
+
+ int versionMadeBy = ZipShort.getValue(cfh, off);
+ off += 2;
+ ze.setPlatform((versionMadeBy >> 8) & 0x0F);
+
+ off += 4; // skip version info and general purpose byte
+
+ ze.setMethod(ZipShort.getValue(cfh, off));
+ off += 2;
+
+ // FIXME this is actually not very cpu cycles friendly as we are
+ // converting from
+ // dos to java while the underlying Sun implementation will convert
+ // from java to dos time for internal storage...
+ long time = dosToJavaTime(ZipLong.getValue(cfh, off));
+ ze.setTime(time);
+ off += 4;
+
+ ze.setCrc(ZipLong.getValue(cfh, off));
+ off += 4;
+
+ ze.setCompressedSize(ZipLong.getValue(cfh, off));
+ off += 4;
+
+ ze.setSize(ZipLong.getValue(cfh, off));
+ off += 4;
+
+ int fileNameLen = ZipShort.getValue(cfh, off);
+ off += 2;
+
+ int extraLen = ZipShort.getValue(cfh, off);
+ off += 2;
+
+ int commentLen = ZipShort.getValue(cfh, off);
+ off += 2;
+
+ off += 2; // disk number
+
+ ze.setInternalAttributes(ZipShort.getValue(cfh, off));
+ off += 2;
+
+ ze.setExternalAttributes(ZipLong.getValue(cfh, off));
+ off += 4;
+
+ byte[] fileName = new byte[fileNameLen];
+ archive.readFully(fileName);
+ ze.setName(getString(fileName));
+
+ // LFH offset,
+ OffsetEntry offset = new OffsetEntry();
+ offset.headerOffset = ZipLong.getValue(cfh, off);
+ // data offset will be filled later
+ entries.put(ze, offset);
+
+ nameMap.put(ze.getName(), ze);
+
+ archive.skipBytes(extraLen);
+
+ byte[] comment = new byte[commentLen];
+ archive.readFully(comment);
+ ze.setComment(getString(comment));
+
+ archive.readFully(signatureBytes);
+ sig = ZipLong.getValue(signatureBytes);
}
-
- /**
- * close a zipfile quietly; throw no io fault, do nothing
- * on a null parameter
- * @param zipfile file to close, can be null
- */
- public static void closeQuietly(ZipFile zipfile) {
- if (zipfile != null) {
- try {
- zipfile.close();
- } catch (IOException e) {
- //ignore
+ }
+
+ private static final int MIN_EOCD_SIZE =
+ /* end of central dir signature */4
+ /* number of this disk */+ 2
+ /* number of the disk with the */
+ /* start of the central directory */+ 2
+ /* total number of entries in */
+ /* the central dir on this disk */+ 2
+ /* total number of entries in */
+ /* the central dir */+ 2
+ /* size of the central directory */+ 4
+ /* offset of start of central */
+ /* directory with respect to */
+ /* the starting disk number */+ 4
+ /* zipfile comment length */+ 2;
+
+ private static final int CFD_LOCATOR_OFFSET =
+ /* end of central dir signature */4
+ /* number of this disk */+ 2
+ /* number of the disk with the */
+ /* start of the central directory */+ 2
+ /* total number of entries in */
+ /* the central dir on this disk */+ 2
+ /* total number of entries in */
+ /* the central dir */+ 2
+ /* size of the central directory */+ 4;
+
+ /**
+ * Searches for the "End of central dir record", parses it and
+ * positions the stream at the first central directory record.
+ */
+ private void positionAtCentralDirectory() throws IOException {
+ boolean found = false;
+ long off = archive.length() - MIN_EOCD_SIZE;
+ if (off >= 0) {
+ archive.seek(off);
+ byte[] sig = ZipOutputStream.EOCD_SIG;
+ int curr = archive.read();
+ while (curr != -1) {
+ if (curr == sig[0]) {
+ curr = archive.read();
+ if (curr == sig[1]) {
+ curr = archive.read();
+ if (curr == sig[2]) {
+ curr = archive.read();
+ if (curr == sig[3]) {
+ found = true;
+ break;
+ }
}
+ }
}
+ archive.seek(--off);
+ curr = archive.read();
+ }
}
-
- /**
- * Returns all entries.
- * @return all entries as {@link ZipEntry} instances
- */
- public Enumeration getEntries() {
- return entries.keys();
+ if (!found) {
+ throw new ZipException("archive is not a ZIP archive");
}
-
- /**
- * Returns a named entry - or <code>null</code> if no entry by
- * that name exists.
- * @param name name of the entry.
- * @return the ZipEntry corresponding to the given name - or
- * <code>null</code> if not present.
- */
- public ZipEntry getEntry(String name) {
- return (ZipEntry) nameMap.get(name);
+ archive.seek(off + CFD_LOCATOR_OFFSET);
+ byte[] cfdOffset = new byte[4];
+ archive.readFully(cfdOffset);
+ archive.seek(ZipLong.getValue(cfdOffset));
+ }
+
+ /**
+ * Number of bytes in local file header up to the "length of
+ * filename" entry.
+ */
+ private static final long LFH_OFFSET_FOR_FILENAME_LENGTH =
+ /* local file header signature */4
+ /* version needed to extract */+ 2
+ /* general purpose bit flag */+ 2
+ /* compression method */+ 2
+ /* last mod file time */+ 2
+ /* last mod file date */+ 2
+ /* crc-32 */+ 4
+ /* compressed size */+ 4
+ /* uncompressed size */+ 4;
+
+ /**
+ * Walks through all recorded entries and adds the data available from the
+ * local file header.
+ *
+ * <p>
+ * Also records the offsets for the data to read from the entries.
+ * </p>
+ */
+ private void resolveLocalFileHeaderData() throws IOException {
+ Enumeration e = getEntries();
+ while (e.hasMoreElements()) {
+ ZipEntry ze = (ZipEntry) e.nextElement();
+ OffsetEntry offsetEntry = (OffsetEntry) entries.get(ze);
+ long offset = offsetEntry.headerOffset;
+ archive.seek(offset + LFH_OFFSET_FOR_FILENAME_LENGTH);
+ byte[] b = new byte[2];
+ archive.readFully(b);
+ int fileNameLen = ZipShort.getValue(b);
+ archive.readFully(b);
+ int extraFieldLen = ZipShort.getValue(b);
+ archive.skipBytes(fileNameLen);
+ byte[] localExtraData = new byte[extraFieldLen];
+ archive.readFully(localExtraData);
+ ze.setExtra(localExtraData);
+ /*
+ * dataOffsets.put(ze, new Long(offset + LFH_OFFSET_FOR_FILENAME_LENGTH +
+ * 2 + 2 + fileNameLen + extraFieldLen));
+ */
+ offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH + 2 + 2
+ + fileNameLen + extraFieldLen;
}
-
- /**
- * Returns an InputStream for reading the contents of the given entry.
- * @param ze the entry to get the stream for.
- * @return a stream to read the entry from.
- * @throws IOException if unable to create an input stream from the zipenty
- * @throws ZipException if the zipentry has an unsupported compression method
- */
- public InputStream getInputStream(ZipEntry ze)
- throws IOException, ZipException {
- OffsetEntry offsetEntry = (OffsetEntry) entries.get(ze);
- if (offsetEntry == null) {
- return null;
- }
- long start = offsetEntry.dataOffset;
- BoundedInputStream bis =
- new BoundedInputStream(start, ze.getCompressedSize());
- switch (ze.getMethod()) {
- case ZipEntry.STORED:
- return bis;
- case ZipEntry.DEFLATED:
- bis.addDummy();
- return new InflaterInputStream(bis, new Inflater(true));
- default:
- throw new ZipException("Found unsupported compression method "
- + ze.getMethod());
- }
+ }
+
+ /**
+ * Convert a DOS date/time field to a Date object.
+ *
+ * @param zipDosTime
+ * contains the stored DOS time.
+ * @return a Date instance corresponding to the given time.
+ */
+ protected static Date fromDosTime(ZipLong zipDosTime) {
+ long dosTime = zipDosTime.getValue();
+ return new Date(dosToJavaTime(dosTime));
+ }
+
+ /*
+ * Converts DOS time to Java time (number of milliseconds since epoch).
+ */
+ private static long dosToJavaTime(long dosTime) {
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, (int) ((dosTime >> 25) & 0x7f) + 1980);
+ cal.set(Calendar.MONTH, (int) ((dosTime >> 21) & 0x0f) - 1);
+ cal.set(Calendar.DATE, (int) (dosTime >> 16) & 0x1f);
+ cal.set(Calendar.HOUR_OF_DAY, (int) (dosTime >> 11) & 0x1f);
+ cal.set(Calendar.MINUTE, (int) (dosTime >> 5) & 0x3f);
+ cal.set(Calendar.SECOND, (int) (dosTime << 1) & 0x3e);
+ return cal.getTime().getTime();
+ }
+
+ /**
+ * Retrieve a String from the given bytes using the encoding set for this
+ * ZipFile.
+ *
+ * @param bytes
+ * the byte array to transform
+ * @return String obtained by using the given encoding
+ * @throws ZipException
+ * if the encoding cannot be recognized.
+ */
+ protected String getString(byte[] bytes) throws ZipException {
+ if (encoding == null) {
+ return new String(bytes);
+ } else {
+ try {
+ return new String(bytes, encoding);
+ } catch (UnsupportedEncodingException uee) {
+ throw new ZipException(uee.getMessage());
+ }
}
+ }
- private static final int CFH_LEN =
- /* version made by */ 2
- /* version needed to extract */ + 2
- /* general purpose bit flag */ + 2
- /* compression method */ + 2
- /* last mod file time */ + 2
- /* last mod file date */ + 2
- /* crc-32 */ + 4
- /* compressed size */ + 4
- /* uncompressed size */ + 4
- /* filename length */ + 2
- /* extra field length */ + 2
- /* file comment length */ + 2
- /* disk number start */ + 2
- /* internal file attributes */ + 2
- /* external file attributes */ + 4
- /* relative offset of local header */ + 4;
-
- /**
- * Reads the central directory of the given archive and populates
- * the internal tables with ZipEntry instances.
- *
- * <p>The ZipEntrys will know all data that can be obtained from
- * the central directory alone, but not the data that requires the
- * local file header or additional data to be read.</p>
- */
- private void populateFromCentralDirectory()
- throws IOException {
- positionAtCentralDirectory();
-
- byte[] cfh = new byte[CFH_LEN];
-
- byte[] signatureBytes = new byte[4];
- archive.readFully(signatureBytes);
- long sig = ZipLong.getValue(signatureBytes);
- final long cfhSig = ZipLong.getValue(ZipOutputStream.CFH_SIG);
- while (sig == cfhSig) {
- archive.readFully(cfh);
- int off = 0;
- ZipEntry ze = new ZipEntry();
-
- int versionMadeBy = ZipShort.getValue(cfh, off);
- off += 2;
- ze.setPlatform((versionMadeBy >> 8) & 0x0F);
-
- off += 4; // skip version info and general purpose byte
-
- ze.setMethod(ZipShort.getValue(cfh, off));
- off += 2;
-
- // FIXME this is actually not very cpu cycles friendly as we are converting from
- // dos to java while the underlying Sun implementation will convert
- // from java to dos time for internal storage...
- long time = dosToJavaTime(ZipLong.getValue(cfh, off));
- ze.setTime(time);
- off += 4;
-
- ze.setCrc(ZipLong.getValue(cfh, off));
- off += 4;
-
- ze.setCompressedSize(ZipLong.getValue(cfh, off));
- off += 4;
-
- ze.setSize(ZipLong.getValue(cfh, off));
- off += 4;
-
- int fileNameLen = ZipShort.getValue(cfh, off);
- off += 2;
-
- int extraLen = ZipShort.getValue(cfh, off);
- off += 2;
-
- int commentLen = ZipShort.getValue(cfh, off);
- off += 2;
-
- off += 2; // disk number
-
- ze.setInternalAttributes(ZipShort.getValue(cfh, off));
- off += 2;
-
- ze.setExternalAttributes(ZipLong.getValue(cfh, off));
- off += 4;
+ /**
+ * InputStream that delegates requests to the underlying RandomAccessFile,
+ * making sure that only bytes from a certain range can be read.
+ */
+ private class BoundedInputStream extends InputStream {
+ private long remaining;
- byte[] fileName = new byte[fileNameLen];
- archive.readFully(fileName);
- ze.setName(getString(fileName));
+ private long loc;
+ private boolean addDummyByte = false;
- // LFH offset,
- OffsetEntry offset = new OffsetEntry();
- offset.headerOffset = ZipLong.getValue(cfh, off);
- // data offset will be filled later
- entries.put(ze, offset);
-
- nameMap.put(ze.getName(), ze);
-
- archive.skipBytes(extraLen);
-
- byte[] comment = new byte[commentLen];
- archive.readFully(comment);
- ze.setComment(getString(comment));
-
- archive.readFully(signatureBytes);
- sig = ZipLong.getValue(signatureBytes);
- }
+ BoundedInputStream(long start, long remaining) {
+ this.remaining = remaining;
+ loc = start;
}
- private static final int MIN_EOCD_SIZE =
- /* end of central dir signature */ 4
- /* number of this disk */ + 2
- /* number of the disk with the */
- /* start of the central directory */ + 2
- /* total number of entries in */
- /* the central dir on this disk */ + 2
- /* total number of entries in */
- /* the central dir */ + 2
- /* size of the central directory */ + 4
- /* offset of start of central */
- /* directory with respect to */
- /* the starting disk number */ + 4
- /* zipfile comment length */ + 2;
-
- private static final int CFD_LOCATOR_OFFSET =
- /* end of central dir signature */ 4
- /* number of this disk */ + 2
- /* number of the disk with the */
- /* start of the central directory */ + 2
- /* total number of entries in */
- /* the central dir on this disk */ + 2
- /* total number of entries in */
- /* the central dir */ + 2
- /* size of the central directory */ + 4;
-
- /**
- * Searches for the "End of central dir record", parses
- * it and positions the stream at the first central directory
- * record.
- */
- private void positionAtCentralDirectory()
- throws IOException {
- boolean found = false;
- long off = archive.length() - MIN_EOCD_SIZE;
- if (off >= 0) {
- archive.seek(off);
- byte[] sig = ZipOutputStream.EOCD_SIG;
- int curr = archive.read();
- while (curr != -1) {
- if (curr == sig[0]) {
- curr = archive.read();
- if (curr == sig[1]) {
- curr = archive.read();
- if (curr == sig[2]) {
- curr = archive.read();
- if (curr == sig[3]) {
- found = true;
- break;
- }
- }
- }
- }
- archive.seek(--off);
- curr = archive.read();
- }
- }
- if (!found) {
- throw new ZipException("archive is not a ZIP archive");
+ public int read() throws IOException {
+ if (remaining-- <= 0) {
+ if (addDummyByte) {
+ addDummyByte = false;
+ return 0;
}
- archive.seek(off + CFD_LOCATOR_OFFSET);
- byte[] cfdOffset = new byte[4];
- archive.readFully(cfdOffset);
- archive.seek(ZipLong.getValue(cfdOffset));
+ return -1;
+ }
+ synchronized (archive) {
+ archive.seek(loc++);
+ return archive.read();
+ }
}
- /**
- * Number of bytes in local file header up to the "length of
- * filename" entry.
- */
- private static final long LFH_OFFSET_FOR_FILENAME_LENGTH =
- /* local file header signature */ 4
- /* version needed to extract */ + 2
- /* general purpose bit flag */ + 2
- /* compression method */ + 2
- /* last mod file time */ + 2
- /* last mod file date */ + 2
- /* crc-32 */ + 4
- /* compressed size */ + 4
- /* uncompressed size */ + 4;
-
- /**
- * Walks through all recorded entries and adds the data available
- * from the local file header.
- *
- * <p>Also records the offsets for the data to read from the
- * entries.</p>
- */
- private void resolveLocalFileHeaderData()
- throws IOException {
- Enumeration e = getEntries();
- while (e.hasMoreElements()) {
- ZipEntry ze = (ZipEntry) e.nextElement();
- OffsetEntry offsetEntry = (OffsetEntry) entries.get(ze);
- long offset = offsetEntry.headerOffset;
- archive.seek(offset + LFH_OFFSET_FOR_FILENAME_LENGTH);
- byte[] b = new byte[2];
- archive.readFully(b);
- int fileNameLen = ZipShort.getValue(b);
- archive.readFully(b);
- int extraFieldLen = ZipShort.getValue(b);
- archive.skipBytes(fileNameLen);
- byte[] localExtraData = new byte[extraFieldLen];
- archive.readFully(localExtraData);
- ze.setExtra(localExtraData);
- /*dataOffsets.put(ze,
- new Long(offset + LFH_OFFSET_FOR_FILENAME_LENGTH
- + 2 + 2 + fileNameLen + extraFieldLen));
- */
- offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH
- + 2 + 2 + fileNameLen + extraFieldLen;
+ public int read(byte[] b, int off, int len) throws IOException {
+ if (remaining <= 0) {
+ if (addDummyByte) {
+ addDummyByte = false;
+ b[off] = 0;
+ return 1;
}
+ return -1;
+ }
+
+ if (len <= 0) {
+ return 0;
+ }
+
+ if (len > remaining) {
+ len = (int) remaining;
+ }
+ int ret = -1;
+ synchronized (archive) {
+ archive.seek(loc);
+ ret = archive.read(b, off, len);
+ }
+ if (ret > 0) {
+ loc += ret;
+ remaining -= ret;
+ }
+ return ret;
}
/**
- * Convert a DOS date/time field to a Date object.
- *
- * @param zipDosTime contains the stored DOS time.
- * @return a Date instance corresponding to the given time.
+ * Inflater needs an extra dummy byte for nowrap - see Inflater's javadocs.
*/
- protected static Date fromDosTime(ZipLong zipDosTime) {
- long dosTime = zipDosTime.getValue();
- return new Date(dosToJavaTime(dosTime));
- }
-
- /*
- * Converts DOS time to Java time (number of milliseconds since epoch).
- */
- private static long dosToJavaTime(long dosTime) {
- Calendar cal = Calendar.getInstance();
- cal.set(Calendar.YEAR, (int) ((dosTime >> 25) & 0x7f) + 1980);
- cal.set(Calendar.MONTH, (int) ((dosTime >> 21) & 0x0f) - 1);
- cal.set(Calendar.DATE, (int) (dosTime >> 16) & 0x1f);
- cal.set(Calendar.HOUR_OF_DAY, (int) (dosTime >> 11) & 0x1f);
- cal.set(Calendar.MINUTE, (int) (dosTime >> 5) & 0x3f);
- cal.set(Calendar.SECOND, (int) (dosTime << 1) & 0x3e);
- return cal.getTime().getTime();
- }
-
-
- /**
- * Retrieve a String from the given bytes using the encoding set
- * for this ZipFile.
- *
- * @param bytes the byte array to transform
- * @return String obtained by using the given encoding
- * @throws ZipException if the encoding cannot be recognized.
- */
- protected String getString(byte[] bytes) throws ZipException {
- if (encoding == null) {
- return new String(bytes);
- } else {
- try {
- return new String(bytes, encoding);
- } catch (UnsupportedEncodingException uee) {
- throw new ZipException(uee.getMessage());
- }
- }
- }
-
- /**
- * InputStream that delegates requests to the underlying
- * RandomAccessFile, making sure that only bytes from a certain
- * range can be read.
- */
- private class BoundedInputStream extends InputStream {
- private long remaining;
- private long loc;
- private boolean addDummyByte = false;
-
- BoundedInputStream(long start, long remaining) {
- this.remaining = remaining;
- loc = start;
- }
-
- public int read() throws IOException {
- if (remaining-- <= 0) {
- if (addDummyByte) {
- addDummyByte = false;
- return 0;
- }
- return -1;
- }
- synchronized (archive) {
- archive.seek(loc++);
- return archive.read();
- }
- }
-
- public int read(byte[] b, int off, int len) throws IOException {
- if (remaining <= 0) {
- if (addDummyByte) {
- addDummyByte = false;
- b[off] = 0;
- return 1;
- }
- return -1;
- }
-
- if (len <= 0) {
- return 0;
- }
-
- if (len > remaining) {
- len = (int) remaining;
- }
- int ret = -1;
- synchronized (archive) {
- archive.seek(loc);
- ret = archive.read(b, off, len);
- }
- if (ret > 0) {
- loc += ret;
- remaining -= ret;
- }
- return ret;
- }
-
- /**
- * Inflater needs an extra dummy byte for nowrap - see
- * Inflater's javadocs.
- */
- void addDummy() {
- addDummyByte = true;
- }
+ void addDummy() {
+ addDummyByte = true;
}
+ }
}
package org.apache.tools.zip;
/**
- * Utility class that represents a four byte integer with conversion
- * rules for the big endian byte order of ZIP files.
- *
+ * Utility class that represents a four byte integer with conversion rules for
+ * the big endian byte order of ZIP files.
+ *
*/
public final class ZipLong implements Cloneable {
- private long value;
+ private long value;
- /**
- * Create instance from a number.
- * @param value the long to store as a ZipLong
- * @since 1.1
- */
- public ZipLong(long value) {
- this.value = value;
- }
+ /**
+ * Create instance from a number.
+ *
+ * @param value
+ * the long to store as a ZipLong
+ * @since 1.1
+ */
+ public ZipLong(long value) {
+ this.value = value;
+ }
- /**
- * Create instance from bytes.
- * @param bytes the bytes to store as a ZipLong
- * @since 1.1
- */
- public ZipLong (byte[] bytes) {
- this(bytes, 0);
- }
+ /**
+ * Create instance from bytes.
+ *
+ * @param bytes
+ * the bytes to store as a ZipLong
+ * @since 1.1
+ */
+ public ZipLong(byte[] bytes) {
+ this(bytes, 0);
+ }
- /**
- * Create instance from the four bytes starting at offset.
- * @param bytes the bytes to store as a ZipLong
- * @param offset the offset to start
- * @since 1.1
- */
- public ZipLong (byte[] bytes, int offset) {
- value = ZipLong.getValue(bytes, offset);
- }
+ /**
+ * Create instance from the four bytes starting at offset.
+ *
+ * @param bytes
+ * the bytes to store as a ZipLong
+ * @param offset
+ * the offset to start
+ * @since 1.1
+ */
+ public ZipLong(byte[] bytes, int offset) {
+ value = ZipLong.getValue(bytes, offset);
+ }
- /**
- * Get value as four bytes in big endian byte order.
- * @since 1.1
- * @return value as four bytes in big endian order
- */
- public byte[] getBytes() {
- return ZipLong.getBytes(value);
- }
+ /**
+ * Get value as four bytes in big endian byte order.
+ *
+ * @since 1.1
+ * @return value as four bytes in big endian order
+ */
+ public byte[] getBytes() {
+ return ZipLong.getBytes(value);
+ }
- /**
- * Get value as Java long.
- * @since 1.1
- * @return value as a long
- */
- public long getValue() {
- return value;
- }
+ /**
+ * Get value as Java long.
+ *
+ * @since 1.1
+ * @return value as a long
+ */
+ public long getValue() {
+ return value;
+ }
- /**
- * Get value as four bytes in big endian byte order.
- * @param value the value to convert
- * @return value as four bytes in big endian byte order
- */
- public static byte[] getBytes(long value) {
- byte[] result = new byte[4];
- result[0] = (byte) ((value & 0xFF));
- result[1] = (byte) ((value & 0xFF00) >> 8);
- result[2] = (byte) ((value & 0xFF0000) >> 16);
- result[3] = (byte) ((value & 0xFF000000L) >> 24);
- return result;
- }
+ /**
+ * Get value as four bytes in big endian byte order.
+ *
+ * @param value
+ * the value to convert
+ * @return value as four bytes in big endian byte order
+ */
+ public static byte[] getBytes(long value) {
+ byte[] result = new byte[4];
+ result[0] = (byte) ((value & 0xFF));
+ result[1] = (byte) ((value & 0xFF00) >> 8);
+ result[2] = (byte) ((value & 0xFF0000) >> 16);
+ result[3] = (byte) ((value & 0xFF000000L) >> 24);
+ return result;
+ }
- /**
- * Helper method to get the value as a Java long from four bytes starting at given array offset
- * @param bytes the array of bytes
- * @param offset the offset to start
- * @return the correspondanding Java long value
- */
- public static long getValue(byte[] bytes, int offset) {
- long value = (bytes[offset + 3] << 24) & 0xFF000000L;
- value += (bytes[offset + 2] << 16) & 0xFF0000;
- value += (bytes[offset + 1] << 8) & 0xFF00;
- value += (bytes[offset] & 0xFF);
- return value;
- }
+ /**
+ * Helper method to get the value as a Java long from four bytes starting at
+ * given array offset
+ *
+ * @param bytes
+ * the array of bytes
+ * @param offset
+ * the offset to start
+ * @return the correspondanding Java long value
+ */
+ public static long getValue(byte[] bytes, int offset) {
+ long value = (bytes[offset + 3] << 24) & 0xFF000000L;
+ value += (bytes[offset + 2] << 16) & 0xFF0000;
+ value += (bytes[offset + 1] << 8) & 0xFF00;
+ value += (bytes[offset] & 0xFF);
+ return value;
+ }
- /**
- * Helper method to get the value as a Java long from a four-byte array
- * @param bytes the array of bytes
- * @return the correspondanding Java long value
- */
- public static long getValue(byte[] bytes) {
- return getValue(bytes, 0);
- }
+ /**
+ * Helper method to get the value as a Java long from a four-byte array
+ *
+ * @param bytes
+ * the array of bytes
+ * @return the correspondanding Java long value
+ */
+ public static long getValue(byte[] bytes) {
+ return getValue(bytes, 0);
+ }
- /**
- * Override to make two instances with same value equal.
- * @param o an object to compare
- * @return true if the objects are equal
- * @since 1.1
- */
- public boolean equals(Object o) {
- if (o == null || !(o instanceof ZipLong)) {
- return false;
- }
- return value == ((ZipLong) o).getValue();
+ /**
+ * Override to make two instances with same value equal.
+ *
+ * @param o
+ * an object to compare
+ * @return true if the objects are equal
+ * @since 1.1
+ */
+ public boolean equals(Object o) {
+ if (o == null || !(o instanceof ZipLong)) {
+ return false;
}
+ return value == ((ZipLong) o).getValue();
+ }
- /**
- * Override to make two instances with same value equal.
- * @return the value stored in the ZipLong
- * @since 1.1
- */
- public int hashCode() {
- return (int) value;
- }
+ /**
+ * Override to make two instances with same value equal.
+ *
+ * @return the value stored in the ZipLong
+ * @since 1.1
+ */
+ public int hashCode() {
+ return (int) value;
+ }
}
/**
* Reimplementation of {@link java.util.zip.ZipOutputStream
- * java.util.zip.ZipOutputStream} that does handle the extended
- * functionality of this package, especially internal/external file
- * attributes and extra fields with different layouts for local file
- * data and central directory entries.
- *
- * <p>This class will try to use {@link java.io.RandomAccessFile
- * RandomAccessFile} when you know that the output is going to go to a
- * file.</p>
- *
- * <p>If RandomAccessFile cannot be used, this implementation will use
- * a Data Descriptor to store size and CRC information for {@link
- * #DEFLATED DEFLATED} entries, this means, you don't need to
- * calculate them yourself. Unfortunately this is not possible for
- * the {@link #STORED STORED} method, here setting the CRC and
- * uncompressed size information is required before {@link
- * #putNextEntry putNextEntry} can be called.</p>
- *
+ * java.util.zip.ZipOutputStream} that does handle the extended functionality of
+ * this package, especially internal/external file attributes and extra fields
+ * with different layouts for local file data and central directory entries.
+ *
+ * <p>
+ * This class will try to use {@link java.io.RandomAccessFile RandomAccessFile}
+ * when you know that the output is going to go to a file.
+ * </p>
+ *
+ * <p>
+ * If RandomAccessFile cannot be used, this implementation will use a Data
+ * Descriptor to store size and CRC information for {@link #DEFLATED DEFLATED}
+ * entries, this means, you don't need to calculate them yourself. Unfortunately
+ * this is not possible for the {@link #STORED STORED} method, here setting the
+ * CRC and uncompressed size information is required before
+ * {@link #putNextEntry putNextEntry} can be called.
+ * </p>
+ *
*/
public class ZipOutputStream extends FilterOutputStream {
- /**
- * Compression method for deflated entries.
- *
- * @since 1.1
- */
- public static final int DEFLATED = java.util.zip.ZipEntry.DEFLATED;
-
- /**
- * Default compression level for deflated entries.
- *
- * @since Ant 1.7
- */
- public static final int DEFAULT_COMPRESSION = Deflater.DEFAULT_COMPRESSION;
-
- /**
- * Compression method for stored entries.
- *
- * @since 1.1
- */
- public static final int STORED = java.util.zip.ZipEntry.STORED;
-
- /**
- * Current entry.
- *
- * @since 1.1
- */
- private ZipEntry entry;
-
- /**
- * The file comment.
- *
- * @since 1.1
- */
- private String comment = "";
-
- /**
- * Compression level for next entry.
- *
- * @since 1.1
- */
- private int level = DEFAULT_COMPRESSION;
-
- /**
- * Has the compression level changed when compared to the last
- * entry?
- *
- * @since 1.5
- */
- private boolean hasCompressionLevelChanged = false;
-
- /**
- * Default compression method for next entry.
- *
- * @since 1.1
- */
- private int method = java.util.zip.ZipEntry.DEFLATED;
-
- /**
- * List of ZipEntries written so far.
- *
- * @since 1.1
- */
- private Vector entries = new Vector();
-
- /**
- * CRC instance to avoid parsing DEFLATED data twice.
- *
- * @since 1.1
- */
- private CRC32 crc = new CRC32();
-
- /**
- * Count the bytes written to out.
- *
- * @since 1.1
- */
- private long written = 0;
-
- /**
- * Data for local header data
- *
- * @since 1.1
- */
- private long dataStart = 0;
-
- /**
- * Offset for CRC entry in the local file header data for the
- * current entry starts here.
- *
- * @since 1.15
- */
- private long localDataStart = 0;
-
- /**
- * Start of central directory.
- *
- * @since 1.1
- */
- private long cdOffset = 0;
-
- /**
- * Length of central directory.
- *
- * @since 1.1
- */
- private long cdLength = 0;
-
- /**
- * Helper, a 0 as ZipShort.
- *
- * @since 1.1
- */
- private static final byte[] ZERO = {0, 0};
-
- /**
- * Helper, a 0 as ZipLong.
- *
- * @since 1.1
- */
- private static final byte[] LZERO = {0, 0, 0, 0};
-
- /**
- * Holds the offsets of the LFH starts for each entry.
- *
- * @since 1.1
- */
- private Hashtable offsets = new Hashtable();
-
- /**
- * The encoding to use for filenames and the file comment.
- *
- * <p>For a list of possible values see <a
- * href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html">http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
- * Defaults to the platform's default character encoding.</p>
- *
- * @since 1.3
- */
- private String encoding = null;
-
- // CheckStyle:VisibilityModifier OFF - bc
-
- /**
- * This Deflater object is used for output.
- *
- * <p>This attribute is only protected to provide a level of API
- * backwards compatibility. This class used to extend {@link
- * java.util.zip.DeflaterOutputStream DeflaterOutputStream} up to
- * Revision 1.13.</p>
- *
- * @since 1.14
- */
- protected Deflater def = new Deflater(level, true);
-
- /**
- * This buffer servers as a Deflater.
- *
- * <p>This attribute is only protected to provide a level of API
- * backwards compatibility. This class used to extend {@link
- * java.util.zip.DeflaterOutputStream DeflaterOutputStream} up to
- * Revision 1.13.</p>
- *
- * @since 1.14
- */
- protected byte[] buf = new byte[512];
-
- // CheckStyle:VisibilityModifier ON
-
- /**
- * Optional random access output.
- *
- * @since 1.14
- */
- private RandomAccessFile raf = null;
-
- /**
- * Creates a new ZIP OutputStream filtering the underlying stream.
- * @param out the outputstream to zip
- * @since 1.1
- */
- public ZipOutputStream(OutputStream out) {
- super(out);
- }
-
- /**
- * Creates a new ZIP OutputStream writing to a File. Will use
- * random access if possible.
- * @param file the file to zip to
- * @since 1.14
- * @throws IOException on error
- */
- public ZipOutputStream(File file) throws IOException {
- super(null);
-
+ /**
+ * Compression method for deflated entries.
+ *
+ * @since 1.1
+ */
+ public static final int DEFLATED = java.util.zip.ZipEntry.DEFLATED;
+
+ /**
+ * Default compression level for deflated entries.
+ *
+ * @since Ant 1.7
+ */
+ public static final int DEFAULT_COMPRESSION = Deflater.DEFAULT_COMPRESSION;
+
+ /**
+ * Compression method for stored entries.
+ *
+ * @since 1.1
+ */
+ public static final int STORED = java.util.zip.ZipEntry.STORED;
+
+ /**
+ * Current entry.
+ *
+ * @since 1.1
+ */
+ private ZipEntry entry;
+
+ /**
+ * The file comment.
+ *
+ * @since 1.1
+ */
+ private String comment = "";
+
+ /**
+ * Compression level for next entry.
+ *
+ * @since 1.1
+ */
+ private int level = DEFAULT_COMPRESSION;
+
+ /**
+ * Has the compression level changed when compared to the last entry?
+ *
+ * @since 1.5
+ */
+ private boolean hasCompressionLevelChanged = false;
+
+ /**
+ * Default compression method for next entry.
+ *
+ * @since 1.1
+ */
+ private int method = java.util.zip.ZipEntry.DEFLATED;
+
+ /**
+ * List of ZipEntries written so far.
+ *
+ * @since 1.1
+ */
+ private Vector entries = new Vector();
+
+ /**
+ * CRC instance to avoid parsing DEFLATED data twice.
+ *
+ * @since 1.1
+ */
+ private CRC32 crc = new CRC32();
+
+ /**
+ * Count the bytes written to out.
+ *
+ * @since 1.1
+ */
+ private long written = 0;
+
+ /**
+ * Data for local header data
+ *
+ * @since 1.1
+ */
+ private long dataStart = 0;
+
+ /**
+ * Offset for CRC entry in the local file header data for the current entry
+ * starts here.
+ *
+ * @since 1.15
+ */
+ private long localDataStart = 0;
+
+ /**
+ * Start of central directory.
+ *
+ * @since 1.1
+ */
+ private long cdOffset = 0;
+
+ /**
+ * Length of central directory.
+ *
+ * @since 1.1
+ */
+ private long cdLength = 0;
+
+ /**
+ * Helper, a 0 as ZipShort.
+ *
+ * @since 1.1
+ */
+ private static final byte[] ZERO = { 0, 0 };
+
+ /**
+ * Helper, a 0 as ZipLong.
+ *
+ * @since 1.1
+ */
+ private static final byte[] LZERO = { 0, 0, 0, 0 };
+
+ /**
+ * Holds the offsets of the LFH starts for each entry.
+ *
+ * @since 1.1
+ */
+ private Hashtable offsets = new Hashtable();
+
+ /**
+ * The encoding to use for filenames and the file comment.
+ *
+ * <p>
+ * For a list of possible values see <a
+ * href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html"
+ * >http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
+ * Defaults to the platform's default character encoding.
+ * </p>
+ *
+ * @since 1.3
+ */
+ private String encoding = null;
+
+ // CheckStyle:VisibilityModifier OFF - bc
+
+ /**
+ * This Deflater object is used for output.
+ *
+ * <p>
+ * This attribute is only protected to provide a level of API backwards
+ * compatibility. This class used to extend
+ * {@link java.util.zip.DeflaterOutputStream DeflaterOutputStream} up to
+ * Revision 1.13.
+ * </p>
+ *
+ * @since 1.14
+ */
+ protected Deflater def = new Deflater(level, true);
+
+ /**
+ * This buffer servers as a Deflater.
+ *
+ * <p>
+ * This attribute is only protected to provide a level of API backwards
+ * compatibility. This class used to extend
+ * {@link java.util.zip.DeflaterOutputStream DeflaterOutputStream} up to
+ * Revision 1.13.
+ * </p>
+ *
+ * @since 1.14
+ */
+ protected byte[] buf = new byte[512];
+
+ // CheckStyle:VisibilityModifier ON
+
+ /**
+ * Optional random access output.
+ *
+ * @since 1.14
+ */
+ private RandomAccessFile raf = null;
+
+ /**
+ * Creates a new ZIP OutputStream filtering the underlying stream.
+ *
+ * @param out
+ * the outputstream to zip
+ * @since 1.1
+ */
+ public ZipOutputStream(OutputStream out) {
+ super(out);
+ }
+
+ /**
+ * Creates a new ZIP OutputStream writing to a File. Will use random access if
+ * possible.
+ *
+ * @param file
+ * the file to zip to
+ * @since 1.14
+ * @throws IOException
+ * on error
+ */
+ public ZipOutputStream(File file) throws IOException {
+ super(null);
+
+ try {
+ raf = new RandomAccessFile(file, "rw");
+ raf.setLength(0);
+ } catch (IOException e) {
+ if (raf != null) {
try {
- raf = new RandomAccessFile(file, "rw");
- raf.setLength(0);
- } catch (IOException e) {
- if (raf != null) {
- try {
- raf.close();
- } catch (IOException inner) {
- // ignore
- }
- raf = null;
- }
- out = new FileOutputStream(file);
+ raf.close();
+ } catch (IOException inner) {
+ // ignore
}
+ raf = null;
+ }
+ out = new FileOutputStream(file);
}
-
- /**
- * This method indicates whether this archive is writing to a seekable stream (i.e., to a random
- * access file).
- *
- * <p>For seekable streams, you don't need to calculate the CRC or
- * uncompressed size for {@link #STORED} entries before
- * invoking {@link #putNextEntry}.
- * @return true if seekable
- * @since 1.17
- */
- public boolean isSeekable() {
- return raf != null;
- }
-
- /**
- * The encoding to use for filenames and the file comment.
- *
- * <p>For a list of possible values see <a
- * href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html">http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
- * Defaults to the platform's default character encoding.</p>
- * @param encoding the encoding value
- * @since 1.3
- */
- public void setEncoding(String encoding) {
- this.encoding = encoding;
+ }
+
+ /**
+ * This method indicates whether this archive is writing to a seekable stream
+ * (i.e., to a random access file).
+ *
+ * <p>
+ * For seekable streams, you don't need to calculate the CRC or uncompressed
+ * size for {@link #STORED} entries before invoking {@link #putNextEntry}.
+ *
+ * @return true if seekable
+ * @since 1.17
+ */
+ public boolean isSeekable() {
+ return raf != null;
+ }
+
+ /**
+ * The encoding to use for filenames and the file comment.
+ *
+ * <p>
+ * For a list of possible values see <a
+ * href="http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html"
+ * >http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html</a>.
+ * Defaults to the platform's default character encoding.
+ * </p>
+ *
+ * @param encoding
+ * the encoding value
+ * @since 1.3
+ */
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+ /**
+ * The encoding to use for filenames and the file comment.
+ *
+ * @return null if using the platform's default character encoding.
+ *
+ * @since 1.3
+ */
+ public String getEncoding() {
+ return encoding;
+ }
+
+ /**
+ * Finishs writing the contents and closes this as well as the underlying
+ * stream.
+ *
+ * @since 1.1
+ * @throws IOException
+ * on error
+ */
+ public void finish() throws IOException {
+ closeEntry();
+ cdOffset = written;
+ for (int i = 0, entriesSize = entries.size(); i < entriesSize; i++) {
+ writeCentralFileHeader((ZipEntry) entries.elementAt(i));
}
-
- /**
- * The encoding to use for filenames and the file comment.
- *
- * @return null if using the platform's default character encoding.
- *
- * @since 1.3
- */
- public String getEncoding() {
- return encoding;
+ cdLength = written - cdOffset;
+ writeCentralDirectoryEnd();
+ offsets.clear();
+ entries.removeAllElements();
+ }
+
+ /**
+ * Writes all necessary data for this entry.
+ *
+ * @since 1.1
+ * @throws IOException
+ * on error
+ */
+ public void closeEntry() throws IOException {
+ if (entry == null) {
+ return;
}
- /**
- * Finishs writing the contents and closes this as well as the
- * underlying stream.
- *
- * @since 1.1
- * @throws IOException on error
- */
- public void finish() throws IOException {
- closeEntry();
- cdOffset = written;
- for (int i = 0, entriesSize = entries.size(); i < entriesSize; i++) {
- writeCentralFileHeader((ZipEntry) entries.elementAt(i));
- }
- cdLength = written - cdOffset;
- writeCentralDirectoryEnd();
- offsets.clear();
- entries.removeAllElements();
+ long realCrc = crc.getValue();
+ crc.reset();
+
+ if (entry.getMethod() == DEFLATED) {
+ def.finish();
+ while (!def.finished()) {
+ deflate();
+ }
+
+ entry.setSize(adjustToLong(def.getTotalIn()));
+ entry.setCompressedSize(adjustToLong(def.getTotalOut()));
+ entry.setCrc(realCrc);
+
+ def.reset();
+
+ written += entry.getCompressedSize();
+ } else if (raf == null) {
+ if (entry.getCrc() != realCrc) {
+ throw new ZipException("bad CRC checksum for entry " + entry.getName()
+ + ": " + Long.toHexString(entry.getCrc()) + " instead of "
+ + Long.toHexString(realCrc));
+ }
+
+ if (entry.getSize() != written - dataStart) {
+ throw new ZipException("bad size for entry " + entry.getName() + ": "
+ + entry.getSize() + " instead of " + (written - dataStart));
+ }
+ } else { /* method is STORED and we used RandomAccessFile */
+ long size = written - dataStart;
+
+ entry.setSize(size);
+ entry.setCompressedSize(size);
+ entry.setCrc(realCrc);
}
- /**
- * Writes all necessary data for this entry.
- *
- * @since 1.1
- * @throws IOException on error
- */
- public void closeEntry() throws IOException {
- if (entry == null) {
- return;
- }
-
- long realCrc = crc.getValue();
- crc.reset();
-
- if (entry.getMethod() == DEFLATED) {
- def.finish();
- while (!def.finished()) {
- deflate();
- }
-
- entry.setSize(adjustToLong(def.getTotalIn()));
- entry.setCompressedSize(adjustToLong(def.getTotalOut()));
- entry.setCrc(realCrc);
-
- def.reset();
-
- written += entry.getCompressedSize();
- } else if (raf == null) {
- if (entry.getCrc() != realCrc) {
- throw new ZipException("bad CRC checksum for entry "
- + entry.getName() + ": "
- + Long.toHexString(entry.getCrc())
- + " instead of "
- + Long.toHexString(realCrc));
- }
-
- if (entry.getSize() != written - dataStart) {
- throw new ZipException("bad size for entry "
- + entry.getName() + ": "
- + entry.getSize()
- + " instead of "
- + (written - dataStart));
- }
- } else { /* method is STORED and we used RandomAccessFile */
- long size = written - dataStart;
-
- entry.setSize(size);
- entry.setCompressedSize(size);
- entry.setCrc(realCrc);
- }
+ // If random access output, write the local file header containing
+ // the correct CRC and compressed/uncompressed sizes
+ if (raf != null) {
+ long save = raf.getFilePointer();
- // If random access output, write the local file header containing
- // the correct CRC and compressed/uncompressed sizes
- if (raf != null) {
- long save = raf.getFilePointer();
-
- raf.seek(localDataStart);
- writeOut(ZipLong.getBytes(entry.getCrc()));
- writeOut(ZipLong.getBytes(entry.getCompressedSize()));
- writeOut(ZipLong.getBytes(entry.getSize()));
- raf.seek(save);
- }
-
- writeDataDescriptor(entry);
- entry = null;
+ raf.seek(localDataStart);
+ writeOut(ZipLong.getBytes(entry.getCrc()));
+ writeOut(ZipLong.getBytes(entry.getCompressedSize()));
+ writeOut(ZipLong.getBytes(entry.getSize()));
+ raf.seek(save);
}
- /**
- * Begin writing next entry.
- * @param ze the entry to write
- * @since 1.1
- * @throws IOException on error
- */
- public void putNextEntry(ZipEntry ze) throws IOException {
- closeEntry();
-
- entry = ze;
- entries.addElement(entry);
-
- if (entry.getMethod() == -1) { // not specified
- entry.setMethod(method);
- }
-
- if (entry.getTime() == -1) { // not specified
- entry.setTime(System.currentTimeMillis());
- }
-
- // Size/CRC not required if RandomAccessFile is used
- if (entry.getMethod() == STORED && raf == null) {
- if (entry.getSize() == -1) {
- throw new ZipException("uncompressed size is required for"
- + " STORED method when not writing to a"
- + " file");
- }
- if (entry.getCrc() == -1) {
- throw new ZipException("crc checksum is required for STORED"
- + " method when not writing to a file");
- }
- entry.setCompressedSize(entry.getSize());
- }
-
- if (entry.getMethod() == DEFLATED && hasCompressionLevelChanged) {
- def.setLevel(level);
- hasCompressionLevelChanged = false;
- }
- writeLocalFileHeader(entry);
+ writeDataDescriptor(entry);
+ entry = null;
+ }
+
+ /**
+ * Begin writing next entry.
+ *
+ * @param ze
+ * the entry to write
+ * @since 1.1
+ * @throws IOException
+ * on error
+ */
+ public void putNextEntry(ZipEntry ze) throws IOException {
+ closeEntry();
+
+ entry = ze;
+ entries.addElement(entry);
+
+ if (entry.getMethod() == -1) { // not specified
+ entry.setMethod(method);
}
- /**
- * Set the file comment.
- * @param comment the comment
- * @since 1.1
- */
- public void setComment(String comment) {
- this.comment = comment;
+ if (entry.getTime() == -1) { // not specified
+ entry.setTime(System.currentTimeMillis());
}
- /**
- * Sets the compression level for subsequent entries.
- *
- * <p>Default is Deflater.DEFAULT_COMPRESSION.</p>
- * @param level the compression level.
- * @throws IllegalArgumentException if an invalid compression level is specified.
- * @since 1.1
- */
- public void setLevel(int level) {
- if (level < Deflater.DEFAULT_COMPRESSION
- || level > Deflater.BEST_COMPRESSION) {
- throw new IllegalArgumentException(
- "Invalid compression level: " + level);
- }
- hasCompressionLevelChanged = (this.level != level);
- this.level = level;
+ // Size/CRC not required if RandomAccessFile is used
+ if (entry.getMethod() == STORED && raf == null) {
+ if (entry.getSize() == -1) {
+ throw new ZipException("uncompressed size is required for"
+ + " STORED method when not writing to a" + " file");
+ }
+ if (entry.getCrc() == -1) {
+ throw new ZipException("crc checksum is required for STORED"
+ + " method when not writing to a file");
+ }
+ entry.setCompressedSize(entry.getSize());
}
- /**
- * Sets the default compression method for subsequent entries.
- *
- * <p>Default is DEFLATED.</p>
- * @param method an <code>int</code> from java.util.zip.ZipEntry
- * @since 1.1
- */
- public void setMethod(int method) {
- this.method = method;
+ if (entry.getMethod() == DEFLATED && hasCompressionLevelChanged) {
+ def.setLevel(level);
+ hasCompressionLevelChanged = false;
}
-
- /**
- * Writes bytes to ZIP entry.
- * @param b the byte array to write
- * @param offset the start position to write from
- * @param length the number of bytes to write
- * @throws IOException on error
- */
- public void write(byte[] b, int offset, int length) throws IOException {
- if (entry.getMethod() == DEFLATED) {
- if (length > 0) {
- if (!def.finished()) {
- def.setInput(b, offset, length);
- while (!def.needsInput()) {
- deflate();
- }
- }
- }
- } else {
- writeOut(b, offset, length);
- written += length;
- }
- crc.update(b, offset, length);
- }
-
- /**
- * Writes a single byte to ZIP entry.
- *
- * <p>Delegates to the three arg method.</p>
- * @param b the byte to write
- * @since 1.14
- * @throws IOException on error
- */
- public void write(int b) throws IOException {
- byte[] buff = new byte[1];
- buff[0] = (byte) (b & 0xff);
- write(buff, 0, 1);
+ writeLocalFileHeader(entry);
+ }
+
+ /**
+ * Set the file comment.
+ *
+ * @param comment
+ * the comment
+ * @since 1.1
+ */
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ /**
+ * Sets the compression level for subsequent entries.
+ *
+ * <p>
+ * Default is Deflater.DEFAULT_COMPRESSION.
+ * </p>
+ *
+ * @param level
+ * the compression level.
+ * @throws IllegalArgumentException
+ * if an invalid compression level is specified.
+ * @since 1.1
+ */
+ public void setLevel(int level) {
+ if (level < Deflater.DEFAULT_COMPRESSION
+ || level > Deflater.BEST_COMPRESSION) {
+ throw new IllegalArgumentException("Invalid compression level: " + level);
}
-
- /**
- * Closes this output stream and releases any system resources
- * associated with the stream.
- *
- * @exception IOException if an I/O error occurs.
- * @since 1.14
- */
- public void close() throws IOException {
- finish();
-
- if (raf != null) {
- raf.close();
- }
- if (out != null) {
- out.close();
+ hasCompressionLevelChanged = (this.level != level);
+ this.level = level;
+ }
+
+ /**
+ * Sets the default compression method for subsequent entries.
+ *
+ * <p>
+ * Default is DEFLATED.
+ * </p>
+ *
+ * @param method
+ * an <code>int</code> from java.util.zip.ZipEntry
+ * @since 1.1
+ */
+ public void setMethod(int method) {
+ this.method = method;
+ }
+
+ /**
+ * Writes bytes to ZIP entry.
+ *
+ * @param b
+ * the byte array to write
+ * @param offset
+ * the start position to write from
+ * @param length
+ * the number of bytes to write
+ * @throws IOException
+ * on error
+ */
+ public void write(byte[] b, int offset, int length) throws IOException {
+ if (entry.getMethod() == DEFLATED) {
+ if (length > 0) {
+ if (!def.finished()) {
+ def.setInput(b, offset, length);
+ while (!def.needsInput()) {
+ deflate();
+ }
}
+ }
+ } else {
+ writeOut(b, offset, length);
+ written += length;
}
-
- /**
- * Flushes this output stream and forces any buffered output bytes
- * to be written out to the stream.
- *
- * @exception IOException if an I/O error occurs.
- * @since 1.14
- */
- public void flush() throws IOException {
- if (out != null) {
- out.flush();
- }
+ crc.update(b, offset, length);
+ }
+
+ /**
+ * Writes a single byte to ZIP entry.
+ *
+ * <p>
+ * Delegates to the three arg method.
+ * </p>
+ *
+ * @param b
+ * the byte to write
+ * @since 1.14
+ * @throws IOException
+ * on error
+ */
+ public void write(int b) throws IOException {
+ byte[] buff = new byte[1];
+ buff[0] = (byte) (b & 0xff);
+ write(buff, 0, 1);
+ }
+
+ /**
+ * Closes this output stream and releases any system resources associated with
+ * the stream.
+ *
+ * @exception IOException
+ * if an I/O error occurs.
+ * @since 1.14
+ */
+ public void close() throws IOException {
+ finish();
+
+ if (raf != null) {
+ raf.close();
}
-
- /*
- * Various ZIP constants
- */
- /**
- * local file header signature
- *
- * @since 1.1
- */
- protected static final byte[] LFH_SIG = ZipLong.getBytes(0X04034B50L);
- /**
- * data descriptor signature
- *
- * @since 1.1
- */
- protected static final byte[] DD_SIG = ZipLong.getBytes(0X08074B50L);
- /**
- * central file header signature
- *
- * @since 1.1
- */
- protected static final byte[] CFH_SIG = ZipLong.getBytes(0X02014B50L);
- /**
- * end of central dir signature
- *
- * @since 1.1
- */
- protected static final byte[] EOCD_SIG = ZipLong.getBytes(0X06054B50L);
-
- /**
- * Writes next block of compressed data to the output stream.
- * @throws IOException on error
- *
- * @since 1.14
- */
- protected final void deflate() throws IOException {
- int len = def.deflate(buf, 0, buf.length);
- if (len > 0) {
- writeOut(buf, 0, len);
- }
+ if (out != null) {
+ out.close();
}
-
- /**
- * Writes the local file header entry
- * @param ze the entry to write
- * @throws IOException on error
- *
- * @since 1.1
- */
- protected void writeLocalFileHeader(ZipEntry ze) throws IOException {
- offsets.put(ze, ZipLong.getBytes(written));
-
- writeOut(LFH_SIG);
- written += 4;
-
- //store method in local variable to prevent multiple method calls
- final int zipMethod = ze.getMethod();
-
- // version needed to extract
- // general purpose bit flag
- if (zipMethod == DEFLATED && raf == null) {
- // requires version 2 as we are going to store length info
- // in the data descriptor
- writeOut(ZipShort.getBytes(20));
-
- // bit3 set to signal, we use a data descriptor
- writeOut(ZipShort.getBytes(8));
- } else {
- writeOut(ZipShort.getBytes(10));
- writeOut(ZERO);
- }
- written += 4;
-
- // compression method
- writeOut(ZipShort.getBytes(zipMethod));
- written += 2;
-
- // last mod. time and date
- writeOut(toDosTime(ze.getTime()));
- written += 4;
-
- // CRC
- // compressed length
- // uncompressed length
- localDataStart = written;
- if (zipMethod == DEFLATED || raf != null) {
- writeOut(LZERO);
- writeOut(LZERO);
- writeOut(LZERO);
- } else {
- writeOut(ZipLong.getBytes(ze.getCrc()));
- writeOut(ZipLong.getBytes(ze.getSize()));
- writeOut(ZipLong.getBytes(ze.getSize()));
- }
- written += 12;
-
- // file name length
- byte[] name = getBytes(ze.getName());
- writeOut(ZipShort.getBytes(name.length));
- written += 2;
-
- // extra field length
- byte[] extra = ze.getLocalFileDataExtra();
- writeOut(ZipShort.getBytes(extra.length));
- written += 2;
-
- // file name
- writeOut(name);
- written += name.length;
-
- // extra field
- writeOut(extra);
- written += extra.length;
-
- dataStart = written;
+ }
+
+ /**
+ * Flushes this output stream and forces any buffered output bytes to be
+ * written out to the stream.
+ *
+ * @exception IOException
+ * if an I/O error occurs.
+ * @since 1.14
+ */
+ public void flush() throws IOException {
+ if (out != null) {
+ out.flush();
}
-
- /**
- * Writes the data descriptor entry.
- * @param ze the entry to write
- * @throws IOException on error
- *
- * @since 1.1
- */
- protected void writeDataDescriptor(ZipEntry ze) throws IOException {
- if (ze.getMethod() != DEFLATED || raf != null) {
- return;
- }
- writeOut(DD_SIG);
- writeOut(ZipLong.getBytes(entry.getCrc()));
- writeOut(ZipLong.getBytes(entry.getCompressedSize()));
- writeOut(ZipLong.getBytes(entry.getSize()));
- written += 16;
+ }
+
+ /*
+ * Various ZIP constants
+ */
+ /**
+ * local file header signature
+ *
+ * @since 1.1
+ */
+ protected static final byte[] LFH_SIG = ZipLong.getBytes(0X04034B50L);
+
+ /**
+ * data descriptor signature
+ *
+ * @since 1.1
+ */
+ protected static final byte[] DD_SIG = ZipLong.getBytes(0X08074B50L);
+
+ /**
+ * central file header signature
+ *
+ * @since 1.1
+ */
+ protected static final byte[] CFH_SIG = ZipLong.getBytes(0X02014B50L);
+
+ /**
+ * end of central dir signature
+ *
+ * @since 1.1
+ */
+ protected static final byte[] EOCD_SIG = ZipLong.getBytes(0X06054B50L);
+
+ /**
+ * Writes next block of compressed data to the output stream.
+ *
+ * @throws IOException
+ * on error
+ *
+ * @since 1.14
+ */
+ protected final void deflate() throws IOException {
+ int len = def.deflate(buf, 0, buf.length);
+ if (len > 0) {
+ writeOut(buf, 0, len);
}
-
- /**
- * Writes the central file header entry.
- * @param ze the entry to write
- * @throws IOException on error
- *
- * @since 1.1
- */
- protected void writeCentralFileHeader(ZipEntry ze) throws IOException {
- writeOut(CFH_SIG);
- written += 4;
-
- // version made by
- writeOut(ZipShort.getBytes((ze.getPlatform() << 8) | 20));
- written += 2;
-
- // version needed to extract
- // general purpose bit flag
- if (ze.getMethod() == DEFLATED && raf == null) {
- // requires version 2 as we are going to store length info
- // in the data descriptor
- writeOut(ZipShort.getBytes(20));
-
- // bit3 set to signal, we use a data descriptor
- writeOut(ZipShort.getBytes(8));
- } else {
- writeOut(ZipShort.getBytes(10));
- writeOut(ZERO);
- }
- written += 4;
-
- // compression method
- writeOut(ZipShort.getBytes(ze.getMethod()));
- written += 2;
-
- // last mod. time and date
- writeOut(toDosTime(ze.getTime()));
- written += 4;
-
- // CRC
- // compressed length
- // uncompressed length
- writeOut(ZipLong.getBytes(ze.getCrc()));
- writeOut(ZipLong.getBytes(ze.getCompressedSize()));
- writeOut(ZipLong.getBytes(ze.getSize()));
- written += 12;
-
- // file name length
- byte[] name = getBytes(ze.getName());
- writeOut(ZipShort.getBytes(name.length));
- written += 2;
-
- // extra field length
- byte[] extra = ze.getCentralDirectoryExtra();
- writeOut(ZipShort.getBytes(extra.length));
- written += 2;
-
- // file comment length
- String comm = ze.getComment();
- if (comm == null) {
- comm = "";
- }
- byte[] commentB = getBytes(comm);
- writeOut(ZipShort.getBytes(commentB.length));
- written += 2;
-
- // disk number start
- writeOut(ZERO);
- written += 2;
-
- // internal file attributes
- writeOut(ZipShort.getBytes(ze.getInternalAttributes()));
- written += 2;
-
- // external file attributes
- writeOut(ZipLong.getBytes(ze.getExternalAttributes()));
- written += 4;
-
- // relative offset of LFH
- writeOut((byte[]) offsets.get(ze));
- written += 4;
-
- // file name
- writeOut(name);
- written += name.length;
-
- // extra field
- writeOut(extra);
- written += extra.length;
-
- // file comment
- writeOut(commentB);
- written += commentB.length;
+ }
+
+ /**
+ * Writes the local file header entry
+ *
+ * @param ze
+ * the entry to write
+ * @throws IOException
+ * on error
+ *
+ * @since 1.1
+ */
+ protected void writeLocalFileHeader(ZipEntry ze) throws IOException {
+ offsets.put(ze, ZipLong.getBytes(written));
+
+ writeOut(LFH_SIG);
+ written += 4;
+
+ // store method in local variable to prevent multiple method calls
+ final int zipMethod = ze.getMethod();
+
+ // version needed to extract
+ // general purpose bit flag
+ if (zipMethod == DEFLATED && raf == null) {
+ // requires version 2 as we are going to store length info
+ // in the data descriptor
+ writeOut(ZipShort.getBytes(20));
+
+ // bit3 set to signal, we use a data descriptor
+ writeOut(ZipShort.getBytes(8));
+ } else {
+ writeOut(ZipShort.getBytes(10));
+ writeOut(ZERO);
}
-
- /**
- * Writes the "End of central dir record".
- * @throws IOException on error
- *
- * @since 1.1
- */
- protected void writeCentralDirectoryEnd() throws IOException {
- writeOut(EOCD_SIG);
-
- // disk numbers
- writeOut(ZERO);
- writeOut(ZERO);
-
- // number of entries
- byte[] num = ZipShort.getBytes(entries.size());
- writeOut(num);
- writeOut(num);
-
- // length and location of CD
- writeOut(ZipLong.getBytes(cdLength));
- writeOut(ZipLong.getBytes(cdOffset));
-
- // ZIP file comment
- byte[] data = getBytes(comment);
- writeOut(ZipShort.getBytes(data.length));
- writeOut(data);
+ written += 4;
+
+ // compression method
+ writeOut(ZipShort.getBytes(zipMethod));
+ written += 2;
+
+ // last mod. time and date
+ writeOut(toDosTime(ze.getTime()));
+ written += 4;
+
+ // CRC
+ // compressed length
+ // uncompressed length
+ localDataStart = written;
+ if (zipMethod == DEFLATED || raf != null) {
+ writeOut(LZERO);
+ writeOut(LZERO);
+ writeOut(LZERO);
+ } else {
+ writeOut(ZipLong.getBytes(ze.getCrc()));
+ writeOut(ZipLong.getBytes(ze.getSize()));
+ writeOut(ZipLong.getBytes(ze.getSize()));
}
-
- /**
- * Smallest date/time ZIP can handle.
- *
- * @since 1.1
- */
- private static final byte[] DOS_TIME_MIN = ZipLong.getBytes(0x00002100L);
-
- /**
- * Convert a Date object to a DOS date/time field.
- * @param time the <code>Date</code> to convert
- * @return the date as a <code>ZipLong</code>
- * @since 1.1
- */
- protected static ZipLong toDosTime(Date time) {
- return new ZipLong(toDosTime(time.getTime()));
+ written += 12;
+
+ // file name length
+ byte[] name = getBytes(ze.getName());
+ writeOut(ZipShort.getBytes(name.length));
+ written += 2;
+
+ // extra field length
+ byte[] extra = ze.getLocalFileDataExtra();
+ writeOut(ZipShort.getBytes(extra.length));
+ written += 2;
+
+ // file name
+ writeOut(name);
+ written += name.length;
+
+ // extra field
+ writeOut(extra);
+ written += extra.length;
+
+ dataStart = written;
+ }
+
+ /**
+ * Writes the data descriptor entry.
+ *
+ * @param ze
+ * the entry to write
+ * @throws IOException
+ * on error
+ *
+ * @since 1.1
+ */
+ protected void writeDataDescriptor(ZipEntry ze) throws IOException {
+ if (ze.getMethod() != DEFLATED || raf != null) {
+ return;
}
-
- /**
- * Convert a Date object to a DOS date/time field.
- *
- * <p>Stolen from InfoZip's <code>fileio.c</code></p>
- * @param t number of milliseconds since the epoch
- * @return the date as a byte array
- * @since 1.26
- */
- protected static byte[] toDosTime(long t) {
- Date time = new Date(t);
- int year = time.getYear() + 1900;
- if (year < 1980) {
- return DOS_TIME_MIN;
- }
- int month = time.getMonth() + 1;
- long value = ((year - 1980) << 25)
- | (month << 21)
- | (time.getDate() << 16)
- | (time.getHours() << 11)
- | (time.getMinutes() << 5)
- | (time.getSeconds() >> 1);
- return ZipLong.getBytes(value);
+ writeOut(DD_SIG);
+ writeOut(ZipLong.getBytes(entry.getCrc()));
+ writeOut(ZipLong.getBytes(entry.getCompressedSize()));
+ writeOut(ZipLong.getBytes(entry.getSize()));
+ written += 16;
+ }
+
+ /**
+ * Writes the central file header entry.
+ *
+ * @param ze
+ * the entry to write
+ * @throws IOException
+ * on error
+ *
+ * @since 1.1
+ */
+ protected void writeCentralFileHeader(ZipEntry ze) throws IOException {
+ writeOut(CFH_SIG);
+ written += 4;
+
+ // version made by
+ writeOut(ZipShort.getBytes((ze.getPlatform() << 8) | 20));
+ written += 2;
+
+ // version needed to extract
+ // general purpose bit flag
+ if (ze.getMethod() == DEFLATED && raf == null) {
+ // requires version 2 as we are going to store length info
+ // in the data descriptor
+ writeOut(ZipShort.getBytes(20));
+
+ // bit3 set to signal, we use a data descriptor
+ writeOut(ZipShort.getBytes(8));
+ } else {
+ writeOut(ZipShort.getBytes(10));
+ writeOut(ZERO);
}
-
- /**
- * Retrieve the bytes for the given String in the encoding set for
- * this Stream.
- * @param name the string to get bytes from
- * @return the bytes as a byte array
- * @throws ZipException on error
- *
- * @since 1.3
- */
- protected byte[] getBytes(String name) throws ZipException {
- if (encoding == null) {
- return name.getBytes();
- } else {
- try {
- return name.getBytes(encoding);
- } catch (UnsupportedEncodingException uee) {
- throw new ZipException(uee.getMessage());
- }
- }
+ written += 4;
+
+ // compression method
+ writeOut(ZipShort.getBytes(ze.getMethod()));
+ written += 2;
+
+ // last mod. time and date
+ writeOut(toDosTime(ze.getTime()));
+ written += 4;
+
+ // CRC
+ // compressed length
+ // uncompressed length
+ writeOut(ZipLong.getBytes(ze.getCrc()));
+ writeOut(ZipLong.getBytes(ze.getCompressedSize()));
+ writeOut(ZipLong.getBytes(ze.getSize()));
+ written += 12;
+
+ // file name length
+ byte[] name = getBytes(ze.getName());
+ writeOut(ZipShort.getBytes(name.length));
+ written += 2;
+
+ // extra field length
+ byte[] extra = ze.getCentralDirectoryExtra();
+ writeOut(ZipShort.getBytes(extra.length));
+ written += 2;
+
+ // file comment length
+ String comm = ze.getComment();
+ if (comm == null) {
+ comm = "";
}
-
- /**
- * Write bytes to output or random access file.
- * @param data the byte array to write
- * @throws IOException on error
- *
- * @since 1.14
- */
- protected final void writeOut(byte[] data) throws IOException {
- writeOut(data, 0, data.length);
+ byte[] commentB = getBytes(comm);
+ writeOut(ZipShort.getBytes(commentB.length));
+ written += 2;
+
+ // disk number start
+ writeOut(ZERO);
+ written += 2;
+
+ // internal file attributes
+ writeOut(ZipShort.getBytes(ze.getInternalAttributes()));
+ written += 2;
+
+ // external file attributes
+ writeOut(ZipLong.getBytes(ze.getExternalAttributes()));
+ written += 4;
+
+ // relative offset of LFH
+ writeOut((byte[]) offsets.get(ze));
+ written += 4;
+
+ // file name
+ writeOut(name);
+ written += name.length;
+
+ // extra field
+ writeOut(extra);
+ written += extra.length;
+
+ // file comment
+ writeOut(commentB);
+ written += commentB.length;
+ }
+
+ /**
+ * Writes the "End of central dir record".
+ *
+ * @throws IOException
+ * on error
+ *
+ * @since 1.1
+ */
+ protected void writeCentralDirectoryEnd() throws IOException {
+ writeOut(EOCD_SIG);
+
+ // disk numbers
+ writeOut(ZERO);
+ writeOut(ZERO);
+
+ // number of entries
+ byte[] num = ZipShort.getBytes(entries.size());
+ writeOut(num);
+ writeOut(num);
+
+ // length and location of CD
+ writeOut(ZipLong.getBytes(cdLength));
+ writeOut(ZipLong.getBytes(cdOffset));
+
+ // ZIP file comment
+ byte[] data = getBytes(comment);
+ writeOut(ZipShort.getBytes(data.length));
+ writeOut(data);
+ }
+
+ /**
+ * Smallest date/time ZIP can handle.
+ *
+ * @since 1.1
+ */
+ private static final byte[] DOS_TIME_MIN = ZipLong.getBytes(0x00002100L);
+
+ /**
+ * Convert a Date object to a DOS date/time field.
+ *
+ * @param time
+ * the <code>Date</code> to convert
+ * @return the date as a <code>ZipLong</code>
+ * @since 1.1
+ */
+ protected static ZipLong toDosTime(Date time) {
+ return new ZipLong(toDosTime(time.getTime()));
+ }
+
+ /**
+ * Convert a Date object to a DOS date/time field.
+ *
+ * <p>
+ * Stolen from InfoZip's <code>fileio.c</code>
+ * </p>
+ *
+ * @param t
+ * number of milliseconds since the epoch
+ * @return the date as a byte array
+ * @since 1.26
+ */
+ protected static byte[] toDosTime(long t) {
+ Date time = new Date(t);
+ int year = time.getYear() + 1900;
+ if (year < 1980) {
+ return DOS_TIME_MIN;
}
-
- /**
- * Write bytes to output or random access file.
- * @param data the byte array to write
- * @param offset the start position to write from
- * @param length the number of bytes to write
- * @throws IOException on error
- *
- * @since 1.14
- */
- protected final void writeOut(byte[] data, int offset, int length)
- throws IOException {
- if (raf != null) {
- raf.write(data, offset, length);
- } else {
- out.write(data, offset, length);
- }
+ int month = time.getMonth() + 1;
+ long value = ((year - 1980) << 25) | (month << 21) | (time.getDate() << 16)
+ | (time.getHours() << 11) | (time.getMinutes() << 5)
+ | (time.getSeconds() >> 1);
+ return ZipLong.getBytes(value);
+ }
+
+ /**
+ * Retrieve the bytes for the given String in the encoding set for this
+ * Stream.
+ *
+ * @param name
+ * the string to get bytes from
+ * @return the bytes as a byte array
+ * @throws ZipException
+ * on error
+ *
+ * @since 1.3
+ */
+ protected byte[] getBytes(String name) throws ZipException {
+ if (encoding == null) {
+ return name.getBytes();
+ } else {
+ try {
+ return name.getBytes(encoding);
+ } catch (UnsupportedEncodingException uee) {
+ throw new ZipException(uee.getMessage());
+ }
}
-
- /**
- * Assumes a negative integer really is a positive integer that
- * has wrapped around and re-creates the original value.
- * @param i the value to treat as unsigned int.
- * @return the unsigned int as a long.
- * @since 1.34
- */
- protected static long adjustToLong(int i) {
- if (i < 0) {
- return 2 * ((long) Integer.MAX_VALUE) + 2 + i;
- } else {
- return i;
- }
+ }
+
+ /**
+ * Write bytes to output or random access file.
+ *
+ * @param data
+ * the byte array to write
+ * @throws IOException
+ * on error
+ *
+ * @since 1.14
+ */
+ protected final void writeOut(byte[] data) throws IOException {
+ writeOut(data, 0, data.length);
+ }
+
+ /**
+ * Write bytes to output or random access file.
+ *
+ * @param data
+ * the byte array to write
+ * @param offset
+ * the start position to write from
+ * @param length
+ * the number of bytes to write
+ * @throws IOException
+ * on error
+ *
+ * @since 1.14
+ */
+ protected final void writeOut(byte[] data, int offset, int length)
+ throws IOException {
+ if (raf != null) {
+ raf.write(data, offset, length);
+ } else {
+ out.write(data, offset, length);
+ }
+ }
+
+ /**
+ * Assumes a negative integer really is a positive integer that has wrapped
+ * around and re-creates the original value.
+ *
+ * @param i
+ * the value to treat as unsigned int.
+ * @return the unsigned int as a long.
+ * @since 1.34
+ */
+ protected static long adjustToLong(int i) {
+ if (i < 0) {
+ return 2 * ((long) Integer.MAX_VALUE) + 2 + i;
+ } else {
+ return i;
}
+ }
}
package org.apache.tools.zip;
/**
- * Utility class that represents a two byte integer with conversion
- * rules for the big endian byte order of ZIP files.
- *
+ * Utility class that represents a two byte integer with conversion rules for
+ * the big endian byte order of ZIP files.
+ *
*/
public final class ZipShort implements Cloneable {
- private int value;
+ private int value;
- /**
- * Create instance from a number.
- * @param value the int to store as a ZipShort
- * @since 1.1
- */
- public ZipShort (int value) {
- this.value = value;
- }
+ /**
+ * Create instance from a number.
+ *
+ * @param value
+ * the int to store as a ZipShort
+ * @since 1.1
+ */
+ public ZipShort(int value) {
+ this.value = value;
+ }
- /**
- * Create instance from bytes.
- * @param bytes the bytes to store as a ZipShort
- * @since 1.1
- */
- public ZipShort (byte[] bytes) {
- this(bytes, 0);
- }
+ /**
+ * Create instance from bytes.
+ *
+ * @param bytes
+ * the bytes to store as a ZipShort
+ * @since 1.1
+ */
+ public ZipShort(byte[] bytes) {
+ this(bytes, 0);
+ }
- /**
- * Create instance from the two bytes starting at offset.
- * @param bytes the bytes to store as a ZipShort
- * @param offset the offset to start
- * @since 1.1
- */
- public ZipShort (byte[] bytes, int offset) {
- value = ZipShort.getValue(bytes, offset);
- }
+ /**
+ * Create instance from the two bytes starting at offset.
+ *
+ * @param bytes
+ * the bytes to store as a ZipShort
+ * @param offset
+ * the offset to start
+ * @since 1.1
+ */
+ public ZipShort(byte[] bytes, int offset) {
+ value = ZipShort.getValue(bytes, offset);
+ }
- /**
- * Get value as two bytes in big endian byte order.
- * @return the value as a a two byte array in big endian byte order
- * @since 1.1
- */
- public byte[] getBytes() {
- byte[] result = new byte[2];
- result[0] = (byte) (value & 0xFF);
- result[1] = (byte) ((value & 0xFF00) >> 8);
- return result;
- }
+ /**
+ * Get value as two bytes in big endian byte order.
+ *
+ * @return the value as a a two byte array in big endian byte order
+ * @since 1.1
+ */
+ public byte[] getBytes() {
+ byte[] result = new byte[2];
+ result[0] = (byte) (value & 0xFF);
+ result[1] = (byte) ((value & 0xFF00) >> 8);
+ return result;
+ }
- /**
- * Get value as Java int.
- * @return value as a Java int
- * @since 1.1
- */
- public int getValue() {
- return value;
- }
+ /**
+ * Get value as Java int.
+ *
+ * @return value as a Java int
+ * @since 1.1
+ */
+ public int getValue() {
+ return value;
+ }
- /**
- * Get value as two bytes in big endian byte order.
- * @param value the Java int to convert to bytes
- * @return the converted int as a byte array in big endian byte order
- */
- public static byte[] getBytes(int value) {
- byte[] result = new byte[2];
- result[0] = (byte) (value & 0xFF);
- result[1] = (byte) ((value & 0xFF00) >> 8);
- return result;
- }
+ /**
+ * Get value as two bytes in big endian byte order.
+ *
+ * @param value
+ * the Java int to convert to bytes
+ * @return the converted int as a byte array in big endian byte order
+ */
+ public static byte[] getBytes(int value) {
+ byte[] result = new byte[2];
+ result[0] = (byte) (value & 0xFF);
+ result[1] = (byte) ((value & 0xFF00) >> 8);
+ return result;
+ }
- /**
- * Helper method to get the value as a java int from two bytes starting at given array offset
- * @param bytes the array of bytes
- * @param offset the offset to start
- * @return the correspondanding java int value
- */
- public static int getValue(byte[] bytes, int offset) {
- int value = (bytes[offset + 1] << 8) & 0xFF00;
- value += (bytes[offset] & 0xFF);
- return value;
- }
+ /**
+ * Helper method to get the value as a java int from two bytes starting at
+ * given array offset
+ *
+ * @param bytes
+ * the array of bytes
+ * @param offset
+ * the offset to start
+ * @return the correspondanding java int value
+ */
+ public static int getValue(byte[] bytes, int offset) {
+ int value = (bytes[offset + 1] << 8) & 0xFF00;
+ value += (bytes[offset] & 0xFF);
+ return value;
+ }
- /**
- * Helper method to get the value as a java int from a two-byte array
- * @param bytes the array of bytes
- * @return the correspondanding java int value
- */
- public static int getValue(byte[] bytes) {
- return getValue(bytes, 0);
- }
+ /**
+ * Helper method to get the value as a java int from a two-byte array
+ *
+ * @param bytes
+ * the array of bytes
+ * @return the correspondanding java int value
+ */
+ public static int getValue(byte[] bytes) {
+ return getValue(bytes, 0);
+ }
- /**
- * Override to make two instances with same value equal.
- * @param o an object to compare
- * @return true if the objects are equal
- * @since 1.1
- */
- public boolean equals(Object o) {
- if (o == null || !(o instanceof ZipShort)) {
- return false;
- }
- return value == ((ZipShort) o).getValue();
+ /**
+ * Override to make two instances with same value equal.
+ *
+ * @param o
+ * an object to compare
+ * @return true if the objects are equal
+ * @since 1.1
+ */
+ public boolean equals(Object o) {
+ if (o == null || !(o instanceof ZipShort)) {
+ return false;
}
+ return value == ((ZipShort) o).getValue();
+ }
- /**
- * Override to make two instances with same value equal.
- * @return the value stored in the ZipShort
- * @since 1.1
- */
- public int hashCode() {
- return value;
- }
+ /**
+ * Override to make two instances with same value equal.
+ *
+ * @return the value stored in the ZipShort
+ * @since 1.1
+ */
+ public int hashCode() {
+ return value;
+ }
}
-/**
- *
- */
-package uk.ac.vamsas.client;
-
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.jar.JarInputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author jimp
- * LATER: this may not be a necessary or useful class to return from IClientAppdata get*InputStream() methods
- */
-public class AppDataInputStream extends DataInputStream implements DataInput {
- private Log log = LogFactory.getLog(AppDataInputStream.class);
- private boolean isOpen = false;
- /**
- * Wrapper for writing to/from AppData Entries in a Vamsas Document.
- */
- public AppDataInputStream(InputStream inputstream) {
- super(inputstream);
- isOpen=true;
- }
-
- /* (non-Javadoc)
- * @see java.io.FilterInputStream#close()
- */
- public void close() throws IOException {
- if (!isOpen) {
- log.debug("close() called on closed AppDataInputStream.");
- // throw new IOException("Attempt to close an already closed AppDataInputStream");
- } else {
- isOpen=false;
- }
- }
-
- /**
- * Will return zero if stream has been closed.
- * @see java.io.FilterInputStream#available()
- */
- public int available() throws IOException {
- if (isOpen)
- return super.available();
- else
- return 0;
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+import java.io.DataInput;\r
+import java.io.DataInputStream;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.util.jar.JarInputStream;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+/**\r
+ * @author jimp LATER: this may not be a necessary or useful class to return\r
+ * from IClientAppdata get*InputStream() methods\r
+ */\r
+public class AppDataInputStream extends DataInputStream implements DataInput {\r
+ private Log log = LogFactory.getLog(AppDataInputStream.class);\r
+\r
+ private boolean isOpen = false;\r
+\r
+ /**\r
+ * Wrapper for writing to/from AppData Entries in a Vamsas Document.\r
+ */\r
+ public AppDataInputStream(InputStream inputstream) {\r
+ super(inputstream);\r
+ isOpen = true;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.io.FilterInputStream#close()\r
+ */\r
+ public void close() throws IOException {\r
+ if (!isOpen) {\r
+ log.debug("close() called on closed AppDataInputStream.");\r
+ // throw new\r
+ // IOException("Attempt to close an already closed AppDataInputStream");\r
+ } else {\r
+ isOpen = false;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Will return zero if stream has been closed.\r
+ * \r
+ * @see java.io.FilterInputStream#available()\r
+ */\r
+ public int available() throws IOException {\r
+ if (isOpen)\r
+ return super.available();\r
+ else\r
+ return 0;\r
+ }\r
+\r
+}\r
-/**
- *
- */
-package uk.ac.vamsas.client;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author jimp
- *
- */
-public class AppDataOutputStream extends DataOutputStream {
- private Log log = LogFactory.getLog(AppDataOutputStream.class);
- private boolean isOpen=true;
- /**
- * @param out
- */
- public AppDataOutputStream(OutputStream out) {
- super(out);
- isOpen=true;
- }
- /* (non-Javadoc)
- * @see java.io.DataOutputStream#flush()
- */
- public void flush() throws IOException {
- if (isOpen)
- super.flush();
- else
- log.warn("flush() called on closed AppDataOutputStream");
- }
- /* (non-Javadoc)
- * @see java.io.DataOutputStream#write(byte[], int, int)
- */
- public synchronized void write(byte[] b, int off, int len) throws IOException {
- if (isOpen) {
- super.write(b, off, len);
- } else {
- log.debug("write(b,off,len) called on closed AppDataOutputStream");
- throw new IOException("Attempt to write to closed AppDataOutputStream");
- }
- }
- /* (non-Javadoc)
- * @see java.io.DataOutputStream#write(int)
- */
- public synchronized void write(int b) throws IOException {
- if (isOpen) {
- super.write(b);
- } else {
- log.debug("write(b) called on closed AppDataOutputStream");
- throw new IOException("Attempt to write to closed AppDataOutputStream");
- }
- }
- /**
- * Sets an internal flag preventing further write operations
- * to the AppData output stream and flushes any pending writes.
- * @see java.io.FilterOutputStream#close()
- */
- public void close() throws IOException {
- isOpen=false;
- super.flush();
- log.debug("AppDataOutputStream was closed.");
- }
- /* (non-Javadoc)
- * @see java.io.FilterOutputStream#write(byte[])
- */
- public void write(byte[] b) throws IOException {
- if (isOpen) {
- super.write(b);
- } else {
- log.debug("write(b[]) called on closed AppDataOutputStream");
- throw new IOException("Attempt to write to closed AppDataOutputStream");
- }
- }
- /**
- * @return true if stream is still Open.
- */
- public boolean isOpen() {
- return isOpen;
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+import java.io.DataOutputStream;\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+/**\r
+ * @author jimp\r
+ * \r
+ */\r
+public class AppDataOutputStream extends DataOutputStream {\r
+ private Log log = LogFactory.getLog(AppDataOutputStream.class);\r
+\r
+ private boolean isOpen = true;\r
+\r
+ /**\r
+ * @param out\r
+ */\r
+ public AppDataOutputStream(OutputStream out) {\r
+ super(out);\r
+ isOpen = true;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.io.DataOutputStream#flush()\r
+ */\r
+ public void flush() throws IOException {\r
+ if (isOpen)\r
+ super.flush();\r
+ else\r
+ log.warn("flush() called on closed AppDataOutputStream");\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.io.DataOutputStream#write(byte[], int, int)\r
+ */\r
+ public synchronized void write(byte[] b, int off, int len) throws IOException {\r
+ if (isOpen) {\r
+ super.write(b, off, len);\r
+ } else {\r
+ log.debug("write(b,off,len) called on closed AppDataOutputStream");\r
+ throw new IOException("Attempt to write to closed AppDataOutputStream");\r
+ }\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.io.DataOutputStream#write(int)\r
+ */\r
+ public synchronized void write(int b) throws IOException {\r
+ if (isOpen) {\r
+ super.write(b);\r
+ } else {\r
+ log.debug("write(b) called on closed AppDataOutputStream");\r
+ throw new IOException("Attempt to write to closed AppDataOutputStream");\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets an internal flag preventing further write operations to the AppData\r
+ * output stream and flushes any pending writes.\r
+ * \r
+ * @see java.io.FilterOutputStream#close()\r
+ */\r
+ public void close() throws IOException {\r
+ isOpen = false;\r
+ super.flush();\r
+ log.debug("AppDataOutputStream was closed.");\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.io.FilterOutputStream#write(byte[])\r
+ */\r
+ public void write(byte[] b) throws IOException {\r
+ if (isOpen) {\r
+ super.write(b);\r
+ } else {\r
+ log.debug("write(b[]) called on closed AppDataOutputStream");\r
+ throw new IOException("Attempt to write to closed AppDataOutputStream");\r
+ }\r
+ }\r
+\r
+ /**\r
+ * @return true if stream is still Open.\r
+ */\r
+ public boolean isOpen() {\r
+ return isOpen;\r
+ }\r
+\r
+}\r
/*
- *
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
import uk.ac.vamsas.objects.core.VAMSAS;
/**
- * skeleton abstract class to allow client implementations
- * access to vamsas.client.Vobject registry mechanism.
+ * skeleton abstract class to allow client implementations access to
+ * vamsas.client.Vobject registry mechanism.
*/
public abstract class ClientDocument implements IClientDocument {
static Log log = LogFactory.getLog(ClientDocument.class);
-
+
/**
* collection of uk.ac.vamsas.client.Vobject references
*/
protected Hashtable vamsasObjects;
+
protected IVorbaIdFactory vorbafactory;
-
+
protected ClientDocument(Hashtable objects, IVorbaIdFactory factory) {
vamsasObjects = objects;
vorbafactory = factory;
}
-
+
/**
* @see IClientHandle.registerObject(Vobject unregistered)
*/
protected VorbaId _registerObject(Vobject unregistered) {
- // be ultra safe here because the user may be trying to mix different factories
- if (unregistered.__vorba==null)
- unregistered.__vorba = vorbafactory;
- else
- if (unregistered.__vorba!=vorbafactory) {
- // LATER: decide if this is allowed - it isn't for the moment.
- log.error("Attempt to overwrite info in a registered vorba Vobject (under a different IVorbaIdFactory) ! - Implementation fix needed.");
- return null;
- } else {
- // probably didn't need to call registerObject.
- log.debug("Redundant call to registerObject");
- }
+ // be ultra safe here because the user may be trying to mix different
+ // factories
+ if (unregistered.__vorba == null)
+ unregistered.__vorba = vorbafactory;
+ else if (unregistered.__vorba != vorbafactory) {
+ // LATER: decide if this is allowed - it isn't for the moment.
+ log
+ .error("Attempt to overwrite info in a registered vorba Vobject (under a different IVorbaIdFactory) ! - Implementation fix needed.");
+ return null;
+ } else {
+ // probably didn't need to call registerObject.
+ log.debug("Redundant call to registerObject");
+ }
// TODO: add default provenance.
// TODO: decide if we need to do call __ensure_instance_ids here
- // TODO: check if __ensure_instance_ids works correctly with new 'visit flag' mechanism
- unregistered.__ensure_instance_ids(); // call cascade method here :
+ // TODO: check if __ensure_instance_ids works correctly with new 'visit
+ // flag' mechanism
+ unregistered.__ensure_instance_ids(); // call cascade method here :
return unregistered.getVorbaId();
}
}
/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
/**
* Uniquely describes a vamsas client application.
- * @author jimp
+ *
+ * @author jimp
*/
public class ClientHandle implements Serializable {
static final long serialVersionUID = 0;
-
+
/**
* @param clientName
* @param version
super();
this.clientName = _clientName;
this.version = _version;
- //this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO: decide on application handle ornthing (used to prefix new ids made by a particular application)
+ // this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO:
+ // decide on application handle ornthing (used to prefix new ids made by a
+ // particular application)
this.setClientUrn(this.generateClientUrn(this.clientName, this.version));
}
+
/**
* (non-unique) human readable vamsas client name
*/
String clientName;
/**
- * the unambiguous client identifier
- * This may be rewritten by the Vorba object if
- * other clients with the same name, version
- * and user are involved in a session.
+ * the unambiguous client identifier This may be rewritten by the Vorba object
+ * if other clients with the same name, version and user are involved in a
+ * session.
*
*/
String clientUrn;
/**
* Generates the client Urn from the clientName and version
- *
- * @param clientName (non-unique) human readable vamsas client name
- * @param version version modifier
+ *
+ * @param clientName
+ * (non-unique) human readable vamsas client name
+ * @param version
+ * version modifier
* @return a String corresponding to the clientUrn
*/
- private String generateClientUrn(String _clientName, String _version)
- {
- return ("vamsas://"+_clientName+":"+_version+"/").intern();
- }
-
+ private String generateClientUrn(String _clientName, String _version) {
+ return ("vamsas://" + _clientName + ":" + _version + "/").intern();
+ }
+
/**
* @return Returns the clientUrn.
*/
/**
* May become protected - should only be set by a Vorba object.
+ *
* @param clientUrn
* The clientUrn to set.
*/
this.setClientUrn(this.generateClientUrn(this.clientName, this.version));
}
-
/**
* @return Returns the clientName.
*/
public boolean equals(Object that) {
if (that instanceof ClientHandle)
- return this.equals((ClientHandle) that);
+ return this.equals((ClientHandle) that);
return false;
}
+
public boolean equals(ClientHandle that) {
- return ( (this.clientName == null || this.clientName.equals(that.clientName))
- && (this.version == null || this.version.equals(that.version))
- && (this.clientUrn == null || this.clientUrn.equals(that.clientUrn)));
+ return ((this.clientName == null || this.clientName.equals(that.clientName))
+ && (this.version == null || this.version.equals(that.version)) && (this.clientUrn == null || this.clientUrn
+ .equals(that.clientUrn)));
}
public String getClientNCname() {
-
+
String ncname = clientName.replace(':', '_');
ncname = ncname.replace('@', '.');
return ncname;
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
+ */
package uk.ac.vamsas.client;
/**
* Enumerates the event types generated during the lifecycle of a Vamsas
- * session.
- * See the excel spreadsheet in VamsasClient/docs/VamsasSessionEventAnalysis.xls for
- * some more information about when these are generated and how they should be
- * handled.
+ * session. See the excel spreadsheet in
+ * VamsasClient/docs/VamsasSessionEventAnalysis.xls for some more information
+ * about when these are generated and how they should be handled.
*
*/
public class Events {
/**
- * Generated when a client has finished updating the document.
- * Client which has completed an update should
- * not receive the event.
- * NewValue: uk.ac.vamsas.client.IClient for session.
+ * Generated when a client has finished updating the document. Client which
+ * has completed an update should not receive the event. NewValue:
+ * uk.ac.vamsas.client.IClient for session.
*/
public static final String DOCUMENT_UPDATE = "uk.ac.vamsas.client.events.documentUpdateEvent";
/**
* Generated when a new vamsas document is created (perhaps from some existing
* Vamsas data) so an application may do its own data space initialization.
- * Raised for a new application connecting to a vamsas document
- * NewValue: uk.ac.vamsas.client.IClient for session.
- * LATER: DOCUMENT_CREATE event may be redundant
+ * Raised for a new application connecting to a vamsas document NewValue:
+ * uk.ac.vamsas.client.IClient for session. LATER: DOCUMENT_CREATE event may
+ * be redundant
*/
public static final String DOCUMENT_CREATE = "uk.ac.vamsas.client.events.documentCreateEvent";
/**
* Generated prior to session Shutdown, after the last participating vamsas
- * client has finalized.
- * Probably only useful to IClientFactory implementations.
- * NewValue: <Vamsas-session URN>
+ * client has finalized. Probably only useful to IClientFactory
+ * implementations. NewValue: <Vamsas-session URN>
*/
public static final String SESSION_SHUTDOWN = "uk.ac.vamsas.client.events.SessionShutdownEvent";
/**
* Generated for all clients when any client calls IClient.storeDocument() to
* allow them to store any updates before an offline copy of the session is
- * created.
- * Any client that handles this should call the
+ * created. Any client that handles this should call the
* IClient.getDocument(), update and then IClient.updateDocument in the same
* handler thread (the lock on the document is held until the handler exits).
- * EventName: <Vamsas-session URN>
- * NewValue: uk.ac.vamsas.client.IClient for session.
+ * EventName: <Vamsas-session URN> NewValue: uk.ac.vamsas.client.IClient for
+ * session.
*/
public static final String DOCUMENT_FINALIZEAPPDATA = "uk.ac.vamsas.client.events.DocumentFinalizeAppData";
/**
- * Generated by Vorba stub for the sole remaining client instance in a session,
- * when it makes a call to finalizeClient().
- * It is only raised if the session has been modified since the
- * last call to storeDocument() by any application.
- * LATER: copies of a document should be on a per-user basis for multi-user sessions.
- * Sequence is as follows : 1. All other vamsas clients have
- * called finalizeClient() 2. Final living client monitors closures, and
+ * Generated by Vorba stub for the sole remaining client instance in a
+ * session, when it makes a call to finalizeClient(). It is only raised if the
+ * session has been modified since the last call to storeDocument() by any
+ * application. LATER: copies of a document should be on a per-user basis for
+ * multi-user sessions. Sequence is as follows : 1. All other vamsas clients
+ * have called finalizeClient() 2. Final living client monitors closures, and
* realises that it is last. 3. Final client generates event to prompt
* associated application to inquire if the user wishes to save the document
- * for future reference.
- * * Any call to finalizeClient in a thread other than the registered
- * EventListener will block until the RequestToClose handler has exited.
- * NewValue: uk.ac.vamsas.client.IClient for session.
+ * for future reference. * Any call to finalizeClient in a thread other than
+ * the registered EventListener will block until the RequestToClose handler
+ * has exited. NewValue: uk.ac.vamsas.client.IClient for session.
*/
public static final String DOCUMENT_REQUESTTOCLOSE = "uk.ac.vamas.client.DocumentRequestToCloseEvent";
-/**
- * uk.ac.vamsas.client.IClient
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
*
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
import java.io.IOException;
/**
- * Defines the methods availabable to a vamsas
- * application for interacting with its Vorba agent
- * created by an IClientFactory instance for a particular session,
- * user, and application handle.
- * (it's VORBA, not CORBA!)
- * LATER: add exceptions for timeouts raised when there are problems accessing session data (because another application is hogging it).
- * LATER: think about situations when two applications both want a ClientDocument at the same time - can one have read-only access (and be told that another is about to update)
+ * Defines the methods availabable to a vamsas application for interacting with
+ * its Vorba agent created by an IClientFactory instance for a particular
+ * session, user, and application handle. (it's VORBA, not CORBA!) LATER: add
+ * exceptions for timeouts raised when there are problems accessing session data
+ * (because another application is hogging it). LATER: think about situations
+ * when two applications both want a ClientDocument at the same time - can one
+ * have read-only access (and be told that another is about to update)
*/
public interface IClient {
-
+
/**
- * Self-documenting/describing info for the application to present
- * to the user.
- * LATER: formalise this for describing VAMSAS system, a particular
+ * Self-documenting/describing info for the application to present to the
+ * user. LATER: formalise this for describing VAMSAS system, a particular
* Vorba client agent, and a particular session.
+ *
* @return string like VamsasClient v.1.1.1 (GPL) and whatever
*/
public String getAbout();
-
+
/**
- * convenience method to get the SessionUrn as a string (for passing directly to a text box...).
+ * convenience method to get the SessionUrn as a string (for passing directly
+ * to a text box...).
+ *
* @return current SessionUrn
*/
- public String getSessionUrn();
- /**
- * Returns a valid URN for other applications to connect to
- * the vamsas session.
- * @return session handle for this session.
- */
- public SessionHandle getSessionHandle();
- /**
- * Included for applications with several ClientHandle
- * identities.
- * @return ClientHandle used to interact with
- * other Vamsas applications.
- */
- public ClientHandle getClientHandle();
- /**
- *
- * @return UserHandle used when interacting
- * with other Vamsas applications.
- */
- public UserHandle getUserHandle();
- /**
- * Method called by client application on exit.
- * Vorba will inform other clients if they exist.
- * If this is the last application in the session
- * then the session will be closed.
- * Note: The application should be ready to handle
- * 'RequestToCloseDocument' events from the Vorba
- * agent in the latter case and so prompt the user
- * to save the session locally.
- * LATER: pick a better name ?
- */
- public void finalizeClient();
- /**
- * register handler for updates for the current session
- */
- public void addDocumentUpdateHandler(PropertyChangeListener evt);
- /**
- * get vamsas document with
- * user and app specific data
- * IClientDocuments are not thread-safe.
- * TODO: New exception for failed document lock.
- * @throws IOException if lock is not obtainable for the document in the session
- */
- public IClientDocument getClientDocument() throws IOException;
- /**
- * Queue new Vorba objects for storage and propagation
- * to other clients (via Event.DOCUMENT_UPDATE based
- * notification of document change)
- * New objects without provenance information will be
- * given a default entry using the IClient's application,
- * user (and session) handles
- * Validity of IClientDocument object instances after this call is implementation dependent
- * TODO: consider refactoring to remove the redundant IClientDocument parameter for this method
- */
- public void updateDocument(IClientDocument newdoc);
- /**
- * Any application may call storeDocument to
- * save a local copy of the current vamsas document
- * including all application specific entries.
- *
- * @param location to write zip file
- */
- public void storeDocument(java.io.File location);
- /**
- * Any application may call importDocument to merge a stored
- * vamsasDocument into the current session.
- * Note: use a IClientFactory's implementation to make sessions out of vamsas documents
- * TODO: this is not currently implemented by SimpleClient - and may be dropped from the first version of the interface.
- * LATER: VAMSAS: The IClient implementation will handle all ID 'relocations'
- * @param location
- */
- public void importDocument(java.io.File location);
- /**
- * Add a listener to a particular event chain.
- * See uk.ac.vamsas.client.Events for allowed
- * values for EventChain.
- * The EventChain value is passed as the
- * propertyName in the java.bean.PropertyChangeEvent
- * LATER: extend class to form own vamsas Event/Listener model.
- * @param EventChain Name of event. Blank/null registers handler for all events.
- * @param evt - event handler function.
- */
- public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt);
- /**
- * Sets the update handler that will be called when any updates occur to objects of type rootObject.
- * @param rootObject
- * @param handler
- */
- public void setUpdateHandler(IObjectUpdate handler);
- public IObjectUpdate getUpdateHandler(Class rootObject);
- public void removeUpdateHandler(Class rootObject);
- public IObjectUpdate[] getUpdateHandlers();
- /**
- * client application calls this to force the
- * Vorba client to check for updates immediately.
- *
- */
- public void pollUpdate();
-
- /**
- * Client application calls this after any pre-session initialization
- * (registering of Handlers, etc)
- * Exceptions are raised for any failures. Any stateful calls to the session prior to
- * this will result in an implicit call to joinSession - if that results in an exception
- * then the VamsasClient should raise an Error.
- * LATER: create VAMSAS exception hierarchy (in a language agnostic manner)
- */
- public void joinSession() throws Exception;
- /**
- * get the Vamsas Pick Manager for registering pick handlers and sending messages for the current session.
- * @return an object implementing IPickManager (which maybe the same as the IClient implementer)
- */
- public uk.ac.vamsas.client.picking.IPickManager getPickManager();
-
+ public String getSessionUrn();
+
+ /**
+ * Returns a valid URN for other applications to connect to the vamsas
+ * session.
+ *
+ * @return session handle for this session.
+ */
+ public SessionHandle getSessionHandle();
+
+ /**
+ * Included for applications with several ClientHandle identities.
+ *
+ * @return ClientHandle used to interact with other Vamsas applications.
+ */
+ public ClientHandle getClientHandle();
+
+ /**
+ *
+ * @return UserHandle used when interacting with other Vamsas applications.
+ */
+ public UserHandle getUserHandle();
+
+ /**
+ * Method called by client application on exit. Vorba will inform other
+ * clients if they exist. If this is the last application in the session then
+ * the session will be closed. Note: The application should be ready to handle
+ * 'RequestToCloseDocument' events from the Vorba agent in the latter case and
+ * so prompt the user to save the session locally. LATER: pick a better name ?
+ */
+ public void finalizeClient();
+
+ /**
+ * register handler for updates for the current session
+ */
+ public void addDocumentUpdateHandler(PropertyChangeListener evt);
+
+ /**
+ * get vamsas document with user and app specific data IClientDocuments are
+ * not thread-safe. TODO: New exception for failed document lock.
+ *
+ * @throws IOException
+ * if lock is not obtainable for the document in the session
+ */
+ public IClientDocument getClientDocument() throws IOException;
+
+ /**
+ * Queue new Vorba objects for storage and propagation to other clients (via
+ * Event.DOCUMENT_UPDATE based notification of document change) New objects
+ * without provenance information will be given a default entry using the
+ * IClient's application, user (and session) handles Validity of
+ * IClientDocument object instances after this call is implementation
+ * dependent TODO: consider refactoring to remove the redundant
+ * IClientDocument parameter for this method
+ */
+ public void updateDocument(IClientDocument newdoc);
+
+ /**
+ * Any application may call storeDocument to save a local copy of the current
+ * vamsas document including all application specific entries.
+ *
+ * @param location
+ * to write zip file
+ */
+ public void storeDocument(java.io.File location);
+
+ /**
+ * Any application may call importDocument to merge a stored vamsasDocument
+ * into the current session. Note: use a IClientFactory's implementation to
+ * make sessions out of vamsas documents TODO: this is not currently
+ * implemented by SimpleClient - and may be dropped from the first version of
+ * the interface. LATER: VAMSAS: The IClient implementation will handle all ID
+ * 'relocations'
+ *
+ * @param location
+ */
+ public void importDocument(java.io.File location);
+
+ /**
+ * Add a listener to a particular event chain. See uk.ac.vamsas.client.Events
+ * for allowed values for EventChain. The EventChain value is passed as the
+ * propertyName in the java.bean.PropertyChangeEvent LATER: extend class to
+ * form own vamsas Event/Listener model.
+ *
+ * @param EventChain
+ * Name of event. Blank/null registers handler for all events.
+ * @param evt
+ * - event handler function.
+ */
+ public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt);
+
+ /**
+ * Sets the update handler that will be called when any updates occur to
+ * objects of type rootObject.
+ *
+ * @param rootObject
+ * @param handler
+ */
+ public void setUpdateHandler(IObjectUpdate handler);
+
+ public IObjectUpdate getUpdateHandler(Class rootObject);
+
+ public void removeUpdateHandler(Class rootObject);
+
+ public IObjectUpdate[] getUpdateHandlers();
+
+ /**
+ * client application calls this to force the Vorba client to check for
+ * updates immediately.
+ *
+ */
+ public void pollUpdate();
+
+ /**
+ * Client application calls this after any pre-session initialization
+ * (registering of Handlers, etc) Exceptions are raised for any failures. Any
+ * stateful calls to the session prior to this will result in an implicit call
+ * to joinSession - if that results in an exception then the VamsasClient
+ * should raise an Error. LATER: create VAMSAS exception hierarchy (in a
+ * language agnostic manner)
+ */
+ public void joinSession() throws Exception;
+
+ /**
+ * get the Vamsas Pick Manager for registering pick handlers and sending
+ * messages for the current session.
+ *
+ * @return an object implementing IPickManager (which maybe the same as the
+ * IClient implementer)
+ */
+ public uk.ac.vamsas.client.picking.IPickManager getPickManager();
+
}
-/**
- *
- */
-package uk.ac.vamsas.client;
-
-
-
-/**
- * Object for accessing Client and User specific data
- * in an IClientDocument instance.
- *
- */
-public interface IClientAppdata {
- /**
- * @return true if Client's non-user specific application data is non-zero length.
- */
- boolean hasClientAppdata();
- /**
- * @return true if User's Client Application data is non-zero length
- */
- boolean hasUserAppdata();
- /**
- *
- * @return byte array containing the Client's non-user specific application data
- */
- byte[] getClientAppdata();
- /**
- *
- * @return byte array containing the Client's user specific application data
- */
- byte[] getUserAppdata();
- /**
- * set the non-User-specific application data
- * @param data - the new non-user-specific data
- */
- void setClientAppdata(byte[] data);
- /**
- * set the User-specific application data
- * @param data - the new user-specific data
- */
- void setUserAppdata(byte[] data);
- /**
- * @return non-user specific data output stream
- */
- AppDataOutputStream getClientOutputStream();
- /**
- * @return non-user specific data input stream
- */
- AppDataInputStream getClientInputStream();
- /**
- *
- * @return user specific data output stream
- */
- AppDataOutputStream getUserOutputStream();
- /**
- *
- * @return user specific data input stream
- */
- AppDataInputStream getUserInputStream();
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+/**\r
+ * Object for accessing Client and User specific data in an IClientDocument\r
+ * instance.\r
+ * \r
+ */\r
+public interface IClientAppdata {\r
+ /**\r
+ * @return true if Client's non-user specific application data is non-zero\r
+ * length.\r
+ */\r
+ boolean hasClientAppdata();\r
+\r
+ /**\r
+ * @return true if User's Client Application data is non-zero length\r
+ */\r
+ boolean hasUserAppdata();\r
+\r
+ /**\r
+ * \r
+ * @return byte array containing the Client's non-user specific application\r
+ * data\r
+ */\r
+ byte[] getClientAppdata();\r
+\r
+ /**\r
+ * \r
+ * @return byte array containing the Client's user specific application data\r
+ */\r
+ byte[] getUserAppdata();\r
+\r
+ /**\r
+ * set the non-User-specific application data\r
+ * \r
+ * @param data\r
+ * - the new non-user-specific data\r
+ */\r
+ void setClientAppdata(byte[] data);\r
+\r
+ /**\r
+ * set the User-specific application data\r
+ * \r
+ * @param data\r
+ * - the new user-specific data\r
+ */\r
+ void setUserAppdata(byte[] data);\r
+\r
+ /**\r
+ * @return non-user specific data output stream\r
+ */\r
+ AppDataOutputStream getClientOutputStream();\r
+\r
+ /**\r
+ * @return non-user specific data input stream\r
+ */\r
+ AppDataInputStream getClientInputStream();\r
+\r
+ /**\r
+ * \r
+ * @return user specific data output stream\r
+ */\r
+ AppDataOutputStream getUserOutputStream();\r
+\r
+ /**\r
+ * \r
+ * @return user specific data input stream\r
+ */\r
+ AppDataInputStream getUserInputStream();\r
+}\r
/*
- * Created on 13-Sep-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
import uk.ac.vamsas.objects.core.VAMSAS;
-
/**
- * Defines the API for the Vamsas XML Document
- * as accessed by a Vamsas SimpleClient Application.
- * An instance of this interface is valid for a
- * particular set of user, session and application
- * handles.
+ * Defines the API for the Vamsas XML Document as accessed by a Vamsas
+ * SimpleClient Application. An instance of this interface is valid for a
+ * particular set of user, session and application handles.
+ *
+ * It initially represents a snapshot of the XML document at a particular time -
+ * queriable by reference or by retrieval of root objects. It provides methods
+ * to make new Vobject references, These are guaranteed to be unique amongst
+ * existing objects in the document, all other references created by this
+ * Vobject's instance and all other references constructed by any other vamsas
+ * agents in the session. TODO: LATER: finegrained access control for
+ * public/private user access Finegrained access control: Since a clientDocument
+ * is created for a particular UserHandle, there is scope for fine grain data
+ * access control based on user identity. A user may also want to make private
+ * notes, not available to other people using the same application in the same
+ * session. TODO: LATER: implement a more sophisticated query interface for
+ * quickly identifying new data in a vamsas document and manipulating existing
+ * objects
*
- * It initially represents a snapshot of the
- * XML document at a particular time - queriable by
- * reference or by retrieval of root objects.
- * It provides methods to make new Vobject references,
- * These are guaranteed to be unique amongst existing
- * objects in the document, all other references created
- * by this Vobject's instance and all other references
- * constructed by any other vamsas agents in the session.
- * TODO: LATER: finegrained access control for public/private user access
- * Finegrained access control: Since a clientDocument is created for a particular
- * UserHandle, there is scope for fine grain data access
- * control based on user identity.
- * A user may also want to make private notes, not
- * available to other people using the same application
- * in the same session.
- * TODO: LATER: implement a more sophisticated query interface for quickly identifying new data in a vamsas document and manipulating existing objects
* @author jimp
*/
public interface IClientDocument {
-
+
/**
* Get a single Vobject.
+ *
* @param id
* @return Vobject referred to by id or null if it doesn't exist.
*/
Vobject getObject(VorbaId id);
+
/**
* Get a list of objects.
+ *
* @param ids
* @return array of objects using a vector of VorbaId ids.
*/
Vobject[] getObjects(VorbaId[] ids);
+
/**
- * Returns all root objects in document. All objects inherit
- * from uk.ac.vamsas.client.Vobject and have valid VorbaIds and provenance entries.
+ * Returns all root objects in document. All objects inherit from
+ * uk.ac.vamsas.client.Vobject and have valid VorbaIds and provenance entries.
+ *
* @return array of root Vamsas element objects.
*/
VAMSAS[] getVamsasRoots();
+
/**
- * set the VAMSAS roots in the document
- * TODO: decide if objects are verified for provenance and VorbaIds by this call or when document is stored
- * TODO: decide if this call should throw InvalidVamsasObject exceptions.
- * TODO: decide how this call deals with applications that 'forget' to include all VAMSAS roots (this is where reference counting/garbage collection happens)
+ * set the VAMSAS roots in the document TODO: decide if objects are verified
+ * for provenance and VorbaIds by this call or when document is stored TODO:
+ * decide if this call should throw InvalidVamsasObject exceptions. TODO:
+ * decide how this call deals with applications that 'forget' to include all
+ * VAMSAS roots (this is where reference counting/garbage collection happens)
+ *
* @param roots
*/
void setVamsasRoots(VAMSAS[] roots);
+
/**
- * Adds a new VAMSAS root entry
- * TODO: decide on same InvalidVamsasObject exceptions.
- * TODO: decide if a 'removeVamsasRoot' method is really needed.
+ * Adds a new VAMSAS root entry TODO: decide on same InvalidVamsasObject
+ * exceptions. TODO: decide if a 'removeVamsasRoot' method is really needed.
+ *
* @param newroot
*/
void addVamsasRoot(VAMSAS newroot);
+
/**
- * Returns an Vobject with a valid VorbaId, and provenance element.
- * The VorbaId is so the application may refer to it in
- * its own dataspace.
+ * Returns an Vobject with a valid VorbaId, and provenance element. The
+ * VorbaId is so the application may refer to it in its own dataspace.
*
- * Note: An Vobject with valid VorbaId will not be reregistered.
- * Advice: Calling this method for a high-level Vobject
- * (such as uk.ac.vamsas.objects.core.VAMSAS) will
- * register all its component objects too.
+ * Note: An Vobject with valid VorbaId will not be reregistered. Advice:
+ * Calling this method for a high-level Vobject (such as
+ * uk.ac.vamsas.objects.core.VAMSAS) will register all its component objects
+ * too.
*
- * @param unregistered unregistered vamsas Vobject
+ * @param unregistered
+ * unregistered vamsas Vobject
* @return VorbaId registered for vamsas Vobject
*/
VorbaId registerObject(Vobject unregistered);
+
/**
- * Returns an array of objects, each with a valid VorbaId
- * (and completed provenance entry).
- * Note: An Vobject with valid VorbaId will not be reregistered.
- * @param unregistered array of unregistered objects.
+ * Returns an array of objects, each with a valid VorbaId (and completed
+ * provenance entry). Note: An Vobject with valid VorbaId will not be
+ * reregistered.
+ *
+ * @param unregistered
+ * array of unregistered objects.
* @return array of VorbaIds for the registered objects
*/
VorbaId[] registerObjects(Vobject[] unregistered);
+
/**
- * Get instance of Client and User specific vamsas document data access interface.
+ * Get instance of Client and User specific vamsas document data access
+ * interface.
+ *
* @return Interface to Client and user specific application data
*/
IClientAppdata getClientAppdata();
-}
\ No newline at end of file
+}
/*
- * Created on 13-Sep-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
/**
* Defines methods for instantiating Vorba client application agents
+ *
* @author jimp
- *
- * (it's VORBA, not CORBA!)
+ *
+ * (it's VORBA, not CORBA!)
*/
public interface IClientFactory {
- /**
- * Create a new Vorba Session
- * @param applicationHandle is the application's VAMSAS handle string
- * @throws NoDefaultSessionException if more than one session exists that the client may connect to
- */
- IClient getIClient(ClientHandle applicationHandle) throws NoDefaultSessionException;
- /**
- * returns new Vorba for a given session.
- * @param applicationHandle
- * @param sessionUrn session to connect to (or null to create a new session)
- * @return
- */
- IClient getIClient(ClientHandle applicationHandle, String sessionUrn);
- /**
- * returns new vorba for a given session acting as a particular identity
- * @param applicationHandle
- * @param userId
- * @param sessionUrn session to connect to (or null to create a new session)
- * @return
- */
- IClient getIClient(ClientHandle applicationHandle, UserHandle userId, String sessionUrn);
- /**
- * New session for application and specific user
- * @param applicationHandle
- * @param userId
- * @return
- * @throws NoDefaultSessionException if more than one session exists that the client may connect to
- */
- IClient getIClient(ClientHandle applicationHandle, UserHandle userId) throws NoDefaultSessionException;
- /**
- * Create a new sesssion for the application with the current user
- * @param applicationHandle
- * @return
- */
- IClient getNewSessionIClient(ClientHandle applicationHandle);
- /**
- * Create a new session for the application using a particular user identity
- * @param applicationHandle
- * @param userId
- * @return
- */
- IClient getNewSessionIClient(ClientHandle applicationHandle, UserHandle userId);
- /**
- * Create a new session and import an existing vamsas document into it.
- * @param applicationHandle
- * @param vamsasDocument
- * @return
- */
- IClient openAsNewSessionIClient(ClientHandle applicationHandle, File vamsasDocument) throws InvalidSessionDocumentException;
- /**
- * Create a new session as a particular user and import an existing vamsas document into it.
- * @param applicationHandle
- * @param userId
- * @param vamsasDocument
- * @return
- */
- IClient openAsNewSessionIClient(ClientHandle applicationHandle, UserHandle userId, File vamsasDocument) throws InvalidSessionDocumentException;
- /**
- * enumerate the active sessions this IClientFactory instance knows about.
- * Can be used by caller to pick a session on catching a NoDefaultSessionException.
- * LATER: Define interface for discovering more information about a session (so it can be presented to a user in a meaningful way)
- * @return possibly empty array of sessionUrn strings
- */
- public String[] getCurrentSessions();
+ /**
+ * Create a new Vorba Session
+ *
+ * @param applicationHandle
+ * is the application's VAMSAS handle string
+ * @throws NoDefaultSessionException
+ * if more than one session exists that the client may connect to
+ */
+ IClient getIClient(ClientHandle applicationHandle)
+ throws NoDefaultSessionException;
+
+ /**
+ * returns new Vorba for a given session.
+ *
+ * @param applicationHandle
+ * @param sessionUrn
+ * session to connect to (or null to create a new session)
+ * @return
+ */
+ IClient getIClient(ClientHandle applicationHandle, String sessionUrn);
+
+ /**
+ * returns new vorba for a given session acting as a particular identity
+ *
+ * @param applicationHandle
+ * @param userId
+ * @param sessionUrn
+ * session to connect to (or null to create a new session)
+ * @return
+ */
+ IClient getIClient(ClientHandle applicationHandle, UserHandle userId,
+ String sessionUrn);
+
+ /**
+ * New session for application and specific user
+ *
+ * @param applicationHandle
+ * @param userId
+ * @return
+ * @throws NoDefaultSessionException
+ * if more than one session exists that the client may connect to
+ */
+ IClient getIClient(ClientHandle applicationHandle, UserHandle userId)
+ throws NoDefaultSessionException;
+
+ /**
+ * Create a new sesssion for the application with the current user
+ *
+ * @param applicationHandle
+ * @return
+ */
+ IClient getNewSessionIClient(ClientHandle applicationHandle);
+
+ /**
+ * Create a new session for the application using a particular user identity
+ *
+ * @param applicationHandle
+ * @param userId
+ * @return
+ */
+ IClient getNewSessionIClient(ClientHandle applicationHandle, UserHandle userId);
+
+ /**
+ * Create a new session and import an existing vamsas document into it.
+ *
+ * @param applicationHandle
+ * @param vamsasDocument
+ * @return
+ */
+ IClient openAsNewSessionIClient(ClientHandle applicationHandle,
+ File vamsasDocument) throws InvalidSessionDocumentException;
+
+ /**
+ * Create a new session as a particular user and import an existing vamsas
+ * document into it.
+ *
+ * @param applicationHandle
+ * @param userId
+ * @param vamsasDocument
+ * @return
+ */
+ IClient openAsNewSessionIClient(ClientHandle applicationHandle,
+ UserHandle userId, File vamsasDocument)
+ throws InvalidSessionDocumentException;
+
+ /**
+ * enumerate the active sessions this IClientFactory instance knows about. Can
+ * be used by caller to pick a session on catching a
+ * NoDefaultSessionException. LATER: Define interface for discovering more
+ * information about a session (so it can be presented to a user in a
+ * meaningful way)
+ *
+ * @return possibly empty array of sessionUrn strings
+ */
+ public String[] getCurrentSessions();
}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client;\r
\r
/**\r
* Methods implemented by a Vamsas Application's Object Update handler\r
- * @author vamsas\r
- * Introduced November 2006 Vamsas Meeting\r
- * TODO: verify this is sufficient for the per-object update event mechanism\r
+ * \r
+ * @author vamsas Introduced November 2006 Vamsas Meeting TODO: verify this is\r
+ * sufficient for the per-object update event mechanism\r
*/\r
public interface IObjectUpdate {\r
/**\r
- * Called by the library to find out which vamsas document object this update handler is interested in\r
+ * Called by the library to find out which vamsas document object this update\r
+ * handler is interested in\r
+ * \r
* @return class that extends org.vamsas.Vobject\r
*/\r
Class getRootVobject();\r
+\r
/**\r
- * Called to test if this handler is to be called for updates to any Vobjects below the Root Vobject in the vamsas document.\r
- * @return false means IObjectUpdate.update(updated, cdoc) will only be called with instances of type getRootVobject(). \r
+ * Called to test if this handler is to be called for updates to any Vobjects\r
+ * below the Root Vobject in the vamsas document.\r
+ * \r
+ * @return false means IObjectUpdate.update(updated, cdoc) will only be called\r
+ * with instances of type getRootVobject().\r
*/\r
boolean handlesSubtreeUpdates();\r
+\r
/**\r
- * Method called by Vamsas Client Library for all updated objects that the handler is registered for.\r
+ * Method called by Vamsas Client Library for all updated objects that the\r
+ * handler is registered for.\r
+ * \r
* @param updated\r
* @param cdoc\r
*/\r
- void update(uk.ac.vamsas.client.Vobject updated, uk.ac.vamsas.client.IClientDocument cdoc);\r
+ void update(uk.ac.vamsas.client.Vobject updated,\r
+ uk.ac.vamsas.client.IClientDocument cdoc);\r
}\r
/*
- * Created on 14-Sep-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
/**
- * @author jimp
- * middleware interface for generating new VorbaId objects
- * for a particular vamsas client based on the current
- * session, user and client handle. Generally implemented
- * by instances of the vamsas library api only.
+ * @author jimp middleware interface for generating new VorbaId objects for a
+ * particular vamsas client based on the current session, user and
+ * client handle. Generally implemented by instances of the vamsas
+ * library api only.
*/
public interface IVorbaIdFactory {
/**
* construct a new id appropriate for this client in the vamsas session.
- * @param vobject TODO
+ *
+ * @param vobject
+ * TODO
*
* @return valid VorbaId for session, or null if VorbaIdFactory not configured
* correctly.
public abstract ClientHandle getClientHandle();
public abstract UserHandle getUserHandle();
+
/**
- * called when an object is touched by the vamsas library prior to writing
- * to record last hash for the object's VorbaId
+ * called when an object is touched by the vamsas library prior to writing to
+ * record last hash for the object's VorbaId
+ *
* @param vobject
*/
public abstract void updateHashValue(Vobject vobject);
-}
\ No newline at end of file
+}
-/**
- * uk.ac.vamsas.client.Iapp
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
+
public interface Iapp {
- /**
- * Define core callback functionality that a fully
- * fledged vamsas application Vobject must implement
- * TODO: define some Application Callbacks and create use cases for them
- */
+ /**
+ * Define core callback functionality that a fully fledged vamsas application
+ * Vobject must implement TODO: define some Application Callbacks and create
+ * use cases for them
+ */
};
-/**\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
* \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package uk.ac.vamsas.client;\r
\r
/**\r
* @author JimP\r
- *\r
+ * \r
*/\r
-public class InvalidSessionDocumentException extends Exception\r
-{\r
+public class InvalidSessionDocumentException extends Exception {\r
/**\r
* basic error for this exception\r
*/\r
public static final String INVALID_DOC = "Invalid Shared Document.";\r
+\r
/**\r
* \r
*/\r
- public InvalidSessionDocumentException() {\r
- super(INVALID_DOC);\r
+ public InvalidSessionDocumentException() {\r
+ super(INVALID_DOC);\r
}\r
\r
- /**\r
- * @param message\r
- */\r
- public InvalidSessionDocumentException(String message) {\r
- super(INVALID_DOC+":"+message);\r
- }\r
+ /**\r
+ * @param message\r
+ */\r
+ public InvalidSessionDocumentException(String message) {\r
+ super(INVALID_DOC + ":" + message);\r
+ }\r
\r
- /**\r
- * @param cause\r
- */\r
- public InvalidSessionDocumentException(Throwable cause) {\r
- super(INVALID_DOC, cause);\r
- }\r
+ /**\r
+ * @param cause\r
+ */\r
+ public InvalidSessionDocumentException(Throwable cause) {\r
+ super(INVALID_DOC, cause);\r
+ }\r
\r
- /**\r
- * @param message\r
- * @param cause\r
- */\r
- public InvalidSessionDocumentException(String message, Throwable cause) {\r
- super(INVALID_DOC+":"+message, cause);\r
- }\r
+ /**\r
+ * @param message\r
+ * @param cause\r
+ */\r
+ public InvalidSessionDocumentException(String message, Throwable cause) {\r
+ super(INVALID_DOC + ":" + message, cause);\r
+ }\r
\r
}\r
-package uk.ac.vamsas.client;
-
-public class InvalidSessionUrnException extends Exception {
-
- /**
- *
- */
- public InvalidSessionUrnException() {
- super("Invalid Vamsas Session URN.");
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param message
- * @param cause
- */
- public InvalidSessionUrnException(String message, Throwable cause) {
- super(message, cause);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param message
- */
- public InvalidSessionUrnException(String message) {
- super("Invalid Vamsas Session URN: "+message);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param cause
- */
- public InvalidSessionUrnException(Throwable cause) {
- super(cause);
- // TODO Auto-generated constructor stub
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+public class InvalidSessionUrnException extends Exception {\r
+\r
+ /**\r
+ * \r
+ */\r
+ public InvalidSessionUrnException() {\r
+ super("Invalid Vamsas Session URN.");\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+ /**\r
+ * @param message\r
+ * @param cause\r
+ */\r
+ public InvalidSessionUrnException(String message, Throwable cause) {\r
+ super(message, cause);\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+ /**\r
+ * @param message\r
+ */\r
+ public InvalidSessionUrnException(String message) {\r
+ super("Invalid Vamsas Session URN: " + message);\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+ /**\r
+ * @param cause\r
+ */\r
+ public InvalidSessionUrnException(Throwable cause) {\r
+ super(cause);\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+}\r
-/**
- *
- */
-package uk.ac.vamsas.client;
-
-/**
- * @author jimp
- * Raised if an IClient instance is requested without
- * specifying a particular vamsas session handle
- * when more than one candidate session exists.
- */
-public class NoDefaultSessionException extends Exception {
-
- /**
- *
- */
- public NoDefaultSessionException() {
- super("No Default Session Defined");
- }
-
- /**
- * @param message
- */
- public NoDefaultSessionException(String message) {
- super(message);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param cause
- */
- public NoDefaultSessionException(Throwable cause) {
- super(cause);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param message
- * @param cause
- */
- public NoDefaultSessionException(String message, Throwable cause) {
- super(message, cause);
- // TODO Auto-generated constructor stub
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+/**\r
+ * @author jimp Raised if an IClient instance is requested without specifying a\r
+ * particular vamsas session handle when more than one candidate session\r
+ * exists.\r
+ */\r
+public class NoDefaultSessionException extends Exception {\r
+\r
+ /**\r
+ * \r
+ */\r
+ public NoDefaultSessionException() {\r
+ super("No Default Session Defined");\r
+ }\r
+\r
+ /**\r
+ * @param message\r
+ */\r
+ public NoDefaultSessionException(String message) {\r
+ super(message);\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+ /**\r
+ * @param cause\r
+ */\r
+ public NoDefaultSessionException(Throwable cause) {\r
+ super(cause);\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+ /**\r
+ * @param message\r
+ * @param cause\r
+ */\r
+ public NoDefaultSessionException(String message, Throwable cause) {\r
+ super(message, cause);\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+}\r
/*
- * Created on 12-Sep-2005
- *
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
/**
* Uniquely locates a particular VAMSAS session.
+ *
* @author jimp
- *
+ *
*/
public class SessionHandle implements Serializable {
-
+
/**
* @param sessionUrn
*/
super();
this.sessionUrn = _sessionUrn;
}
+
/**
* @return Returns the sessionUrn.
*/
public String getSessionUrn() {
return this.sessionUrn;
}
+
/**
- * @param sessionUrn The sessionUrn to set.
+ * @param sessionUrn
+ * The sessionUrn to set.
*/
public void setSessionUrn(String _sessionUrn) {
- this.sessionUrn = _sessionUrn;
+ this.sessionUrn = _sessionUrn;
}
+
/**
* The path to the vamsas session file.
*/
String sessionUrn = null;
-
+
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (obj instanceof SessionHandle)
- return this.equals((SessionHandle) obj);
+ return this.equals((SessionHandle) obj);
return false;
}
-
public boolean equals(SessionHandle that) {
return (this.sessionUrn.equals(that.getSessionUrn()));
}
-
-
+
}
-/**
- *
- */
-package uk.ac.vamsas.client;
-
-import java.net.URI;
-import java.util.Hashtable;
-
-/**
- * @author jimp
- * base class for vamsas session/document types
- * uses java.net.URI internally for construction of URN
- */
-public abstract class SessionUrn {
- protected URI urn;
- /**
- * The types of URI protocols we understand
- */
- protected static final Hashtable TYPES=new Hashtable();
-
-
- protected SessionUrn()
- {
- //
- }
- /**
- * construct urn for a locally stored session file
- * @param type
- * @param url
- */
- protected SessionUrn(String type, java.net.URL url) {
- if (!TYPES.containsKey(type.toLowerCase()))
- throw new Error("Unknown "+this.getClass().getName()+" type '"+type+"' for URL '"+url+"'");
- try {
-
- this.setURN(type+"://"+url.getPath());
- // urn = URI.create(type+"://"+url.getPath());
- } catch (Exception e) {
- // TODO: something better than throwing an error should be done here.
- e.printStackTrace(System.err);
- throw new Error(e);
- }
- }
-
- protected SessionUrn(String type, URI uri) {
- if (!TYPES.containsKey(type.toLowerCase()))
- throw new Error("Unknown "+this.getClass().getName()+" type '"+type+"' for URI '"+uri+"'");
- try {
- // this.setURN(type+"://"+uri.getPath());
- //bad hack but should do the trick
- this.setURN(type+"://"+uri.getRawPath());
- } catch (Exception e) {
- // TODO: something better than throwing an error should be done here.
- e.printStackTrace(System.err);
- throw new Error(e);
- }
- }
-
- public String getSessionUrn() {
- return this.urn.toString();
- }
-
- /**
- * Set the urn attribute
- * create a URI from the provided String
- *
- * @param urnString urn to convert to a URN
- */
- protected void setURN(String urnString) throws InvalidSessionUrnException// NullPointerException, IllegalArgumentException
- {
- try {
- this.urn = URI.create(urnString);
- } catch (Exception e) {
- throw new InvalidSessionUrnException(e);
- }
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+import java.net.URI;\r
+import java.util.Hashtable;\r
+\r
+/**\r
+ * @author jimp base class for vamsas session/document types uses java.net.URI\r
+ * internally for construction of URN\r
+ */\r
+public abstract class SessionUrn {\r
+ protected URI urn;\r
+\r
+ /**\r
+ * The types of URI protocols we understand\r
+ */\r
+ protected static final Hashtable TYPES = new Hashtable();\r
+\r
+ protected SessionUrn() {\r
+ //\r
+ }\r
+\r
+ /**\r
+ * construct urn for a locally stored session file\r
+ * \r
+ * @param type\r
+ * @param url\r
+ */\r
+ protected SessionUrn(String type, java.net.URL url) {\r
+ if (!TYPES.containsKey(type.toLowerCase()))\r
+ throw new Error("Unknown " + this.getClass().getName() + " type '" + type\r
+ + "' for URL '" + url + "'");\r
+ try {\r
+\r
+ this.setURN(type + "://" + url.getPath());\r
+ // urn = URI.create(type+"://"+url.getPath());\r
+ } catch (Exception e) {\r
+ // TODO: something better than throwing an error should be done here.\r
+ e.printStackTrace(System.err);\r
+ throw new Error(e);\r
+ }\r
+ }\r
+\r
+ protected SessionUrn(String type, URI uri) {\r
+ if (!TYPES.containsKey(type.toLowerCase()))\r
+ throw new Error("Unknown " + this.getClass().getName() + " type '" + type\r
+ + "' for URI '" + uri + "'");\r
+ try {\r
+ // this.setURN(type+"://"+uri.getPath());\r
+ // bad hack but should do the trick\r
+ this.setURN(type + "://" + uri.getRawPath());\r
+ } catch (Exception e) {\r
+ // TODO: something better than throwing an error should be done here.\r
+ e.printStackTrace(System.err);\r
+ throw new Error(e);\r
+ }\r
+ }\r
+\r
+ public String getSessionUrn() {\r
+ return this.urn.toString();\r
+ }\r
+\r
+ /**\r
+ * Set the urn attribute create a URI from the provided String\r
+ * \r
+ * @param urnString\r
+ * urn to convert to a URN\r
+ */\r
+ protected void setURN(String urnString) throws InvalidSessionUrnException// NullPointerException,\r
+ // IllegalArgumentException\r
+ {\r
+ try {\r
+ this.urn = URI.create(urnString);\r
+ } catch (Exception e) {\r
+ throw new InvalidSessionUrnException(e);\r
+ }\r
+ }\r
+\r
+}\r
/*
- * Created on 12-Sep-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
/**
- * Unique user identifier for a vamsas session.
- * Used to write user provenance information, and
- * track view/access control in multiuser sessions.
+ * Unique user identifier for a vamsas session. Used to write user provenance
+ * information, and track view/access control in multiuser sessions.
+ *
* @author jimp
*/
public class UserHandle {
this.fullName = fullName;
Organization = organization;
}
+
String fullName;
+
String Organization;
+
/**
* @return Returns the fullName.
*/
public String getFullName() {
return fullName;
}
+
/**
- * @param fullName The fullName to set.
+ * @param fullName
+ * The fullName to set.
*/
public void setFullName(String fullname) {
fullName = fullname;
}
+
/**
* @return Returns the organization.
*/
public String getOrganization() {
return Organization;
}
+
/**
- * @param organization The organization to set.
+ * @param organization
+ * The organization to set.
*/
public void setOrganization(String organization) {
Organization = organization;
-/**
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
*
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
*/
public abstract class Vobject {
static Log log = LogFactory.getLog(Vobject.class);
-
+
/**
- * true if Vobject was stored in a vamsas Document or has been retrieved from it
+ * true if Vobject was stored in a vamsas Document or has been retrieved from
+ * it
*/
protected boolean __stored_in_document = false;
+
/**
- * true if Vobject was updated since the vamsas library last read a Vobj with the same VorbaId from a document.
+ * true if Vobject was updated since the vamsas library last read a Vobj with
+ * the same VorbaId from a document.
*/
protected boolean __updated_since_last_read = false;
+
/**
- * true if Vobject appeared in the document after the last access by this vamsas library instance
+ * true if Vobject appeared in the document after the last access by this
+ * vamsas library instance
*/
protected boolean __added_since_last_read = false;
+
/**
- * memory of the last doHash() value computed for the Vobject
+ * memory of the last doHash() value computed for the Vobject
+ *
* @see doHash()
*/
- protected int __last_hash = 0;
+ protected int __last_hash = 0;
+
/**
* set by testInstanceForIdField() if Vobject should have a VorbaId
*/
- protected boolean registerable = false;
+ protected boolean registerable = false;
+
protected boolean __visited = false;
+
/**
* reference to containing object for this Vobject.
*/
- protected Vobject V_parent=null;
+ protected Vobject V_parent = null;
+
/**
* unique id for all vamsas objects allows unambiguous referencing to any
* Vobject in the vamsas document
* the source of unique VorbaIds.
*/
protected IVorbaIdFactory __vorba = null;
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#finalize()
*/
protected void finalize() throws Throwable {
- V_parent=null;
- __vorba=null;
- vorbaId=null;
+ V_parent = null;
+ __vorba = null;
+ vorbaId = null;
super.finalize();
}
super();
testInstanceForIdField();
}
+
/**
- * Override Object.hashCode with base value for castor generated object hashcodes.
+ * Override Object.hashCode with base value for castor generated object
+ * hashcodes.
*/
public int hashCode() {
return 17;
}
- java.lang.reflect.Field ___id_field=null; // set to ease pain of reflection
+
+ java.lang.reflect.Field ___id_field = null; // set to ease pain of reflection
+
/**
- * set the isRegisterable flag based on the presence of a 'private String _id' field in
- * the reflected class instance.
+ * set the isRegisterable flag based on the presence of a 'private String _id'
+ * field in the reflected class instance.
*/
private void testInstanceForIdField() {
- // TODO: decide if 'id' is an appropriate reserved attribute name for the VorbaId
+ // TODO: decide if 'id' is an appropriate reserved attribute name for the
+ // VorbaId
// look for the id field in all castor classes (should be an NCName string)
-
- Class thisclass=this.getClass();
+
+ Class thisclass = this.getClass();
setRegisterable(false);
while (!thisclass.equals(Vobject.class)) {
try {
java.lang.reflect.Field fd = thisclass.getDeclaredField("_id");
if (String.class.isAssignableFrom(fd.getType())) {
- ___id_field=fd;
+ ___id_field = fd;
this.setRegisterable(true);
break;
}
} catch (SecurityException e) {
- log.error("Unexpected Security Exception whilst finding id fields to set!",e);
+ log
+ .error(
+ "Unexpected Security Exception whilst finding id fields to set!",
+ e);
} catch (NoSuchFieldException e) {
- thisclass=thisclass.getSuperclass();
+ thisclass = thisclass.getSuperclass();
}
}
}
+
// boolean __testedInstance=false;
/**
* update the Vobject instance's _id field, based on the contents of the
* VorbaId. Only call this if you mean to do it!
*/
protected void setInstanceIdField() {
- /*if (!registerable && !__testedInstance) {
- testInstanceForIdField();
- __testedInstance=true;
- }*/
+ /*
+ * if (!registerable && !__testedInstance) { testInstanceForIdField();
+ * __testedInstance=true; }
+ */
if (registerable) {
if (__vorba != null)
try {
- Method fd = this.getClass().getMethod("setId", new Class[] { String.class });
- fd.invoke((Object) this, new Object[] {new String(this.getVorbaId().id)});
- log.debug(this.getClass().getName()+" called setInstanceIdField!");
- } catch (InvocationTargetException e) {
- log.error("SourceGeneration of "
- + this.getClass().toString()
- + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.", e);
- }
- catch (IllegalAccessException e) {
- log.error("SourceGeneration of "
- + this.getClass().toString()
- + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.", e);
+ Method fd = this.getClass().getMethod("setId",
+ new Class[] { String.class });
+ fd.invoke((Object) this, new Object[] { new String(
+ this.getVorbaId().id) });
+ log.debug(this.getClass().getName() + " called setInstanceIdField!");
+ } catch (InvocationTargetException e) {
+ log
+ .error(
+ "SourceGeneration of "
+ + this.getClass().toString()
+ + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.",
+ e);
+ } catch (IllegalAccessException e) {
+ log
+ .error(
+ "SourceGeneration of "
+ + this.getClass().toString()
+ + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.",
+ e);
} catch (SecurityException e) {
- log.error("Security access violation for "+this.getClass().toString(),e);
+ log.error("Security access violation for "
+ + this.getClass().toString(), e);
} catch (NoSuchMethodException e) {
- log.warn(this.getClass().toString()+" was erroneously marked as a Vorba Vobject class (Implementation error?)");
+ log
+ .warn(this.getClass().toString()
+ + " was erroneously marked as a Vorba Vobject class (Implementation error?)");
this.setRegisterable(false);
}
} else {
+ this.getClass().toString() + " (which cannot be given a vorbaId)");
}
}
-
+
protected String __getInstanceIdField() {
- /*if (!registerable && !__testedInstance) {
- testInstanceForIdField();
- __testedInstance=true;
- }*/
+ /*
+ * if (!registerable && !__testedInstance) { testInstanceForIdField();
+ * __testedInstance=true; }
+ */
if (registerable) {
if (__vorba != null)
try {
Method fd = this.getClass().getMethod("getId", (Class[]) null);
Object idstring = fd.invoke((Object) this, (Object[]) null);
- log.debug(this.getClass().getName()+" called getInstanceIdField!");
- if (idstring!=null && idstring instanceof String) {
- if (((String) idstring).length()>0)
+ log.debug(this.getClass().getName() + " called getInstanceIdField!");
+ if (idstring != null && idstring instanceof String) {
+ if (((String) idstring).length() > 0)
return (String) idstring;
}
- } catch (InvocationTargetException e) {
- log.error("SourceGeneration of "
- + this.getClass().toString()
- + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.", e);
- }
- catch (IllegalAccessException e) {
- log.error("SourceGeneration of "
- + this.getClass().toString()
- + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.", e);
+ } catch (InvocationTargetException e) {
+ log
+ .error(
+ "SourceGeneration of "
+ + this.getClass().toString()
+ + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.",
+ e);
+ } catch (IllegalAccessException e) {
+ log
+ .error(
+ "SourceGeneration of "
+ + this.getClass().toString()
+ + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.",
+ e);
} catch (SecurityException e) {
- log.error("Security access violation for "+this.getClass().toString(),e);
+ log.error("Security access violation for "
+ + this.getClass().toString(), e);
} catch (NoSuchMethodException e) {
- log.warn(this.getClass().toString()+" was erroneously marked as a Vorba Vobject class (Implementation error?)");
+ log
+ .warn(this.getClass().toString()
+ + " was erroneously marked as a Vorba Vobject class (Implementation error?)");
this.setRegisterable(false);
}
} else {
}
return null;
}
+
/**
* calls the castor-generated hashCode() method
+ *
* @return
*/
protected int __callHash() {
Method fd = this.getClass().getMethod("hashCode", (Class[]) null);
Object hashvalue = fd.invoke((Object) this, (Object[]) null);
if (log.isDebugEnabled())
- log.debug(this.getClass().getName()+" called hashCode()!");
- if (hashvalue!=null && hashvalue instanceof Integer) {
+ log.debug(this.getClass().getName() + " called hashCode()!");
+ if (hashvalue != null && hashvalue instanceof Integer) {
return ((Integer) hashvalue).intValue();
}
- } catch (InvocationTargetException e) {
- log.error("SourceGeneration of "
- + this.getClass().toString()
- + "\n has resulted in an inaccessible 'hashCode' method!\nHave you set org.exolab.castor.builder.equalsmethod=true in castorbuilder.properties ?.", e);
- }
- catch (IllegalAccessException e) {
- log.error("SourceGeneration of "
- + this.getClass().toString()
- + "\n has resulted in an inaccessible 'hashCode' method!\nHave you set org.exolab.castor.builder.equalsmethod=true in castorbuilder.properties ?.", e);
+ } catch (InvocationTargetException e) {
+ log
+ .error(
+ "SourceGeneration of "
+ + this.getClass().toString()
+ + "\n has resulted in an inaccessible 'hashCode' method!\nHave you set org.exolab.castor.builder.equalsmethod=true in castorbuilder.properties ?.",
+ e);
+ } catch (IllegalAccessException e) {
+ log
+ .error(
+ "SourceGeneration of "
+ + this.getClass().toString()
+ + "\n has resulted in an inaccessible 'hashCode' method!\nHave you set org.exolab.castor.builder.equalsmethod=true in castorbuilder.properties ?.",
+ e);
} catch (SecurityException e) {
- log.error("Security access violation for "+this.getClass().toString(),e);
+ log.error("Security access violation for " + this.getClass().toString(),
+ e);
} catch (NoSuchMethodException e) {
- log.warn(this.getClass().toString()+" was erroneously extending from a Vorba Vobject class (Implementation error? no hashCode() method)" +
- "\nHave you set org.exolab.castor.builder.equalsmethod=true in castorbuilder.properties ?.", e);
+ log
+ .warn(
+ this.getClass().toString()
+ + " was erroneously extending from a Vorba Vobject class (Implementation error? no hashCode() method)"
+ + "\nHave you set org.exolab.castor.builder.equalsmethod=true in castorbuilder.properties ?.",
+ e);
}
return 0;
}
+
/**
* calculate a hash for the Vobject with all housekeeping fields at standard
- * values. (isRegisterable is an immutable attribute property)
- * TODO: LATER: make this hash function compute a hash that truly reflects changes in Vobject attributes for benefit of update mechanism
- * @return true if new hash different to last hash (or first time its been computed)
+ * values. (isRegisterable is an immutable attribute property) TODO: LATER:
+ * make this hash function compute a hash that truly reflects changes in
+ * Vobject attributes for benefit of update mechanism
+ *
+ * @return true if new hash different to last hash (or first time its been
+ * computed)
*/
synchronized protected boolean doHash() {
boolean stored = __stored_in_document;
- __stored_in_document=false;
+ __stored_in_document = false;
boolean updated = __updated_since_last_read;
- __updated_since_last_read=false;
- boolean added_since=__added_since_last_read;
- __added_since_last_read=false;
+ __updated_since_last_read = false;
+ boolean added_since = __added_since_last_read;
+ __added_since_last_read = false;
long __old_hash = __last_hash;
__last_hash = 0;
// leave registerable - doesn't change
boolean visited = __visited;
- __visited=false;
- Vobject _V_parent=V_parent;
- V_parent=null;
+ __visited = false;
+ Vobject _V_parent = V_parent;
+ V_parent = null;
VorbaId thisid = vorbaId;
vorbaId = null;
IVorbaIdFactory factory = __vorba;
__vorba = null;
java.lang.reflect.Field idfield = ___id_field;
- ___id_field=null;
+ ___id_field = null;
long l_hash = __l_hash;
__l_hash = 0;
// compute hash
__last_hash = __callHash();
// reset houseskeeping variables
- ___id_field=idfield;
+ ___id_field = idfield;
vorbaId = thisid;
__vorba = factory;
__stored_in_document = stored;
- __updated_since_last_read=updated;
- V_parent=_V_parent;
- __visited=visited;
- __added_since_last_read=added_since;
+ __updated_since_last_read = updated;
+ V_parent = _V_parent;
+ __visited = visited;
+ __added_since_last_read = added_since;
__l_hash = l_hash;
// return true if first time hash was computed or if hash has changed
- return (__old_hash==0) || (__old_hash != __last_hash);
+ return (__old_hash == 0) || (__old_hash != __last_hash);
}
/**
* @return
*/
protected boolean merge(Vobject laterCopy) {
- log.warn(this.getClass().getName()+".merge() not implemented.");
+ log.warn(this.getClass().getName() + ".merge() not implemented.");
return true;
}
public VorbaId getVorbaId() {
if (registerable && vorbaId == null) {
if (this.__stored_in_document) {
- if (__vorba!=null)
- vorbaId=uk.ac.vamsas.client.VorbaId.newId(this.__getInstanceIdField());
+ if (__vorba != null)
+ vorbaId = uk.ac.vamsas.client.VorbaId.newId(this
+ .__getInstanceIdField());
}
// Try to use the associated factory.
if (__vorba != null)
}
/**
- * @return true if this object has been updated in the currently stored document since the last time a Vobject with the same ID was read from a Vamsas Document
+ * @return true if this object has been updated in the currently stored
+ * document since the last time a Vobject with the same ID was read
+ * from a Vamsas Document
*/
public boolean isUpdated() {
return __updated_since_last_read;
}
+
/**
*
- * @return true if this object was added to the document after the last time the vamsas library acessed the session document
+ * @return true if this object was added to the document after the last time
+ * the vamsas library acessed the session document
*/
public boolean isNewInDocument() {
return __added_since_last_read;
}
+
/**
- * Set internal flag to indicate this object was updated since the last document read
- * @param __updated_since_last_read the __updated_since_last_read to set
+ * Set internal flag to indicate this object was updated since the last
+ * document read
+ *
+ * @param __updated_since_last_read
+ * the __updated_since_last_read to set
*/
protected void set__updated_since_last_read(boolean __updated_since_last_read) {
this.__updated_since_last_read = __updated_since_last_read;
- if(__updated_since_last_read && log.isDebugEnabled())
- log.debug("Registered update for "+this.getVorbaId());
+ if (__updated_since_last_read && log.isDebugEnabled())
+ log.debug("Registered update for " + this.getVorbaId());
}
/**
* for use by Vorba agent to reflect state of vamsas Vobject to client
- * application.
- * Setting stored_in_document on a registerable Vobject without a
- * vorbaId will mean is will *never* get a vorbaId and
- * horrible things will happen.
- * @param __stored_in_document true if Vobject has been marshalled into current document.
+ * application. Setting stored_in_document on a registerable Vobject without a
+ * vorbaId will mean is will *never* get a vorbaId and horrible things will
+ * happen.
+ *
+ * @param __stored_in_document
+ * true if Vobject has been marshalled into current document.
*/
protected void set__stored_in_document(boolean __stored_in_document) {
this.__stored_in_document = __stored_in_document;
- if(__stored_in_document && log.isDebugEnabled())
- log.debug("Retrieved document object: "+this.getVorbaId());
+ if (__stored_in_document && log.isDebugEnabled())
+ log.debug("Retrieved document object: " + this.getVorbaId());
}
/**
- * @param __added_since_last_read the __added_since_last_read to set
+ * @param __added_since_last_read
+ * the __added_since_last_read to set
*/
protected void set__added_since_last_read(boolean __added_since_last_read) {
this.__added_since_last_read = __added_since_last_read;
- if(__added_since_last_read && log.isDebugEnabled())
- log.debug("New object in document: "+this.getVorbaId());
+ if (__added_since_last_read && log.isDebugEnabled())
+ log.debug("New object in document: " + this.getVorbaId());
}
/**
}
/**
- * Called by __testInstanceForidField and the post-unmarshalling handler
- * to indicate if Vobject will have a vorbaId.
- * @param registerable
+ * Called by __testInstanceForidField and the post-unmarshalling handler to
+ * indicate if Vobject will have a vorbaId.
+ *
+ * @param registerable
*/
protected void setRegisterable(boolean registerable) {
this.registerable = registerable;
}
+
/**
- * ensure's internal id field corresponds to vorbaId and
- * cascade through all fields referring to an instance of Vobject
- * calling the same method on them.
- * TODO: LATER: properly apply castors own field mechanisms to get at accessors
- * TODO: FIX CYCLIC __ensure+instance_ids
- * Implementation note for the todo:
- * this works like a depth-first search over all vamsas objects in an vamsasDocument.
- * __visited is the visited flag, any Vobj who's flag is of a different parity
- * to the visited argument will be recursed on.
- * note - the doHash() function used to be used as the 'visited' flag -
- * this *is not* a valid heuristic, although it will work "most of the time".
- * TODO: LATER? Add another method for setDefaultProvenanceField (in the spirit of setInstanceIdField) using the info from the __vorba.getClient/User/Session methods
+ * ensure's internal id field corresponds to vorbaId and cascade through all
+ * fields referring to an instance of Vobject calling the same method on them.
+ * TODO: LATER: properly apply castors own field mechanisms to get at
+ * accessors TODO: FIX CYCLIC __ensure+instance_ids Implementation note for
+ * the todo: this works like a depth-first search over all vamsas objects in
+ * an vamsasDocument. __visited is the visited flag, any Vobj who's flag is of
+ * a different parity to the visited argument will be recursed on. note - the
+ * doHash() function used to be used as the 'visited' flag - this *is not* a
+ * valid heuristic, although it will work "most of the time". TODO: LATER? Add
+ * another method for setDefaultProvenanceField (in the spirit of
+ * setInstanceIdField) using the info from the __vorba.getClient/User/Session
+ * methods
*/
protected void __ensure_instance_ids() {
__ensure_instance_ids(!__visited);
}
+
protected void __ensure_instance_ids(boolean visited) {
- if (__vorba==null)
- throw new Error("Improperly intialised uk.ac.vamsas.client.Vobject - no VorbaFactory given.");
- log.debug("doing "+this.getClass()+".__ensure_instance_ids()");
+ if (__vorba == null)
+ throw new Error(
+ "Improperly intialised uk.ac.vamsas.client.Vobject - no VorbaFactory given.");
+ log.debug("doing " + this.getClass() + ".__ensure_instance_ids()");
if (!__stored_in_document && registerable)
setInstanceIdField();
- if (__visited==visited)
+ if (__visited == visited)
return;
- __visited=visited;
- //__vorba.updateHashValue(this);
-
+ __visited = visited;
+ // __vorba.updateHashValue(this);
+
Class descriptor = null;
XMLClassDescriptorImpl descimpl = null;
try {
StringBuffer desname = new StringBuffer(this.getClass().getName());
desname.insert(desname.lastIndexOf("."), ".descriptors");
desname.append("Descriptor");
- descriptor = this.getClass().getClassLoader().loadClass(desname.toString());
- descimpl = (XMLClassDescriptorImpl) descriptor.getConstructor((Class[])null).newInstance((Object[])null);
+ descriptor = this.getClass().getClassLoader().loadClass(
+ desname.toString());
+ descimpl = (XMLClassDescriptorImpl) descriptor.getConstructor(
+ (Class[]) null).newInstance((Object[]) null);
} catch (Exception e) {
log.fatal("Source Generation Error!: Couldn't resolve descriptor for "
- +this.getClass().getName()
- +" was 'generate descriptors' set for castorbuilder.properties?");
+ + this.getClass().getName()
+ + " was 'generate descriptors' set for castorbuilder.properties?");
return;
}
FieldDescriptor fields[] = descimpl.getFields();
- for (int i=0,j=fields.length; i<j; i++) {
- Class type= fields[i].getFieldType();
+ for (int i = 0, j = fields.length; i < j; i++) {
+ Class type = fields[i].getFieldType();
if (type.isArray()) {
if (Vobject[].class.isAssignableFrom(type)) {
try {
Object val = fields[i].getHandler().getValue(this);
- if (val!=null) {
- Vobject vals[] = (Vobject[]) val;
- for (int k=0, l=vals.length; k<l; k++) {
- if (vals[k].__vorba==null)
+ if (val != null) {
+ Vobject vals[] = (Vobject[]) val;
+ for (int k = 0, l = vals.length; k < l; k++) {
+ if (vals[k].__vorba == null)
vals[k].__vorba = __vorba; // propagate IVorbaIdFactory
- if (vals[k].V_parent==null)
- vals[k].V_parent=this; // propagate parent reference to this element.
+ if (vals[k].V_parent == null)
+ vals[k].V_parent = this; // propagate parent reference to this
+ // element.
vals[k].__ensure_instance_ids(visited);
}
}
- }
- catch (Exception e) {
- log.error("Client error - could not access array "+type.getName()+" in "+this.getClass().getName(), e);
+ } catch (Exception e) {
+ log.error("Client error - could not access array " + type.getName()
+ + " in " + this.getClass().getName(), e);
}
}
- } else
- if (Vobject.class.isAssignableFrom(type)) {
- try {
- FieldHandler fh = fields[i].getHandler();
- Vobject rf = null;
- if (fh != null) {
- Object fval = fh.getValue(this);
- if (fval!=null) {
- if (fval.getClass().isArray()) {
- //if (Vobject[].class.isAssignableFrom(type)) {
- try {
- Vobject vals[] = (Vobject[]) fval;
- for (int k=0, l=vals.length; k<l; k++) {
- if (vals[k].__vorba==null)
- vals[k].__vorba = __vorba; // propagate IVorbaIdFactory
- if (vals[k].V_parent==null)
- vals[k].V_parent=this; // propagate parent reference to this field object
- vals[k].__ensure_instance_ids(visited);
- }
- }
- catch (Exception e) {
- log.error("Client error - could not access (fhval)array "+type.getName()+" in "+this.getClass().getName(), e);
- }
- //}
- } else {
- rf = (Vobject) fval;
- log.debug("Got value for "+fields[i].getFieldName());
- }
- }
- } else {
- // castor's mechanism doesn't work for this object... so...*/
- // fuck around, fuck around, jump up jump up and get down! */
- Object o = fields[i].getClassDescriptor();
- if (o!=null) {
- // XMLClassDescriptorImpl fclasdes = (XMLClassDescriptorImpl) o;
- String methname = "get"+fields[i].getFieldName();
- Method fgetmeth = this.getClass().getMethod(methname,(Class[])null);
- if (fgetmeth!=null) {
- Object fval = fgetmeth.invoke(this,(Object[])null);
- if (fval!=null)
- rf = (Vobject) fval;
- } else {
- log.warn("Couldn't find "+this.getClass().getName()+"."+methname);
+ } else if (Vobject.class.isAssignableFrom(type)) {
+ try {
+ FieldHandler fh = fields[i].getHandler();
+ Vobject rf = null;
+ if (fh != null) {
+ Object fval = fh.getValue(this);
+ if (fval != null) {
+ if (fval.getClass().isArray()) {
+ // if (Vobject[].class.isAssignableFrom(type)) {
+ try {
+ Vobject vals[] = (Vobject[]) fval;
+ for (int k = 0, l = vals.length; k < l; k++) {
+ if (vals[k].__vorba == null)
+ vals[k].__vorba = __vorba; // propagate IVorbaIdFactory
+ if (vals[k].V_parent == null)
+ vals[k].V_parent = this; // propagate parent reference to
+ // this field object
+ vals[k].__ensure_instance_ids(visited);
+ }
+ } catch (Exception e) {
+ log.error("Client error - could not access (fhval)array "
+ + type.getName() + " in " + this.getClass().getName(), e);
}
+ // }
+ } else {
+ rf = (Vobject) fval;
+ log.debug("Got value for " + fields[i].getFieldName());
}
}
- if (rf!=null) {
- if (rf.__vorba==null)
- rf.__vorba = __vorba; // propagate IVorbaIdFactory
- if (rf.V_parent==null)
- rf.V_parent=this; // propagate parent reference
- rf.__ensure_instance_ids(visited);
+ } else {
+ // castor's mechanism doesn't work for this object... so...*/
+ // fuck around, fuck around, jump up jump up and get down! */
+ Object o = fields[i].getClassDescriptor();
+ if (o != null) {
+ // XMLClassDescriptorImpl fclasdes = (XMLClassDescriptorImpl) o;
+ String methname = "get" + fields[i].getFieldName();
+ Method fgetmeth = this.getClass().getMethod(methname,
+ (Class[]) null);
+ if (fgetmeth != null) {
+ Object fval = fgetmeth.invoke(this, (Object[]) null);
+ if (fval != null)
+ rf = (Vobject) fval;
+ } else {
+ log.warn("Couldn't find " + this.getClass().getName() + "."
+ + methname);
+ }
}
}
- catch (Exception e) {
- log.error("Client error - could not access "+type.getName()+" in "+this.getClass().getName(), e);
+ if (rf != null) {
+ if (rf.__vorba == null)
+ rf.__vorba = __vorba; // propagate IVorbaIdFactory
+ if (rf.V_parent == null)
+ rf.V_parent = this; // propagate parent reference
+ rf.__ensure_instance_ids(visited);
}
+ } catch (Exception e) {
+ log.error("Client error - could not access " + type.getName()
+ + " in " + this.getClass().getName(), e);
}
+ }
}
-
+
}
/**
}
/**
- * @param __parent the __parent to set
+ * @param __parent
+ * the __parent to set
*/
protected void setV_parent(Vobject V_parent) {
this.V_parent = V_parent;
}
+
/**
* LhashValue - used for change detection between document updates.
*/
- private long __l_hash=0;
+ private long __l_hash = 0;
+
/**
* set the base LhashValue for this object
+ *
* @param checksum
*/
protected void __setInitHash(long checksum) {
__l_hash = checksum;
}
+
/**
- * compute the final LhashValue as a difference between checksum and the current base
+ * compute the final LhashValue as a difference between checksum and the
+ * current base
+ *
* @param checksum
*/
protected void __setFinalHash(long checksum) {
__l_hash = checksum - __l_hash;
}
+
/**
* get the LhashValue for this object
- * @return the difference in values passed to __setFinalHash less __setInitHash
+ *
+ * @return the difference in values passed to __setFinalHash less
+ * __setInitHash
*/
protected long __getLHash() {
return __l_hash;
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client;\r
\r
/**\r
- * Holds information about Vobj instances that is held over between different writes to the document.\r
- * Currently records the LhashValue obtained from Vobject\r
+ * Holds information about Vobj instances that is held over between different\r
+ * writes to the document. Currently records the LhashValue obtained from\r
+ * Vobject\r
+ * \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class Vobjhash {\r
- private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Vobjhash.class); \r
- long hashvalue;\r
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getLog(Vobjhash.class);\r
+\r
+ long hashvalue;\r
+\r
/**\r
* creates a record of the hash value for a vamsas document object\r
+ * \r
* @param tobemarshalled\r
*/\r
public Vobjhash(Vobject tobemarshalled) {\r
tobemarshalled.doHash();\r
hashvalue = tobemarshalled.get__last_hash();\r
if (log.isDebugEnabled())\r
- log.debug(tobemarshalled.getVorbaId()+":"+hashvalue);\r
+ log.debug(tobemarshalled.getVorbaId() + ":" + hashvalue);\r
}\r
+\r
/**\r
- * compares the old hash value with the unmarshalled object's most recently computed hash value and updates internal record.\r
+ * compares the old hash value with the unmarshalled object's most recently\r
+ * computed hash value and updates internal record.\r
+ * \r
* @param unmarshalled\r
* @return true if the hash values differ\r
*/\r
public boolean isUpdated(Vobject unmarshalled) {\r
long oldhash = hashvalue;\r
unmarshalled.doHash();\r
- hashvalue=unmarshalled.get__last_hash();\r
- if (log.isDebugEnabled() && oldhash!=hashvalue)\r
- log.debug(" has changed."+unmarshalled.getVorbaId());\r
- return oldhash!=hashvalue;\r
+ hashvalue = unmarshalled.get__last_hash();\r
+ if (log.isDebugEnabled() && oldhash != hashvalue)\r
+ log.debug(" has changed." + unmarshalled.getVorbaId());\r
+ return oldhash != hashvalue;\r
}\r
}\r
/*
- * Created on 12-Sep-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
import java.io.Serializable;
/**
- * The unique reference id for a Vamsas document Vobject,
- * used by applications to refer to the vamsas Vobject
- * within their own data space in the vamsas document.
- * This is serializable (thanks to Dominik Lindner) so an
- * application can store it easily.
+ * The unique reference id for a Vamsas document Vobject, used by applications
+ * to refer to the vamsas Vobject within their own data space in the vamsas
+ * document. This is serializable (thanks to Dominik Lindner) so an application
+ * can store it easily.
+ *
* @author jimp
*/
public class VorbaId implements Serializable {
* 1 is first vamsas release ID version.
*/
private static final long serialVersionUID = 1L;
+
protected String id;
+
protected VorbaId() {
super();
}
+
private VorbaId(String Id) {
super();
id = Id;
}
+
/**
*
- * @param vorbaObject the source of vorba Ids
- * @param vobject the Vobject to be registered with a new vorba id
+ * @param vorbaObject
+ * the source of vorba Ids
+ * @param vobject
+ * the Vobject to be registered with a new vorba id
* @return
*/
protected static VorbaId newId(IVorbaIdFactory vorbaObject, Vobject vobject) {
// Make unique id from appSpace info in vorbaObject
synchronized (vorbaObject) {
- vobject.vorbaId=vorbaObject.makeVorbaId(vobject);
+ vobject.vorbaId = vorbaObject.makeVorbaId(vobject);
return vobject.vorbaId;
}
}
+
/**
- * protected VorbaId constructor used when turning XML ID strings into vorba IDs
+ * protected VorbaId constructor used when turning XML ID strings into vorba
+ * IDs
+ *
* @param id
* @return VorbaId object or null if string was null.
*/
protected static VorbaId newId(String id) {
- return (id==null) ? null : new VorbaId(id);
+ return (id == null) ? null : new VorbaId(id);
}
+
/**
* @return Returns the id.
*/
public String getId() {
return id;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (obj instanceof String)
return id.equals(obj);
else if (obj instanceof VorbaId)
- return id.equals(((VorbaId)obj).id);
+ return id.equals(((VorbaId) obj).id);
return false;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return id.hashCode();
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
public String toString() {
return id;
}
-
+
}
/*
- * Created on 12-Sep-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client;
import java.util.Vector;
/**
- * A VorbaIdFactory is constructed by an IClient instance.
- * It guarantees that any new VorbaId objects are unique
- * within the VAMSAS session.
+ * A VorbaIdFactory is constructed by an IClient instance. It guarantees that
+ * any new VorbaId objects are unique within the VAMSAS session.
*
* @author jimp
*/
/**
* hash of VorbaIds to Vobject.
*/
- protected Hashtable extantids=null;
+ protected Hashtable extantids = null;
+
/**
* hash of VorbaIds to persisted hash values
*/
- protected Hashtable extanthashv=null;
+ protected Hashtable extanthashv = null;
+
/**
* list of Vobjects added since last Document read.
*/
- protected Vector newobj=null;
-
+ protected Vector newobj = null;
+
/**
* construct a new id appropriate for this client in the vamsas session.
*
* correctly.
*/
public abstract VorbaId makeVorbaId(Vobject vobject);
-
+
/**
- * internal method to access the protected VorbaId object constructor
- * This shennanigan is to prevent casual generation of VorbaIds
- * (which may destroy the integrity of a Vamsas Document!)
+ * internal method to access the protected VorbaId object constructor This
+ * shennanigan is to prevent casual generation of VorbaIds (which may destroy
+ * the integrity of a Vamsas Document!)
+ *
* @param id
* @return new VorbaId object
*/
protected VorbaId newId(String id) {
return VorbaId.newId(id);
}
+
/**
- * Called by VorbaXmlBinder so the record of newly unmarshalled Vobject Ids
- * is accessible to the Document's VorbaIdFactory instance.
+ * Called by VorbaXmlBinder so the record of newly unmarshalled Vobject Ids is
+ * accessible to the Document's VorbaIdFactory instance.
+ *
* @param idtable
*/
protected void setNewIdHash(Hashtable idtable) {
extantids = idtable;
}
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IVorbaIdFactory#updateHashValue(uk.ac.vamsas.client.Vobject)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * uk.ac.vamsas.client.IVorbaIdFactory#updateHashValue(uk.ac.vamsas.client
+ * .Vobject)
*/
public void updateHashValue(Vobject vobject) {
if (vobject.isRegisterable())
-/**
- *
- */
-package uk.ac.vamsas.client;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.lang.reflect.Field;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.exolab.castor.mapping.FieldHandler;
-import org.exolab.castor.mapping.GeneralizedFieldHandler;
-import org.exolab.castor.mapping.ValidityException;
-import org.exolab.castor.xml.IDResolver;
-import org.exolab.castor.xml.MarshalException;
-import org.exolab.castor.xml.MarshalListener;
-import org.exolab.castor.xml.Marshaller;
-import org.exolab.castor.xml.UnmarshalListener;
-import org.exolab.castor.xml.Unmarshaller;
-import org.exolab.castor.xml.ValidationException;
-
-import uk.ac.vamsas.objects.core.VamsasDocument;
-/**
- * Implements the Vamsas Vobject ID machinery for translating
- * between non-volatile XML IDs and Vobject references. Use the
- * marshalling and unmarshalling methods in this class in order
- * to add automatically computed values for required fields in objects,
- * so as to avoid validation exceptions when marshalling new objects
- * into the vamsas document.
- */
-public class VorbaXmlBinder implements UnmarshalListener {
- private static Log log = LogFactory.getLog(VorbaXmlBinder.class);
- private final IVorbaIdFactory vorbafactory;
-
- private final Vector obj;
- private final Hashtable oldobjhashes;
- private final Hashtable objrefs;
- private final Vector updatedobjs; // not yet used elswhere ?
- public VorbaXmlBinder(IVorbaIdFactory vorbafactory2, Vector unrefedObj, Hashtable objrefs2, Hashtable oldobjhashes, Vector updatedObj) {
- this.vorbafactory = vorbafactory2;
- this.obj = unrefedObj;
- this.objrefs = objrefs2;
- this.oldobjhashes = oldobjhashes;
- this.updatedobjs = updatedObj;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.exolab.castor.xml.UnmarshalListener#attributesProcessed(java.lang.Object)
- */
- public void attributesProcessed(Object object) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.exolab.castor.xml.UnmarshalListener#fieldAdded(java.lang.String,
- * java.lang.Object, java.lang.Object)
- */
- public void fieldAdded(String fieldName, Object parent, Object child) {
- if (parent instanceof Vobject && child instanceof Vobject) {
- if (((Vobject) child).V_parent==null) {
- // System.err.println("Setting parent of "+fieldName);
- ((Vobject) child).setV_parent((Vobject) parent);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.exolab.castor.xml.UnmarshalListener#initialized(java.lang.Object)
- */
- public void initialized(Object object) {
- if (object instanceof Vobject) {
- Vobject nobj = (Vobject) object;
- }
- }
-
- /*
- * Check if the object has an 'id' field - if it does, copy the value into
- * the VorbaId field of Vobject, and add the Vobject to the VorbaId hash.
- *
- * @see org.exolab.castor.xml.UnmarshalListener#unmarshalled(java.lang.Object)
- */
- public void unmarshalled(Object newobj) {
- if (newobj instanceof Vobject) {
- Vobject nobj = (Vobject) newobj;
- nobj.set__stored_in_document(true);
- try {
- if (nobj.isRegisterable() && nobj.___id_field!=null) {
- VorbaId nobj_id=null;
- // look for the id field (should be an NCName string)
- nobj.__vorba = vorbafactory;
- // use the Vobject accessor method to avoid unpleasant security exceptions.
- String idstring = nobj.__getInstanceIdField();
- if (idstring!=null) {
- if (idstring.length() > 0) {
- nobj.setVorbaId(VorbaId.newId(idstring));
- nobj_id=nobj.getVorbaId();
- if (objrefs.containsKey(nobj_id) && !objrefs.get(nobj_id).equals(nobj)) {
- System.err.println("Serious problem : duplicate id '"+idstring+"' found! expect badness.");
- // TODO: HANDLE duplicate XML ids correctly
- }
- objrefs.put(nobj_id, nobj);
- } else {
- // add to list of objects without a valid vorbaId
- obj.add(nobj);
- }
- } else {
- // TODO: add to list of objects without a valid vorbaId
- obj.add(nobj);
- }
- nobj.doHash(); // updates detected by comparing with last hash when marshalling
- // check to see if new object was present in old object hash
- if (nobj_id!=null) {
- if (oldobjhashes.containsKey(nobj_id)) {
- Vobjhash oldhash = (Vobjhash) oldobjhashes.get(nobj_id);
- if (oldhash.isUpdated(nobj)) {
- // mark the object as updated in this document read.
- nobj.set__updated_since_last_read(true);
- updatedobjs.addElement(nobj);
- }
- } else {
- // object has no entry in the oldhashvalue list but
- // there is a valid vorbaId so
- nobj.set__added_since_last_read(true);
- }
- // and record the just-unmarshalled hash value
- oldobjhashes.put(nobj_id, new Vobjhash(nobj));
- } else {
- // for objects yet to get a valid vorba_id
- nobj.set__added_since_last_read(true);
- }
- }
-
- } catch (Exception e) {
- return;
- };
-
- }
- }
-
- /**
- * writes the VamsasDocument to the given stream.
- * TODO: ensure that (at least) default provenance entries are written for objects.
- * @param outstream
- * @param vorba valid VorbaIdFactory to construct any missing IDs
- * @param doc
- * @throws IOException
- * @throws MarshalException
- * @throws ValidationException
- */
- public static void putVamsasDocument(PrintWriter outstream, VorbaIdFactory vorba, VamsasDocument doc)
- throws IOException, MarshalException, ValidationException {
- // Ensure references
- if (vorba==null)
- throw new Error("Null VorbaIdFactory Parameter");
- if (doc.__vorba==null)
- doc.__vorba = vorba;
- doc.__ensure_instance_ids(); // this may take a while. Do we allow for cyclic references ?
- Marshaller mshl = new Marshaller(outstream);
- mshl.marshal(doc);
-
- }
- /**
- * creates new VorbaId references where necessary for newly unmarshalled objects
- * @param unrefed
- * @param objrefs
- * @return false if any new object references were made
- */
- private static boolean ensure_references(Vector unrefed, Hashtable objrefs) {
- boolean sync=true;
- if (unrefed.size()>0) {
- sync=false; // document is out of sync - ids have been created.
- java.util.Iterator newobj = unrefed.listIterator();
- while (newobj.hasNext()) {
- Vobject o = (Vobject) newobj.next();
- // forces registration and id field update.
- VorbaId id = o.getVorbaId();
- if (!objrefs.containsKey(id)) {
- objrefs.put(id, o);
- } else {
- if (!objrefs.get(id).equals(o))
- throw new Error("Serious! Duplicate reference made by vorbaIdFactory!");
- }
- }
- }
- return sync;
- }
- /**
- * Unmarshals a vamsasDocument Vobject from a stream, registers
- * unregistered objects, records existing VorbaIds, and completes
- * the uk.ac.vamsas.client.Vobject housekeeping fields.
- * For a valid unmarshalling, the array of returned objects also includes
- * a <return>sync</return> parameter which is true if new VorbaIds
- * were created. If sync is false, then the caller should ensure that the
- * vamsasDocument is written back to disk to propagate the new VorbaIds.
- * TODO: ensure that provenance is correct for newly registered objects
- * as getVamsasObjects but will detect updated objects based on differing hash values
- * obtained from the VorbaIdFactory's VorbaId, Vobject.get__last_Hash() pairs (if any)
- * @param instream - the XML input stream
- * @param factory - the SimpleClient's properly configured VorbaId factory to make new references.
- * @param root the root element's uk.ac.vamsas.objects.core Vobject.
- * @return null or {(Object) VamsasDocument Vobject, (Object) Hashtable of Vobject references, (Object) Boolean(sync), (Object) Vector of updated objects in document }
- */
- public static Object[] getVamsasObjects(Reader instream,
- VorbaIdFactory factory, Vobject root) {
- Unmarshaller unmarshaller = new Unmarshaller(root);
- unmarshaller.setIDResolver(new IDResolver() {
- public Object resolve(String id) {
- // TODO: allow for external ID resolution
- VorbaXmlBinder.log.warn("Warning - id " + id
- + " is not found in the Vamsas XML! (TODO: Ignore if this is a forward reference!)");
- return null;
- }
- });
- final Hashtable objrefs = new Hashtable();
- if (factory.extanthashv==null)
- factory.extanthashv=new Hashtable();
- final Hashtable oobjhashes=factory.extanthashv;
- final VorbaIdFactory vorbafactory = factory;
- final Vector unrefedObj = new Vector();
- final Vector updatedObj = new Vector();
- unmarshaller.setUnmarshalListener(new VorbaXmlBinder(vorbafactory, unrefedObj, objrefs, oobjhashes,updatedObj));
- // Call the unmarshaller.
- try {
- while (instream.ready()) {
- // TODO: mark objects in oobjhash prior to unmarshalling, to detect when objects have been lost through an update.
- //tohere
- Object obj = unmarshaller.unmarshal(instream);
- boolean sync=ensure_references(unrefedObj, objrefs);
- if (!(obj instanceof Vobject))
- return null;
- vorbafactory.setNewIdHash(objrefs); // update the Document IO Handler's set of vorbaId<>Object bindings.
- return new Object[] { obj, objrefs, new Boolean(sync),updatedObj};
- }
- } catch (MarshalException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ValidationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
- }
-}
\ No newline at end of file
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+import java.io.IOException;\r
+import java.io.PrintWriter;\r
+import java.io.Reader;\r
+import java.io.Writer;\r
+import java.lang.reflect.Field;\r
+import java.util.Hashtable;\r
+import java.util.Iterator;\r
+import java.util.Vector;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.exolab.castor.mapping.FieldHandler;\r
+import org.exolab.castor.mapping.GeneralizedFieldHandler;\r
+import org.exolab.castor.mapping.ValidityException;\r
+import org.exolab.castor.xml.IDResolver;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.MarshalListener;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.UnmarshalListener;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+\r
+/**\r
+ * Implements the Vamsas Vobject ID machinery for translating between\r
+ * non-volatile XML IDs and Vobject references. Use the marshalling and\r
+ * unmarshalling methods in this class in order to add automatically computed\r
+ * values for required fields in objects, so as to avoid validation exceptions\r
+ * when marshalling new objects into the vamsas document.\r
+ */\r
+public class VorbaXmlBinder implements UnmarshalListener {\r
+ private static Log log = LogFactory.getLog(VorbaXmlBinder.class);\r
+\r
+ private final IVorbaIdFactory vorbafactory;\r
+\r
+ private final Vector obj;\r
+\r
+ private final Hashtable oldobjhashes;\r
+\r
+ private final Hashtable objrefs;\r
+\r
+ private final Vector updatedobjs; // not yet used elswhere ?\r
+\r
+ public VorbaXmlBinder(IVorbaIdFactory vorbafactory2, Vector unrefedObj,\r
+ Hashtable objrefs2, Hashtable oldobjhashes, Vector updatedObj) {\r
+ this.vorbafactory = vorbafactory2;\r
+ this.obj = unrefedObj;\r
+ this.objrefs = objrefs2;\r
+ this.oldobjhashes = oldobjhashes;\r
+ this.updatedobjs = updatedObj;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * org.exolab.castor.xml.UnmarshalListener#attributesProcessed(java.lang.Object\r
+ * )\r
+ */\r
+ public void attributesProcessed(Object object) {\r
+\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see org.exolab.castor.xml.UnmarshalListener#fieldAdded(java.lang.String,\r
+ * java.lang.Object, java.lang.Object)\r
+ */\r
+ public void fieldAdded(String fieldName, Object parent, Object child) {\r
+ if (parent instanceof Vobject && child instanceof Vobject) {\r
+ if (((Vobject) child).V_parent == null) {\r
+ // System.err.println("Setting parent of "+fieldName);\r
+ ((Vobject) child).setV_parent((Vobject) parent);\r
+ }\r
+ }\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see org.exolab.castor.xml.UnmarshalListener#initialized(java.lang.Object)\r
+ */\r
+ public void initialized(Object object) {\r
+ if (object instanceof Vobject) {\r
+ Vobject nobj = (Vobject) object;\r
+ }\r
+ }\r
+\r
+ /*\r
+ * Check if the object has an 'id' field - if it does, copy the value into the\r
+ * VorbaId field of Vobject, and add the Vobject to the VorbaId hash.\r
+ * \r
+ * @see org.exolab.castor.xml.UnmarshalListener#unmarshalled(java.lang.Object)\r
+ */\r
+ public void unmarshalled(Object newobj) {\r
+ if (newobj instanceof Vobject) {\r
+ Vobject nobj = (Vobject) newobj;\r
+ nobj.set__stored_in_document(true);\r
+ try {\r
+ if (nobj.isRegisterable() && nobj.___id_field != null) {\r
+ VorbaId nobj_id = null;\r
+ // look for the id field (should be an NCName string)\r
+ nobj.__vorba = vorbafactory;\r
+ // use the Vobject accessor method to avoid unpleasant security\r
+ // exceptions.\r
+ String idstring = nobj.__getInstanceIdField();\r
+ if (idstring != null) {\r
+ if (idstring.length() > 0) {\r
+ nobj.setVorbaId(VorbaId.newId(idstring));\r
+ nobj_id = nobj.getVorbaId();\r
+ if (objrefs.containsKey(nobj_id)\r
+ && !objrefs.get(nobj_id).equals(nobj)) {\r
+ System.err.println("Serious problem : duplicate id '"\r
+ + idstring + "' found! expect badness.");\r
+ // TODO: HANDLE duplicate XML ids correctly\r
+ }\r
+ objrefs.put(nobj_id, nobj);\r
+ } else {\r
+ // add to list of objects without a valid vorbaId\r
+ obj.add(nobj);\r
+ }\r
+ } else {\r
+ // TODO: add to list of objects without a valid vorbaId\r
+ obj.add(nobj);\r
+ }\r
+ nobj.doHash(); // updates detected by comparing with last hash when\r
+ // marshalling\r
+ // check to see if new object was present in old object hash\r
+ if (nobj_id != null) {\r
+ if (oldobjhashes.containsKey(nobj_id)) {\r
+ Vobjhash oldhash = (Vobjhash) oldobjhashes.get(nobj_id);\r
+ if (oldhash.isUpdated(nobj)) {\r
+ // mark the object as updated in this document read.\r
+ nobj.set__updated_since_last_read(true);\r
+ updatedobjs.addElement(nobj);\r
+ }\r
+ } else {\r
+ // object has no entry in the oldhashvalue list but\r
+ // there is a valid vorbaId so\r
+ nobj.set__added_since_last_read(true);\r
+ }\r
+ // and record the just-unmarshalled hash value\r
+ oldobjhashes.put(nobj_id, new Vobjhash(nobj));\r
+ } else {\r
+ // for objects yet to get a valid vorba_id\r
+ nobj.set__added_since_last_read(true);\r
+ }\r
+ }\r
+\r
+ } catch (Exception e) {\r
+ return;\r
+ }\r
+ ;\r
+\r
+ }\r
+ }\r
+\r
+ /**\r
+ * writes the VamsasDocument to the given stream. TODO: ensure that (at least)\r
+ * default provenance entries are written for objects.\r
+ * \r
+ * @param outstream\r
+ * @param vorba\r
+ * valid VorbaIdFactory to construct any missing IDs\r
+ * @param doc\r
+ * @throws IOException\r
+ * @throws MarshalException\r
+ * @throws ValidationException\r
+ */\r
+ public static void putVamsasDocument(PrintWriter outstream,\r
+ VorbaIdFactory vorba, VamsasDocument doc) throws IOException,\r
+ MarshalException, ValidationException {\r
+ // Ensure references\r
+ if (vorba == null)\r
+ throw new Error("Null VorbaIdFactory Parameter");\r
+ if (doc.__vorba == null)\r
+ doc.__vorba = vorba;\r
+ doc.__ensure_instance_ids(); // this may take a while. Do we allow for\r
+ // cyclic references ?\r
+ Marshaller mshl = new Marshaller(outstream);\r
+ mshl.marshal(doc);\r
+\r
+ }\r
+\r
+ /**\r
+ * creates new VorbaId references where necessary for newly unmarshalled\r
+ * objects\r
+ * \r
+ * @param unrefed\r
+ * @param objrefs\r
+ * @return false if any new object references were made\r
+ */\r
+ private static boolean ensure_references(Vector unrefed, Hashtable objrefs) {\r
+ boolean sync = true;\r
+ if (unrefed.size() > 0) {\r
+ sync = false; // document is out of sync - ids have been created.\r
+ java.util.Iterator newobj = unrefed.listIterator();\r
+ while (newobj.hasNext()) {\r
+ Vobject o = (Vobject) newobj.next();\r
+ // forces registration and id field update.\r
+ VorbaId id = o.getVorbaId();\r
+ if (!objrefs.containsKey(id)) {\r
+ objrefs.put(id, o);\r
+ } else {\r
+ if (!objrefs.get(id).equals(o))\r
+ throw new Error(\r
+ "Serious! Duplicate reference made by vorbaIdFactory!");\r
+ }\r
+ }\r
+ }\r
+ return sync;\r
+ }\r
+\r
+ /**\r
+ * Unmarshals a vamsasDocument Vobject from a stream, registers unregistered\r
+ * objects, records existing VorbaIds, and completes the\r
+ * uk.ac.vamsas.client.Vobject housekeeping fields. For a valid unmarshalling,\r
+ * the array of returned objects also includes a <return>sync</return>\r
+ * parameter which is true if new VorbaIds were created. If sync is false,\r
+ * then the caller should ensure that the vamsasDocument is written back to\r
+ * disk to propagate the new VorbaIds. TODO: ensure that provenance is correct\r
+ * for newly registered objects as getVamsasObjects but will detect updated\r
+ * objects based on differing hash values obtained from the VorbaIdFactory's\r
+ * VorbaId, Vobject.get__last_Hash() pairs (if any)\r
+ * \r
+ * @param instream\r
+ * - the XML input stream\r
+ * @param factory\r
+ * - the SimpleClient's properly configured VorbaId factory to make\r
+ * new references.\r
+ * @param root\r
+ * the root element's uk.ac.vamsas.objects.core Vobject.\r
+ * @return null or {(Object) VamsasDocument Vobject, (Object) Hashtable of\r
+ * Vobject references, (Object) Boolean(sync), (Object) Vector of\r
+ * updated objects in document }\r
+ */\r
+ public static Object[] getVamsasObjects(Reader instream,\r
+ VorbaIdFactory factory, Vobject root) {\r
+ Unmarshaller unmarshaller = new Unmarshaller(root);\r
+ unmarshaller.setIDResolver(new IDResolver() {\r
+ public Object resolve(String id) {\r
+ // TODO: allow for external ID resolution\r
+ VorbaXmlBinder.log\r
+ .warn("Warning - id "\r
+ + id\r
+ + " is not found in the Vamsas XML! (TODO: Ignore if this is a forward reference!)");\r
+ return null;\r
+ }\r
+ });\r
+ final Hashtable objrefs = new Hashtable();\r
+ if (factory.extanthashv == null)\r
+ factory.extanthashv = new Hashtable();\r
+ final Hashtable oobjhashes = factory.extanthashv;\r
+ final VorbaIdFactory vorbafactory = factory;\r
+ final Vector unrefedObj = new Vector();\r
+ final Vector updatedObj = new Vector();\r
+ unmarshaller.setUnmarshalListener(new VorbaXmlBinder(vorbafactory,\r
+ unrefedObj, objrefs, oobjhashes, updatedObj));\r
+ // Call the unmarshaller.\r
+ try {\r
+ while (instream.ready()) {\r
+ // TODO: mark objects in oobjhash prior to unmarshalling, to detect when\r
+ // objects have been lost through an update.\r
+ // tohere\r
+ Object obj = unmarshaller.unmarshal(instream);\r
+ boolean sync = ensure_references(unrefedObj, objrefs);\r
+ if (!(obj instanceof Vobject))\r
+ return null;\r
+ vorbafactory.setNewIdHash(objrefs); // update the Document IO Handler's\r
+ // set of vorbaId<>Object bindings.\r
+ return new Object[] { obj, objrefs, new Boolean(sync), updatedObj };\r
+ }\r
+ } catch (MarshalException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (ValidationException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (IOException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ return null;\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
/**\r
* Defines a custom message that applications can use to send message types that\r
* haven't been predefined in the API.\r
*/\r
-public class CustomMessage extends Message\r
-{ \r
- /**\r
- * Constructs a new custom message.\r
- * @param message the message to be sent\r
- */\r
- public CustomMessage(String message)\r
- {\r
- this.message = "CUSTOM\t" + message;\r
- }\r
-}
\ No newline at end of file
+public class CustomMessage extends Message {\r
+ /**\r
+ * Constructs a new custom message.\r
+ * \r
+ * @param message\r
+ * the message to be sent\r
+ */\r
+ public CustomMessage(String message) {\r
+ this.message = "CUSTOM\t" + message;\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
/**\r
* interface must be implemented by the client application (TOPALi, Jalview or\r
* AstexViewer).\r
*/\r
-public interface IMessageHandler\r
-{\r
- /**\r
- * Responds to a message received event. It is advisable to implement this\r
- * method so that it threads off any actions into the GUI event-dispatching\r
- * thread.\r
- * @param message the message that was received\r
- */\r
- public void handleMessage(Message message);\r
-}
\ No newline at end of file
+public interface IMessageHandler {\r
+ /**\r
+ * Responds to a message received event. It is advisable to implement this\r
+ * method so that it threads off any actions into the GUI event-dispatching\r
+ * thread.\r
+ * \r
+ * @param message\r
+ * the message that was received\r
+ */\r
+ public void handleMessage(Message message);\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
/**\r
* Interface that defines the methods required for a pick manager.\r
*/\r
-public interface IPickManager\r
-{\r
- /**\r
- * Sends a message.\r
- * @param message the message to send\r
- */\r
- public void sendMessage(Message message);\r
- \r
- /**\r
- * Registers a message handler with the manager that allows the manager to\r
- * perform a method callback on that object whenever a message is received.\r
- * @param handler the message handler to register\r
- */\r
- public void registerMessageHandler(IMessageHandler handler);\r
- \r
- /**\r
- * Shutsdown the pick manager processes, terminating any connections to\r
- * other clients.\r
- */\r
- public void shutdown();\r
-}
\ No newline at end of file
+public interface IPickManager {\r
+ /**\r
+ * Sends a message.\r
+ * \r
+ * @param message\r
+ * the message to send\r
+ */\r
+ public void sendMessage(Message message);\r
+\r
+ /**\r
+ * Registers a message handler with the manager that allows the manager to\r
+ * perform a method callback on that object whenever a message is received.\r
+ * \r
+ * @param handler\r
+ * the message handler to register\r
+ */\r
+ public void registerMessageHandler(IMessageHandler handler);\r
+\r
+ /**\r
+ * Shutsdown the pick manager processes, terminating any connections to other\r
+ * clients.\r
+ */\r
+ public void shutdown();\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
/**\r
* Abstract base class for all message types supported by the picking API.\r
*/\r
-public abstract class Message\r
-{\r
- protected String message;\r
- \r
- /**\r
- * Constructs a new message.\r
- */\r
- protected Message()\r
- {\r
+public abstract class Message {\r
+ protected String message;\r
+\r
+ /**\r
+ * Constructs a new message.\r
+ */\r
+ protected Message() {\r
+\r
+ }\r
+\r
+ /**\r
+ * Returns the raw message content as a string.\r
+ * \r
+ * @return the raw message content as a string\r
+ */\r
+ public String getRawMessage() {\r
+ return message;\r
+ }\r
+\r
+ /**\r
+ * compare the on-wire message content of the given message to this.\r
+ * \r
+ * @param msg\r
+ * @return true if message content is equal\r
+ */\r
+ public boolean equals(Message msg) {\r
+ return message.equals(msg.getRawMessage());\r
+ }\r
\r
- }\r
- \r
- /**\r
- * Returns the raw message content as a string.\r
- * @return the raw message content as a string\r
- */\r
- public String getRawMessage()\r
- { return message; }\r
- /**\r
- * compare the on-wire message content of the given message to this.\r
- * @param msg\r
- * @return true if message content is equal\r
- */\r
- public boolean equals(Message msg)\r
- {\r
- return message.equals(msg.getRawMessage());\r
- }\r
- /**\r
- * Test consistence of a Message class implementation. This method throws an error if\r
- * the message object cannot be parsed into another instance of the same object by\r
- * invoking the MessageImpl(String this.getRawMessage()) constructor or that\r
- * newinstance.getRawMessage != this.getRawMessage \r
- */\r
+ /**\r
+ * Test consistence of a Message class implementation. This method throws an\r
+ * error if the message object cannot be parsed into another instance of the\r
+ * same object by invoking the MessageImpl(String this.getRawMessage())\r
+ * constructor or that newinstance.getRawMessage != this.getRawMessage\r
+ */\r
public void validate() {\r
try {\r
- java.lang.reflect.Constructor msgcons = this.getClass().getConstructor(new Class[] { String.class });\r
- if (msgcons==null)\r
- {\r
- throw new Exception("No "+this.getClass().getName()+"(String rawmessage) constructor.");\r
+ java.lang.reflect.Constructor msgcons = this.getClass().getConstructor(\r
+ new Class[] { String.class });\r
+ if (msgcons == null) {\r
+ throw new Exception("No " + this.getClass().getName()\r
+ + "(String rawmessage) constructor.");\r
}\r
- Message instance = (Message) msgcons.newInstance(new Object[] { this.getRawMessage() });\r
- if (!instance.getRawMessage().equals(getRawMessage()))\r
- {\r
- throw new Error("Raw Message Content does not match :\nInitial Message:"+getRawMessage()+"\nParsed and regnerated as :\n"+instance.getRawMessage()+"\n");\r
+ Message instance = (Message) msgcons.newInstance(new Object[] { this\r
+ .getRawMessage() });\r
+ if (!instance.getRawMessage().equals(getRawMessage())) {\r
+ throw new Error(\r
+ "Raw Message Content does not match :\nInitial Message:"\r
+ + getRawMessage() + "\nParsed and regnerated as :\n"\r
+ + instance.getRawMessage() + "\n");\r
}\r
- } catch (Exception e)\r
- {\r
- throw new Error("Message implementation broken for "+this.getClass(),e);\r
+ } catch (Exception e) {\r
+ throw new Error("Message implementation broken for " + this.getClass(), e);\r
}\r
}\r
\r
-}
\ No newline at end of file
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
/**\r
* Message class that can be used to send mouse over events.\r
*/\r
-public class MouseOverMessage extends Message\r
-{\r
- private String vorbaID;\r
- private int position;\r
- \r
- /**\r
- * Constructs a new mouse over message.\r
- * @param vorbaID the VAMSAS object ID of the event's source (usually an\r
- * alignment or alignment sequence)\r
- * @param position a position on the source in its coordinate system (ie a\r
- * column or nucleotide/residue position)\r
- */\r
- public MouseOverMessage(String vorbaID, int position)\r
- {\r
- this.vorbaID = vorbaID;\r
- this.position = position;\r
- \r
- message = "MOUSEOVER\t"\r
- + "vorbaID=" + vorbaID + "\t" + "position=" + position;\r
- }\r
- \r
- /**\r
- * Constructs a new mouse over message from its underlying string format.\r
- * @param str the string representation of an instance of this object\r
- * @throws java.lang.Exception if the message cannot be reconstructed\r
- */\r
- MouseOverMessage(String str)\r
- throws Exception\r
- {\r
- message = str;\r
- \r
- String[] elements = str.split("\t");\r
- \r
- for (int i = 0; i < elements.length; i++)\r
- {\r
- if (elements[i].startsWith("vorbaID="))\r
- vorbaID = elements[i].substring(8);\r
- else if (elements[i].startsWith("position="))\r
- position = Integer.parseInt(elements[i].substring(9));\r
- }\r
- }\r
- \r
- /**\r
- * Returns the VAMSAS object ID associated with this message.\r
- * @return the VAMSAS object ID associated with this message\r
- */\r
- public String getVorbaID()\r
- { return vorbaID; }\r
- \r
- /**\r
- * Returns the position value associated with this message.\r
- * @return the position value associated with this message\r
- */\r
- public int getPosition()\r
- { return position; }\r
-}
\ No newline at end of file
+public class MouseOverMessage extends Message {\r
+ private String vorbaID;\r
+\r
+ private int position;\r
+\r
+ /**\r
+ * Constructs a new mouse over message.\r
+ * \r
+ * @param vorbaID\r
+ * the VAMSAS object ID of the event's source (usually an alignment\r
+ * or alignment sequence)\r
+ * @param position\r
+ * a position on the source in its coordinate system (ie a column or\r
+ * nucleotide/residue position)\r
+ */\r
+ public MouseOverMessage(String vorbaID, int position) {\r
+ this.vorbaID = vorbaID;\r
+ this.position = position;\r
+\r
+ message = "MOUSEOVER\t" + "vorbaID=" + vorbaID + "\t" + "position="\r
+ + position;\r
+ }\r
+\r
+ /**\r
+ * Constructs a new mouse over message from its underlying string format.\r
+ * \r
+ * @param str\r
+ * the string representation of an instance of this object\r
+ * @throws java.lang.Exception\r
+ * if the message cannot be reconstructed\r
+ */\r
+ MouseOverMessage(String str) throws Exception {\r
+ message = str;\r
+\r
+ String[] elements = str.split("\t");\r
+\r
+ for (int i = 0; i < elements.length; i++) {\r
+ if (elements[i].startsWith("vorbaID="))\r
+ vorbaID = elements[i].substring(8);\r
+ else if (elements[i].startsWith("position="))\r
+ position = Integer.parseInt(elements[i].substring(9));\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Returns the VAMSAS object ID associated with this message.\r
+ * \r
+ * @return the VAMSAS object ID associated with this message\r
+ */\r
+ public String getVorbaID() {\r
+ return vorbaID;\r
+ }\r
+\r
+ /**\r
+ * Returns the position value associated with this message.\r
+ * \r
+ * @return the position value associated with this message\r
+ */\r
+ public int getPosition() {\r
+ return position;\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
import java.io.*;\r
\r
import org.apache.commons.logging.Log;\r
\r
-class PickEndPoint extends Thread\r
-{\r
- private Log logger = org.apache.commons.logging.LogFactory.getLog(uk.ac.vamsas.client.picking.PickEndPoint.class);\r
- \r
- private Socket socket;\r
- private int rPort;\r
- private BufferedWriter os;\r
- private BufferedReader in;\r
- /**\r
+class PickEndPoint extends Thread {\r
+ private Log logger = org.apache.commons.logging.LogFactory\r
+ .getLog(uk.ac.vamsas.client.picking.PickEndPoint.class);\r
+\r
+ private Socket socket;\r
+\r
+ private int rPort;\r
+\r
+ private BufferedWriter os;\r
+\r
+ private BufferedReader in;\r
+\r
+ /**\r
* reference to server or null if no comms session active\r
*/\r
- private SocketManager manager; \r
- \r
- PickEndPoint(SocketManager manager, Socket s)\r
- {\r
- this.manager = manager;\r
- socket = s;\r
- }\r
- \r
- boolean openConnection()\r
- {\r
- try\r
- {\r
- // Create the socket if it doesn't already exist\r
- if (socket == null)\r
- socket = new Socket(InetAddress.getLocalHost(), PickServer.PORT);\r
- \r
- rPort = socket.getPort();\r
- socket.setKeepAlive(true);\r
- \r
- // Open the streams for reading/writing\r
- os = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));\r
- in = new BufferedReader(new InputStreamReader(socket.getInputStream()));\r
- \r
- // Start the thread to listen for incoming messages\r
- logger.debug("CLIENT: connection successful to port "\r
- + socket.getPort() + " via port " + socket.getLocalPort());\r
- start();\r
- \r
- return true;\r
- }\r
- catch (Exception e)\r
- {\r
- logger.info("CLIENT: connection failed: " + e);\r
- return false;\r
- }\r
- }\r
- \r
- void send(Message message)\r
- {\r
- try\r
- {\r
- String str = message.getRawMessage();\r
- \r
- // System.err.println("CLIENT: send " + str + " to " + rPort);\r
- os.write(str);\r
- \r
- // We use a newline to terminate the message\r
- os.newLine();\r
- os.flush();\r
- }\r
- catch (Exception e)\r
- {\r
- //logger.info("CLIENT: failed to send");\r
- \r
- // TODO: terminate the connection on a failed send or retry? (Has this been done? JBP)\r
- terminate();\r
- }\r
- }\r
- \r
- // void receive() (threaded)\r
- public void run()\r
- {\r
- try\r
- {\r
- while (manager!=null)\r
- {\r
- String str = in.readLine(); \r
- //logger.info("CLIENT: recv " + str + " from " + rPort);\r
- \r
- // TODO: Spawn this off into the GUI Event-Dispatch thread...\r
- \r
- // Convert the string back into something API friendly\r
- Message message = strToMessage(str);\r
- \r
- // Ignore corrupted or unknown message types\r
- if (message != null) \r
- manager.processMessage(this, message);\r
- }\r
- }\r
- catch (Exception e)\r
- {\r
- // Means the other end of the connection has (probably died) so we need\r
- // terminate this endpoint (if this is server side)\r
- //logger.info("CLIENT: read failed: " + e);\r
- \r
- terminate(); // this may not be necessary - probably caused infinite loop on terminate() without null checks\r
- }\r
- }\r
- \r
- void terminate()\r
- {\r
- SocketManager mgr=manager;\r
- manager=null; // stops receive thread\r
- if (socket!=null) {\r
- try { socket.close(); }\r
- catch (IOException e) {}\r
- socket=null;\r
+ private SocketManager manager;\r
+\r
+ PickEndPoint(SocketManager manager, Socket s) {\r
+ this.manager = manager;\r
+ socket = s;\r
+ }\r
+\r
+ boolean openConnection() {\r
+ try {\r
+ // Create the socket if it doesn't already exist\r
+ if (socket == null)\r
+ socket = new Socket(InetAddress.getLocalHost(), PickServer.PORT);\r
+\r
+ rPort = socket.getPort();\r
+ socket.setKeepAlive(true);\r
+\r
+ // Open the streams for reading/writing\r
+ os = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));\r
+ in = new BufferedReader(new InputStreamReader(socket.getInputStream()));\r
+\r
+ // Start the thread to listen for incoming messages\r
+ logger.debug("CLIENT: connection successful to port " + socket.getPort()\r
+ + " via port " + socket.getLocalPort());\r
+ start();\r
+\r
+ return true;\r
+ } catch (Exception e) {\r
+ logger.info("CLIENT: connection failed: " + e);\r
+ return false;\r
+ }\r
+ }\r
+\r
+ void send(Message message) {\r
+ try {\r
+ String str = message.getRawMessage();\r
+\r
+ // System.err.println("CLIENT: send " + str + " to " + rPort);\r
+ os.write(str);\r
+\r
+ // We use a newline to terminate the message\r
+ os.newLine();\r
+ os.flush();\r
+ } catch (Exception e) {\r
+ // logger.info("CLIENT: failed to send");\r
+\r
+ // TODO: terminate the connection on a failed send or retry? (Has this\r
+ // been done? JBP)\r
+ terminate();\r
+ }\r
+ }\r
+\r
+ // void receive() (threaded)\r
+ public void run() {\r
+ try {\r
+ while (manager != null) {\r
+ String str = in.readLine();\r
+ // logger.info("CLIENT: recv " + str + " from " + rPort);\r
+\r
+ // TODO: Spawn this off into the GUI Event-Dispatch thread...\r
+\r
+ // Convert the string back into something API friendly\r
+ Message message = strToMessage(str);\r
+\r
+ // Ignore corrupted or unknown message types\r
+ if (message != null)\r
+ manager.processMessage(this, message);\r
+ }\r
+ } catch (Exception e) {\r
+ // Means the other end of the connection has (probably died) so we need\r
+ // terminate this endpoint (if this is server side)\r
+ // logger.info("CLIENT: read failed: " + e);\r
+\r
+ terminate(); // this may not be necessary - probably caused infinite loop\r
+ // on terminate() without null checks\r
+ }\r
+ }\r
+\r
+ void terminate() {\r
+ SocketManager mgr = manager;\r
+ manager = null; // stops receive thread\r
+ if (socket != null) {\r
+ try {\r
+ socket.close();\r
+ } catch (IOException e) {\r
+ }\r
+ socket = null;\r
}\r
- //logger.info("CLIENT: closing connection to port " + socket.getPort());\r
- // terminate() can be called by the socket manager to shutdown the connection,\r
+ // logger.info("CLIENT: closing connection to port " + socket.getPort());\r
+ // terminate() can be called by the socket manager to shutdown the\r
+ // connection,\r
// or the receive thread after an exception has been received\r
// (which includes the above case when the socket is closed.\r
- // so we only want to removeEndPoint once - for the initial call to terminate()\r
- if (mgr!=null)\r
+ // so we only want to removeEndPoint once - for the initial call to\r
+ // terminate()\r
+ if (mgr != null)\r
mgr.removeEndPoint(this);\r
- }\r
- \r
- private Message strToMessage(String str)\r
- {\r
- try\r
- {\r
- // System.err.println("Received Message\n*\n"+str+"*");\r
- if (str==null || str.length()==1)\r
+ }\r
+\r
+ private Message strToMessage(String str) {\r
+ try {\r
+ // System.err.println("Received Message\n*\n"+str+"*");\r
+ if (str == null || str.length() == 1)\r
return null;\r
- if (str.startsWith("CUSTOM"))\r
- return new CustomMessage(str.substring(6));\r
- if (str.startsWith("MOUSEOVER"))\r
- return new MouseOverMessage(str);\r
- if (str.startsWith("SELECTION"))\r
+ if (str.startsWith("CUSTOM"))\r
+ return new CustomMessage(str.substring(6));\r
+ if (str.startsWith("MOUSEOVER"))\r
+ return new MouseOverMessage(str);\r
+ if (str.startsWith("SELECTION"))\r
return new SelectionMessage(str);\r
- \r
- }\r
- catch (Exception e)\r
- {\r
- //logger.info("Unable to reconstruct message: " + e);\r
- }\r
- \r
- return null;\r
- }\r
-}
\ No newline at end of file
+\r
+ } catch (Exception e) {\r
+ // logger.info("Unable to reconstruct message: " + e);\r
+ }\r
+\r
+ return null;\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
import java.io.*;\r
/**\r
* Server class that listens for incoming connections on a predefined port.\r
*/\r
-class PickServer extends Thread\r
-{\r
- private Log logger = org.apache.commons.logging.LogFactory.getLog(uk.ac.vamsas.client.picking.PickServer.class);\r
- \r
- // The port number we'll listen on\r
- static final int PORT = 53782;\r
- \r
- private ServerSocket serverSocket;\r
- // Set to true once the server is established\r
- private boolean isServer = false;\r
+class PickServer extends Thread {\r
+ private Log logger = org.apache.commons.logging.LogFactory\r
+ .getLog(uk.ac.vamsas.client.picking.PickServer.class);\r
+\r
+ // The port number we'll listen on\r
+ static final int PORT = 53782;\r
+\r
+ private ServerSocket serverSocket;\r
+\r
+ // Set to true once the server is established\r
+ private boolean isServer = false;\r
+\r
// Set to false when server is shutting down\r
- private boolean isAlive= true;\r
- private SocketManager manager;\r
- \r
- /**\r
- * Constructs a new instance of the server (but doesn't start it).\r
- * @param manager a reference to the pick manager that owns this server\r
- */\r
- PickServer(SocketManager manager)\r
- {\r
- this.manager = manager;\r
- }\r
- \r
- /**\r
- * Returns true if this server instance is running.\r
- * Return true if this server instance is running\r
- */\r
- boolean isServer()\r
- { return isServer; }\r
- \r
- /**\r
- * Attempts to create the server by opening a server socket on the port.\r
- * @return true if the server was created; false otherwise\r
- */\r
- boolean createServer()\r
- {\r
- try\r
- {\r
- serverSocket = new ServerSocket(PORT);\r
- start(); \r
- \r
- return isServer = true;\r
- }\r
- catch (IOException e)\r
- {\r
- logger.debug("SERVER: " + e);\r
- return false;\r
- }\r
- }\r
- \r
- /**\r
- * Thread listening method - loops indefinitely listening for connections.\r
- * When one is received, the socket object is passed to the manager so it\r
- * can make a full client connection for further comms.\r
- */\r
- public void run()\r
- {\r
- logger.debug("SERVER: listening on " + PORT + " - SERVER");\r
- \r
- // Loop forever, accepting connectons from other clients\r
- // TODO: add in the ability to terminate the server if a VAMSAS session\r
- // is ended\r
- while (isAlive)\r
- {\r
- try\r
- {\r
- Socket socket = serverSocket.accept(); \r
- logger.info("SERVER: connection detected");\r
- if (isAlive)\r
- manager.addEndPoint(socket);\r
- }\r
- catch (IOException e) {}\r
- }\r
- }\r
- \r
- void terminate()\r
- {\r
- logger.debug("Server shutting down...");\r
- isAlive=false;\r
- try { serverSocket.close(); }\r
- catch (Exception e)\r
- {\r
- logger.error(e);\r
- }\r
+ private boolean isAlive = true;\r
+\r
+ private SocketManager manager;\r
+\r
+ /**\r
+ * Constructs a new instance of the server (but doesn't start it).\r
+ * \r
+ * @param manager\r
+ * a reference to the pick manager that owns this server\r
+ */\r
+ PickServer(SocketManager manager) {\r
+ this.manager = manager;\r
+ }\r
+\r
+ /**\r
+ * Returns true if this server instance is running. Return true if this server\r
+ * instance is running\r
+ */\r
+ boolean isServer() {\r
+ return isServer;\r
+ }\r
+\r
+ /**\r
+ * Attempts to create the server by opening a server socket on the port.\r
+ * \r
+ * @return true if the server was created; false otherwise\r
+ */\r
+ boolean createServer() {\r
+ try {\r
+ serverSocket = new ServerSocket(PORT);\r
+ start();\r
+\r
+ return isServer = true;\r
+ } catch (IOException e) {\r
+ logger.debug("SERVER: " + e);\r
+ return false;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Thread listening method - loops indefinitely listening for connections.\r
+ * When one is received, the socket object is passed to the manager so it can\r
+ * make a full client connection for further comms.\r
+ */\r
+ public void run() {\r
+ logger.debug("SERVER: listening on " + PORT + " - SERVER");\r
+\r
+ // Loop forever, accepting connectons from other clients\r
+ // TODO: add in the ability to terminate the server if a VAMSAS session\r
+ // is ended\r
+ while (isAlive) {\r
+ try {\r
+ Socket socket = serverSocket.accept();\r
+ logger.info("SERVER: connection detected");\r
+ if (isAlive)\r
+ manager.addEndPoint(socket);\r
+ } catch (IOException e) {\r
+ }\r
+ }\r
+ }\r
+\r
+ void terminate() {\r
+ logger.debug("Server shutting down...");\r
+ isAlive = false;\r
+ try {\r
+ serverSocket.close();\r
+ } catch (Exception e) {\r
+ logger.error(e);\r
+ }\r
logger.debug("Server shut down complete.");\r
- }\r
-}
\ No newline at end of file
+ }\r
+}\r
-/**\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
* \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package uk.ac.vamsas.client.picking;\r
\r
\r
RangeType ranges;\r
\r
- private boolean none=false;\r
+ private boolean none = false;\r
+\r
/**\r
* parse a message payload as a selection message\r
* \r
if (elements[i].startsWith("ranges=")) {\r
segs = elements[i].substring(7).split(",");\r
}\r
- if (elements[i].equals("none"))\r
- {\r
- none=true;\r
+ if (elements[i].equals("none")) {\r
+ none = true;\r
}\r
}\r
- if (none)\r
- {\r
+ if (none) {\r
ranges = null;\r
vorbaIDs = null;\r
}\r
/**\r
* create a new selection message\r
* \r
- * @param selectionID -\r
- * (may be null) optional handle (or ID) to refer to selection by\r
- * @param vorbaIDs -\r
- * one or more objects to be selected, or null for the empty selection\r
+ * @param selectionID\r
+ * - (may be null) optional handle (or ID) to refer to selection by\r
+ * @param vorbaIDs\r
+ * - one or more objects to be selected, or null for the empty\r
+ * selection\r
* @param ranges\r
* optional rangetype specifying positions or intervals over\r
* object(s) coordinate system.\r
*/\r
public SelectionMessage(String selectionID, String[] vorbaIDs,\r
RangeType ranges) {\r
- this(selectionID,vorbaIDs,ranges,false);\r
+ this(selectionID, vorbaIDs, ranges, false);\r
}\r
- public SelectionMessage(String selectionID, String[] vorbaIDs, RangeType ranges, boolean none)\r
- {\r
+\r
+ public SelectionMessage(String selectionID, String[] vorbaIDs,\r
+ RangeType ranges, boolean none) {\r
super();\r
this.selectionID = selectionID;\r
if (selectionID != null && selectionID.indexOf("\t") > -1) {\r
}\r
this.vorbaIDs = vorbaIDs;\r
this.ranges = ranges;\r
- this.none=none;\r
+ this.none = none;\r
StringBuffer message = new StringBuffer();\r
message.append("SELECTION\t");\r
if (selectionID != null) {\r
}\r
if (none) {\r
// must have only IDs for the selection or the selection scope - no range\r
- if (ranges!=null)\r
- {\r
+ if (ranges != null) {\r
throw new Error("Empty selection cannot specify a range.");\r
}\r
- if ((selectionID==null || selectionID.length()==0) && (vorbaIDs==null || vorbaIDs.length==0))\r
- {\r
- throw new Error("Empty selection must have at least a selection ID or at least one vorbaID indicating selection scope.");\r
+ if ((selectionID == null || selectionID.length() == 0)\r
+ && (vorbaIDs == null || vorbaIDs.length == 0)) {\r
+ throw new Error(\r
+ "Empty selection must have at least a selection ID or at least one vorbaID indicating selection scope.");\r
}\r
message.append("none");\r
return;\r
- } \r
- // Verify that the range has at least one valid vorbaID for it to be defined on.\r
- if (vorbaIDs==null || vorbaIDs.length==0)\r
- {\r
- throw new Error("You must specify at least one vorbaID for the selection.");\r
+ }\r
+ // Verify that the range has at least one valid vorbaID for it to be defined\r
+ // on.\r
+ if (vorbaIDs == null || vorbaIDs.length == 0) {\r
+ throw new Error(\r
+ "You must specify at least one vorbaID for the selection.");\r
}\r
if (ranges != null) {\r
if (ranges.getPosCount() > 0) {\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
import java.net.*;\r
* server for other clients; failing that, it attempts to connect to an existing\r
* server instead.\r
*/\r
-public class SocketManager implements IPickManager\r
-{\r
- private Log logger = org.apache.commons.logging.LogFactory.getLog(uk.ac.vamsas.client.picking.SocketManager.class);\r
- \r
- // Maintains a list of client communication objects - each object represents\r
- // a way of talking to either:\r
- // the server - if this is client side (and in which case, the list will only contain one element\r
- // the other clients - if this is server side\r
- private LinkedList clients;\r
- \r
- private PickServer server;\r
- \r
- private IMessageHandler msgHandler;\r
- \r
- private boolean isRunning = true;\r
- \r
- /**\r
- * Constructs a new PickManager. This method will return immediately, while\r
- * a looping thread runs that attempts to run the server or connect to an\r
- * existing server.\r
- */\r
- public SocketManager()\r
- {\r
- //logger.setLevel(Level.OFF);\r
- \r
- server = new PickServer(this);\r
- clients = new LinkedList();\r
- \r
- new InitializeThread().start();\r
- }\r
- \r
- /**\r
- * Registers a message handler with the manager that allows the manager to\r
- * perform a method callback on that object whenever a message is received.\r
- * @param handler the message handler to register\r
- */\r
- public void registerMessageHandler(IMessageHandler handler)\r
- {\r
- msgHandler = handler;\r
- }\r
- \r
- /**\r
- * Attempts to establish a connection between two client endpoints. This\r
- * method is called in two ways: 1) by the server when it receives a remote\r
- * request (in which case the socket will already be established) and 2) by\r
- * a client that is attempting to connect *to* the server.\r
- * @param socket a socket endpoint for the connection\r
- * @return true if the connection is successfully, false otherwise\r
- */\r
- synchronized boolean addEndPoint(Socket socket)\r
- {\r
- PickEndPoint client = new PickEndPoint(this, socket);\r
- \r
- if (client.openConnection())\r
- {\r
- clients.add(client);\r
- //logger.info("List now contains " + clients.size() + " client(s)");\r
- return true;\r
- }\r
- \r
- return false;\r
- }\r
- \r
- /**\r
- * Sends a message to other clients.\r
- * @param message the message to send\r
- */\r
- public void sendMessage(Message message)\r
- {\r
- forwardMessage(null, message);\r
- }\r
- \r
- /**\r
- * Forwards (or sends) a message. When the server (client A) receives a\r
- * message from client B, it must also forward it to clients C and D (etc),\r
- * but mustn't forward it *back* to client B.\r
- * @param origin the client endpoint that received the message (will be null\r
- * if the message originates from this instance\r
- * @param message the message to send\r
- */\r
- private void forwardMessage(PickEndPoint origin, Message message)\r
- {\r
- for (int i = clients.size()-1; i >= 0; i--)\r
- {\r
- try\r
- {\r
- PickEndPoint client = (PickEndPoint) clients.get(i);\r
- if (client != origin)\r
- client.send(message);\r
- }\r
- catch (Exception e)\r
- {\r
- System.out.println("FORWARD: " + e);\r
- }\r
- }\r
- }\r
- \r
- /**\r
- * Handles a received message. If the manager is running in server mode,\r
- * then it must ensure the message is also forwarded to the other clients.\r
- * @param origin the client endpoint that received the message\r
- * @message the message that was received\r
- */\r
- void processMessage(PickEndPoint origin, Message message)\r
- { \r
- if (server.isServer())\r
- forwardMessage(origin, message);\r
- \r
- if (msgHandler != null)\r
- msgHandler.handleMessage(message);\r
-// else\r
-// logger.info("No handler available to deal with incoming message");\r
- }\r
- \r
- /**\r
- * Removes a client connection from the list when its connection is no\r
- * longer valid.\r
- * @param client the client endpoint to remove\r
- */\r
- synchronized void removeEndPoint(PickEndPoint client)\r
- {\r
- clients.remove(client);\r
- //logger.info("List now contains " + clients.size() + " client(s)");\r
- \r
- // If there's no endpoints left, then we've lost all connections and\r
- // need to reinitialize - but only if we've not been told to stop\r
- if (clients.size() == 0 && isRunning)\r
- new InitializeThread().start();\r
- }\r
- \r
- /**\r
- * Thread extension class to handle the actual initialization\r
- */\r
- private class InitializeThread extends Thread\r
- {\r
- public void run()\r
- {\r
- logger.debug("Initializing connection...");\r
- boolean connected = false;\r
- \r
- // Loop until we can get a connection (one way or the other)\r
- while (!connected && isRunning)\r
- {\r
- // Sleep for a rnd time so we don't end up with all the VAMSAS\r
- // apps trying to initialize servers at the same time\r
- try { Thread.sleep((int)(10*Math.random())); }\r
- catch (InterruptedException e) {}\r
- \r
- // Attempt to open the server port...\r
- if (server.isServer() || server.createServer())\r
- connected = true;\r
-\r
- // If it fails, then attempt to make a client connection...\r
- else if (addEndPoint(null))\r
- connected = true;\r
- }\r
+public class SocketManager implements IPickManager {\r
+ private Log logger = org.apache.commons.logging.LogFactory\r
+ .getLog(uk.ac.vamsas.client.picking.SocketManager.class);\r
+\r
+ // Maintains a list of client communication objects - each object represents\r
+ // a way of talking to either:\r
+ // the server - if this is client side (and in which case, the list will only\r
+ // contain one element\r
+ // the other clients - if this is server side\r
+ private LinkedList clients;\r
+\r
+ private PickServer server;\r
+\r
+ private IMessageHandler msgHandler;\r
+\r
+ private boolean isRunning = true;\r
+\r
+ /**\r
+ * Constructs a new PickManager. This method will return immediately, while a\r
+ * looping thread runs that attempts to run the server or connect to an\r
+ * existing server.\r
+ */\r
+ public SocketManager() {\r
+ // logger.setLevel(Level.OFF);\r
+\r
+ server = new PickServer(this);\r
+ clients = new LinkedList();\r
+\r
+ new InitializeThread().start();\r
+ }\r
+\r
+ /**\r
+ * Registers a message handler with the manager that allows the manager to\r
+ * perform a method callback on that object whenever a message is received.\r
+ * \r
+ * @param handler\r
+ * the message handler to register\r
+ */\r
+ public void registerMessageHandler(IMessageHandler handler) {\r
+ msgHandler = handler;\r
+ }\r
+\r
+ /**\r
+ * Attempts to establish a connection between two client endpoints. This\r
+ * method is called in two ways: 1) by the server when it receives a remote\r
+ * request (in which case the socket will already be established) and 2) by a\r
+ * client that is attempting to connect *to* the server.\r
+ * \r
+ * @param socket\r
+ * a socket endpoint for the connection\r
+ * @return true if the connection is successfully, false otherwise\r
+ */\r
+ synchronized boolean addEndPoint(Socket socket) {\r
+ PickEndPoint client = new PickEndPoint(this, socket);\r
+\r
+ if (client.openConnection()) {\r
+ clients.add(client);\r
+ // logger.info("List now contains " + clients.size() + " client(s)");\r
+ return true;\r
+ }\r
+\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Sends a message to other clients.\r
+ * \r
+ * @param message\r
+ * the message to send\r
+ */\r
+ public void sendMessage(Message message) {\r
+ forwardMessage(null, message);\r
+ }\r
+\r
+ /**\r
+ * Forwards (or sends) a message. When the server (client A) receives a\r
+ * message from client B, it must also forward it to clients C and D (etc),\r
+ * but mustn't forward it *back* to client B.\r
+ * \r
+ * @param origin\r
+ * the client endpoint that received the message (will be null if the\r
+ * message originates from this instance\r
+ * @param message\r
+ * the message to send\r
+ */\r
+ private void forwardMessage(PickEndPoint origin, Message message) {\r
+ for (int i = clients.size() - 1; i >= 0; i--) {\r
+ try {\r
+ PickEndPoint client = (PickEndPoint) clients.get(i);\r
+ if (client != origin)\r
+ client.send(message);\r
+ } catch (Exception e) {\r
+ System.out.println("FORWARD: " + e);\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Handles a received message. If the manager is running in server mode, then\r
+ * it must ensure the message is also forwarded to the other clients.\r
+ * \r
+ * @param origin\r
+ * the client endpoint that received the message\r
+ * @message the message that was received\r
+ */\r
+ void processMessage(PickEndPoint origin, Message message) {\r
+ if (server.isServer())\r
+ forwardMessage(origin, message);\r
+\r
+ if (msgHandler != null)\r
+ msgHandler.handleMessage(message);\r
+ // else\r
+ // logger.info("No handler available to deal with incoming message");\r
+ }\r
+\r
+ /**\r
+ * Removes a client connection from the list when its connection is no longer\r
+ * valid.\r
+ * \r
+ * @param client\r
+ * the client endpoint to remove\r
+ */\r
+ synchronized void removeEndPoint(PickEndPoint client) {\r
+ clients.remove(client);\r
+ // logger.info("List now contains " + clients.size() + " client(s)");\r
+\r
+ // If there's no endpoints left, then we've lost all connections and\r
+ // need to reinitialize - but only if we've not been told to stop\r
+ if (clients.size() == 0 && isRunning)\r
+ new InitializeThread().start();\r
+ }\r
+\r
+ /**\r
+ * Thread extension class to handle the actual initialization\r
+ */\r
+ private class InitializeThread extends Thread {\r
+ public void run() {\r
+ logger.debug("Initializing connection...");\r
+ boolean connected = false;\r
+\r
+ // Loop until we can get a connection (one way or the other)\r
+ while (!connected && isRunning) {\r
+ // Sleep for a rnd time so we don't end up with all the VAMSAS\r
+ // apps trying to initialize servers at the same time\r
+ try {\r
+ Thread.sleep((int) (10 * Math.random()));\r
+ } catch (InterruptedException e) {\r
+ }\r
+\r
+ // Attempt to open the server port...\r
+ if (server.isServer() || server.createServer())\r
+ connected = true;\r
+\r
+ // If it fails, then attempt to make a client connection...\r
+ else if (addEndPoint(null))\r
+ connected = true;\r
+ }\r
logger.debug("Completed initializing connection.");\r
- }\r
- }\r
- \r
- public void shutdown()\r
- {\r
- logger.debug("Shutting down socket manager.");\r
+ }\r
+ }\r
+\r
+ public void shutdown() {\r
+ logger.debug("Shutting down socket manager.");\r
if (server == null)\r
- throw new Error("Client Implementation Error: shutdown() called on uninitialized SocketManager.");\r
- \r
- isRunning = false;\r
- \r
- if (server.isServer())\r
- server.terminate();\r
- \r
- while (clients.size() > 0) {\r
- logger.debug("Closing endpoint.");\r
- ((PickEndPoint)clients.getFirst()).terminate();\r
- }\r
+ throw new Error(\r
+ "Client Implementation Error: shutdown() called on uninitialized SocketManager.");\r
+\r
+ isRunning = false;\r
+\r
+ if (server.isServer())\r
+ server.terminate();\r
+\r
+ while (clients.size() > 0) {\r
+ logger.debug("Closing endpoint.");\r
+ ((PickEndPoint) clients.getFirst()).terminate();\r
+ }\r
logger.debug("Shutdown of socketmanager completed.");\r
}\r
-}
\ No newline at end of file
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.picking;\r
\r
import java.util.logging.*;\r
for (int id = 0; id < ids.length; id++) {\r
ids[id] = "object" + id;\r
}\r
- \r
- SelectionMessage sel = new SelectionMessage("mysel", ids, (ids.length>0) ? range : null,(ids.length==0) ? true : false);\r
+\r
+ SelectionMessage sel = new SelectionMessage("mysel", ids,\r
+ (ids.length > 0) ? range : null, (ids.length == 0) ? true : false);\r
sel.validate();\r
manager.sendMessage(sel);\r
} catch (Exception e) {\r
+ sm.getRanges().getSegCount() + "intervals.")));\r
}\r
}\r
-}
\ No newline at end of file
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-import java.net.MalformedURLException;
-
-/**
- * Vamsas Document URN for files understood by ArchiveReader and
- * written by VamsasArchive.
- * vdoc://{Absolute path to file}
- * @author jimp
- *
- */
-public class ArchiveUrn extends uk.ac.vamsas.client.SessionUrn {
- /**
- * a simple vamsas document urn prefix
- */
- public static String VAMSASDOCUMENT="vdoc";
- static {
- TYPES.put(ArchiveUrn.VAMSASDOCUMENT, ArchiveUrn.class);
- }
-
- public ArchiveUrn(File docLocation) throws MalformedURLException {
- super(VAMSASDOCUMENT, docLocation.getAbsoluteFile().toURL());
- }
-
- /**
- * TODO: LATER: think about this again.
- * @return File(urn.getPath())
- */
- public File asFile() {
- return new File(urn.getPath());
- }
- // TODO: add abstract 'handler' methods for resolving the URN to a particular class
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.net.MalformedURLException;\r
+\r
+/**\r
+ * Vamsas Document URN for files understood by ArchiveReader and written by\r
+ * VamsasArchive. vdoc://{Absolute path to file}\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class ArchiveUrn extends uk.ac.vamsas.client.SessionUrn {\r
+ /**\r
+ * a simple vamsas document urn prefix\r
+ */\r
+ public static String VAMSASDOCUMENT = "vdoc";\r
+ static {\r
+ TYPES.put(ArchiveUrn.VAMSASDOCUMENT, ArchiveUrn.class);\r
+ }\r
+\r
+ public ArchiveUrn(File docLocation) throws MalformedURLException {\r
+ super(VAMSASDOCUMENT, docLocation.getAbsoluteFile().toURL());\r
+ }\r
+\r
+ /**\r
+ * TODO: LATER: think about this again.\r
+ * \r
+ * @return File(urn.getPath())\r
+ */\r
+ public File asFile() {\r
+ return new File(urn.getPath());\r
+ }\r
+ // TODO: add abstract 'handler' methods for resolving the URN to a particular\r
+ // class\r
+}\r
/*
- *
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client.simpleclient;
import uk.ac.vamsas.test.objects.Core;
/**
- * Maintains a collection of vamsas objects, appdatas and states,
- * and provides api for a SimpleClient's client.
- * TODO: test and migrate ArchiveClient.getAppData methods to here and retest in ExampleApplication
- * @author jimp
+ * Maintains a collection of vamsas objects, appdatas and states, and provides
+ * api for a SimpleClient's client. TODO: test and migrate
+ * ArchiveClient.getAppData methods to here and retest in ExampleApplication
+ *
+ * @author jimp
*/
-public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implements IClientDocument {
+public class ClientDocument extends uk.ac.vamsas.client.ClientDocument
+ implements IClientDocument {
private static Log log = LogFactory.getLog(ClientDocument.class);
+
private VamsasDocument doc;
+
protected SimpleClient sclient;
+
protected VamsasArchive iohandler = null;
+
/**
* indicate if new data has been incorporated
*/
private boolean isModified = false;
+
/**
* Public method for internal use by SimpleClient.
+ *
* @return true if document has been modified.
*/
public boolean isModified() {
return isModified;
}
+
/**
- *
- * prepare Application-side dataset from the vamsas Document iohandler
- * @param doc - the dataset
- * @param docHandler - the sessionFile IO handler
- * @param Factory - the source of current and new vorbaIds
- * @param sclient - the simpleclient instance
+ *
+ * prepare Application-side dataset from the vamsas Document iohandler
+ *
+ * @param doc
+ * - the dataset
+ * @param docHandler
+ * - the sessionFile IO handler
+ * @param Factory
+ * - the source of current and new vorbaIds
+ * @param sclient
+ * - the simpleclient instance
*/
- protected ClientDocument(VamsasDocument doc, VamsasArchive docHandler, IdFactory Factory, SimpleClient sclient) {
+ protected ClientDocument(VamsasDocument doc, VamsasArchive docHandler,
+ IdFactory Factory, SimpleClient sclient) {
super(Factory.getVorbaIdHash(), Factory);
-
-
+
/**
* prepare Application-side dataset from the vamsas Document iohandler
*/
this.sclient = sclient;
iohandler = docHandler;
this.doc = doc;
- _VamsasRoots=doc.getVAMSAS();
+ _VamsasRoots = doc.getVAMSAS();
}
-
+
/*
* (non-Javadoc)
*
- * @see uk.ac.vamsas.client.IClientDocument#getObject(uk.ac.vamsas.client.VorbaId)
+ * @see
+ * uk.ac.vamsas.client.IClientDocument#getObject(uk.ac.vamsas.client.VorbaId)
*/
public Vobject getObject(VorbaId id) {
- if (vamsasObjects==null) {
+ if (vamsasObjects == null) {
log.debug("getObject called on null objrefs list.");
return null;
}
if (vamsasObjects.containsKey(id))
return (Vobject) vamsasObjects.get(id);
- log.debug("Returning null Vobject reference for id "+id.getId());
+ log.debug("Returning null Vobject reference for id " + id.getId());
return null;
}
-
+
/*
* (non-Javadoc)
*
- * @see uk.ac.vamsas.client.IClientDocument#getObjects(uk.ac.vamsas.client.VorbaId[])
+ * @see
+ * uk.ac.vamsas.client.IClientDocument#getObjects(uk.ac.vamsas.client.VorbaId
+ * [])
*/
public Vobject[] getObjects(VorbaId[] ids) {
- if (vamsasObjects==null) {
+ if (vamsasObjects == null) {
log.debug("getObject[] called on null vamsasObjects list.");
return null;
}
Vobject[] vo = new Vobject[ids.length];
- for (int i=0,j=ids.length; i<j;i++)
+ for (int i = 0, j = ids.length; i < j; i++)
if (vamsasObjects.containsKey(ids[i]))
vo[i] = (Vobject) vamsasObjects.get(ids[i]);
else
- log.debug("Returning null Vobject reference for id "+ids[i].getId());
+ log.debug("Returning null Vobject reference for id " + ids[i].getId());
return vo;
}
+
/**
* internal reference to single copy of Document Roots array
*/
- private VAMSAS[] _VamsasRoots=null;
+ private VAMSAS[] _VamsasRoots = null;
+
/**
- * set if the client has corrupted the Vamsas Document structure somehow.
- * if this is set the document will never be written back to the session unless the corruption is fixed.
+ * set if the client has corrupted the Vamsas Document structure somehow. if
+ * this is set the document will never be written back to the session unless
+ * the corruption is fixed.
*/
- private boolean invalidModification=false;
+ private boolean invalidModification = false;
protected void updateDocumentRoots() {
- if (doc==null) {
- log.error("updateDocumentRoots called on null document. Probably an implementation error.");
+ if (doc == null) {
+ log
+ .error("updateDocumentRoots called on null document. Probably an implementation error.");
return;
}
if (isModified) {
- if (_VamsasRoots!=null) {
+ if (_VamsasRoots != null) {
doc.setVAMSAS(_VamsasRoots);
- _VamsasRoots=null;
+ _VamsasRoots = null;
}
}
}
-/*
- * (non-Javadoc)
- * LATER: currently there is only one Vector of roots ever passed to client - decide if this is correct (means this is not thread safe and may behave unexpectedly)
+
+ /*
+ * (non-Javadoc) LATER: currently there is only one Vector of roots ever
+ * passed to client - decide if this is correct (means this is not thread safe
+ * and may behave unexpectedly)
+ *
* @see uk.ac.vamsas.client.IClientDocument#getVamsasRoots()
*/
public VAMSAS[] getVamsasRoots() {
- if (doc==null) {
+ if (doc == null) {
log.debug("Null document for getVamsasRoots(), returning null");
return null;
}
- if (iohandler==null) {
+ if (iohandler == null) {
// LATER: decide on read-only status of ClientDocument object
log.warn("getVamsasRoots() called on possibly read-only document.");
}
- if (_VamsasRoots!=null)
+ if (_VamsasRoots != null)
return _VamsasRoots;
VAMSAS[] roots = doc.getVAMSAS();
if (roots == null) {
- // Make a new one to return to client to get filled.
+ // Make a new one to return to client to get filled.
_VamsasRoots = new VAMSAS[] { new VAMSAS() };
registerObject(_VamsasRoots[0]);
// Do provenance now. just in case.
- doc.getProvenance().addEntry(sclient.getProvenanceEntry("Created new document root [id="+_VamsasRoots[0].getId()+"]"));
+ doc.getProvenance().addEntry(
+ sclient.getProvenanceEntry("Created new document root [id="
+ + _VamsasRoots[0].getId() + "]"));
doc.addVAMSAS(_VamsasRoots[0]);
} else {
_VamsasRoots = new VAMSAS[roots.length];
- for (int r=0;r<roots.length; r++)
+ for (int r = 0; r < roots.length; r++)
_VamsasRoots[r] = roots[r];
}
return _VamsasRoots;
}
-
+
private int _contains(VAMSAS root, VAMSAS[] docRoots) {
- if (root==null)
+ if (root == null)
return -1;
- if (docRoots==null || docRoots.length==0)
+ if (docRoots == null || docRoots.length == 0)
return -1;
- VorbaId d_id=null,r_id = root.getVorbaId();
- for (int i=0,j=docRoots.length; i<j; i++)
- if (docRoots[i]==root || (docRoots[i]!=null && (d_id=docRoots[i].getVorbaId())!=null) && d_id.equals(r_id))
+ VorbaId d_id = null, r_id = root.getVorbaId();
+ for (int i = 0, j = docRoots.length; i < j; i++)
+ if (docRoots[i] == root
+ || (docRoots[i] != null && (d_id = docRoots[i].getVorbaId()) != null)
+ && d_id.equals(r_id))
return i;
return -1;
}
-
-/**
- * verify that newr version is really an intact version of the
- * @param newVersion (may be modified)
- * @param oldVersion
- * @param modflag
- * @return true if newVersion is a valid root that preserves original references
- */
- private boolean isValidUpdate(VAMSAS newVersion, final VAMSAS oldVersion, ClientDocument modflag) {
- // ideal - this cascades down the two structures, ensuring that all ID'd objects in one are present in the other.
- if (oldVersion==newVersion) {
+
+ /**
+ * verify that newr version is really an intact version of the
+ *
+ * @param newVersion
+ * (may be modified)
+ * @param oldVersion
+ * @param modflag
+ * @return true if newVersion is a valid root that preserves original
+ * references
+ */
+ private boolean isValidUpdate(VAMSAS newVersion, final VAMSAS oldVersion,
+ ClientDocument modflag) {
+ // ideal - this cascades down the two structures, ensuring that all ID'd
+ // objects in one are present in the other.
+ if (oldVersion == newVersion) {
// may be a virgin root element.
- if (!newVersion.isRegistered())
- {
- _registerObject(newVersion); // TODO: check - this call hasn't been tested. (seems to work now)
- modflag.isModified=true;
+ if (!newVersion.isRegistered()) {
+ _registerObject(newVersion); // TODO: check - this call hasn't been
+ // tested. (seems to work now)
+ modflag.isModified = true;
}
- // TODO: Should attempt to repair document if client app has deleted/broken bits of it
+ // TODO: Should attempt to repair document if client app has
+ // deleted/broken bits of it
if (oldVersion.is__stored_in_document()) {
// retrieve compare hashCodes to detect update.
- if (oldVersion.get__last_hash()!=oldVersion.hashCode())
- {
- log.debug("Modified hashcode for vamsas root "+oldVersion.getVorbaId());
+ if (oldVersion.get__last_hash() != oldVersion.hashCode()) {
+ log.debug("Modified hashcode for vamsas root "
+ + oldVersion.getVorbaId());
modflag.isModified = true;
} else {
- log.debug("Unmodified vamsas root "+oldVersion.getVorbaId());
+ log.debug("Unmodified vamsas root " + oldVersion.getVorbaId());
}
}
// just do internal validation for moment.
try {
- if (getSimpleClientConfig().validateUpdatedRoots())
- {
+ if (getSimpleClientConfig().validateUpdatedRoots()) {
newVersion.validate();
}
return true;
- }
- catch (Exception e)
- {
- log.error("Validation Exception for new vamsas root :"+newVersion.getVorbaId(),e);
- modflag.invalidModification=true;
+ } catch (Exception e) {
+ log.error("Validation Exception for new vamsas root :"
+ + newVersion.getVorbaId(), e);
+ modflag.invalidModification = true;
}
return false;
} else {
// redundant ? if (oldVersion.is__stored_in_document())
- if (!newVersion.isRegistered())
- {
+ if (!newVersion.isRegistered()) {
_registerObject(newVersion);
- modflag.isModified=true;
+ modflag.isModified = true;
}
try {
- if (getSimpleClientConfig().validateMergedRoots())
- {
+ if (getSimpleClientConfig().validateMergedRoots()) {
newVersion.validate();
}
- modflag.isModified=true;
+ modflag.isModified = true;
return true;
- }
- catch (Exception e)
- {
- log.error("Validation Exception for new vamsas root :"+newVersion.getVorbaId(),e);
+ } catch (Exception e) {
+ log.error("Validation Exception for new vamsas root :"
+ + newVersion.getVorbaId(), e);
}
}
return false;
/**
- * LATER: MUCH LATER! - not needed for simple case and this routine shouldn't live in this class anymore
- * isValidUpdate : Ideally. we efficiently walk down, comparing hashes, to deal with merging and verifying provenance for objects
-
- // extract root objects
- if (newroots != null) {
- // check newroots for objects that were present in the old document
- // check to see if the 'old' objects have been modified
- // if they have ? we overwrite them with their new version, ensuring that
- // provenance is updated.
- // if they haven't ? do nothing ?
-
- for (int i = 0, k = newroots.length; i < k; i++) {
- if (newroots[i].isRegistered()) {
- // easy - just check if anything has changed and do provenance
- Vobject oldversion = getObject(newroots[i].getVorbaId());
- if (oldversion instanceof VAMSAS) {
- // LATER: appropriate merging behaviour when two clients have improperly modified the same Vobject independently.
- if (newroots[i].get__last_hash() != newroots[i].hashCode()) {
- // client has modified this Vobject since last retrieval.
- if (newroots[i].get__last_hash() != oldversion.get__last_hash()) {
- // Vobject has been modified by another client since this
- // client's
- // last access to document.
- }
- }
- } else {
- throw new Error(
- "SimpleClient error when using setVamsasRoots : The vorbaId for Vobject "
- + i
- + " does not refer to an Vobject of type VAMSAS in the current document!");
- }
- } else {
- if (!newroots[i].is__stored_in_document()) {
- // check if Vobject is modified
- if (newroots[i].get__last_hash() != newroots[i].hashCode()) {
- // it is - so we add newroots[i] as a new Vobject, with updated
- // provenance.
- } else {
- // do nothing
- newroots[i] = null;
- }
- } else {
- // just add newroots[i] as a new Vobject in the document
- // - with appropriate provenance.
- }
- }
- }*/
+ * LATER: MUCH LATER! - not needed for simple case and this routine
+ * shouldn't live in this class anymore isValidUpdate : Ideally. we
+ * efficiently walk down, comparing hashes, to deal with merging and
+ * verifying provenance for objects
+ *
+ * // extract root objects if (newroots != null) { // check newroots for
+ * objects that were present in the old document // check to see if the
+ * 'old' objects have been modified // if they have ? we overwrite them with
+ * their new version, ensuring that // provenance is updated. // if they
+ * haven't ? do nothing ?
+ *
+ * for (int i = 0, k = newroots.length; i < k; i++) { if
+ * (newroots[i].isRegistered()) { // easy - just check if anything has
+ * changed and do provenance Vobject oldversion =
+ * getObject(newroots[i].getVorbaId()); if (oldversion instanceof VAMSAS) {
+ * // LATER: appropriate merging behaviour when two clients have improperly
+ * modified the same Vobject independently. if (newroots[i].get__last_hash()
+ * != newroots[i].hashCode()) { // client has modified this Vobject since
+ * last retrieval. if (newroots[i].get__last_hash() !=
+ * oldversion.get__last_hash()) { // Vobject has been modified by another
+ * client since this // client's // last access to document. } } } else {
+ * throw new Error(
+ * "SimpleClient error when using setVamsasRoots : The vorbaId for Vobject "
+ * + i +
+ * " does not refer to an Vobject of type VAMSAS in the current document!");
+ * } } else { if (!newroots[i].is__stored_in_document()) { // check if
+ * Vobject is modified if (newroots[i].get__last_hash() !=
+ * newroots[i].hashCode()) { // it is - so we add newroots[i] as a new
+ * Vobject, with updated // provenance. } else { // do nothing newroots[i] =
+ * null; } } else { // just add newroots[i] as a new Vobject in the document
+ * // - with appropriate provenance. } } }
+ */
}
+
private SimpleClientConfig getSimpleClientConfig() {
return sclient.getSimpleClientConfig();
-}
+ }
+
/**
* merge old and new root vectors
- * @param newr This array may be written to
+ *
+ * @param newr
+ * This array may be written to
* @param original
- * @param the client document (usually this) which this root set belongs to.
+ * @param the
+ * client document (usually this) which this root set belongs to.
* @return merged vector of vamsas roots
*/
- private VAMSAS[] _combineRoots(VAMSAS[] newr, final VAMSAS[] original, ClientDocument modflag) {
+ private VAMSAS[] _combineRoots(VAMSAS[] newr, final VAMSAS[] original,
+ ClientDocument modflag) {
Vector rts = new Vector();
- for (int i=0,j=original.length; i<j; i++) {
+ for (int i = 0, j = original.length; i < j; i++) {
int k = _contains(original[i], newr);
- if (k>-1) {
+ if (k > -1) {
if (isValidUpdate(newr[k], original[i], modflag)) {
- // set by isValidUpdate if the hashcodes were really different from last store
+ // set by isValidUpdate if the hashcodes were really different from
+ // last store
rts.add(newr[k]);
- newr[k]=null;
+ newr[k] = null;
} else {
// LATER: try harder to merge ducument roots.
- log.warn("Couldn't merge new VAMSAS root "+newr[k].getId());
+ log.warn("Couldn't merge new VAMSAS root " + newr[k].getId());
newr[k] = null; // LATER: this means we ignore mangled roots. NOT GOOD
}
} else {
}
}
// add remaining (new) roots
- for (int i=0,j=newr.length; i<j; i++) {
- if (newr[i]!=null) {
+ for (int i = 0, j = newr.length; i < j; i++) {
+ if (newr[i] != null) {
rts.add(newr[i]);
- modflag.isModified=true;
+ modflag.isModified = true;
}
}
newr = new VAMSAS[rts.size()];
- for (int i=0,j=rts.size(); i<j; i++)
+ for (int i = 0, j = rts.size(); i < j; i++)
newr[i] = (VAMSAS) rts.get(i);
return newr;
}
-
+
/**
- * update the document with new roots.
- * LATER: decide: this affects the next call to getVamsasRoots()
+ * update the document with new roots. LATER: decide: this affects the next
+ * call to getVamsasRoots()
+ *
* @see org.vamsas.IClientDocument.setVamsasRoots
*/
public void setVamsasRoots(VAMSAS[] newroots) {
- if (doc==null) {
+ if (doc == null) {
log.debug("setVamsasRoots called on null document.");
return;
}
VAMSAS[] newr;
- if (newroots==null) {
+ if (newroots == null) {
log.debug("setVamsasRoots(null) - do nothing.");
return;
}
// are we dealing with same array ?
- if (_VamsasRoots!=newroots) {
+ if (_VamsasRoots != newroots) {
// merge roots into local version.
newr = new VAMSAS[newroots.length];
- for (int i=0;i<newr.length;i++)
+ for (int i = 0; i < newr.length; i++)
newr[i] = newroots[i];
- newr=_combineRoots(newr,_VamsasRoots,this);
+ newr = _combineRoots(newr, _VamsasRoots, this);
} else {
newr = new VAMSAS[_VamsasRoots.length];
- for (int i=0;i<newr.length;i++)
- newr[i]=_VamsasRoots[i];
+ for (int i = 0; i < newr.length; i++)
+ newr[i] = _VamsasRoots[i];
}
- // actually compare with document root set for final combination (to ensure nothing is lost)
- _VamsasRoots = _combineRoots(newr, doc.getVAMSAS(), this);
+ // actually compare with document root set for final combination (to ensure
+ // nothing is lost)
+ _VamsasRoots = _combineRoots(newr, doc.getVAMSAS(), this);
}
-
-
- /* (non-Javadoc)
- * LATER: decide: this affects the next call to getVamsasRoots()
- * @see uk.ac.vamsas.client.IClientDocument#addVamsasRoot(uk.ac.vamsas.objects.core.VAMSAS)
+
+ /*
+ * (non-Javadoc) LATER: decide: this affects the next call to getVamsasRoots()
+ *
+ * @see
+ * uk.ac.vamsas.client.IClientDocument#addVamsasRoot(uk.ac.vamsas.objects.
+ * core.VAMSAS)
*/
public void addVamsasRoot(VAMSAS newroot) {
- if (doc==null) {
+ if (doc == null) {
log.debug("addVamsasRoots called on null document.");
return;
}
- VAMSAS[] newroots = _combineRoots(new VAMSAS[] {newroot}, getVamsasRoots(), this);
- _VamsasRoots = newroots;
+ VAMSAS[] newroots = _combineRoots(new VAMSAS[] { newroot },
+ getVamsasRoots(), this);
+ _VamsasRoots = newroots;
}
-
+
/*
* (non-Javadoc)
*
- * @see uk.ac.vamsas.client.IClientDocument#registerObjects(uk.ac.vamsas.client.Vobject[])
+ * @see
+ * uk.ac.vamsas.client.IClientDocument#registerObjects(uk.ac.vamsas.client
+ * .Vobject[])
*/
public VorbaId[] registerObjects(Vobject[] unregistered) {
- if (doc==null) {
+ if (doc == null) {
log.warn("registerObjects[] called on null document.");
return null;
}
- if (vamsasObjects==null) {
+ if (vamsasObjects == null) {
log.warn("registerObjects[] called for null vamsasObjects hasharray.");
return null;
}
- if (unregistered!=null) {
+ if (unregistered != null) {
VorbaId ids[] = new VorbaId[unregistered.length];
- for (int i=0,k=unregistered.length; i<k; i++)
- if (unregistered[i]!=null) {
- log.warn("Null Vobject passed to registerObject[] at position "+i);
+ for (int i = 0, k = unregistered.length; i < k; i++)
+ if (unregistered[i] != null) {
+ log.warn("Null Vobject passed to registerObject[] at position " + i);
return null;
} else {
- ids[i]=registerObject(unregistered[i]);
+ ids[i] = registerObject(unregistered[i]);
}
- log.debug("Registered "+unregistered.length+" objects - total of "+vamsasObjects.size()+" ids.");
+ log.debug("Registered " + unregistered.length + " objects - total of "
+ + vamsasObjects.size() + " ids.");
return ids;
}
return null;
}
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientDocument#registerObject(uk.ac.vamsas.client.Vobject)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * uk.ac.vamsas.client.IClientDocument#registerObject(uk.ac.vamsas.client.
+ * Vobject)
*/
public VorbaId registerObject(Vobject unregistered) {
- if (doc==null) {
+ if (doc == null) {
log.warn("registerObjects called on null document.");
return null;
}
- if (vamsasObjects==null) {
+ if (vamsasObjects == null) {
log.warn("registerObjects called for null vamsasObjects hasharray.");
return null;
}
- if (iohandler==null) {
+ if (iohandler == null) {
log.warn("registerObjects called for read only document.");
return null;
}
-
- if (unregistered!=null) {
+
+ if (unregistered != null) {
VorbaId id = _registerObject(unregistered);
- log.debug("Registered object - total of "+vamsasObjects.size()+" ids.");
+ log.debug("Registered object - total of " + vamsasObjects.size()
+ + " ids.");
return id;
}
log.warn("Null Vobject passed to registerObject.");
return null;
}
+
/**
* IClientAppdata instance - if it exists.
*/
SimpleClientAppdata scappd = null;
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see uk.ac.vamsas.client.IClientDocument#getClientAppdata()
*/
public IClientAppdata getClientAppdata() {
// TODO: getClientAppdata not tested in ArchiveClient mockup
log.error("TODO: TEST Client Appdata access methods");
- if (doc==null) {
+ if (doc == null) {
log.warn("getClientAppdata called on null document.");
return null;
}
- if (scappd==null) {
- log.debug("Creating new SimpleClientAppdata instance for "+sclient.getSessionHandle());
+ if (scappd == null) {
+ log.debug("Creating new SimpleClientAppdata instance for "
+ + sclient.getSessionHandle());
scappd = new SimpleClientAppdata(this);
- if (scappd==null) {
+ if (scappd == null) {
// LATER: may not need this as a warning message.
- log.warn("Null appdata object for "+sclient.getSessionHandle());
+ log.warn("Null appdata object for " + sclient.getSessionHandle());
} else {
log.debug("Created SimpleClientAppdata successfully.");
}
}
return scappd;
}
+
/**
* access the vamsas document
+ *
* @return the session's vamsas document
*/
protected VamsasDocument getVamsasDocument() {
return doc;
}
+
/**
* returns the read-only IO interface for the vamsas document Jar file
+ *
* @return
*/
protected VamsasArchiveReader getVamsasArchiveReader() {
- if (iohandler==null) {
- log.error("Near fatal. Null VamsasArchive iohandler so can't get VamsasArchiveReader");
+ if (iohandler == null) {
+ log
+ .error("Near fatal. Null VamsasArchive iohandler so can't get VamsasArchiveReader");
return null;
}
try {
}
return null;
}
+
/**
* called by vamsas api to write updated document to session
+ *
* @return true if update was successful
* @throws java.io.IOException
*/
protected boolean updateSessionDocument() throws java.io.IOException {
boolean docupdate = true; // 'non-serious' problems below set this false
- if (doc==null) {
+ if (doc == null) {
log.warn("updateSessionDocument called on null document.");
throw new java.io.IOException("Document is closed.");
}
- if (iohandler==null) {
- log.warn("updateSessionDocument called on null document iohandler handler.");
+ if (iohandler == null) {
+ log
+ .warn("updateSessionDocument called on null document iohandler handler.");
throw new java.io.IOException("Document is closed.");
}
-
+
if (!isModified() && !scappd.isModified()) {
log.debug("Document update not necessary. returning false.");
return false;
}
VamsasSession session = sclient._session;
- log.debug("updating Session Document in "+session.sessionDir);
+ log.debug("updating Session Document in " + session.sessionDir);
// update the VamsasDocument structure with any new appData's.
// try to update the sessionFile
- log.debug("Attempting to update session "+sclient.session.getSessionUrn());
- if (scappd!=null && scappd.isModified()) {
+ log
+ .debug("Attempting to update session "
+ + sclient.session.getSessionUrn());
+ if (scappd != null && scappd.isModified()) {
ClientHandle client = sclient.client;
UserHandle user = sclient.user;
- scappd.closeForWriting();
- if (scappd.appsGlobal==null) {
+ scappd.closeForWriting();
+ if (scappd.appsGlobal == null) {
log.debug("Creating new appData entry for this application...");
// first write for this application - add a new section in document
ApplicationData appd = scappd.appsGlobal = new ApplicationData();
// appd.setUrn(client.getClientUrn());
appd.setVersion(client.getVersion());
doc.addApplicationData(appd);
- // embed or jarEntry ? - for now only jarEntry's are dealt with.
- appd.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()));
+ // embed or jarEntry ? - for now only jarEntry's are dealt with.
+ appd.setDataReference(AppDataReference.uniqueAppDataReference(doc,
+ sclient.client.getClientUrn()));
log.debug("... created.");
}
- if (scappd.newAppData!=null && scappd.newAppData.sessionFile.exists()) {
+ if (scappd.newAppData != null && scappd.newAppData.sessionFile.exists()) {
log.debug("Beginning update for new Global Appdata...");
// new global appdata to write.
- if (scappd.appsGlobal.getData()!=null) {
+ if (scappd.appsGlobal.getData() != null) {
scappd.appsGlobal.setData(null);
- scappd.appsGlobal.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()));
+ scappd.appsGlobal.setDataReference(AppDataReference
+ .uniqueAppDataReference(doc, sclient.client.getClientUrn()));
}
- // LATER: use a switch to decide if the data should be written as a reference or as an embedded data chunk
- scappd.updateAnAppdataEntry(iohandler, scappd.appsGlobal, scappd.newAppData);
+ // LATER: use a switch to decide if the data should be written as a
+ // reference or as an embedded data chunk
+ scappd.updateAnAppdataEntry(iohandler, scappd.appsGlobal,
+ scappd.newAppData);
log.debug("...Successfully updated Global Appdata Entry.");
}
- if (scappd.newUserData!=null && scappd.newUserData.sessionFile.exists()) {
+ if (scappd.newUserData != null && scappd.newUserData.sessionFile.exists()) {
log.debug("Beginning to update Users Appdata entry....");
- if (scappd.usersData==null) {
+ if (scappd.usersData == null) {
// create new user appdata
scappd.usersData = new User();
scappd.usersData.setFullname(user.getFullName());
scappd.appsGlobal.addUser(scappd.usersData);
}
User appd = scappd.usersData;
- if (appd.getData()!=null || appd.getDataReference()==null) {
- // LATER make standard appDataReference constructor for client+user
- appd.setData(null);
+ if (appd.getData() != null || appd.getDataReference() == null) {
+ // LATER make standard appDataReference constructor for client+user
+ appd.setData(null);
String safe_username = user.getFullName();
int t = safe_username.indexOf(" ");
- if (t!=-1) {
+ if (t != -1) {
safe_username = safe_username.substring(t);
}
- appd.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()+safe_username));
+ appd.setDataReference(AppDataReference.uniqueAppDataReference(doc,
+ sclient.client.getClientUrn() + safe_username));
}
- scappd.updateAnAppdataEntry(iohandler, scappd.usersData, scappd.newUserData);
+ scappd.updateAnAppdataEntry(iohandler, scappd.usersData,
+ scappd.newUserData);
log.debug("...Successfully updated user AppData entry.");
}
}
log.error("While transferring remaining AppDatas", e);
}
log.debug("Updating Document...");
- // now update the document. - this was basically the doUpdate method in test.ArchiveClient
+ // now update the document. - this was basically the doUpdate method in
+ // test.ArchiveClient
updateDocumentRoots();
try {
iohandler.putVamsasDocument(doc);
log.debug("Successfully written document entry.");
- }
- catch (Exception e) {
- log.error("Marshalling error for vamsas document.",e);
- docupdate = false; // pass on the (probable) object validation error
+ } catch (Exception e) {
+ log.error("Marshalling error for vamsas document.", e);
+ docupdate = false; // pass on the (probable) object validation error
}
iohandler.closeArchive();
- iohandler=null; // so this method cannot be called again for this instance
+ iohandler = null; // so this method cannot be called again for this instance
log.debug("...successully finished and closed.");
return docupdate; // no errors ?
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#finalize()
*/
protected void finalize() throws Throwable {
log.debug("Garbage collecting on ClientDocument instance.");
- if (scappd!=null) {
+ if (scappd != null) {
scappd.finalize();
scappd = null;
}
- if (doc!=null) {
+ if (doc != null) {
doc = null;
}
// disengage from client
- if (sclient!=null && sclient.cdocument==this)
+ if (sclient != null && sclient.cdocument == this)
sclient.cdocument = null;
- sclient=null;
-
+ sclient = null;
+
super.finalize();
}
+
public Vector getUpdatedObjects() {
- // TODO: WALK through the document objects calling the update mechanism for each one, or just pass this vector back to client ?return updatedObjects;
+ // TODO: WALK through the document objects calling the update mechanism for
+ // each one, or just pass this vector back to client ?return updatedObjects;
return null;
}
+
/**
- * if this is set the document will never be written back to the session unless the corruption is fixed.
+ * if this is set the document will never be written back to the session
+ * unless the corruption is fixed.
+ *
* @return the invalidModification
*/
public boolean isInvalidModification() {
return invalidModification;
}
+
/**
- * set if the client has corrupted the Vamsas Document structure somehow.
- * if this is set the document will never be written back to the session unless the corruption is fixed.
- * @param invalidModification the invalidModification to set
+ * set if the client has corrupted the Vamsas Document structure somehow. if
+ * this is set the document will never be written back to the session unless
+ * the corruption is fixed.
+ *
+ * @param invalidModification
+ * the invalidModification to set
*/
public void setInvalidModification(boolean invalidModification) {
this.invalidModification = invalidModification;
-
-package uk.ac.vamsas.client.simpleclient;
-
-
-public class ClientSessionFileWatcherElement extends SessionFileWatcherElement {
-
- private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(VamsasFileWatcherElement.class);
-
- /**
- * count of watch cycle before considering there is no other active client.
- */
- private int timeoutBeforeLastCycle = -1;
-
- private boolean isTimeOutEnable = false;
-
- /**
- * @param watcher
- * @param handler
- */
- public ClientSessionFileWatcherElement(SessionFile watcher,
- WatcherCallBack handler) {
- super(watcher, handler);
- }
-
- /**
- * @param watcher
- * @param handler
- * @param enableWatching
- */
- public ClientSessionFileWatcherElement(SessionFile watcher,
- WatcherCallBack handler, boolean enableWatching) {
- super(watcher, handler, enableWatching);
- }
-
- /**
- * @see uk.ac.vamsas.client.simpleclient.WatcherElement#doWatch()
- * * @return true if the handler was called for a changeEvent
- */
- public boolean doWatch()
- {
- if (!watchForChange || handler==null)
- { //log.debug("!watchForChange || handler==null");
- return false;
- }
- if (watcher==null)
- initWatch(); // somehow not done the first time
- handlerCalled=false;
- Lock doclock=null;
- try
- {
- doclock=watcher.getChangedState();
- }
- catch (Exception e) {
- log.error("Whilst watching "+watcher.getSubject(), e);
- }
- // log.debug("got lock watcher");
- if (doclock==null)
- {//no change detected
- this.cycleCountSinceModif ++;
- if (this.isTimeOutEnable && cycleCountSinceModif > timeoutBeforeLastCycle)
- {
- if(this.handler != null )
- synchronized (this.handler)
- {
- this.callHandler(doclock);
- }
- }
- //log.debug("no modification");
- return false;
- }
- if (this.isTimeOutEnable) this.cycleCountSinceModif =0; //change detected
- if(this.handler != null )
- synchronized (this.handler)
- {
- this.callHandler(doclock);
- }
-
- return true;
- }
-
-
- /**
- * count of cycles since last modification on the file
- */
- protected int cycleCountSinceModif =0;
-
- /**
- * resets count of watch cycles (default value : 0)
- *
- */
- protected void resetCycleCount ()
- {
- this.cycleCountSinceModif = 0;
- }
-
- /**
- * Increases the count of cycles
- *
- */
- protected void increaseCycleCount ()
- {
- this.cycleCountSinceModif ++;
- }
-
- /**
- * Enable the time out if the timeout is greater than zero
- * @param timeoutBeforeLastCycle the timeoutBeforeLastCycle to set
- */
- public void setTimeoutBeforeLastCycle(int timeoutBeforeLastCycle) {
-
- this.timeoutBeforeLastCycle = timeoutBeforeLastCycle;
- if (this.timeoutBeforeLastCycle>0)
- isTimeOutEnable = true;
- }
-
- /**
- * Disables the checking on the count of cycles
- *
- */
- public void disableCycleTimeOut ()
- {
- this.isTimeOutEnable = false;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+public class ClientSessionFileWatcherElement extends SessionFileWatcherElement {\r
+\r
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getLog(VamsasFileWatcherElement.class);\r
+\r
+ /**\r
+ * count of watch cycle before considering there is no other active client.\r
+ */\r
+ private int timeoutBeforeLastCycle = -1;\r
+\r
+ private boolean isTimeOutEnable = false;\r
+\r
+ /**\r
+ * @param watcher\r
+ * @param handler\r
+ */\r
+ public ClientSessionFileWatcherElement(SessionFile watcher,\r
+ WatcherCallBack handler) {\r
+ super(watcher, handler);\r
+ }\r
+\r
+ /**\r
+ * @param watcher\r
+ * @param handler\r
+ * @param enableWatching\r
+ */\r
+ public ClientSessionFileWatcherElement(SessionFile watcher,\r
+ WatcherCallBack handler, boolean enableWatching) {\r
+ super(watcher, handler, enableWatching);\r
+ }\r
+\r
+ /**\r
+ * @see uk.ac.vamsas.client.simpleclient.WatcherElement#doWatch() * @return\r
+ * true if the handler was called for a changeEvent\r
+ */\r
+ public boolean doWatch() {\r
+ if (!watchForChange || handler == null) { // log.debug("!watchForChange || handler==null");\r
+ return false;\r
+ }\r
+ if (watcher == null)\r
+ initWatch(); // somehow not done the first time\r
+ handlerCalled = false;\r
+ Lock doclock = null;\r
+ try {\r
+ doclock = watcher.getChangedState();\r
+ } catch (Exception e) {\r
+ log.error("Whilst watching " + watcher.getSubject(), e);\r
+ }\r
+ // log.debug("got lock watcher");\r
+ if (doclock == null) {// no change detected\r
+ this.cycleCountSinceModif++;\r
+ if (this.isTimeOutEnable && cycleCountSinceModif > timeoutBeforeLastCycle) {\r
+ if (this.handler != null)\r
+ synchronized (this.handler) {\r
+ this.callHandler(doclock);\r
+ }\r
+ }\r
+ // log.debug("no modification");\r
+ return false;\r
+ }\r
+ if (this.isTimeOutEnable)\r
+ this.cycleCountSinceModif = 0; // change detected\r
+ if (this.handler != null)\r
+ synchronized (this.handler) {\r
+ this.callHandler(doclock);\r
+ }\r
+\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * count of cycles since last modification on the file\r
+ */\r
+ protected int cycleCountSinceModif = 0;\r
+\r
+ /**\r
+ * resets count of watch cycles (default value : 0)\r
+ * \r
+ */\r
+ protected void resetCycleCount() {\r
+ this.cycleCountSinceModif = 0;\r
+ }\r
+\r
+ /**\r
+ * Increases the count of cycles\r
+ * \r
+ */\r
+ protected void increaseCycleCount() {\r
+ this.cycleCountSinceModif++;\r
+ }\r
+\r
+ /**\r
+ * Enable the time out if the timeout is greater than zero\r
+ * \r
+ * @param timeoutBeforeLastCycle\r
+ * the timeoutBeforeLastCycle to set\r
+ */\r
+ public void setTimeoutBeforeLastCycle(int timeoutBeforeLastCycle) {\r
+\r
+ this.timeoutBeforeLastCycle = timeoutBeforeLastCycle;\r
+ if (this.timeoutBeforeLastCycle > 0)\r
+ isTimeOutEnable = true;\r
+ }\r
+\r
+ /**\r
+ * Disables the checking on the count of cycles\r
+ * \r
+ */\r
+ public void disableCycleTimeOut() {\r
+ this.isTimeOutEnable = false;\r
+ }\r
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import uk.ac.vamsas.client.*;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.util.Vector;
-
-/**
- * Handler for the clientsFile within a vamsas session thread.
- * @author jim
- */
-public class ClientsFile extends ListFile {
- private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ClientsFile.class);
- /**
- * number of my client in list - passed back when a client
- * is added to list, and used (if valid) for quickly
- * looking up presence of client handle in the list.
- */
- private int syncnum = 1;
-
- public ClientsFile(File filelist) throws IOException {
- super(filelist);
- }
-
- /**
- * internal method for getting clientList - ensures a lock has been made but
- * does not release it.
- *
- * @return list of clients
- */
- private ClientHandle[] retrieveClientHandles() {
- if (lockFile()) {
- try {
- ClientHandle[] clients=null;
- if (fileLock.length()>0) {
-
- ObjectInputStream is = new ObjectInputStream(fileLock.getBufferedInputStream(true));
- Object o;
- o=is.readObject();
- if (o!=null) {
- try {
- clients = (ClientHandle[]) o;
- }
- catch (Exception e) {
- System.err.println("Garbage in the clientHandle list "+this.sessionFile);
- }
- }
- }
- return clients;
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace(System.err);
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
- return null;
- }
- /**
- * get the clientList from the file. May return null if lock failed!
- * @return clientList
- */
- public ClientHandle[] retrieveClientList() {
- if (lockFile()) {
- ClientHandle[] clients = retrieveClientHandles();
- unlockFile();
- return clients;
- }
- return null;
- }
- /**
- * get list from the locked ClientList.
- * @param extantlock
- * @return clientList or null if lock failed (or file was empty)
- */
- public ClientHandle[] retrieveClientList(Lock extantlock) {
- if (lockFile(extantlock)) {
- ClientHandle[] clients = retrieveClientHandles();
- unlockFile();
- return clients;
- }
- return null;
- }
- /**
- * adds clientHandle me to the clientList under an existing lock extantLock.
- * @param me
- * @param extantLock
- * @return client index in list or 0 if lock was invalid or addClient operation failed.
- */
- public int addClient(ClientHandle me, Lock extantLock) {
- return addClient(me, true, extantLock);
- }
-
- /**
- * adds clientHandle me to the clientList under an existing lock.
- * @param me - clientHandle
- * @param disambig - if true then add will fail if an identical clientHandle already exists
- * @param extantLock - existing lock
- * @return client index in list or 0 if addClient (or the lock) failed.
- */
-
- public int addClient(ClientHandle me, boolean disambig, Lock extantLock) {
- if (lockFile(extantLock)) {
- syncnum = addClient(me, disambig);
- unlockFile();
- return syncnum;
- }
- return 0;
- }
-
- /**
- * adds the ClientHandle to the list - if it is not unique, then the
- * ClientHandle object is modified to make it unique in the list. returns the
- * clientNumber for the client in the session.
- *
- * @param me
- * @return
- */
-
- public int addClient(ClientHandle me) {
- syncnum = addClient(me, true);
- unlockFile();
- return syncnum;
- }
-
- /**
- * removes 'me' from the session ClientList without complaint if 'me' isn't in the clientList already.
- * @param me client handle to be removed
- * @param clientlock existing lock passed from watcher.
- */
- public void removeClient(ClientHandle me, Lock clientlock) {
- int mynum=-1;
- if (lockFile(clientlock)) {
- ClientHandle[] clients = retrieveClientHandles();
- if (clients != null) {
- if ((syncnum<=0 || syncnum>clients.length) || clients[syncnum-1]!=me) {
- for (int i = 0, j = clients.length; i < j; i++)
- if (clients[i].equals(me)) {
- mynum=i;
- break;
- }
- } else {
- mynum=syncnum-1;
- }
- if (mynum>-1) {
- ClientHandle[] newlist = new ClientHandle[clients.length - 1];
- for (int k=0,i = 0, j = clients.length; i < j; i++)
- if (i!=mynum)
- newlist[k++] = clients[i];
- if (!putClientList(newlist))
- throw new Error("Failed to write new clientList!"); // failed to put the clientList to disk.
- }
- }
- unlockFile();
- } else {
- throw new Error("Couldn't get lock for "+((sessionFile==null) ? "Unitialised sessionFile in ClientsFile" : sessionFile.getAbsolutePath()));
- }
- }
- /**
- * Adds a ClientHandle to the ClientList file - optionally disambiguating
- * the ClientHandle (modifes the URN).
- * Note: Caller is left to release the lock on the ClientList.
- * @param me
- * @param disambiguate -
- * flag indicating if the URN for me should be disambiguated to
- * differentiate between sessions.
- * @return index of clientHandle in new list, or -1-position of existing
- * clientHandle (if disambiguate is true)
- */
- protected int addClient(ClientHandle me, boolean disambiguate) {
- int newclient = 0;
- int tries=5;
- while (tries-->0 && !lockFile())
- try { Thread.sleep(1); } catch (Exception e){};
- if (lockFile()) {
- ClientHandle[] clients = retrieveClientHandles();
- if (me.getClientUrn()==null) {
- // TODO: move this into ClientUrn as a standard form method.
- me.setClientUrn("vamsas://"+me.getClientName()+":"+me.getVersion()+"/");
- }
- if (clients == null) {
- clients = new ClientHandle[1];
- clients[0] = me;
- newclient = 1;
- } else {
- int k = 0;
- for (int i = 0, j = clients.length; i < j; i++) {
- if (clients[i].equals(me)) {
- if (disambiguate) {
- while (clients[i].equals(me)) {
- me.setClientUrn(me.getClientUrn() + k++); // TODO: make a better
- // disambiguation of
- // urn.
- }
- } else {
- // will not write the ambiguous clientHandle to disk, just return
- // its index.
- return -1 - i;
- }
- }
- }
- int i, j;
- ClientHandle[] newlist = new ClientHandle[clients.length + 1];
- for (i = 0, j = clients.length; i < j; i++)
- newlist[i] = clients[i];
- newlist[j] = me;
- clients = newlist;
- newclient = j+1;
- }
- if (!putClientList(clients))
- return 0; // failed to put the clientList to disk.
- }
- return newclient;
- }
- /**
- * when set true - get FileNotFoundExceptions on WinXP when writing to locked stream after the backup has been made (via the backupFile method)
- */
- boolean backup=false;
- /**
- * safely writes clients array to the file referred to by sessionFile.
- *
- * @param clients
- * @return true if successful write. Throws Errors otherwise.
- */
- protected boolean putClientList(ClientHandle[] clients) {
- if (lockFile()) {
- File templist=null;
- if (backup) {
- templist = backupSessionFile();
- }
- if (!backup || (templist != null)) {
- int retries=3;
- while (retries-->0) {
- try {
- ObjectOutputStream os =
- new ObjectOutputStream(fileLock.getBufferedOutputStream(true));
- log.debug("About to write "+clients.length+" clientHandles to output stream.");
- os.writeObject(clients);
- os.close();
- // All done - remove the backup.
- if (backup)
- templist.delete();
- templist = null;
- retries=-1;
- } catch (Exception e) {
- System.err
- .println("Serious - problems writing to sessionFile.");
- if (retries>0 && templist != null) {
- System.err.println("Recovering from Backup in "
- + templist.getAbsolutePath());
- templist.renameTo(fileLock.target);
- }
- e.printStackTrace(System.err);
- }
- }
- if (retries>-2) {
- System.err
- .println("Serious - problems writing to sessionFile. Giving Up.");
- return false;
- }
- } else {
- throw new Error(
- "Couldn't create backup of the clientList before writing to it!");
- }
- } else {
- throw new Error("Could not lock the clientList: "
- + ((sessionFile == null) ? "Unitialized ClientsFile"
- : " failed to get lock on " + sessionFile.getAbsolutePath()));
- }
- // successful!
- return true;
- }
-
- public void clearList() {
- if (lockFile()) {
- try {
- FileOutputStream fout = fileLock.getFileOutputStream(true);
- fout.flush();
- fout.close();
- } catch (Exception e) {
- throw new Error("Problems trying to clear clientlist!",e);
-
- }
- }
-
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import uk.ac.vamsas.client.*;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.BufferedOutputStream;\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.InputStreamReader;\r
+import java.io.ObjectInputStream;\r
+import java.io.ObjectOutput;\r
+import java.io.ObjectOutputStream;\r
+import java.io.OutputStream;\r
+import java.util.Vector;\r
+\r
+/**\r
+ * Handler for the clientsFile within a vamsas session thread.\r
+ * \r
+ * @author jim\r
+ */\r
+public class ClientsFile extends ListFile {\r
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getLog(ClientsFile.class);\r
+\r
+ /**\r
+ * number of my client in list - passed back when a client is added to list,\r
+ * and used (if valid) for quickly looking up presence of client handle in the\r
+ * list.\r
+ */\r
+ private int syncnum = 1;\r
+\r
+ public ClientsFile(File filelist) throws IOException {\r
+ super(filelist);\r
+ }\r
+\r
+ /**\r
+ * internal method for getting clientList - ensures a lock has been made but\r
+ * does not release it.\r
+ * \r
+ * @return list of clients\r
+ */\r
+ private ClientHandle[] retrieveClientHandles() {\r
+ if (lockFile()) {\r
+ try {\r
+ ClientHandle[] clients = null;\r
+ if (fileLock.length() > 0) {\r
+\r
+ ObjectInputStream is = new ObjectInputStream(fileLock\r
+ .getBufferedInputStream(true));\r
+ Object o;\r
+ o = is.readObject();\r
+ if (o != null) {\r
+ try {\r
+ clients = (ClientHandle[]) o;\r
+ } catch (Exception e) {\r
+ System.err.println("Garbage in the clientHandle list "\r
+ + this.sessionFile);\r
+ }\r
+ }\r
+ }\r
+ return clients;\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace(System.err);\r
+ } catch (Exception e) {\r
+ e.printStackTrace(System.err);\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * get the clientList from the file. May return null if lock failed!\r
+ * \r
+ * @return clientList\r
+ */\r
+ public ClientHandle[] retrieveClientList() {\r
+ if (lockFile()) {\r
+ ClientHandle[] clients = retrieveClientHandles();\r
+ unlockFile();\r
+ return clients;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * get list from the locked ClientList.\r
+ * \r
+ * @param extantlock\r
+ * @return clientList or null if lock failed (or file was empty)\r
+ */\r
+ public ClientHandle[] retrieveClientList(Lock extantlock) {\r
+ if (lockFile(extantlock)) {\r
+ ClientHandle[] clients = retrieveClientHandles();\r
+ unlockFile();\r
+ return clients;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * adds clientHandle me to the clientList under an existing lock extantLock.\r
+ * \r
+ * @param me\r
+ * @param extantLock\r
+ * @return client index in list or 0 if lock was invalid or addClient\r
+ * operation failed.\r
+ */\r
+ public int addClient(ClientHandle me, Lock extantLock) {\r
+ return addClient(me, true, extantLock);\r
+ }\r
+\r
+ /**\r
+ * adds clientHandle me to the clientList under an existing lock.\r
+ * \r
+ * @param me\r
+ * - clientHandle\r
+ * @param disambig\r
+ * - if true then add will fail if an identical clientHandle already\r
+ * exists\r
+ * @param extantLock\r
+ * - existing lock\r
+ * @return client index in list or 0 if addClient (or the lock) failed.\r
+ */\r
+\r
+ public int addClient(ClientHandle me, boolean disambig, Lock extantLock) {\r
+ if (lockFile(extantLock)) {\r
+ syncnum = addClient(me, disambig);\r
+ unlockFile();\r
+ return syncnum;\r
+ }\r
+ return 0;\r
+ }\r
+\r
+ /**\r
+ * adds the ClientHandle to the list - if it is not unique, then the\r
+ * ClientHandle object is modified to make it unique in the list. returns the\r
+ * clientNumber for the client in the session.\r
+ * \r
+ * @param me\r
+ * @return\r
+ */\r
+\r
+ public int addClient(ClientHandle me) {\r
+ syncnum = addClient(me, true);\r
+ unlockFile();\r
+ return syncnum;\r
+ }\r
+\r
+ /**\r
+ * removes 'me' from the session ClientList without complaint if 'me' isn't in\r
+ * the clientList already.\r
+ * \r
+ * @param me\r
+ * client handle to be removed\r
+ * @param clientlock\r
+ * existing lock passed from watcher.\r
+ */\r
+ public void removeClient(ClientHandle me, Lock clientlock) {\r
+ int mynum = -1;\r
+ if (lockFile(clientlock)) {\r
+ ClientHandle[] clients = retrieveClientHandles();\r
+ if (clients != null) {\r
+ if ((syncnum <= 0 || syncnum > clients.length)\r
+ || clients[syncnum - 1] != me) {\r
+ for (int i = 0, j = clients.length; i < j; i++)\r
+ if (clients[i].equals(me)) {\r
+ mynum = i;\r
+ break;\r
+ }\r
+ } else {\r
+ mynum = syncnum - 1;\r
+ }\r
+ if (mynum > -1) {\r
+ ClientHandle[] newlist = new ClientHandle[clients.length - 1];\r
+ for (int k = 0, i = 0, j = clients.length; i < j; i++)\r
+ if (i != mynum)\r
+ newlist[k++] = clients[i];\r
+ if (!putClientList(newlist))\r
+ throw new Error("Failed to write new clientList!"); // failed to put\r
+ // the\r
+ // clientList to\r
+ // disk.\r
+ }\r
+ }\r
+ unlockFile();\r
+ } else {\r
+ throw new Error("Couldn't get lock for "\r
+ + ((sessionFile == null) ? "Unitialised sessionFile in ClientsFile"\r
+ : sessionFile.getAbsolutePath()));\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Adds a ClientHandle to the ClientList file - optionally disambiguating the\r
+ * ClientHandle (modifes the URN). Note: Caller is left to release the lock on\r
+ * the ClientList.\r
+ * \r
+ * @param me\r
+ * @param disambiguate\r
+ * - flag indicating if the URN for me should be disambiguated to\r
+ * differentiate between sessions.\r
+ * @return index of clientHandle in new list, or -1-position of existing\r
+ * clientHandle (if disambiguate is true)\r
+ */\r
+ protected int addClient(ClientHandle me, boolean disambiguate) {\r
+ int newclient = 0;\r
+ int tries = 5;\r
+ while (tries-- > 0 && !lockFile())\r
+ try {\r
+ Thread.sleep(1);\r
+ } catch (Exception e) {\r
+ }\r
+ ;\r
+ if (lockFile()) {\r
+ ClientHandle[] clients = retrieveClientHandles();\r
+ if (me.getClientUrn() == null) {\r
+ // TODO: move this into ClientUrn as a standard form method.\r
+ me.setClientUrn("vamsas://" + me.getClientName() + ":"\r
+ + me.getVersion() + "/");\r
+ }\r
+ if (clients == null) {\r
+ clients = new ClientHandle[1];\r
+ clients[0] = me;\r
+ newclient = 1;\r
+ } else {\r
+ int k = 0;\r
+ for (int i = 0, j = clients.length; i < j; i++) {\r
+ if (clients[i].equals(me)) {\r
+ if (disambiguate) {\r
+ while (clients[i].equals(me)) {\r
+ me.setClientUrn(me.getClientUrn() + k++); // TODO: make a better\r
+ // disambiguation of\r
+ // urn.\r
+ }\r
+ } else {\r
+ // will not write the ambiguous clientHandle to disk, just return\r
+ // its index.\r
+ return -1 - i;\r
+ }\r
+ }\r
+ }\r
+ int i, j;\r
+ ClientHandle[] newlist = new ClientHandle[clients.length + 1];\r
+ for (i = 0, j = clients.length; i < j; i++)\r
+ newlist[i] = clients[i];\r
+ newlist[j] = me;\r
+ clients = newlist;\r
+ newclient = j + 1;\r
+ }\r
+ if (!putClientList(clients))\r
+ return 0; // failed to put the clientList to disk.\r
+ }\r
+ return newclient;\r
+ }\r
+\r
+ /**\r
+ * when set true - get FileNotFoundExceptions on WinXP when writing to locked\r
+ * stream after the backup has been made (via the backupFile method)\r
+ */\r
+ boolean backup = false;\r
+\r
+ /**\r
+ * safely writes clients array to the file referred to by sessionFile.\r
+ * \r
+ * @param clients\r
+ * @return true if successful write. Throws Errors otherwise.\r
+ */\r
+ protected boolean putClientList(ClientHandle[] clients) {\r
+ if (lockFile()) {\r
+ File templist = null;\r
+ if (backup) {\r
+ templist = backupSessionFile();\r
+ }\r
+ if (!backup || (templist != null)) {\r
+ int retries = 3;\r
+ while (retries-- > 0) {\r
+ try {\r
+ ObjectOutputStream os = new ObjectOutputStream(fileLock\r
+ .getBufferedOutputStream(true));\r
+ log.debug("About to write " + clients.length\r
+ + " clientHandles to output stream.");\r
+ os.writeObject(clients);\r
+ os.close();\r
+ // All done - remove the backup.\r
+ if (backup)\r
+ templist.delete();\r
+ templist = null;\r
+ retries = -1;\r
+ } catch (Exception e) {\r
+ System.err.println("Serious - problems writing to sessionFile.");\r
+ if (retries > 0 && templist != null) {\r
+ System.err.println("Recovering from Backup in "\r
+ + templist.getAbsolutePath());\r
+ templist.renameTo(fileLock.target);\r
+ }\r
+ e.printStackTrace(System.err);\r
+ }\r
+ }\r
+ if (retries > -2) {\r
+ System.err\r
+ .println("Serious - problems writing to sessionFile. Giving Up.");\r
+ return false;\r
+ }\r
+ } else {\r
+ throw new Error(\r
+ "Couldn't create backup of the clientList before writing to it!");\r
+ }\r
+ } else {\r
+ throw new Error("Could not lock the clientList: "\r
+ + ((sessionFile == null) ? "Unitialized ClientsFile"\r
+ : " failed to get lock on " + sessionFile.getAbsolutePath()));\r
+ }\r
+ // successful!\r
+ return true;\r
+ }\r
+\r
+ public void clearList() {\r
+ if (lockFile()) {\r
+ try {\r
+ FileOutputStream fout = fileLock.getFileOutputStream(true);\r
+ fout.flush();\r
+ fout.close();\r
+ } catch (Exception e) {\r
+ throw new Error("Problems trying to clear clientlist!", e);\r
+\r
+ }\r
+ }\r
+\r
+ }\r
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.util.Hashtable;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.Events;
-
-/**
- * monitors watcher objects and generates events.
- */
-public class EventGeneratorThread {
- private static Log log = LogFactory.getLog(EventGeneratorThread.class);
- private SimpleClient client;
- private Hashtable handlers; // manager object
- private VamsasSession session;
- /**
- * thread watching all the session's file objects
- */
- protected VamsasFileWatcherThread watchThread=null;
- /**
- * Watcher element for list of all the clientHandles for the session
- */
- protected SessionFileWatcherElement clientfile=null;
- /**
- * the session's vamsasDocument
- */
- protected VamsasFileWatcherElement vamsasfile=null;
- /**
- * written to by client when its app calls storeDocument.
- */
- protected SessionFileWatcherElement storeFile=null;
-
- EventGeneratorThread(VamsasSession s, SimpleClient _client, Hashtable eventhandlers) {
- if (eventhandlers==null || s==null || _client==null)
- throw new Error("Null arguments to EventGeneratorThread constructor.");
- handlers = eventhandlers;
- session = s;
- client = _client;
- log.debug("Creating VamsasFileWatcherThread.");
- watchThread = new VamsasFileWatcherThread(this);
- initWatchers();
- }
-
- private void initWatchers() {
- if (clientfile==null) {
- log.debug("Initializing clientfile Watcher");
- clientfile = session.getClientWatcherElement();
- // handler is set in the Vamsas session
-/* clientfile.setHandler(new WatcherCallBack() {
-
- public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {
- return clientListChanged(watcher, lock);
- }
- });*/
- watchThread.addElement(clientfile);
- }
- final EventGeneratorThread evgen=this;
-
- if (vamsasfile ==null) {
- log.debug("Initializing VamsasFileWatcher");
- vamsasfile = new VamsasFileWatcherElement(session.vamArchive,
- new WatcherCallBack() {
- public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {
- return evgen.documentChanged(lock);
- }
- });
- watchThread.addElement(vamsasfile);
- }
- if (storeFile == null) {
- storeFile = new SessionFileWatcherElement(session.getStoreDocFile(),
- new WatcherCallBack() {
- public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {
- return evgen.storeDocRequest(lock);
- }
- });
- log.debug("Initializing storeDocFile flag watcher");
- }
- /*
- */
- log.debug("Watchers inited.");
- }
- /**
- * Call registered handlers for a vamsas session event
- * @param handlerEvent a named event
- * @param property property name to pass to handler
- * @param oldval old value of property to pass
- * @param newval new value of property to pass
- * @return true if event generation did not raise any exceptions.
- */
- boolean _raise(String handlerEvent, String property, Object oldval, Object newval) {
- PropertyChangeSupport h = (PropertyChangeSupport) handlers.get(handlerEvent);
- if (h!=null) {
- log.debug("Triggering:"+handlerEvent);
- try {
- h.firePropertyChange(property, oldval, newval);
- } catch (Exception e) {
- log.warn("Client Exception during handling of "+handlerEvent, e);
- return false;
- }
- catch (Error e)
- {
- log.error("Serious! Client Error during handling of "+handlerEvent, e);
- return false;
- }
- log.debug("Finished :"+handlerEvent);
- } else
- log.debug("No handlers for raised "+handlerEvent);
- return true;
- }
- protected boolean storeDocRequest(Lock lock) {
- if (log.isDebugEnabled())
- log.debug("StoreDocRequest on "+(lock==null ? (lock.isLocked() ? "" : "Invalid ") : "Non-")+"Existing lock");
- // TODO: define the storeFile semaphore mechanism : file exists - all clients inform their apps, and then the client that wrote the file should delete the file (it should hold the lock to it).
- if (storeFile.getWatcher().exists) {
- _raise(Events.DOCUMENT_FINALIZEAPPDATA, client.getSessionUrn(), null, client);
- // expect client to write to document so update watcher state on return
- vamsasfile.getWatcher().setState();
- lock.release();
- }
- return true;
- }
-
- protected boolean documentChanged(Lock doclock) {
- boolean continueWatching=true;
- if (!block_document_updates) {
- session.vamArchive.fileLock=doclock;
- if (client.pickmanager!=null)
- client.pickmanager.setPassThru(false);
- if (log.isDebugEnabled()) {
- log.debug("Initiating a documentChanged event. Document is "+(client.cdocument==null ? "closed" : "open"));
- }
- // TODO: decide if individual object update handlers are called as well as overall event handler
- if (!_raise(Events.DOCUMENT_UPDATE, client.getSessionUrn(), null, client))
- {
- log.info("Recovering from errors or exceptions generated by client application");
- if (client.cdocument!=null)
- {
- try {
- client.tidyAwaySessionDocumentState();
- }
- catch (Exception e)
- {
- log.warn("Exception generated by vamsas library - when tidying away session document:",e);
- }
- catch (Error e)
- {
- log.error("LIBRARY Implementation error - when tidying away session document:",e);
- }
- }
-
- }
- if (client.pickmanager!=null)
- client.pickmanager.setPassThru(true);
- if (log.isDebugEnabled()) {
- log.debug("Finished handling a documentChanged event. Document is "+(client.cdocument==null ? "closed" : "open"));
- }
- if (client.cdocument!=null)
- {
- log.warn("Implementation Error ? ClientDocument instance has not been closed or updated by handler!");
- }
- /*try {
- client._session.getVamsasDocument().closeArchive();
- } catch (Exception e) {log.warn("Unexpected exception when closing document after update.",e);};
- */
- } else {
- // TODO: check documentChanged */
- log.debug("Ignoring documentChanged event for "+client.getSessionUrn());
- }
- return continueWatching;
- }
- boolean ownsf = false;
- /**
- * Moved to SimpleClientSessionManager
- * scans all watchers and fires changeEvents if necessary
- * @return number of events generated.
- */
- private boolean clientListChanged(WatcherElement clientfile, Lock watchlock) {
- log.debug("ClientListChanged handler called for "+clientfile.getWatcher().getSubject());
- // could make this general - but for now keep simple
- if (watchlock!=null) {
- // TODO: compare new client list to old list version. is it changed ?
- // see what happened to the clientfile - compare our internal version with the one in the file, or just send the updated list out...?
- //
- /**
- * Generated when a new vamsas client is attached to a session (Handle is
- * passed) Note: the newly created client does not receive the event.
- *
- public static final String CLIENT_CREATION = "uk.ac.vamsas.client.events.clientCreateEvent";
- */ // as the test
- /**
- * Generated when a vamsas client leaves a session (Handle is passed to all
- * others).
- public static final String CLIENT_FINALIZATION = "uk.ac.vamsas.client.events.clientFinalizationEvent";
- */ // again - as the test.
- watchlock.release();
- }
- return true;
- }
- /**
- * Events raised by IClient and propagated to others in session
- */
-
- /**
- * number of milliseconds between any file state check.
- */
- long POLL_UNIT = 20;
- protected void wait(int u) {
- if (u<=0)
- u=1;
- long l = System.currentTimeMillis()+POLL_UNIT*u;
- while (System.currentTimeMillis()<l)
- ;
- }
-
-
- private boolean block_document_updates=false;
- int STORE_WAIT=5; // how many units before we decide all clients have finalized their appdatas
- private boolean in_want_to_store_phase=false;
- /**
- * client App requests offline storage of vamsas data.
- * Call blocks whilst other apps do any appData finalizing
- * and then returns (after locking the vamsasDocument in the session)
- * Note - the calling app may also receive events through the EventGeneratorThread for document updates.
- *
- * @return Lock for session.vamArchive
- * @param STORE_WAIT indicates how lock the call will block for when nothing appears to be happening to the session.
- */
- protected Lock want_to_store() {
- if (in_want_to_store_phase) {
- log.error("client error: want_to_store called again before first call has completed.");
- return null;
- }
- in_want_to_store_phase=true;
- // TODO: test the storeDocumentRequest mechanism
- /*/ watchThread.haltWatchers();
- */
- log.debug("Stopping document_update watcher");
- vamsasfile.haltWatch();
- // block_document_updates=true;
- log.debug("Cleared flag for ignoring document_update requests");
-
- log.debug("Sending Store Document Request");
- try {
- session.addStoreDocumentRequest(client.getClientHandle(), client.getUserHandle());
- } catch (Exception e) {
- log.warn("Whilst writing StoreDocumentRequest for "+client.getClientHandle().getClientUrn()+" "+client.getUserHandle(),
- e);
- log.info("trying to continue after storeDocumentRequest exception.");
- }
- log.debug("Waiting for other apps to do FinalizeApp handling.");
- // LATER: refine this semaphore process
- // to make a robust signalling mechanism:
- // app1 requests, app1..n do something (or don't - they may be dead),
- // app1 realises all apps have done their thing, it then continues with synchronized data.
- // this probably needs two files - a request file,
- // and a response file which is acknowledged by the app1 requestor for each app.
- // eventually, no more responses are received for the request, and the app can then only continue with its store.
- FileWatcher sfwatcher=session.getStoreWatcher();
- FileWatcher vfwatcher=session.getDocWatcher();
- int units = 0; // zero if updates occured over a sleep period
- while (units<STORE_WAIT) {
- try {
- Thread.sleep(watchThread.WATCH_SLEEP);
- } catch (InterruptedException e) {
- log.debug("interrupted.");
- }
- if (sfwatcher.hasChanged() || vfwatcher.hasChanged()) {
- units=0;
- } else {
- units++;
- }
- }
-
- block_document_updates=false;
- vamsasfile.enableWatch();
- log.debug("Cleared flag for ignoring document_update requests");
- // wait around again (until our own watcher has woken up and synchronized).
- while (units<STORE_WAIT) {
- try {
- Thread.sleep(watchThread.WATCH_SLEEP);
- } catch (InterruptedException e) {
- log.debug("interrupted.");
- }
- if (sfwatcher.hasChanged() || vfwatcher.hasChanged())
- units=0;
- else
- units++;
- }
-
-
- log.debug("finished waiting.");
- in_want_to_store_phase=false;
- return session.vamArchive.getLock();
- }
- /**
- * count handlers for a particular vamsas event
- * @param event string enumeration from uk.ac.vamsas.client.Events
- * @return -1 for an invalid event, otherwise the number of handlers
- */
- protected int countHandlersFor(String event) {
- if (handlers.containsKey(event)) {
- PropertyChangeSupport handler = (PropertyChangeSupport) handlers.get(event);
- PropertyChangeListener[] listeners;
- if (handler!=null)
- return ((listeners=handler.getPropertyChangeListeners())==null)
- ? -1 : listeners.length;
- }
- return -1;
- }
-
- public void disableDocumentWatch() {
- vamsasfile.haltWatch();
- }
-
- public boolean isDocumentWatchEnabled() {
- return (vamsasfile!=null) && vamsasfile.isWatchEnabled();
- }
-
- public void enableDocumentWatch() {
- vamsasfile.enableWatch();
- }
-
- public boolean isWatcherAlive() {
- return watchThread!=null && watchThread.running && watchThread.isAlive();
- }
-
- public void interruptWatching() {
- if (watchThread!=null && watchThread.isAlive())
- {
- // TODO: find a way of interrupting watcher in a way that prevents file IO being interrupted
- watchThread.interrupt();
- }
-
- }
- /**
- * called to start the session watching thread which generates events
- */
- public void startWatching() {
- enableDocumentWatch();
- watchThread.start();
- while (!watchThread.running && watchThread.isAlive())
- log.debug("Waiting until watcher is really started.");
- }
-
- public void stopWatching() {
- interruptWatching();
- watchThread.haltWatchers();
-
- }
-
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.beans.PropertyChangeListener;\r
+import java.beans.PropertyChangeSupport;\r
+import java.util.Hashtable;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.Events;\r
+\r
+/**\r
+ * monitors watcher objects and generates events.\r
+ */\r
+public class EventGeneratorThread {\r
+ private static Log log = LogFactory.getLog(EventGeneratorThread.class);\r
+\r
+ private SimpleClient client;\r
+\r
+ private Hashtable handlers; // manager object\r
+\r
+ private VamsasSession session;\r
+\r
+ /**\r
+ * thread watching all the session's file objects\r
+ */\r
+ protected VamsasFileWatcherThread watchThread = null;\r
+\r
+ /**\r
+ * Watcher element for list of all the clientHandles for the session\r
+ */\r
+ protected SessionFileWatcherElement clientfile = null;\r
+\r
+ /**\r
+ * the session's vamsasDocument\r
+ */\r
+ protected VamsasFileWatcherElement vamsasfile = null;\r
+\r
+ /**\r
+ * written to by client when its app calls storeDocument.\r
+ */\r
+ protected SessionFileWatcherElement storeFile = null;\r
+\r
+ EventGeneratorThread(VamsasSession s, SimpleClient _client,\r
+ Hashtable eventhandlers) {\r
+ if (eventhandlers == null || s == null || _client == null)\r
+ throw new Error("Null arguments to EventGeneratorThread constructor.");\r
+ handlers = eventhandlers;\r
+ session = s;\r
+ client = _client;\r
+ log.debug("Creating VamsasFileWatcherThread.");\r
+ watchThread = new VamsasFileWatcherThread(this);\r
+ initWatchers();\r
+ }\r
+\r
+ private void initWatchers() {\r
+ if (clientfile == null) {\r
+ log.debug("Initializing clientfile Watcher");\r
+ clientfile = session.getClientWatcherElement();\r
+ // handler is set in the Vamsas session\r
+ /*\r
+ * clientfile.setHandler(new WatcherCallBack() {\r
+ * \r
+ * public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {\r
+ * return clientListChanged(watcher, lock); } });\r
+ */\r
+ watchThread.addElement(clientfile);\r
+ }\r
+ final EventGeneratorThread evgen = this;\r
+\r
+ if (vamsasfile == null) {\r
+ log.debug("Initializing VamsasFileWatcher");\r
+ vamsasfile = new VamsasFileWatcherElement(session.vamArchive,\r
+ new WatcherCallBack() {\r
+ public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {\r
+ return evgen.documentChanged(lock);\r
+ }\r
+ });\r
+ watchThread.addElement(vamsasfile);\r
+ }\r
+ if (storeFile == null) {\r
+ storeFile = new SessionFileWatcherElement(session.getStoreDocFile(),\r
+ new WatcherCallBack() {\r
+ public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {\r
+ return evgen.storeDocRequest(lock);\r
+ }\r
+ });\r
+ log.debug("Initializing storeDocFile flag watcher");\r
+ }\r
+ /*\r
+ */\r
+ log.debug("Watchers inited.");\r
+ }\r
+\r
+ /**\r
+ * Call registered handlers for a vamsas session event\r
+ * \r
+ * @param handlerEvent\r
+ * a named event\r
+ * @param property\r
+ * property name to pass to handler\r
+ * @param oldval\r
+ * old value of property to pass\r
+ * @param newval\r
+ * new value of property to pass\r
+ * @return true if event generation did not raise any exceptions.\r
+ */\r
+ boolean _raise(String handlerEvent, String property, Object oldval,\r
+ Object newval) {\r
+ PropertyChangeSupport h = (PropertyChangeSupport) handlers\r
+ .get(handlerEvent);\r
+ if (h != null) {\r
+ log.debug("Triggering:" + handlerEvent);\r
+ try {\r
+ h.firePropertyChange(property, oldval, newval);\r
+ } catch (Exception e) {\r
+ log.warn("Client Exception during handling of " + handlerEvent, e);\r
+ return false;\r
+ } catch (Error e) {\r
+ log\r
+ .error("Serious! Client Error during handling of " + handlerEvent,\r
+ e);\r
+ return false;\r
+ }\r
+ log.debug("Finished :" + handlerEvent);\r
+ } else\r
+ log.debug("No handlers for raised " + handlerEvent);\r
+ return true;\r
+ }\r
+\r
+ protected boolean storeDocRequest(Lock lock) {\r
+ if (log.isDebugEnabled())\r
+ log.debug("StoreDocRequest on "\r
+ + (lock == null ? (lock.isLocked() ? "" : "Invalid ") : "Non-")\r
+ + "Existing lock");\r
+ // TODO: define the storeFile semaphore mechanism : file exists - all\r
+ // clients inform their apps, and then the client that wrote the file should\r
+ // delete the file (it should hold the lock to it).\r
+ if (storeFile.getWatcher().exists) {\r
+ _raise(Events.DOCUMENT_FINALIZEAPPDATA, client.getSessionUrn(), null,\r
+ client);\r
+ // expect client to write to document so update watcher state on return\r
+ vamsasfile.getWatcher().setState();\r
+ lock.release();\r
+ }\r
+ return true;\r
+ }\r
+\r
+ protected boolean documentChanged(Lock doclock) {\r
+ boolean continueWatching = true;\r
+ if (!block_document_updates) {\r
+ session.vamArchive.fileLock = doclock;\r
+ if (client.pickmanager != null)\r
+ client.pickmanager.setPassThru(false);\r
+ if (log.isDebugEnabled()) {\r
+ log.debug("Initiating a documentChanged event. Document is "\r
+ + (client.cdocument == null ? "closed" : "open"));\r
+ }\r
+ // TODO: decide if individual object update handlers are called as well as\r
+ // overall event handler\r
+ if (!_raise(Events.DOCUMENT_UPDATE, client.getSessionUrn(), null, client)) {\r
+ log\r
+ .info("Recovering from errors or exceptions generated by client application");\r
+ if (client.cdocument != null) {\r
+ try {\r
+ client.tidyAwaySessionDocumentState();\r
+ } catch (Exception e) {\r
+ log\r
+ .warn(\r
+ "Exception generated by vamsas library - when tidying away session document:",\r
+ e);\r
+ } catch (Error e) {\r
+ log\r
+ .error(\r
+ "LIBRARY Implementation error - when tidying away session document:",\r
+ e);\r
+ }\r
+ }\r
+\r
+ }\r
+ if (client.pickmanager != null)\r
+ client.pickmanager.setPassThru(true);\r
+ if (log.isDebugEnabled()) {\r
+ log.debug("Finished handling a documentChanged event. Document is "\r
+ + (client.cdocument == null ? "closed" : "open"));\r
+ }\r
+ if (client.cdocument != null) {\r
+ log\r
+ .warn("Implementation Error ? ClientDocument instance has not been closed or updated by handler!");\r
+ }\r
+ /*\r
+ * try { client._session.getVamsasDocument().closeArchive(); } catch\r
+ * (Exception e)\r
+ * {log.warn("Unexpected exception when closing document after update."\r
+ * ,e);};\r
+ */\r
+ } else {\r
+ // TODO: check documentChanged */\r
+ log.debug("Ignoring documentChanged event for " + client.getSessionUrn());\r
+ }\r
+ return continueWatching;\r
+ }\r
+\r
+ boolean ownsf = false;\r
+\r
+ /**\r
+ * Moved to SimpleClientSessionManager scans all watchers and fires\r
+ * changeEvents if necessary\r
+ * \r
+ * @return number of events generated.\r
+ */\r
+ private boolean clientListChanged(WatcherElement clientfile, Lock watchlock) {\r
+ log.debug("ClientListChanged handler called for "\r
+ + clientfile.getWatcher().getSubject());\r
+ // could make this general - but for now keep simple\r
+ if (watchlock != null) {\r
+ // TODO: compare new client list to old list version. is it changed ?\r
+ // see what happened to the clientfile - compare our internal version with\r
+ // the one in the file, or just send the updated list out...?\r
+ //\r
+ /**\r
+ * Generated when a new vamsas client is attached to a session (Handle is\r
+ * passed) Note: the newly created client does not receive the event.\r
+ * \r
+ * public static final String CLIENT_CREATION =\r
+ * "uk.ac.vamsas.client.events.clientCreateEvent";\r
+ */\r
+ // as the test\r
+ /**\r
+ * Generated when a vamsas client leaves a session (Handle is passed to\r
+ * all others). public static final String CLIENT_FINALIZATION =\r
+ * "uk.ac.vamsas.client.events.clientFinalizationEvent";\r
+ */\r
+ // again - as the test.\r
+ watchlock.release();\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * Events raised by IClient and propagated to others in session\r
+ */\r
+\r
+ /**\r
+ * number of milliseconds between any file state check.\r
+ */\r
+ long POLL_UNIT = 20;\r
+\r
+ protected void wait(int u) {\r
+ if (u <= 0)\r
+ u = 1;\r
+ long l = System.currentTimeMillis() + POLL_UNIT * u;\r
+ while (System.currentTimeMillis() < l)\r
+ ;\r
+ }\r
+\r
+ private boolean block_document_updates = false;\r
+\r
+ int STORE_WAIT = 5; // how many units before we decide all clients have\r
+ // finalized their appdatas\r
+\r
+ private boolean in_want_to_store_phase = false;\r
+\r
+ /**\r
+ * client App requests offline storage of vamsas data. Call blocks whilst\r
+ * other apps do any appData finalizing and then returns (after locking the\r
+ * vamsasDocument in the session) Note - the calling app may also receive\r
+ * events through the EventGeneratorThread for document updates.\r
+ * \r
+ * @return Lock for session.vamArchive\r
+ * @param STORE_WAIT\r
+ * indicates how lock the call will block for when nothing appears to\r
+ * be happening to the session.\r
+ */\r
+ protected Lock want_to_store() {\r
+ if (in_want_to_store_phase) {\r
+ log\r
+ .error("client error: want_to_store called again before first call has completed.");\r
+ return null;\r
+ }\r
+ in_want_to_store_phase = true;\r
+ // TODO: test the storeDocumentRequest mechanism\r
+ /*\r
+ * / watchThread.haltWatchers();\r
+ */\r
+ log.debug("Stopping document_update watcher");\r
+ vamsasfile.haltWatch();\r
+ // block_document_updates=true;\r
+ log.debug("Cleared flag for ignoring document_update requests");\r
+\r
+ log.debug("Sending Store Document Request");\r
+ try {\r
+ session.addStoreDocumentRequest(client.getClientHandle(), client\r
+ .getUserHandle());\r
+ } catch (Exception e) {\r
+ log.warn("Whilst writing StoreDocumentRequest for "\r
+ + client.getClientHandle().getClientUrn() + " "\r
+ + client.getUserHandle(), e);\r
+ log.info("trying to continue after storeDocumentRequest exception.");\r
+ }\r
+ log.debug("Waiting for other apps to do FinalizeApp handling.");\r
+ // LATER: refine this semaphore process\r
+ // to make a robust signalling mechanism:\r
+ // app1 requests, app1..n do something (or don't - they may be dead),\r
+ // app1 realises all apps have done their thing, it then continues with\r
+ // synchronized data.\r
+ // this probably needs two files - a request file,\r
+ // and a response file which is acknowledged by the app1 requestor for each\r
+ // app.\r
+ // eventually, no more responses are received for the request, and the app\r
+ // can then only continue with its store.\r
+ FileWatcher sfwatcher = session.getStoreWatcher();\r
+ FileWatcher vfwatcher = session.getDocWatcher();\r
+ int units = 0; // zero if updates occured over a sleep period\r
+ while (units < STORE_WAIT) {\r
+ try {\r
+ Thread.sleep(watchThread.WATCH_SLEEP);\r
+ } catch (InterruptedException e) {\r
+ log.debug("interrupted.");\r
+ }\r
+ if (sfwatcher.hasChanged() || vfwatcher.hasChanged()) {\r
+ units = 0;\r
+ } else {\r
+ units++;\r
+ }\r
+ }\r
+\r
+ block_document_updates = false;\r
+ vamsasfile.enableWatch();\r
+ log.debug("Cleared flag for ignoring document_update requests");\r
+ // wait around again (until our own watcher has woken up and synchronized).\r
+ while (units < STORE_WAIT) {\r
+ try {\r
+ Thread.sleep(watchThread.WATCH_SLEEP);\r
+ } catch (InterruptedException e) {\r
+ log.debug("interrupted.");\r
+ }\r
+ if (sfwatcher.hasChanged() || vfwatcher.hasChanged())\r
+ units = 0;\r
+ else\r
+ units++;\r
+ }\r
+\r
+ log.debug("finished waiting.");\r
+ in_want_to_store_phase = false;\r
+ return session.vamArchive.getLock();\r
+ }\r
+\r
+ /**\r
+ * count handlers for a particular vamsas event\r
+ * \r
+ * @param event\r
+ * string enumeration from uk.ac.vamsas.client.Events\r
+ * @return -1 for an invalid event, otherwise the number of handlers\r
+ */\r
+ protected int countHandlersFor(String event) {\r
+ if (handlers.containsKey(event)) {\r
+ PropertyChangeSupport handler = (PropertyChangeSupport) handlers\r
+ .get(event);\r
+ PropertyChangeListener[] listeners;\r
+ if (handler != null)\r
+ return ((listeners = handler.getPropertyChangeListeners()) == null) ? -1\r
+ : listeners.length;\r
+ }\r
+ return -1;\r
+ }\r
+\r
+ public void disableDocumentWatch() {\r
+ vamsasfile.haltWatch();\r
+ }\r
+\r
+ public boolean isDocumentWatchEnabled() {\r
+ return (vamsasfile != null) && vamsasfile.isWatchEnabled();\r
+ }\r
+\r
+ public void enableDocumentWatch() {\r
+ vamsasfile.enableWatch();\r
+ }\r
+\r
+ public boolean isWatcherAlive() {\r
+ return watchThread != null && watchThread.running && watchThread.isAlive();\r
+ }\r
+\r
+ public void interruptWatching() {\r
+ if (watchThread != null && watchThread.isAlive()) {\r
+ // TODO: find a way of interrupting watcher in a way that prevents file IO\r
+ // being interrupted\r
+ watchThread.interrupt();\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * called to start the session watching thread which generates events\r
+ */\r
+ public void startWatching() {\r
+ enableDocumentWatch();\r
+ watchThread.start();\r
+ while (!watchThread.running && watchThread.isAlive())\r
+ log.debug("Waiting until watcher is really started.");\r
+ }\r
+\r
+ public void stopWatching() {\r
+ interruptWatching();\r
+ watchThread.haltWatchers();\r
+\r
+ }\r
+\r
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileChannel;
-import java.nio.channels.ReadableByteChannel;
-/**
- * File based Locking mechanism to get around some bizarre limitations of JarEntry seeking.
- * Abstract locks have a target file, to which access is controlled when a lock is held. Native locks on WindowsXP seem to conflict with Jar seek operations, so a file lock creates an advisory lock.
- * Method:
- * A lock file is created, if it doesn't already exist - the naming convention is TargetFile+suffixSeparator+_LockSuffix.
- * A lock is obtained by locking the lock file with a native lock. The NativeLock is used for this.
- * @author JimP
- *
- */
-public class FileLock extends Lock {
- private File _lock = null;
- protected static String _LockSuffix="lck";
- private NativeLock advisory=null;
- /**
- * ensure that the _lock file exists
- * and create a lock
- */
- private boolean ensureLockFile(boolean block) {
- if (_lock==null)
- return false;
- if (advisory!=null && advisory.isLocked())
- return true;
- try {
- advisory=new NativeLock(_lock, block);
- } catch (Exception e) {
- if (!_lock.exists()) {
- // advisory cannot be created. this is serious.
- log.fatal("Failed to create advisory lock file "+_lock,e);
- throw new Error("Failed to create advisory lock file "+_lock);
- }
- }
- return (advisory!=null) && advisory.isLocked();
- }
- /**
- * call to clear up a filelock file after its been made
- *
- */
- private void tidy() {
- if (_lock!=null) {
- if ( advisory!=null) {
- // TODO: fix occasional exceptions raised here (usually on JVM shutdown)
- if (advisory.target!=null) {
- advisory.target.deleteOnExit(); // release will null the target
- }
- advisory.release(true);
- }
- advisory=null;
- _lock=null;
- }
- }
- /**
- * @param lockfile
- * @param block true means thread blocks until FileLock is obtained.
- */
- public FileLock(File lockfile, boolean block) {
- super(lockfile);
- // try and get a lock.
- try {
- _lock = make_lockForTarget(lockfile);
- if (!ensureLockFile(block)) {
- log.debug("Couldn't get lock on "+_lock);
- tidy();
- return;
- }
- // create target file ready to be written to if necessary.
- if (!lockfile.exists())
- if (!lockfile.createNewFile()) {
- log.warn("Failed to create locked file "+lockfile);
- return;
- }
- //openRaFile();
- } catch (FileNotFoundException e) {
- //
- log.debug("FileLock failed with target="+lockfile+" and lockfile suffix of "+_LockSuffix);
- //log.error("Error! Couldn't create a lockfile at "
- // + lockfile.getAbsolutePath(), e);
- } catch (IOException e) {
- log.error("Error! Problems with IO when creating a lock on "
- + lockfile.getAbsolutePath(),e);
- }
- }
- /**
- *
- * @param lockfile target of lock
- * @return file object that will be locked for lockfile
- */
- private File make_lockForTarget(File lockfile) {
- return new File(lockfile.getParentFile(), lockfile.getName()+"."+_LockSuffix);
- }
- private boolean openRaFile() throws IOException {
- if (target==null)
- return false;
- if (advisory==null || !advisory.isLocked())
- return false;
- if (rafile==null || rafile.getFD()==null || !rafile.getFD().valid()) {
- rafile=new RandomAccessFile(target,"rw");
- } else {
- if (log.isDebugEnabled())
- log.debug("Reusing existing RandomAccessFile on "+target);
- }
- return (rafile.getChannel()!=null) && rafile.getChannel().isOpen();
- }
-
- public boolean isLocked() {
- if (advisory != null) {
- if (advisory.isLocked())
- return true;
- advisory=null;
- if (log.isDebugEnabled())
- log.debug("Lockfile "+_lock+" unexpectedly deleted ?");
- }
- return false;
- }
-
- public void release() {
- release(true);
- }
-
- public void release(boolean closeChannel) {
- if (!isLocked())
- return;
- if (rafile!=null) {
- if (closeChannel) {
- try {
- rafile.close();
- } catch (Exception e) {
- log.debug("Unexpected exception whilst closing RandomAccessFile on "+target, e);
- }
- rafile=null; // do not hold reference to rafile anymore either
- }
- if (log.isDebugEnabled())
- log.debug("Releasing advisory lock on "+target);
- // TODO: LATER: verify this change in closeChannel semantics really is correct - ArchiveClient works correctly
- }
- tidy();
- }
-
- public FileInputStream getFileInputStream(boolean atStart) throws IOException {
- if (!isLocked()) {
- log.debug("Don't hold lock on "+target+" to get locked FileInputStream.");
- return null;
- }
- openRaFile();
- if (atStart)
- rafile.seek(0);
- return new FileInputStream(rafile.getFD());
- }
-
-
- public FileOutputStream getFileOutputStream(boolean clear) throws IOException {
- if (!isLocked()) {
- log.debug("Don't hold lock on "+target+" to get locked FileOutputStream.");
- return null;
- }
- openRaFile();
- if (clear) {
- rafile.seek(0);
- rafile.setLength(0);
- } else
- rafile.seek(rafile.length());
- return new LockedFileOutputStream(rafile.getFD());
- }
-
-
- public BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException {
- log.debug("Getting BufferedOutputStream (clear="+clear+")");
- FileOutputStream fos = getFileOutputStream(clear);
- if (fos!=null)
- return new BufferedOutputStream(fos);
- return null;
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.simpleclient.Lock#getLength()
- */
- public long length() {
- if (isLocked()) {
- if (!target.exists()) {
- try {
- target.createNewFile();
- } catch (Exception e) {
- log.error("Invalid lock:Failed to create target file "+target);
- tidy();
- return -1;
- }
- return 0;
- }
- return target.length();
- }
- return -1;
- }
- protected void finalize() throws Throwable {
- release(true); // we explicitly lose the lock here.
- super.finalize();
- }
- public RandomAccessFile getRaFile() throws IOException {
- if (isLocked() && openRaFile()) {
- return rafile;
- }
- log.debug("Failed to getRaFile on target "+target);
- return null;
- }
- public FileChannel getRaChannel() throws IOException {
- if (isLocked() && openRaFile()) {
- return rafile.getChannel();
- }
- log.debug("Failed to getRaChannel on target "+target);
- return null;
- }
- public boolean isTargetLockFile(File afile) {
- if (isLocked())
- {
- if (target.equals(afile) || make_lockForTarget(target).equals(afile))
- return true;
- }
- return false;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.BufferedOutputStream;\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.RandomAccessFile;\r
+import java.nio.channels.FileChannel;\r
+import java.nio.channels.ReadableByteChannel;\r
+\r
+/**\r
+ * File based Locking mechanism to get around some bizarre limitations of\r
+ * JarEntry seeking. Abstract locks have a target file, to which access is\r
+ * controlled when a lock is held. Native locks on WindowsXP seem to conflict\r
+ * with Jar seek operations, so a file lock creates an advisory lock. Method: A\r
+ * lock file is created, if it doesn't already exist - the naming convention is\r
+ * TargetFile+suffixSeparator+_LockSuffix. A lock is obtained by locking the\r
+ * lock file with a native lock. The NativeLock is used for this.\r
+ * \r
+ * @author JimP\r
+ * \r
+ */\r
+public class FileLock extends Lock {\r
+ private File _lock = null;\r
+\r
+ protected static String _LockSuffix = "lck";\r
+\r
+ private NativeLock advisory = null;\r
+\r
+ /**\r
+ * ensure that the _lock file exists and create a lock\r
+ */\r
+ private boolean ensureLockFile(boolean block) {\r
+ if (_lock == null)\r
+ return false;\r
+ if (advisory != null && advisory.isLocked())\r
+ return true;\r
+ try {\r
+ advisory = new NativeLock(_lock, block);\r
+ } catch (Exception e) {\r
+ if (!_lock.exists()) {\r
+ // advisory cannot be created. this is serious.\r
+ log.fatal("Failed to create advisory lock file " + _lock, e);\r
+ throw new Error("Failed to create advisory lock file " + _lock);\r
+ }\r
+ }\r
+ return (advisory != null) && advisory.isLocked();\r
+ }\r
+\r
+ /**\r
+ * call to clear up a filelock file after its been made\r
+ * \r
+ */\r
+ private void tidy() {\r
+ if (_lock != null) {\r
+ if (advisory != null) {\r
+ // TODO: fix occasional exceptions raised here (usually on JVM shutdown)\r
+ if (advisory.target != null) {\r
+ advisory.target.deleteOnExit(); // release will null the target\r
+ }\r
+ advisory.release(true);\r
+ }\r
+ advisory = null;\r
+ _lock = null;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * @param lockfile\r
+ * @param block\r
+ * true means thread blocks until FileLock is obtained.\r
+ */\r
+ public FileLock(File lockfile, boolean block) {\r
+ super(lockfile);\r
+ // try and get a lock.\r
+ try {\r
+ _lock = make_lockForTarget(lockfile);\r
+ if (!ensureLockFile(block)) {\r
+ log.debug("Couldn't get lock on " + _lock);\r
+ tidy();\r
+ return;\r
+ }\r
+ // create target file ready to be written to if necessary.\r
+ if (!lockfile.exists())\r
+ if (!lockfile.createNewFile()) {\r
+ log.warn("Failed to create locked file " + lockfile);\r
+ return;\r
+ }\r
+ // openRaFile();\r
+ } catch (FileNotFoundException e) {\r
+ //\r
+ log.debug("FileLock failed with target=" + lockfile\r
+ + " and lockfile suffix of " + _LockSuffix);\r
+ // log.error("Error! Couldn't create a lockfile at "\r
+ // + lockfile.getAbsolutePath(), e);\r
+ } catch (IOException e) {\r
+ log.error("Error! Problems with IO when creating a lock on "\r
+ + lockfile.getAbsolutePath(), e);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @param lockfile\r
+ * target of lock\r
+ * @return file object that will be locked for lockfile\r
+ */\r
+ private File make_lockForTarget(File lockfile) {\r
+ return new File(lockfile.getParentFile(), lockfile.getName() + "."\r
+ + _LockSuffix);\r
+ }\r
+\r
+ private boolean openRaFile() throws IOException {\r
+ if (target == null)\r
+ return false;\r
+ if (advisory == null || !advisory.isLocked())\r
+ return false;\r
+ if (rafile == null || rafile.getFD() == null || !rafile.getFD().valid()) {\r
+ rafile = new RandomAccessFile(target, "rw");\r
+ } else {\r
+ if (log.isDebugEnabled())\r
+ log.debug("Reusing existing RandomAccessFile on " + target);\r
+ }\r
+ return (rafile.getChannel() != null) && rafile.getChannel().isOpen();\r
+ }\r
+\r
+ public boolean isLocked() {\r
+ if (advisory != null) {\r
+ if (advisory.isLocked())\r
+ return true;\r
+ advisory = null;\r
+ if (log.isDebugEnabled())\r
+ log.debug("Lockfile " + _lock + " unexpectedly deleted ?");\r
+ }\r
+ return false;\r
+ }\r
+\r
+ public void release() {\r
+ release(true);\r
+ }\r
+\r
+ public void release(boolean closeChannel) {\r
+ if (!isLocked())\r
+ return;\r
+ if (rafile != null) {\r
+ if (closeChannel) {\r
+ try {\r
+ rafile.close();\r
+ } catch (Exception e) {\r
+ log.debug("Unexpected exception whilst closing RandomAccessFile on "\r
+ + target, e);\r
+ }\r
+ rafile = null; // do not hold reference to rafile anymore either\r
+ }\r
+ if (log.isDebugEnabled())\r
+ log.debug("Releasing advisory lock on " + target);\r
+ // TODO: LATER: verify this change in closeChannel semantics really is\r
+ // correct - ArchiveClient works correctly\r
+ }\r
+ tidy();\r
+ }\r
+\r
+ public FileInputStream getFileInputStream(boolean atStart) throws IOException {\r
+ if (!isLocked()) {\r
+ log.debug("Don't hold lock on " + target\r
+ + " to get locked FileInputStream.");\r
+ return null;\r
+ }\r
+ openRaFile();\r
+ if (atStart)\r
+ rafile.seek(0);\r
+ return new FileInputStream(rafile.getFD());\r
+ }\r
+\r
+ public FileOutputStream getFileOutputStream(boolean clear) throws IOException {\r
+ if (!isLocked()) {\r
+ log.debug("Don't hold lock on " + target\r
+ + " to get locked FileOutputStream.");\r
+ return null;\r
+ }\r
+ openRaFile();\r
+ if (clear) {\r
+ rafile.seek(0);\r
+ rafile.setLength(0);\r
+ } else\r
+ rafile.seek(rafile.length());\r
+ return new LockedFileOutputStream(rafile.getFD());\r
+ }\r
+\r
+ public BufferedOutputStream getBufferedOutputStream(boolean clear)\r
+ throws IOException {\r
+ log.debug("Getting BufferedOutputStream (clear=" + clear + ")");\r
+ FileOutputStream fos = getFileOutputStream(clear);\r
+ if (fos != null)\r
+ return new BufferedOutputStream(fos);\r
+ return null;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.simpleclient.Lock#getLength()\r
+ */\r
+ public long length() {\r
+ if (isLocked()) {\r
+ if (!target.exists()) {\r
+ try {\r
+ target.createNewFile();\r
+ } catch (Exception e) {\r
+ log.error("Invalid lock:Failed to create target file " + target);\r
+ tidy();\r
+ return -1;\r
+ }\r
+ return 0;\r
+ }\r
+ return target.length();\r
+ }\r
+ return -1;\r
+ }\r
+\r
+ protected void finalize() throws Throwable {\r
+ release(true); // we explicitly lose the lock here.\r
+ super.finalize();\r
+ }\r
+\r
+ public RandomAccessFile getRaFile() throws IOException {\r
+ if (isLocked() && openRaFile()) {\r
+ return rafile;\r
+ }\r
+ log.debug("Failed to getRaFile on target " + target);\r
+ return null;\r
+ }\r
+\r
+ public FileChannel getRaChannel() throws IOException {\r
+ if (isLocked() && openRaFile()) {\r
+ return rafile.getChannel();\r
+ }\r
+ log.debug("Failed to getRaChannel on target " + target);\r
+ return null;\r
+ }\r
+\r
+ public boolean isTargetLockFile(File afile) {\r
+ if (isLocked()) {\r
+ if (target.equals(afile) || make_lockForTarget(target).equals(afile))\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+}\r
-/**
- *
- */
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-
-
-/**
- * Watches a particular file for its creation, deletion, or
- * modification. The watcher is thread safe and different
- * instances watching the state of a particular file carry
- * their own state record for the file.
- */
-public class FileWatcher {
-
- private File subject = null;
-
- private long lastStat[];
- boolean waslocked=false;
- boolean exists = false;
- /**
- * transient lock on subject - can be passed back to calling class
- * to preserve new state of file for immediate reading.
- */
- private Lock subjectLock = null;
- /**
- * clear local locks on subject.
- *
- */
- private void clearLock() {
- if (subjectLock!=null)
- subjectLock.release();
- subjectLock=null;
- }
- /**
- *
- * @return true if subject exists and is locked by another process.
- */
- private boolean checkLock() {
- if (subject!=null && subject.exists()) {
- if (subjectLock!=null) {
- subjectLock.release();
- }
- subjectLock = LockFactory.tryLock(subject);
- if (subjectLock.isLocked()) {
- return false;
- }
- clearLock();
- return true;
- }
- return false;
- }
-
- private long[] getStat(File subject) {
- return new long[] { subject.lastModified(), subject.length() };
- }
- private boolean compStat(long[] stat, long[] newstat) {
- if (stat[0]!=newstat[0] || stat[1]!=newstat[1])
- return false;
- return true;
- }
- /**
- * Detect changes in file state and release of any
- * lock in place during change.
- * @return true if file state has changed. Leaves lock in subjectLock (ready to be passed to caller)
- */
- private boolean check() {
- if (subject != null) {
- if (!subject.exists()) {
- if (exists) {
- if (!waslocked) {
- // !checkLock()) {
-
- exists = false;
- // waslocked=false;
- return true;
- }
- }
- // locked - state change registered after lock is released
- return false;
- } else {
- long[] newStat = getStat(subject); // subject.lastModified();
- if (!checkLock()) {
- // file is free to access, return state change
- if (!exists || !compStat(lastStat, newStat)) {
- waslocked=false;
- exists=true;
- lastStat=newStat;
- return true;
- }
- // no change
- return false;
- } else {
- waslocked=true;
- return false;
- }
- }
- }
- return false;
- }
- /**
- * updates internal record of file state when caller has intentionally
- * modified subject. (ignores locked-state of subject)
- */
- public void setState() {
- if (subject!=null) {
- if (exists = subject.exists()) {
- lastStat = getStat(subject);
- waslocked = false;
- }
- }
- }
-
- /**
- * Make a watcher for a particular file. If the file doesn't exist, the
- * watcher will watch for its creation (and indicate a change of state)
- * For locked files, the removal of a lock constitutes a change of
- * state if the file was modified.
- *
- * @param subject
- */
-
- public FileWatcher(File subject) {
- this.subject = subject;
- setState();
- }
- /**
- * Test for change in file state. Only indicates a change
- * after any lock on a file has been released.
- * @return true if file has been modified.
- */
- public boolean hasChanged() {
- boolean res = check();
- clearLock();
- return res;
- }
- /**
- * passes lock back to caller if hasChanged returned true.
- * @return
- */
- public Lock getChangedState() {
- boolean res = check();
- if (res)
- return subjectLock;
- else {
- clearLock();
- return null;
- }
- }
- /**
- * safely? getting current state of the watched file
- * @return
- */
- public long[] getCurrentState() {
- return getStat(subject);
- }
- /**
- * safely compare an externally recorded state with the current state
- * for significant modifications.
- * @param a
- * @param b
- * @return
- */
- public boolean diffState(long[] a, long[] b) {
- return compStat(a,b);
- }
- /**
- * @return the subject
- */
- public File getSubject() {
- return subject;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+\r
+/**\r
+ * Watches a particular file for its creation, deletion, or modification. The\r
+ * watcher is thread safe and different instances watching the state of a\r
+ * particular file carry their own state record for the file.\r
+ */\r
+public class FileWatcher {\r
+\r
+ private File subject = null;\r
+\r
+ private long lastStat[];\r
+\r
+ boolean waslocked = false;\r
+\r
+ boolean exists = false;\r
+\r
+ /**\r
+ * transient lock on subject - can be passed back to calling class to preserve\r
+ * new state of file for immediate reading.\r
+ */\r
+ private Lock subjectLock = null;\r
+\r
+ /**\r
+ * clear local locks on subject.\r
+ * \r
+ */\r
+ private void clearLock() {\r
+ if (subjectLock != null)\r
+ subjectLock.release();\r
+ subjectLock = null;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return true if subject exists and is locked by another process.\r
+ */\r
+ private boolean checkLock() {\r
+ if (subject != null && subject.exists()) {\r
+ if (subjectLock != null) {\r
+ subjectLock.release();\r
+ }\r
+ subjectLock = LockFactory.tryLock(subject);\r
+ if (subjectLock.isLocked()) {\r
+ return false;\r
+ }\r
+ clearLock();\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ private long[] getStat(File subject) {\r
+ return new long[] { subject.lastModified(), subject.length() };\r
+ }\r
+\r
+ private boolean compStat(long[] stat, long[] newstat) {\r
+ if (stat[0] != newstat[0] || stat[1] != newstat[1])\r
+ return false;\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * Detect changes in file state and release of any lock in place during\r
+ * change.\r
+ * \r
+ * @return true if file state has changed. Leaves lock in subjectLock (ready\r
+ * to be passed to caller)\r
+ */\r
+ private boolean check() {\r
+ if (subject != null) {\r
+ if (!subject.exists()) {\r
+ if (exists) {\r
+ if (!waslocked) {\r
+ // !checkLock()) {\r
+\r
+ exists = false;\r
+ // waslocked=false;\r
+ return true;\r
+ }\r
+ }\r
+ // locked - state change registered after lock is released\r
+ return false;\r
+ } else {\r
+ long[] newStat = getStat(subject); // subject.lastModified();\r
+ if (!checkLock()) {\r
+ // file is free to access, return state change\r
+ if (!exists || !compStat(lastStat, newStat)) {\r
+ waslocked = false;\r
+ exists = true;\r
+ lastStat = newStat;\r
+ return true;\r
+ }\r
+ // no change\r
+ return false;\r
+ } else {\r
+ waslocked = true;\r
+ return false;\r
+ }\r
+ }\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * updates internal record of file state when caller has intentionally\r
+ * modified subject. (ignores locked-state of subject)\r
+ */\r
+ public void setState() {\r
+ if (subject != null) {\r
+ if (exists = subject.exists()) {\r
+ lastStat = getStat(subject);\r
+ waslocked = false;\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Make a watcher for a particular file. If the file doesn't exist, the\r
+ * watcher will watch for its creation (and indicate a change of state) For\r
+ * locked files, the removal of a lock constitutes a change of state if the\r
+ * file was modified.\r
+ * \r
+ * @param subject\r
+ */\r
+\r
+ public FileWatcher(File subject) {\r
+ this.subject = subject;\r
+ setState();\r
+ }\r
+\r
+ /**\r
+ * Test for change in file state. Only indicates a change after any lock on a\r
+ * file has been released.\r
+ * \r
+ * @return true if file has been modified.\r
+ */\r
+ public boolean hasChanged() {\r
+ boolean res = check();\r
+ clearLock();\r
+ return res;\r
+ }\r
+\r
+ /**\r
+ * passes lock back to caller if hasChanged returned true.\r
+ * \r
+ * @return\r
+ */\r
+ public Lock getChangedState() {\r
+ boolean res = check();\r
+ if (res)\r
+ return subjectLock;\r
+ else {\r
+ clearLock();\r
+ return null;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * safely? getting current state of the watched file\r
+ * \r
+ * @return\r
+ */\r
+ public long[] getCurrentState() {\r
+ return getStat(subject);\r
+ }\r
+\r
+ /**\r
+ * safely compare an externally recorded state with the current state for\r
+ * significant modifications.\r
+ * \r
+ * @param a\r
+ * @param b\r
+ * @return\r
+ */\r
+ public boolean diffState(long[] a, long[] b) {\r
+ return compStat(a, b);\r
+ }\r
+\r
+ /**\r
+ * @return the subject\r
+ */\r
+ public File getSubject() {\r
+ return subject;\r
+ }\r
+}\r
-/**
- *
- */
-package uk.ac.vamsas.client.simpleclient;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.ClientHandle;
-import uk.ac.vamsas.client.SessionHandle;
-import uk.ac.vamsas.client.UserHandle;
-import uk.ac.vamsas.client.Vobject;
-import uk.ac.vamsas.client.VorbaId;
-import uk.ac.vamsas.client.VorbaIdFactory;
-import uk.ac.vamsas.objects.utils.document.VersionEntries;
-
-import java.util.Hashtable;
-import java.util.zip.CRC32;
-/**
- * Simplest VorbaId constructor
- * @author jimp
- *
- */
-public class IdFactory extends VorbaIdFactory {
- static Log log = LogFactory.getLog(IdFactory.class);
- private SessionHandle session=null;
- private ClientHandle client;
- private UserHandle user;
- private CRC32 unique=new CRC32(); // used to attempt a unique but predictable stream for IDs
- private String idstring;
- int sequence=1; // incrementing value for next new ID
- /**
- *
- */
- public IdFactory() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param session
- * @param client
- * @param user
- */
- protected IdFactory(SessionHandle session, ClientHandle client, UserHandle user) {
- super();
- this.session = session;
- this.client = client;
- this.user = user;
- unique.reset();
- unique.update(new Object[] { session, client, user}.toString().getBytes());
- // TODO: Ensure format of URNs and use standard composition methods.
- idstring = client.getClientNCname()+"_"+unique.getValue()+".";
- extantids=new Hashtable();
- this.extanthashv=new Hashtable();
- }
- /**
- * Create IdFactory with existing object hashes and id set
- * @param session
- * @param client
- * @param user
- * @param extanthashv hash of existing VorbaIds from a previous read of same document
- */
- protected IdFactory(SessionHandle session, ClientHandle client, UserHandle user, Hashtable extanthashv) {
- this(session, client, user);
- this.extanthashv = extanthashv;
- }
- /**
- * values for keys in this hash can be used to reference the uk.ac.vamsas.client.Vobject instance for the VorbaId string.
- * @return the hash of all VorbaIds
- */
- protected Hashtable getVorbaIdHash() {
- return extantids;
- }
- /**
- * values for keys in this hash are Vobjhash objects created for each Vobj with a VorbaId
- * after this factory has been used to write a vamsas archive.
- * @return the hash of all VorbaIds and their hash values.
- */
- protected Hashtable getVobjhashVals() {
- return extanthashv;
- }
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.VorbaIdFactory#makeVorbaId()
- */
- public VorbaId makeVorbaId(Vobject vobject) {
- if (session==null)
- throw new Error("makeVorbaId called on improperly initialised IdFactory Vobject!");
- if (!vobject.isRegisterable())
- throw new Error("makeVorbaId called on unregisterable object.");
- if (vobject.isRegistered())
- throw new Error("makeVorbaId called on already registered object.");
- String newidstring;
- do {
- if (sequence>0) {
- sequence++;
- } else {
- idstring+="1/";
- sequence=1;
- }
- newidstring=idstring+Integer.toString(sequence);
- } while (extantids.containsKey(newidstring));
- VorbaId id = newId(newidstring); // VorbaId.hash()==newidstring.hash() so we can still recover vobject
- extantids.put(id, vobject); // hash the Vobject by its new Id
- return id;
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.VorbaIdFactory#setSession(uk.ac.vamsas.client.SessionHandle)
- */
- protected void setSession(SessionHandle sessionhandle) {
- if (sessionhandle!=null)
- session=sessionhandle;
- else
- log.warn("setSession(null) called.");
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.VorbaIdFactory#getSessionHandle()
- */
- public SessionHandle getSessionHandle() {
- return session;
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.VorbaIdFactory#setClient(uk.ac.vamsas.client.ClientHandle)
- */
- protected void setClient(ClientHandle appHandle) {
- if (appHandle!=null)
- client = appHandle;
- else
- log.warn("setClient(null) called.");
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.VorbaIdFactory#getClientHandle()
- */
- public ClientHandle getClientHandle() {
- return client;
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.VorbaIdFactory#setUser(uk.ac.vamsas.client.UserHandle)
- */
- protected void setUser(UserHandle userHandle) {
- if (userHandle!=null)
- user = userHandle;
- else
- log.warn("setUser(null) called.");
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.VorbaIdFactory#getUserHandle()
- */
- public UserHandle getUserHandle() {
- return user;
- }
- /**
- * Convenience method used for default behaviour in testing
- * and any anonymous internal vamsasDocument unmarshalling
- * @param clientname
- * @return
- */
- protected static IdFactory getDummyFactory(String clientname) {
- if (clientname==null)
- clientname="uk.ac.vamsas.client.simpleclient.IdFactory";
- return new IdFactory(new SessionHandle("dummy.session"),
- new ClientHandle(clientname,VersionEntries.latestVersion()),
- new UserHandle(clientname, "Arnold User's Inc."));
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.ClientHandle;\r
+import uk.ac.vamsas.client.SessionHandle;\r
+import uk.ac.vamsas.client.UserHandle;\r
+import uk.ac.vamsas.client.Vobject;\r
+import uk.ac.vamsas.client.VorbaId;\r
+import uk.ac.vamsas.client.VorbaIdFactory;\r
+import uk.ac.vamsas.objects.utils.document.VersionEntries;\r
+\r
+import java.util.Hashtable;\r
+import java.util.zip.CRC32;\r
+\r
+/**\r
+ * Simplest VorbaId constructor\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class IdFactory extends VorbaIdFactory {\r
+ static Log log = LogFactory.getLog(IdFactory.class);\r
+\r
+ private SessionHandle session = null;\r
+\r
+ private ClientHandle client;\r
+\r
+ private UserHandle user;\r
+\r
+ private CRC32 unique = new CRC32(); // used to attempt a unique but\r
+ // predictable stream for IDs\r
+\r
+ private String idstring;\r
+\r
+ int sequence = 1; // incrementing value for next new ID\r
+\r
+ /**\r
+ * \r
+ */\r
+ public IdFactory() {\r
+ super();\r
+ // TODO Auto-generated constructor stub\r
+ }\r
+\r
+ /**\r
+ * @param session\r
+ * @param client\r
+ * @param user\r
+ */\r
+ protected IdFactory(SessionHandle session, ClientHandle client,\r
+ UserHandle user) {\r
+ super();\r
+ this.session = session;\r
+ this.client = client;\r
+ this.user = user;\r
+ unique.reset();\r
+ unique.update(new Object[] { session, client, user }.toString().getBytes());\r
+ // TODO: Ensure format of URNs and use standard composition methods.\r
+ idstring = client.getClientNCname() + "_" + unique.getValue() + ".";\r
+ extantids = new Hashtable();\r
+ this.extanthashv = new Hashtable();\r
+ }\r
+\r
+ /**\r
+ * Create IdFactory with existing object hashes and id set\r
+ * \r
+ * @param session\r
+ * @param client\r
+ * @param user\r
+ * @param extanthashv\r
+ * hash of existing VorbaIds from a previous read of same document\r
+ */\r
+ protected IdFactory(SessionHandle session, ClientHandle client,\r
+ UserHandle user, Hashtable extanthashv) {\r
+ this(session, client, user);\r
+ this.extanthashv = extanthashv;\r
+ }\r
+\r
+ /**\r
+ * values for keys in this hash can be used to reference the\r
+ * uk.ac.vamsas.client.Vobject instance for the VorbaId string.\r
+ * \r
+ * @return the hash of all VorbaIds\r
+ */\r
+ protected Hashtable getVorbaIdHash() {\r
+ return extantids;\r
+ }\r
+\r
+ /**\r
+ * values for keys in this hash are Vobjhash objects created for each Vobj\r
+ * with a VorbaId after this factory has been used to write a vamsas archive.\r
+ * \r
+ * @return the hash of all VorbaIds and their hash values.\r
+ */\r
+ protected Hashtable getVobjhashVals() {\r
+ return extanthashv;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.VorbaIdFactory#makeVorbaId()\r
+ */\r
+ public VorbaId makeVorbaId(Vobject vobject) {\r
+ if (session == null)\r
+ throw new Error(\r
+ "makeVorbaId called on improperly initialised IdFactory Vobject!");\r
+ if (!vobject.isRegisterable())\r
+ throw new Error("makeVorbaId called on unregisterable object.");\r
+ if (vobject.isRegistered())\r
+ throw new Error("makeVorbaId called on already registered object.");\r
+ String newidstring;\r
+ do {\r
+ if (sequence > 0) {\r
+ sequence++;\r
+ } else {\r
+ idstring += "1/";\r
+ sequence = 1;\r
+ }\r
+ newidstring = idstring + Integer.toString(sequence);\r
+ } while (extantids.containsKey(newidstring));\r
+ VorbaId id = newId(newidstring); // VorbaId.hash()==newidstring.hash() so we\r
+ // can still recover vobject\r
+ extantids.put(id, vobject); // hash the Vobject by its new Id\r
+ return id;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * uk.ac.vamsas.client.VorbaIdFactory#setSession(uk.ac.vamsas.client.SessionHandle\r
+ * )\r
+ */\r
+ protected void setSession(SessionHandle sessionhandle) {\r
+ if (sessionhandle != null)\r
+ session = sessionhandle;\r
+ else\r
+ log.warn("setSession(null) called.");\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.VorbaIdFactory#getSessionHandle()\r
+ */\r
+ public SessionHandle getSessionHandle() {\r
+ return session;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * uk.ac.vamsas.client.VorbaIdFactory#setClient(uk.ac.vamsas.client.ClientHandle\r
+ * )\r
+ */\r
+ protected void setClient(ClientHandle appHandle) {\r
+ if (appHandle != null)\r
+ client = appHandle;\r
+ else\r
+ log.warn("setClient(null) called.");\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.VorbaIdFactory#getClientHandle()\r
+ */\r
+ public ClientHandle getClientHandle() {\r
+ return client;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * uk.ac.vamsas.client.VorbaIdFactory#setUser(uk.ac.vamsas.client.UserHandle)\r
+ */\r
+ protected void setUser(UserHandle userHandle) {\r
+ if (userHandle != null)\r
+ user = userHandle;\r
+ else\r
+ log.warn("setUser(null) called.");\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.VorbaIdFactory#getUserHandle()\r
+ */\r
+ public UserHandle getUserHandle() {\r
+ return user;\r
+ }\r
+\r
+ /**\r
+ * Convenience method used for default behaviour in testing and any anonymous\r
+ * internal vamsasDocument unmarshalling\r
+ * \r
+ * @param clientname\r
+ * @return\r
+ */\r
+ protected static IdFactory getDummyFactory(String clientname) {\r
+ if (clientname == null)\r
+ clientname = "uk.ac.vamsas.client.simpleclient.IdFactory";\r
+ return new IdFactory(new SessionHandle("dummy.session"), new ClientHandle(\r
+ clientname, VersionEntries.latestVersion()), new UserHandle(clientname,\r
+ "Arnold User's Inc."));\r
+ }\r
+}\r
-/**
- *
- */
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-
-
-/**
- * base class for generic list storage and retrieval operations from a locked IO file
- * TODO: LATER: generalize for all list storage and retrieval operations
- * (pull-up from ClientsFile object)
- */
-public class ListFile extends SessionFile {
-
- /**
- * @param file
- */
- public ListFile(File file) throws java.io.IOException {
- super(file);
- if (!this.sessionFile.exists())
- this.sessionFile.createNewFile();
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+\r
+/**\r
+ * base class for generic list storage and retrieval operations from a locked IO\r
+ * file TODO: LATER: generalize for all list storage and retrieval operations\r
+ * (pull-up from ClientsFile object)\r
+ */\r
+public class ListFile extends SessionFile {\r
+\r
+ /**\r
+ * @param file\r
+ */\r
+ public ListFile(File file) throws java.io.IOException {\r
+ super(file);\r
+ if (!this.sessionFile.exists())\r
+ this.sessionFile.createNewFile();\r
+ }\r
+\r
+}\r
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
+ */
package uk.ac.vamsas.client.simpleclient;
import java.io.BufferedInputStream;
import org.apache.commons.logging.LogFactory;
/**
- * transient object representing a file lock
- * This lock should hold for all processes interacting in a session.
+ * transient object representing a file lock This lock should hold for all
+ * processes interacting in a session.
+ *
* @author jimp
*/
public abstract class Lock {
protected org.apache.commons.logging.Log log = LogFactory.getLog(Lock.class);
+
File target = null; // The file that is being locked
- protected RandomAccessFile rafile=null;
-
+
+ protected RandomAccessFile rafile = null;
+
/**
- * creates a valid Lock (test with <method>isLocked</method>)
- * if a lock could be obtained for <param>lockfile</param>
+ * creates a valid Lock (test with <method>isLocked</method>) if a lock could
+ * be obtained for <param>lockfile</param>
+ *
* @param lockfile
*/
protected Lock(java.io.File lockfile) {
target = lockfile;
}
+
/**
- * test whether the given file is a target or related to the lock
- * on the target file.
- * @param afile a file
+ * test whether the given file is a target or related to the lock on the
+ * target file.
+ *
+ * @param afile
+ * a file
* @return true if target is locked and afile is related to target
*/
public abstract boolean isTargetLockFile(File afile);
+
/**
*
* @return true if lock is held on the target
*/
public abstract boolean isLocked();
+
/**
* release lock and close all managed channels to file
- *
+ *
*/
public abstract void release();
+
/**
- * optionally close the open random access channel on the file when releasing lock
+ * optionally close the open random access channel on the file when releasing
+ * lock
+ *
* @param closeChannel
*/
public abstract void release(boolean closeChannel);
/**
* gets Locked Stream for reading from
- * @param atStart true to start reading at beginning of file.
+ *
+ * @param atStart
+ * true to start reading at beginning of file.
* @return null if file not locked
* @throws IOException
*/
- public abstract FileInputStream getFileInputStream(boolean atStart) throws IOException;
+ public abstract FileInputStream getFileInputStream(boolean atStart)
+ throws IOException;
/**
- * gets Locked stream to write to
- * FileInput always starts at the *end* of the file (after any truncation)
- * @param clear true means file will be cleared to zero length
+ * gets Locked stream to write to FileInput always starts at the *end* of the
+ * file (after any truncation)
+ *
+ * @param clear
+ * true means file will be cleared to zero length
* @return null if file is not locked
* @throws IOException
*/
- public abstract FileOutputStream getFileOutputStream(boolean clear) throws IOException;
+ public abstract FileOutputStream getFileOutputStream(boolean clear)
+ throws IOException;
+
/**
* return buffered output stream to locked file.
- * @param clear - true means file is truncated to 0 length before writing
+ *
+ * @param clear
+ * - true means file is truncated to 0 length before writing
* @return
*/
- public abstract BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException;
-
+ public abstract BufferedOutputStream getBufferedOutputStream(boolean clear)
+ throws IOException;
+
protected void finalize() throws Throwable {
- target=null;
+ target = null;
}
+
/**
* return buffered input stream for locked file.
- * @param atStart - true means read from begining of file
+ *
+ * @param atStart
+ * - true means read from begining of file
* @return null if file is not locked.
*/
- public BufferedInputStream getBufferedInputStream(boolean atStart) throws IOException {
+ public BufferedInputStream getBufferedInputStream(boolean atStart)
+ throws IOException {
FileInputStream fis = getFileInputStream(atStart);
- if (fis!=null)
+ if (fis != null)
return new BufferedInputStream(fis);
return null;
}
+
/**
* safe lock target length() function.
- * @return -1 for non-lockable target, otherwise target's file length
+ *
+ * @return -1 for non-lockable target, otherwise target's file length
*/
public abstract long length();
+
public abstract RandomAccessFile getRaFile() throws IOException;
+
public abstract FileChannel getRaChannel() throws IOException;
}
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class LockFactory {
- protected static Log log = LogFactory.getLog(LockFactory.class);
- public static int locktype=0; // use file lock by default
- public static String[] locktypes = {"file","native"};
- {
- String lockt = System.getProperty("vamsas.locktype");
- if (lockt!=null) {
- int i,j;
- for (i=0, j=locktypes.length; i<j && locktypes[i].equalsIgnoreCase(lockt); i++)
- ;
- if (i>=j) {
- String lt = "'"+locktypes[0]+"'";
- for (i=1; i<j; i++)
- lt += ",'"+locktypes[i]+"'";
- log.warn("System property vamsas.locktype takes one of "+lt);
- log.warn("Defaulting to Locktype of "+locktypes[locktype]);
- }
- } else
- log.debug("Defaulting to Locktype of "+locktypes[locktype]);
- }
- /**
- * lock target (blocks until lock is obtained)
- * @param target
- * @return lock
- */
- public static Lock getLock(java.io.File target) {
- return getLock(target, true);
- }
- public static Lock getLock(java.io.File target, boolean block) {
- if (locktype==0)
- return new FileLock(target, block);
- if (locktype==1)
- return new NativeLock(target, block);
- log.fatal("Implementation Error! No valid Locktype value");
- return null;
- }
- /**
- * try to lock target
- * @param target
- * @return null if lock was not possible
- */
- public static Lock tryLock(File target) {
- return getLock(target, false);
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+public class LockFactory {\r
+ protected static Log log = LogFactory.getLog(LockFactory.class);\r
+\r
+ public static int locktype = 0; // use file lock by default\r
+\r
+ public static String[] locktypes = { "file", "native" };\r
+ {\r
+ String lockt = System.getProperty("vamsas.locktype");\r
+ if (lockt != null) {\r
+ int i, j;\r
+ for (i = 0, j = locktypes.length; i < j\r
+ && locktypes[i].equalsIgnoreCase(lockt); i++)\r
+ ;\r
+ if (i >= j) {\r
+ String lt = "'" + locktypes[0] + "'";\r
+ for (i = 1; i < j; i++)\r
+ lt += ",'" + locktypes[i] + "'";\r
+ log.warn("System property vamsas.locktype takes one of " + lt);\r
+ log.warn("Defaulting to Locktype of " + locktypes[locktype]);\r
+ }\r
+ } else\r
+ log.debug("Defaulting to Locktype of " + locktypes[locktype]);\r
+ }\r
+\r
+ /**\r
+ * lock target (blocks until lock is obtained)\r
+ * \r
+ * @param target\r
+ * @return lock\r
+ */\r
+ public static Lock getLock(java.io.File target) {\r
+ return getLock(target, true);\r
+ }\r
+\r
+ public static Lock getLock(java.io.File target, boolean block) {\r
+ if (locktype == 0)\r
+ return new FileLock(target, block);\r
+ if (locktype == 1)\r
+ return new NativeLock(target, block);\r
+ log.fatal("Implementation Error! No valid Locktype value");\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * try to lock target\r
+ * \r
+ * @param target\r
+ * @return null if lock was not possible\r
+ */\r
+ public static Lock tryLock(File target) {\r
+ return getLock(target, false);\r
+ }\r
+}\r
-/**
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client.simpleclient;
/**
* @author jimp
- *
+ *
*/
public class LockTimeoutException extends Exception {
- static final long serialVersionUID=1;
+ static final long serialVersionUID = 1;
+
static final String defaultMessage = "Timeout whilst waiting for lock on VamsasDocument";
+
public LockTimeoutException() {
super(defaultMessage);
}
+
public LockTimeoutException(String arg0, Throwable arg1) {
- super(arg0+" (timeout whilst waiting for lock)", arg1);
+ super(arg0 + " (timeout whilst waiting for lock)", arg1);
// TODO Auto-generated constructor stub
}
+
public LockTimeoutException(String arg0) {
- super(arg0+" (timeout whilst waiting for lock)");
+ super(arg0 + " (timeout whilst waiting for lock)");
// TODO Auto-generated constructor stub
}
+
public LockTimeoutException(Throwable arg0) {
super(defaultMessage, arg0);
// TODO Auto-generated constructor stub
}
-
+
}
-/**\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
* \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package uk.ac.vamsas.client.simpleclient;\r
\r
\r
/**\r
* @author Jim\r
- *\r
+ * \r
*/\r
public class LockedFileOutputStream extends FileOutputStream {\r
- private static org.apache.commons.logging.Log log = LogFactory.getLog(LockedFileOutputStream.class);\r
- //FileOutputStream ostream=null;\r
- boolean closed=true;\r
+ private static org.apache.commons.logging.Log log = LogFactory\r
+ .getLog(LockedFileOutputStream.class);\r
+\r
+ // FileOutputStream ostream=null;\r
+ boolean closed = true;\r
+\r
private void init() {\r
FileChannel ch = super.getChannel();\r
- if (ch!=null) {\r
- try { closed = !ch.isOpen();\r
+ if (ch != null) {\r
+ try {\r
+ closed = !ch.isOpen();\r
} catch (Exception e) {\r
- closed=true;\r
- log.debug("Invalid LockedOutputStream marked closed.",e);\r
+ closed = true;\r
+ log.debug("Invalid LockedOutputStream marked closed.", e);\r
}\r
}\r
}\r
+\r
/**\r
* @param file\r
* @throws FileNotFoundException\r
super(fdObj);\r
init();\r
if (fdObj.valid())\r
- closed=false;\r
+ closed = false;\r
}\r
\r
/**\r
super(name, append);\r
init();\r
}\r
+\r
/**\r
* closes - actually just flushes the stream instead.\r
*/\r
log.debug("Marking Lockedoutputstream closed.");\r
} else\r
throw new IOException("Close on already closed FileOutputStream.");\r
- closed=true;\r
+ closed = true;\r
}\r
\r
-\r
/**\r
* @throws IOException\r
* @see java.io.OutputStream#flush()\r
return null;\r
}\r
\r
-\r
-\r
/**\r
* @param b\r
* @param off\r
else\r
throw new IOException("write on Closed FileOutputStream");\r
}\r
- \r
+\r
}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-import java.nio.channels.ReadableByteChannel;
-
-/**
- * @author JimP
- *
- */
-public class NativeLock extends Lock {
-
- protected FileLock lock = null;
-
- /**
- * @param lockfile
- * @param block true means thread will block until a lock is obtained.
- */
- public NativeLock(File lockfile, boolean block) {
- super(lockfile);
- // try and get a lock.
- lock = null;
-
- try {
- /*if (!lockfile.createNewFile()) {
- log.warn("Failed to create locked file "+lockfile);
- return;
- }
- */
- rafile=new RandomAccessFile(lockfile,"rw");
- if (block)
- lock = rafile.getChannel().lock();
- else
- lock = rafile.getChannel().tryLock();
- if (lock==null || !lock.isValid()) {
- // failed to get lock. Close the file channel
- log.debug("failed to get lock for "+lockfile);
- rafile.getChannel().close();
- lock=null;
- }
- } catch (FileNotFoundException e) {
- //
- log.debug("Lock failed - normal behaviour for windows locking.");
- //log.error("Error! Couldn't create a lockfile at "
- // + lockfile.getAbsolutePath(), e);
- } catch (IOException e) {
- log.error("Error! Problems with IO when creating a lock on "
- + lockfile.getAbsolutePath(),e);
- } // catch (Exception )
- }
-
- public boolean isLocked() {
- if (lock != null && lock.isValid()) {
- return true;
- }
- return false;
- }
-
- public void release() {
- release(true);
- }
-
- public void release(boolean closeChannel) {
- if (lock==null)
- return;
- try {
- // channel.close should be called before release() for rigourous locking.
- if (lock.isValid() && rafile!=null && rafile.getFD().valid() && rafile.getChannel()!=null) {
- if (closeChannel && rafile.getChannel().isOpen()) {
- rafile.close();
- rafile=null;
- } else {
- // just release the lock without doing anything to the channe;l
- if (lock!=null && lock.isValid())
- lock.release();
- }
- }
- } catch (IOException e) {
- log.warn("Whilst releasing lock",e);
- }
- lock=null;
- }
-
- /**
- * gets Locked Stream for reading from
- * @param atStart true to start reading at beginning of file.
- * @return null if file not locked
- * @throws IOException
- */
- public FileInputStream getFileInputStream(boolean atStart) throws IOException {
- if (!isLocked())
- return null;
- if (atStart)
- rafile.seek(0);
- return new FileInputStream(rafile.getFD());
- }
-
- /**
- * gets Locked stream to write to
- * FileInput always starts at the *end* of the file (after any truncation)
- * @param clear true means file will be cleared to zero length
- * @return null if file is not locked
- * @throws IOException
- */
- public FileOutputStream getFileOutputStream(boolean clear) throws IOException {
- if (!isLocked())
- return null;
- if (clear) {
- rafile.seek(0);
- rafile.setLength(0);
- } else
- rafile.seek(rafile.length());
- return new LockedFileOutputStream(rafile.getFD());
- }
-
- /**
- * return buffered output stream to locked file.
- * @param clear - true means file is truncated to 0 length before writing
- * @return
- */
- public BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException {
- OutputStream fos = getFileOutputStream(clear);
- if (fos!=null)
- return new BufferedOutputStream(fos);
- return null;
- }
- /**
- * @see uk.ac.vamsas.client.simpleclient.Lock#finalize()
- */
- protected void finalize() throws Throwable {
- release(true); // we explicitly lose the lock here.
- // log.debug("lock closing through garbage collection ?");
- super.finalize();
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.simpleclient.Lock#getLength()
- */
- public long length() {
- if (isLocked()){
- try {
- return rafile.length();
- } catch (Exception e) {
- log.debug("getLength exception:",e);
- }
- }
- return -1;
- }
-
- public RandomAccessFile getRaFile() throws IOException {
- if (isLocked())
- return rafile;
- else
- log.debug("Failed to getRaFile on "+target);
- return null;
- }
-
- public FileChannel getRaChannel() throws IOException {
- if (isLocked())
- return rafile.getChannel();
- else
- log.debug("Failed to getRaChannel on "+target);
- return null;
- }
-
- public boolean isTargetLockFile(File afile) {
- if (isLocked() && target.equals(afile))
- return true;
- return false;
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.BufferedOutputStream;\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.io.RandomAccessFile;\r
+import java.nio.channels.FileChannel;\r
+import java.nio.channels.FileLock;\r
+import java.nio.channels.ReadableByteChannel;\r
+\r
+/**\r
+ * @author JimP\r
+ * \r
+ */\r
+public class NativeLock extends Lock {\r
+\r
+ protected FileLock lock = null;\r
+\r
+ /**\r
+ * @param lockfile\r
+ * @param block\r
+ * true means thread will block until a lock is obtained.\r
+ */\r
+ public NativeLock(File lockfile, boolean block) {\r
+ super(lockfile);\r
+ // try and get a lock.\r
+ lock = null;\r
+\r
+ try {\r
+ /*\r
+ * if (!lockfile.createNewFile()) {\r
+ * log.warn("Failed to create locked file "+lockfile); return; }\r
+ */\r
+ rafile = new RandomAccessFile(lockfile, "rw");\r
+ if (block)\r
+ lock = rafile.getChannel().lock();\r
+ else\r
+ lock = rafile.getChannel().tryLock();\r
+ if (lock == null || !lock.isValid()) {\r
+ // failed to get lock. Close the file channel\r
+ log.debug("failed to get lock for " + lockfile);\r
+ rafile.getChannel().close();\r
+ lock = null;\r
+ }\r
+ } catch (FileNotFoundException e) {\r
+ //\r
+ log.debug("Lock failed - normal behaviour for windows locking.");\r
+ // log.error("Error! Couldn't create a lockfile at "\r
+ // + lockfile.getAbsolutePath(), e);\r
+ } catch (IOException e) {\r
+ log.error("Error! Problems with IO when creating a lock on "\r
+ + lockfile.getAbsolutePath(), e);\r
+ } // catch (Exception )\r
+ }\r
+\r
+ public boolean isLocked() {\r
+ if (lock != null && lock.isValid()) {\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ public void release() {\r
+ release(true);\r
+ }\r
+\r
+ public void release(boolean closeChannel) {\r
+ if (lock == null)\r
+ return;\r
+ try {\r
+ // channel.close should be called before release() for rigourous locking.\r
+ if (lock.isValid() && rafile != null && rafile.getFD().valid()\r
+ && rafile.getChannel() != null) {\r
+ if (closeChannel && rafile.getChannel().isOpen()) {\r
+ rafile.close();\r
+ rafile = null;\r
+ } else {\r
+ // just release the lock without doing anything to the channe;l\r
+ if (lock != null && lock.isValid())\r
+ lock.release();\r
+ }\r
+ }\r
+ } catch (IOException e) {\r
+ log.warn("Whilst releasing lock", e);\r
+ }\r
+ lock = null;\r
+ }\r
+\r
+ /**\r
+ * gets Locked Stream for reading from\r
+ * \r
+ * @param atStart\r
+ * true to start reading at beginning of file.\r
+ * @return null if file not locked\r
+ * @throws IOException\r
+ */\r
+ public FileInputStream getFileInputStream(boolean atStart) throws IOException {\r
+ if (!isLocked())\r
+ return null;\r
+ if (atStart)\r
+ rafile.seek(0);\r
+ return new FileInputStream(rafile.getFD());\r
+ }\r
+\r
+ /**\r
+ * gets Locked stream to write to FileInput always starts at the *end* of the\r
+ * file (after any truncation)\r
+ * \r
+ * @param clear\r
+ * true means file will be cleared to zero length\r
+ * @return null if file is not locked\r
+ * @throws IOException\r
+ */\r
+ public FileOutputStream getFileOutputStream(boolean clear) throws IOException {\r
+ if (!isLocked())\r
+ return null;\r
+ if (clear) {\r
+ rafile.seek(0);\r
+ rafile.setLength(0);\r
+ } else\r
+ rafile.seek(rafile.length());\r
+ return new LockedFileOutputStream(rafile.getFD());\r
+ }\r
+\r
+ /**\r
+ * return buffered output stream to locked file.\r
+ * \r
+ * @param clear\r
+ * - true means file is truncated to 0 length before writing\r
+ * @return\r
+ */\r
+ public BufferedOutputStream getBufferedOutputStream(boolean clear)\r
+ throws IOException {\r
+ OutputStream fos = getFileOutputStream(clear);\r
+ if (fos != null)\r
+ return new BufferedOutputStream(fos);\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * @see uk.ac.vamsas.client.simpleclient.Lock#finalize()\r
+ */\r
+ protected void finalize() throws Throwable {\r
+ release(true); // we explicitly lose the lock here.\r
+ // log.debug("lock closing through garbage collection ?");\r
+ super.finalize();\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.simpleclient.Lock#getLength()\r
+ */\r
+ public long length() {\r
+ if (isLocked()) {\r
+ try {\r
+ return rafile.length();\r
+ } catch (Exception e) {\r
+ log.debug("getLength exception:", e);\r
+ }\r
+ }\r
+ return -1;\r
+ }\r
+\r
+ public RandomAccessFile getRaFile() throws IOException {\r
+ if (isLocked())\r
+ return rafile;\r
+ else\r
+ log.debug("Failed to getRaFile on " + target);\r
+ return null;\r
+ }\r
+\r
+ public FileChannel getRaChannel() throws IOException {\r
+ if (isLocked())\r
+ return rafile.getChannel();\r
+ else\r
+ log.debug("Failed to getRaChannel on " + target);\r
+ return null;\r
+ }\r
+\r
+ public boolean isTargetLockFile(File afile) {\r
+ if (isLocked() && target.equals(afile))\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.channels.ReadableByteChannel;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Basic methods for classes handling locked IO on files
- * monitored by all (simpleclient) clients in a vamsas session.
- * @author jimp
- *TODO: support non nio file locking capable systems
- */
-public class SessionFile {
- private static Log log = LogFactory.getLog(SessionFile.class);
- protected File sessionFile;
- protected Lock fileLock = null;
-
- protected SessionFile(File file) {
- super();
- sessionFile = file;
- }
-
- protected boolean lockFile(Lock extantlock) {
- if (fileLock!=null && !fileLock.isLocked()) {
- fileLock.release();// tidy up invalid lock
- fileLock=null;
- }
- if (extantlock!=null && extantlock.isLocked())
- fileLock=extantlock; // THIS IS BROKEN - lockFile then nulls the lock.
- return lockFile();
- }
- private boolean ensureSessionFile() {
- if (sessionFile != null) {
- if (!sessionFile.exists()) {
- // create new file
- try {
- if (!sessionFile.createNewFile()) {
- log.error("Failed to create file prior to locking: "+sessionFile);
- return false;
- }
- } catch (IOException e) {
- log.error("Exception when trying to create file "+sessionFile, e);
- return false;
- }
- }
- return true;
- }
- log.error("ensureSessionFile called for non-initialised SessionFile!");
- return false;
- }
- /**
- * Get a lock for the SessionFile
- *
- * @return true if lock was made
- */
- protected boolean lockFile() {
- if (fileLock != null) {
- if (fileLock.isLocked()) {
- if (!ensureSessionFile())
- return false;
- return true;
- } else {
- // lock failed for some reason.
- fileLock.release();
- log.info("Unexpected session file lock failure. Trying to get it again.");
- fileLock=null;
- }
- }
- if (!ensureSessionFile())
- return false;
- // TODO: see if we need to loop-wait for locks or they just block until
- // lock is made...
- long tries=5000;
- do {
- tries--;
- if (fileLock==null || !fileLock.isLocked()) {
- //try { Thread.sleep(1); } catch (Exception e) {};
- fileLock = LockFactory.getLock(sessionFile,true); // TODO: wait around if we can't get the lock.
- }
- } while (tries>0 && !fileLock.isLocked());
- if (!fileLock.isLocked())
- log.error("Failed to get lock for "+sessionFile);
- // fileLock = new Lock(sessionFile);
- return fileLock.isLocked();
- }
-
- /**
- * Explicitly release the SessionFile's lock.
- *
- * @return true if lock was released.
- */
- protected void unlockFile() {
- if (fileLock != null) {
- fileLock.release();
- fileLock = null;
- }
- }
-
- /**
- * Makes a backup of the sessionFile.
- * @return Backed up SessionFile or null if failed to make backup.
- */
- protected File backupSessionFile() {
- return backupSessionFile(fileLock, sessionFile.getName(),".old", sessionFile.getParentFile());
- }
-
- protected File backupSessionFile(Lock extantLock, String backupPrefix, String backupSuffix, File backupDir) {
- File tempfile=null;
- if (lockFile(extantLock)) {
- try {
- tempfile = File.createTempFile(backupPrefix, backupSuffix, backupDir);
- long sourceln = fileLock.length();
- if (sourceln>0) {
- FileOutputStream tos = new FileOutputStream(tempfile);
- ReadableByteChannel channel;
- channel = fileLock.getRaChannel().position(0);
- long ntrans = 0;
- while (ntrans<sourceln)
- {
- long tlen;
- ntrans+= tlen = tos.getChannel().transferFrom(channel, ntrans,
- sourceln);
- if (log.isDebugEnabled())
- {
- log.debug
- ("Transferred "+tlen+" out of "+sourceln+" bytes");
- }
- }
- tos.close();
- if (!channel.isOpen())
- throw new Error("LIBRARY PORTABILITY ISSUE: "+tos.getChannel().getClass()+".transferFrom closes source channel!");
- if (!lockFile(extantLock))
- throw new Error("LIBRARY PORTABILITY ISSUE: Lost lock for "+sessionFile.getName()+" after backup.");
-
- }
- } catch (FileNotFoundException e1) {
- log.warn("Can't create temp file for "+sessionFile.getName(),e1);
- tempfile=null;
- } catch (IOException e1) {
- log.warn("Error when copying content to temp file for "+sessionFile.getName(),e1);
- tempfile=null;
- }
- }
- return tempfile;
- }
- /**
- * Replaces data in sessionFile with data from file handled by another sessionFile
- * passes up any exceptions.
- * @param newData source for new data
- */
- protected void updateFrom(Lock extantLock, SessionFile newData) throws IOException {
- log.debug("Updating "+sessionFile.getAbsolutePath()+" from "+newData.sessionFile.getAbsolutePath());
- if (newData==null)
- throw new IOException("Null newData object.");
- if (newData.sessionFile==null)
- throw new IOException("Null SessionFile in newData.");
-
- if (!lockFile(extantLock))
- throw new IOException("Failed to get write lock for "+sessionFile);
- if (!newData.lockFile())
- throw new IOException("Failed to get lock for updateFrom "+newData.sessionFile);
- RandomAccessFile nrafile = newData.fileLock.getRaFile();
- nrafile.seek(0);
- RandomAccessFile trafile = fileLock.getRaFile();
- /*long tries=5000;
- while (trafile==null && --tries>0) {
- log.debug("Lost lock on "+sessionFile+"! Re-trying for a transfer.");
- lockFile();
- trafile = fileLock.getRaFile();
- }*/
- // TODO JBPNote: attempt to ensure save really saves the VamDoc.jar file
- trafile.seek(0);
- trafile.getChannel().transferFrom(nrafile.getChannel(), 0,
- nrafile.length());
- // JBPNote: attempt to close the streams to flush the data out
- // trafile.close();
- //nrafile.close();
- }
- /**
- * remove all trace of the sessionFile file
- *
- */
- protected void eraseExistence() {
- unlockFile();
- if (sessionFile!=null) {
- sessionFile.delete();
- sessionFile = null;
- }
- }
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.simpleclient.Lock#getBufferedInputStream(boolean)
- */
- public BufferedInputStream getBufferedInputStream(boolean atStart) throws IOException {
- lockFile();
- return fileLock.getBufferedInputStream(atStart);
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.simpleclient.Lock#getBufferedOutputStream(boolean)
- */
- public BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException {
- lockFile();
- return fileLock.getBufferedOutputStream(clear);
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.simpleclient.Lock#getFileInputStream(boolean)
- */
- public FileInputStream getFileInputStream(boolean atStart) throws IOException {
- lockFile();
- return fileLock.getFileInputStream(atStart);
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.simpleclient.Lock#getFileOutputStream(boolean)
- */
- public FileOutputStream getFileOutputStream(boolean clear) throws IOException {
- lockFile();
- return fileLock.getFileOutputStream(clear);
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.BufferedOutputStream;\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.RandomAccessFile;\r
+import java.nio.channels.ReadableByteChannel;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+/**\r
+ * Basic methods for classes handling locked IO on files monitored by all\r
+ * (simpleclient) clients in a vamsas session.\r
+ * \r
+ * @author jimp TODO: support non nio file locking capable systems\r
+ */\r
+public class SessionFile {\r
+ private static Log log = LogFactory.getLog(SessionFile.class);\r
+\r
+ protected File sessionFile;\r
+\r
+ protected Lock fileLock = null;\r
+\r
+ protected SessionFile(File file) {\r
+ super();\r
+ sessionFile = file;\r
+ }\r
+\r
+ protected boolean lockFile(Lock extantlock) {\r
+ if (fileLock != null && !fileLock.isLocked()) {\r
+ fileLock.release();// tidy up invalid lock\r
+ fileLock = null;\r
+ }\r
+ if (extantlock != null && extantlock.isLocked())\r
+ fileLock = extantlock; // THIS IS BROKEN - lockFile then nulls the lock.\r
+ return lockFile();\r
+ }\r
+\r
+ private boolean ensureSessionFile() {\r
+ if (sessionFile != null) {\r
+ if (!sessionFile.exists()) {\r
+ // create new file\r
+ try {\r
+ if (!sessionFile.createNewFile()) {\r
+ log.error("Failed to create file prior to locking: " + sessionFile);\r
+ return false;\r
+ }\r
+ } catch (IOException e) {\r
+ log.error("Exception when trying to create file " + sessionFile, e);\r
+ return false;\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+ log.error("ensureSessionFile called for non-initialised SessionFile!");\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Get a lock for the SessionFile\r
+ * \r
+ * @return true if lock was made\r
+ */\r
+ protected boolean lockFile() {\r
+ if (fileLock != null) {\r
+ if (fileLock.isLocked()) {\r
+ if (!ensureSessionFile())\r
+ return false;\r
+ return true;\r
+ } else {\r
+ // lock failed for some reason.\r
+ fileLock.release();\r
+ log\r
+ .info("Unexpected session file lock failure. Trying to get it again.");\r
+ fileLock = null;\r
+ }\r
+ }\r
+ if (!ensureSessionFile())\r
+ return false;\r
+ // TODO: see if we need to loop-wait for locks or they just block until\r
+ // lock is made...\r
+ long tries = 5000;\r
+ do {\r
+ tries--;\r
+ if (fileLock == null || !fileLock.isLocked()) {\r
+ // try { Thread.sleep(1); } catch (Exception e) {};\r
+ fileLock = LockFactory.getLock(sessionFile, true); // TODO: wait around\r
+ // if we can't get\r
+ // the lock.\r
+ }\r
+ } while (tries > 0 && !fileLock.isLocked());\r
+ if (!fileLock.isLocked())\r
+ log.error("Failed to get lock for " + sessionFile);\r
+ // fileLock = new Lock(sessionFile);\r
+ return fileLock.isLocked();\r
+ }\r
+\r
+ /**\r
+ * Explicitly release the SessionFile's lock.\r
+ * \r
+ * @return true if lock was released.\r
+ */\r
+ protected void unlockFile() {\r
+ if (fileLock != null) {\r
+ fileLock.release();\r
+ fileLock = null;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Makes a backup of the sessionFile.\r
+ * \r
+ * @return Backed up SessionFile or null if failed to make backup.\r
+ */\r
+ protected File backupSessionFile() {\r
+ return backupSessionFile(fileLock, sessionFile.getName(), ".old",\r
+ sessionFile.getParentFile());\r
+ }\r
+\r
+ protected File backupSessionFile(Lock extantLock, String backupPrefix,\r
+ String backupSuffix, File backupDir) {\r
+ File tempfile = null;\r
+ if (lockFile(extantLock)) {\r
+ try {\r
+ tempfile = File.createTempFile(backupPrefix, backupSuffix, backupDir);\r
+ long sourceln = fileLock.length();\r
+ if (sourceln > 0) {\r
+ FileOutputStream tos = new FileOutputStream(tempfile);\r
+ ReadableByteChannel channel;\r
+ channel = fileLock.getRaChannel().position(0);\r
+ long ntrans = 0;\r
+ while (ntrans < sourceln) {\r
+ long tlen;\r
+ ntrans += tlen = tos.getChannel().transferFrom(channel, ntrans,\r
+ sourceln);\r
+ if (log.isDebugEnabled()) {\r
+ log.debug("Transferred " + tlen + " out of " + sourceln\r
+ + " bytes");\r
+ }\r
+ }\r
+ tos.close();\r
+ if (!channel.isOpen())\r
+ throw new Error("LIBRARY PORTABILITY ISSUE: "\r
+ + tos.getChannel().getClass()\r
+ + ".transferFrom closes source channel!");\r
+ if (!lockFile(extantLock))\r
+ throw new Error("LIBRARY PORTABILITY ISSUE: Lost lock for "\r
+ + sessionFile.getName() + " after backup.");\r
+\r
+ }\r
+ } catch (FileNotFoundException e1) {\r
+ log.warn("Can't create temp file for " + sessionFile.getName(), e1);\r
+ tempfile = null;\r
+ } catch (IOException e1) {\r
+ log.warn("Error when copying content to temp file for "\r
+ + sessionFile.getName(), e1);\r
+ tempfile = null;\r
+ }\r
+ }\r
+ return tempfile;\r
+ }\r
+\r
+ /**\r
+ * Replaces data in sessionFile with data from file handled by another\r
+ * sessionFile passes up any exceptions.\r
+ * \r
+ * @param newData\r
+ * source for new data\r
+ */\r
+ protected void updateFrom(Lock extantLock, SessionFile newData)\r
+ throws IOException {\r
+ log.debug("Updating " + sessionFile.getAbsolutePath() + " from "\r
+ + newData.sessionFile.getAbsolutePath());\r
+ if (newData == null)\r
+ throw new IOException("Null newData object.");\r
+ if (newData.sessionFile == null)\r
+ throw new IOException("Null SessionFile in newData.");\r
+\r
+ if (!lockFile(extantLock))\r
+ throw new IOException("Failed to get write lock for " + sessionFile);\r
+ if (!newData.lockFile())\r
+ throw new IOException("Failed to get lock for updateFrom "\r
+ + newData.sessionFile);\r
+ RandomAccessFile nrafile = newData.fileLock.getRaFile();\r
+ nrafile.seek(0);\r
+ RandomAccessFile trafile = fileLock.getRaFile();\r
+ /*\r
+ * long tries=5000; while (trafile==null && --tries>0) {\r
+ * log.debug("Lost lock on "+sessionFile+"! Re-trying for a transfer.");\r
+ * lockFile(); trafile = fileLock.getRaFile(); }\r
+ */\r
+ // TODO JBPNote: attempt to ensure save really saves the VamDoc.jar file\r
+ trafile.seek(0);\r
+ trafile.getChannel()\r
+ .transferFrom(nrafile.getChannel(), 0, nrafile.length());\r
+ // JBPNote: attempt to close the streams to flush the data out\r
+ // trafile.close();\r
+ // nrafile.close();\r
+ }\r
+\r
+ /**\r
+ * remove all trace of the sessionFile file\r
+ * \r
+ */\r
+ protected void eraseExistence() {\r
+ unlockFile();\r
+ if (sessionFile != null) {\r
+ sessionFile.delete();\r
+ sessionFile = null;\r
+ }\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.simpleclient.Lock#getBufferedInputStream(boolean)\r
+ */\r
+ public BufferedInputStream getBufferedInputStream(boolean atStart)\r
+ throws IOException {\r
+ lockFile();\r
+ return fileLock.getBufferedInputStream(atStart);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.simpleclient.Lock#getBufferedOutputStream(boolean)\r
+ */\r
+ public BufferedOutputStream getBufferedOutputStream(boolean clear)\r
+ throws IOException {\r
+ lockFile();\r
+ return fileLock.getBufferedOutputStream(clear);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.simpleclient.Lock#getFileInputStream(boolean)\r
+ */\r
+ public FileInputStream getFileInputStream(boolean atStart) throws IOException {\r
+ lockFile();\r
+ return fileLock.getFileInputStream(atStart);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.simpleclient.Lock#getFileOutputStream(boolean)\r
+ */\r
+ public FileOutputStream getFileOutputStream(boolean clear) throws IOException {\r
+ lockFile();\r
+ return fileLock.getFileOutputStream(clear);\r
+ }\r
+\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
-\r
/**\r
- * Element of the VamsasFileWatcherThread event generator chain.\r
- * Keep a reference to this element before adding it to the chain \r
- * in order to control the generation of events with halt and enable.\r
+ * Element of the VamsasFileWatcherThread event generator chain. Keep a\r
+ * reference to this element before adding it to the chain in order to control\r
+ * the generation of events with halt and enable.\r
* \r
* doWatch will do nothing if the element is not enabled.\r
* \r
*/\r
public class SessionFileWatcherElement extends WatcherElement {\r
- SessionFile watched=null;\r
+ SessionFile watched = null;\r
+\r
/**\r
* create a new, enabled watch element\r
- * @param watcher file being watched\r
- * @param handler handler to call on state change\r
+ * \r
+ * @param watcher\r
+ * file being watched\r
+ * @param handler\r
+ * handler to call on state change\r
*/\r
public SessionFileWatcherElement(SessionFile watcher, WatcherCallBack handler) {\r
this(watcher, handler, true);\r
}\r
+\r
protected void initWatch() {\r
- if (watched==null)\r
+ if (watched == null)\r
return;\r
- if (watcher==null || !watcher.getSubject().equals(watched.sessionFile)) \r
- watcher=new FileWatcher(watched.sessionFile);\r
+ if (watcher == null || !watcher.getSubject().equals(watched.sessionFile))\r
+ watcher = new FileWatcher(watched.sessionFile);\r
else\r
watcher.setState();\r
}\r
+\r
protected void endWatch() {\r
// leaves watcher in state its in.\r
}\r
+\r
/**\r
* new watcher with flag to initially skip watching this sessionfile\r
+ * \r
* @param watcher\r
* @param handler\r
* @param enableWatching\r
*/\r
- public SessionFileWatcherElement(SessionFile watcher, WatcherCallBack handler, boolean enableWatching) {\r
+ public SessionFileWatcherElement(SessionFile watcher,\r
+ WatcherCallBack handler, boolean enableWatching) {\r
super(handler);\r
this.watched = watcher;\r
if (enableWatching)\r
else\r
haltWatch();\r
}\r
+\r
/**\r
* @return the watched\r
*/\r
public SessionFile getWatched() {\r
return watched;\r
}\r
+\r
protected String getSubject() {\r
return watched.sessionFile.toString();\r
}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * methods for setting and checking
- * binary flags in a vamsas session directory.
- * all methods apart from the constructor will
- * throw a fatal error if the flagFile is not
- * a valid java.io.File object.
- * LATER: extract SessionFlag interface for generalizing the vamsas session code
- * @author jimp
- *
- */
-public class SessionFlagFile {
- private static Log log = LogFactory.getLog(SessionFlagFile.class);
- protected File flagFile=null;
- private void checkFlagFile() {
- if (flagFile==null) {
- log.fatal("Implementation error - uninitialized SessionFlagFile",
- new Error("Implementation error - uninitialized SessionFlagFile"));
- }
- }
- /**
- * will log a warning if exceptions occur during flag creation.
- * @return true if flag was set successfully
- */
- public boolean setFlag() {
- checkFlagFile();
- try {
- if (flagFile.createNewFile()) {
- log.debug("Set session flag "+flagFile);
- } else {
- log.debug("Session flag already set "+flagFile);
- }
- return true;
- }
- catch (Exception e) {
- log.warn("Couldn't set session flag "+flagFile, e);
- }
- return false;
- }
- /**
- *
- * @return true if flag was cleared successfully
- */
- public boolean clearFlag() {
- checkFlagFile();
- if (flagFile.exists()) {
- log.debug("clearing session flag "+flagFile);
- if (!flagFile.delete()) {
- log.warn("failed to clear session flag "+flagFile);
- return false;
- }
- } else {
- log.debug("clearFlag called for already cleared flag "+flagFile);
- }
- return true;
- }
- /**
- *
- * @return state of session flag
- */
- public boolean checkFlag() {
- checkFlagFile();
- if (flagFile.exists()) {
- if (log.isDebugEnabled())
- log.debug("Flag '"+flagFile+"' is set.");
- return true;
- }
- if (log.isDebugEnabled())
- log.debug("Flag '"+flagFile+"' is not set.");
- return false;
- }
- /**
- * @param flagFile
- */
- public SessionFlagFile(File flagFile) {
- super();
- this.flagFile = flagFile;
- };
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+/**\r
+ * methods for setting and checking binary flags in a vamsas session directory.\r
+ * all methods apart from the constructor will throw a fatal error if the\r
+ * flagFile is not a valid java.io.File object. LATER: extract SessionFlag\r
+ * interface for generalizing the vamsas session code\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class SessionFlagFile {\r
+ private static Log log = LogFactory.getLog(SessionFlagFile.class);\r
+\r
+ protected File flagFile = null;\r
+\r
+ private void checkFlagFile() {\r
+ if (flagFile == null) {\r
+ log.fatal("Implementation error - uninitialized SessionFlagFile",\r
+ new Error("Implementation error - uninitialized SessionFlagFile"));\r
+ }\r
+ }\r
+\r
+ /**\r
+ * will log a warning if exceptions occur during flag creation.\r
+ * \r
+ * @return true if flag was set successfully\r
+ */\r
+ public boolean setFlag() {\r
+ checkFlagFile();\r
+ try {\r
+ if (flagFile.createNewFile()) {\r
+ log.debug("Set session flag " + flagFile);\r
+ } else {\r
+ log.debug("Session flag already set " + flagFile);\r
+ }\r
+ return true;\r
+ } catch (Exception e) {\r
+ log.warn("Couldn't set session flag " + flagFile, e);\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return true if flag was cleared successfully\r
+ */\r
+ public boolean clearFlag() {\r
+ checkFlagFile();\r
+ if (flagFile.exists()) {\r
+ log.debug("clearing session flag " + flagFile);\r
+ if (!flagFile.delete()) {\r
+ log.warn("failed to clear session flag " + flagFile);\r
+ return false;\r
+ }\r
+ } else {\r
+ log.debug("clearFlag called for already cleared flag " + flagFile);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return state of session flag\r
+ */\r
+ public boolean checkFlag() {\r
+ checkFlagFile();\r
+ if (flagFile.exists()) {\r
+ if (log.isDebugEnabled())\r
+ log.debug("Flag '" + flagFile + "' is set.");\r
+ return true;\r
+ }\r
+ if (log.isDebugEnabled())\r
+ log.debug("Flag '" + flagFile + "' is not set.");\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * @param flagFile\r
+ */\r
+ public SessionFlagFile(File flagFile) {\r
+ super();\r
+ this.flagFile = flagFile;\r
+ };\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
-\r
/**\r
- * Element of the VamsasFileWatcherThread event generator chain.\r
- * Keep a reference to this element before adding it to the chain \r
- * in order to control the generation of events with halt and enable.\r
+ * Element of the VamsasFileWatcherThread event generator chain. Keep a\r
+ * reference to this element before adding it to the chain in order to control\r
+ * the generation of events with halt and enable.\r
* \r
- * doWatch will do nothing if the element is not enabled.\r
- * TODO: TEST THIS CLASS - not yet used in SimpleClient\r
+ * doWatch will do nothing if the element is not enabled. TODO: TEST THIS CLASS\r
+ * - not yet used in SimpleClient\r
*/\r
public class SessionFlagWatcherElement extends WatcherElement {\r
- SessionFlagFile watched=null;\r
+ SessionFlagFile watched = null;\r
+\r
/**\r
* create a new, enabled watch element\r
- * @param watcher file being watched\r
- * @param handler handler to call on state change\r
+ * \r
+ * @param watcher\r
+ * file being watched\r
+ * @param handler\r
+ * handler to call on state change\r
*/\r
- public SessionFlagWatcherElement(SessionFlagFile watcher, WatcherCallBack handler) {\r
+ public SessionFlagWatcherElement(SessionFlagFile watcher,\r
+ WatcherCallBack handler) {\r
this(watcher, handler, true);\r
}\r
+\r
protected void initWatch() {\r
- if (watched==null)\r
+ if (watched == null)\r
return;\r
watcher = new FileWatcher(watched.flagFile);\r
}\r
+\r
protected void endWatch() {\r
// leaves watcher in state its in.\r
}\r
+\r
/**\r
* new watcher with flag to initially skip watching this sessionfile\r
+ * \r
* @param watcher\r
* @param handler\r
* @param enableWatching\r
*/\r
- public SessionFlagWatcherElement(SessionFlagFile watcher, WatcherCallBack handler, boolean enableWatching) {\r
+ public SessionFlagWatcherElement(SessionFlagFile watcher,\r
+ WatcherCallBack handler, boolean enableWatching) {\r
super(handler);\r
this.watched = watcher;\r
if (enableWatching)\r
else\r
haltWatch();\r
}\r
+\r
/**\r
* @return the watched\r
*/\r
public SessionFlagFile getWatched() {\r
return watched;\r
}\r
+\r
protected String getSubject() {\r
- \r
+\r
return watched.flagFile.toString();\r
}\r
}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-import java.net.URI;
-
-import uk.ac.vamsas.client.InvalidSessionUrnException;
-
-/**
- * SessionUrn for simpleclient sessions:
- * simpleclient://{Absolute path to session directory}
- *
- * For simpleclient urn, it consideres as on the same machine, using the path to the session
- * directory to generate the session URN
- *
- * @author jimp
- *
- */
-public class SessionUrn extends uk.ac.vamsas.client.SessionUrn {
- /**
- * a simple client session urn prefix
- */
- public static final String SIMPLECLIENT="simpleclient";
- public static String VAMSASDOCUMENT="vdoc";
- static {
- TYPES.put(SIMPLECLIENT, SessionUrn.class);
- TYPES.put(SessionUrn.VAMSASDOCUMENT, SessionUrn.class);
- }
-
- /**
- * Creates a SessionUrn object from a String.
- * The string must be a string representation of a URI
- * @param urnString
- * @throws InvalidSessionUrnException
- */
- public SessionUrn(String urnString) throws InvalidSessionUrnException
- {
- super();
- this.setURN(urnString);
- }
-
-
- /**
- * Generates a sessionURN bases on a session directory location
- *
- * @param sessionLocation the file object to the session directory
- */
- public SessionUrn(File sessionLocation)
- {//throws MalformedURLException {
- // TODO: LATER: implement switch to have vamsas document or simpleclient sessions for same constructor
- //use URI instead of URL
- super(SIMPLECLIENT, sessionLocation.getAbsoluteFile().toURI());
- }
-
- /**
- * Generates a sessionURN bases on a vamsas session
- * @param session a VamsasSession
- *
- * Should return the same URN string than the creation with the session directory
- */
- public SessionUrn(VamsasSession session)
- {
- //throws MalformedURLException {
- // use URI instead of URL
- super(SIMPLECLIENT, session.sessionDir.getAbsoluteFile().toURI());
- }
-
-
-
-
-
- /**
- * TODO: LATER: think about this again.
- *
- * Retrieves the file associated to the current sessionURN.
- * The sessionURN (URI) is based on the session directory absolute path.
- * Use the raw path of the URN and change the scheme to file to generate a new file
- * URI. Then, from the URI create the File object (a File object can be created from an uri)
- *
- * @return File object representing the session URN //
- * File(urn.getPath())
- */
- public File asFile() {
- String path = this.urn.getRawPath();
-
- return new File ( URI.create("file://"+path));
- }
- // TODO: add abstract 'handler' methods for resolving the URN to a particular class
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.net.URI;\r
+\r
+import uk.ac.vamsas.client.InvalidSessionUrnException;\r
+\r
+/**\r
+ * SessionUrn for simpleclient sessions: simpleclient://{Absolute path to\r
+ * session directory}\r
+ * \r
+ * For simpleclient urn, it consideres as on the same machine, using the path to\r
+ * the session directory to generate the session URN\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class SessionUrn extends uk.ac.vamsas.client.SessionUrn {\r
+ /**\r
+ * a simple client session urn prefix\r
+ */\r
+ public static final String SIMPLECLIENT = "simpleclient";\r
+\r
+ public static String VAMSASDOCUMENT = "vdoc";\r
+ static {\r
+ TYPES.put(SIMPLECLIENT, SessionUrn.class);\r
+ TYPES.put(SessionUrn.VAMSASDOCUMENT, SessionUrn.class);\r
+ }\r
+\r
+ /**\r
+ * Creates a SessionUrn object from a String. The string must be a string\r
+ * representation of a URI\r
+ * \r
+ * @param urnString\r
+ * @throws InvalidSessionUrnException\r
+ */\r
+ public SessionUrn(String urnString) throws InvalidSessionUrnException {\r
+ super();\r
+ this.setURN(urnString);\r
+ }\r
+\r
+ /**\r
+ * Generates a sessionURN bases on a session directory location\r
+ * \r
+ * @param sessionLocation\r
+ * the file object to the session directory\r
+ */\r
+ public SessionUrn(File sessionLocation) {// throws MalformedURLException {\r
+ // TODO: LATER: implement switch to have vamsas document or simpleclient\r
+ // sessions for same constructor\r
+ // use URI instead of URL\r
+ super(SIMPLECLIENT, sessionLocation.getAbsoluteFile().toURI());\r
+ }\r
+\r
+ /**\r
+ * Generates a sessionURN bases on a vamsas session\r
+ * \r
+ * @param session\r
+ * a VamsasSession\r
+ * \r
+ * Should return the same URN string than the creation with the\r
+ * session directory\r
+ */\r
+ public SessionUrn(VamsasSession session) {\r
+ // throws MalformedURLException {\r
+ // use URI instead of URL\r
+ super(SIMPLECLIENT, session.sessionDir.getAbsoluteFile().toURI());\r
+ }\r
+\r
+ /**\r
+ * TODO: LATER: think about this again.\r
+ * \r
+ * Retrieves the file associated to the current sessionURN. The sessionURN\r
+ * (URI) is based on the session directory absolute path. Use the raw path of\r
+ * the URN and change the scheme to file to generate a new file URI. Then,\r
+ * from the URI create the File object (a File object can be created from an\r
+ * uri)\r
+ * \r
+ * @return File object representing the session URN // File(urn.getPath())\r
+ */\r
+ public File asFile() {\r
+ String path = this.urn.getRawPath();\r
+\r
+ return new File(URI.create("file://" + path));\r
+ }\r
+ // TODO: add abstract 'handler' methods for resolving the URN to a particular\r
+ // class\r
+}\r
-/*
- *
-* VAMSAS Project
-*
-* Dec 13, 2006 - VamsasClient
-*
-*/
-
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.SessionHandle;
-
-/**
- * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
- *
- *
- */
-public class SessionsFile extends ListFile {
-
- private static Log log = LogFactory.getLog(SessionsFile.class);
- /**
- * when set true - get FileNotFoundExceptions on WinXP when writing to locked stream after the backup has been made (via the backupFile method)
- */
- boolean backup=false;
- /**
- * number of my session in list - passed back when a session
- * is added to list, and used (if valid) for quickly
- * looking up presence of session handle in the list.
- */
- private int syncnum = 1;
- /**
- * @param file
- */
- public SessionsFile(File file) throws java.io.IOException {
- super(file);
- }
-
-
- /**
- * internal method for getting sessionsList - ensures a lock has been made but
- * does not release it.
- *
- * @return list of clients
- */
- private SessionHandle[] retrieveSessionHandles() {
- if (lockFile()) {
- try {
- SessionHandle[] sessions =null;
- if (this.fileLock.length()>0) {
-
- ObjectInputStream is = new ObjectInputStream(this.fileLock.getBufferedInputStream(true));
- Object o;
- o=is.readObject();
- if (o!=null) {
- try {
- sessions = (SessionHandle[]) o;
- }
- catch (Exception e) {
- log.error("Garbage in the clientHandle list "+this.sessionFile,e);
- }
- }
- // is.close();
- }
- return sessions;
- } catch (FileNotFoundException e) {
- // e.printStackTrace(System.err);
- log.error(e);
- } catch (Exception e) {
- log.error(e);
- //e.printStackTrace(System.err);
- }
- }
- return null;
- }
-
- /**
- * get the SessionsList from the file. May return null if lock failed!
- * @return sessionsList
- */
- public SessionHandle[] retrieveSessionsList() {
- if (lockFile()) {
- SessionHandle[] clients = retrieveSessionHandles();
- unlockFile();
- return clients;
- }
- return null;
- }
-
- /**
- * get list from the locked SessionsList.
- * @param extantlock
- * @return sessionList or null if lock failed (or file was empty)
- */
- public SessionHandle[] retrieveSessionsList(Lock extantlock) {
- if (lockFile(extantlock)) {
- SessionHandle[] sessions = retrieveSessionHandles();
- unlockFile();
- return sessions;
- }
- return null;
- }
-
-
- /**
- * adds SessionHandle me to the sessionList under an existing lock extantLock.
- * @param newSession
- * @param extantLock
- * @return session index in list or 0 if lock was invalid or addSession operation failed.
- */
- public int addSession(SessionHandle newSession, Lock extantLock) {
- return addSession(newSession, true, extantLock);
- }
-
- /**
- * adds SessionsHandle me to the sessionsList under an existing lock.
- * @param newSession - sessionsHandle
- * @param disambig - if true then add will fail if an identical sessionHandle already exists
- * @param extantLock - existing lock
- * @return client index in list or 0 if addSession (or the lock) failed.
- */
-
- public int addSession(SessionHandle newSession, boolean disambig, Lock extantLock) {
- if (lockFile(extantLock)) {
- this.syncnum = addSession(newSession, disambig);
- unlockFile();
- return this.syncnum;
- }
- return 0;
- }
-
- /**
- * removes the current session from the SessionsList without complaint if the session isn't in the sessionsList already.
- * @param session session handle to be removed
- * @param sessionlock existing lock passed from watcher.
- */
- public void removeSession(SessionHandle session, Lock sessionlock) {
- int mynum =-1;
- if (lockFile(sessionlock)) {
-
- SessionHandle[] sessions = retrieveSessionHandles();
- if (sessions != null) {
- if ((this.syncnum<=0 || this.syncnum>sessions.length) || !sessions[this.syncnum-1].equals(session)) {
- for (int i = 0, j = sessions.length; i < j; i++)
- { if (sessions[i].equals(session)) {
- mynum=i;
- break;
- }
- }
- } else {
- mynum=this.syncnum-1;
- }
-
- if (mynum>-1) {
- SessionHandle[] newlist = new SessionHandle[sessions.length - 1];
- for (int k=0,i = 0, j = sessions.length; i < j; i++)
- if (i!=mynum)
- newlist[k++] = sessions[i];
- if (!putSessionsList(newlist))
- throw new Error("Failed to write new sessionsList!"); // failed to put the sessionList to disk.
- }
- }
- unlockFile();
- } else {
- throw new Error("Couldn't get lock for "+((this.sessionFile==null) ? "Unitialised sessionFile in SessionsFile" : this.sessionFile.getAbsolutePath()));
- }
- }
- /**
- * Adds a SessionHandle to the SessionList file - optionally disambiguating
- * the SessionHandle (modifes the URN).
- * Note: Caller is left to release the lock on the SessionList.
- * @param session
- * @param disambiguate -
- * flag indicating if the URN for me should be disambiguated to
- * differentiate between sessions.
- * @return index of sessionHandle in new list, or -1-position of existing
- * sessionHandle (if disambiguate is true)
- */
- protected int addSession(SessionHandle session, boolean disambiguate) {
- int newsession = 0;
- int tries=5;
- while (tries-->0 && !lockFile())
- try { Thread.sleep(1); } catch (Exception e){};
- if (lockFile()) {
- SessionHandle[] sessions = retrieveSessionHandles();
-
- if (sessions == null) {
- sessions = new SessionHandle[1];
- sessions[0] = session;
- newsession = 1;
- } else {
- int k = 0;
- for (int i = 0, j = sessions.length; i < j; i++) {
- if ( sessions[i].equals(session)) {
- if (disambiguate) {
- while (sessions[i].equals(session)) {
- // me.setClientUrn(me.getClientUrn() + k++); // TODO: make a better
- // disambiguation of
- // urn.
- }
- } else {
- // will not write the ambiguous clientHandle to disk, just return
- // its index.
- return -1 - i;
- }
- }
- }
- int i, j;
- SessionHandle[] newlist = new SessionHandle[sessions.length + 1];
- for (i = 0, j = sessions.length; i < j; i++)
- newlist[i] = sessions[i];
- newlist[j] = session;
- sessions = newlist;
- newsession = j+1;
- }
- if (!putSessionsList(sessions))
- return 0; // failed to put the clientList to disk.
- }
- return newsession;
- }
-
-
- /**
- * safely writes sessions array to the file referred to by sessionFile.
- *
- * @param clients
- * @return true if successful write. Throws Errors otherwise.
- */
- protected boolean putSessionsList(SessionHandle[] clients) {
- if (lockFile()) {
- File templist=null;
- if (!this.backup || (templist = backupSessionFile()) != null) {
- int retries=3;
- while (retries-->0) {
- try {
- ObjectOutputStream os =
- new ObjectOutputStream(this.fileLock.getBufferedOutputStream(true));
- log.debug("About to write "+clients.length+" sessionHandles to output stream.");
- os.writeObject(clients);
- // os.flush();
- os.close();
- // All done - remove the backup.
- if (this.backup)
- templist.delete();
- templist = null;
- retries=-1;
- } catch (Exception e) {
- // System.err
- //.println("Serious - problems writing to sessionFile.");
- log.error("Serious - problems writing to sessionFile.",e);
- if (retries>0 && templist != null) {
- // System.err.println("Recovering from Backup in "
- // + templist.getAbsolutePath());
- log.error("Recovering from Backup in "+ templist.getAbsolutePath());
- templist.renameTo(this.fileLock.target);
- }
- //e.printStackTrace(System.err);
- log.error(e);
- }
- }
- if (retries>-2) {
- // System.err
- // .println("Serious - problems writing to sessionFile. Giving Up.");
- log.error("Serious - problems writing to sessionFile. Giving Up.");
- return false;
- }
- } else {
- throw new Error(
- "Couldn't create backup of the clientList before writing to it!");
- }
- } else {
- throw new Error("Could not lock the clientList: "
- + ((this.sessionFile == null) ? "Unitialized ClientsFile"
- : " failed to get lock on " + this.sessionFile.getAbsolutePath()));
- }
- // successful!
- return true;
- }
-
- public void clearList() {
- if (lockFile()) {
- try {
- FileOutputStream fout = this.fileLock.getFileOutputStream(true);
- fout.flush();
- fout.close();
- } catch (Exception e) {
- throw new Error("Problems trying to clear clientlist!",e);
-
- }
- }
-
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.ObjectInputStream;\r
+import java.io.ObjectOutputStream;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.SessionHandle;\r
+\r
+/**\r
+ * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
+ * \r
+ * \r
+ */\r
+public class SessionsFile extends ListFile {\r
+\r
+ private static Log log = LogFactory.getLog(SessionsFile.class);\r
+\r
+ /**\r
+ * when set true - get FileNotFoundExceptions on WinXP when writing to locked\r
+ * stream after the backup has been made (via the backupFile method)\r
+ */\r
+ boolean backup = false;\r
+\r
+ /**\r
+ * number of my session in list - passed back when a session is added to list,\r
+ * and used (if valid) for quickly looking up presence of session handle in\r
+ * the list.\r
+ */\r
+ private int syncnum = 1;\r
+\r
+ /**\r
+ * @param file\r
+ */\r
+ public SessionsFile(File file) throws java.io.IOException {\r
+ super(file);\r
+ }\r
+\r
+ /**\r
+ * internal method for getting sessionsList - ensures a lock has been made but\r
+ * does not release it.\r
+ * \r
+ * @return list of clients\r
+ */\r
+ private SessionHandle[] retrieveSessionHandles() {\r
+ if (lockFile()) {\r
+ try {\r
+ SessionHandle[] sessions = null;\r
+ if (this.fileLock.length() > 0) {\r
+\r
+ ObjectInputStream is = new ObjectInputStream(this.fileLock\r
+ .getBufferedInputStream(true));\r
+ Object o;\r
+ o = is.readObject();\r
+ if (o != null) {\r
+ try {\r
+ sessions = (SessionHandle[]) o;\r
+ } catch (Exception e) {\r
+ log.error("Garbage in the clientHandle list " + this.sessionFile,\r
+ e);\r
+ }\r
+ }\r
+ // is.close();\r
+ }\r
+ return sessions;\r
+ } catch (FileNotFoundException e) {\r
+ // e.printStackTrace(System.err);\r
+ log.error(e);\r
+ } catch (Exception e) {\r
+ log.error(e);\r
+ // e.printStackTrace(System.err);\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * get the SessionsList from the file. May return null if lock failed!\r
+ * \r
+ * @return sessionsList\r
+ */\r
+ public SessionHandle[] retrieveSessionsList() {\r
+ if (lockFile()) {\r
+ SessionHandle[] clients = retrieveSessionHandles();\r
+ unlockFile();\r
+ return clients;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * get list from the locked SessionsList.\r
+ * \r
+ * @param extantlock\r
+ * @return sessionList or null if lock failed (or file was empty)\r
+ */\r
+ public SessionHandle[] retrieveSessionsList(Lock extantlock) {\r
+ if (lockFile(extantlock)) {\r
+ SessionHandle[] sessions = retrieveSessionHandles();\r
+ unlockFile();\r
+ return sessions;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * adds SessionHandle me to the sessionList under an existing lock extantLock.\r
+ * \r
+ * @param newSession\r
+ * @param extantLock\r
+ * @return session index in list or 0 if lock was invalid or addSession\r
+ * operation failed.\r
+ */\r
+ public int addSession(SessionHandle newSession, Lock extantLock) {\r
+ return addSession(newSession, true, extantLock);\r
+ }\r
+\r
+ /**\r
+ * adds SessionsHandle me to the sessionsList under an existing lock.\r
+ * \r
+ * @param newSession\r
+ * - sessionsHandle\r
+ * @param disambig\r
+ * - if true then add will fail if an identical sessionHandle already\r
+ * exists\r
+ * @param extantLock\r
+ * - existing lock\r
+ * @return client index in list or 0 if addSession (or the lock) failed.\r
+ */\r
+\r
+ public int addSession(SessionHandle newSession, boolean disambig,\r
+ Lock extantLock) {\r
+ if (lockFile(extantLock)) {\r
+ this.syncnum = addSession(newSession, disambig);\r
+ unlockFile();\r
+ return this.syncnum;\r
+ }\r
+ return 0;\r
+ }\r
+\r
+ /**\r
+ * removes the current session from the SessionsList without complaint if the\r
+ * session isn't in the sessionsList already.\r
+ * \r
+ * @param session\r
+ * session handle to be removed\r
+ * @param sessionlock\r
+ * existing lock passed from watcher.\r
+ */\r
+ public void removeSession(SessionHandle session, Lock sessionlock) {\r
+ int mynum = -1;\r
+ if (lockFile(sessionlock)) {\r
+\r
+ SessionHandle[] sessions = retrieveSessionHandles();\r
+ if (sessions != null) {\r
+ if ((this.syncnum <= 0 || this.syncnum > sessions.length)\r
+ || !sessions[this.syncnum - 1].equals(session)) {\r
+ for (int i = 0, j = sessions.length; i < j; i++) {\r
+ if (sessions[i].equals(session)) {\r
+ mynum = i;\r
+ break;\r
+ }\r
+ }\r
+ } else {\r
+ mynum = this.syncnum - 1;\r
+ }\r
+\r
+ if (mynum > -1) {\r
+ SessionHandle[] newlist = new SessionHandle[sessions.length - 1];\r
+ for (int k = 0, i = 0, j = sessions.length; i < j; i++)\r
+ if (i != mynum)\r
+ newlist[k++] = sessions[i];\r
+ if (!putSessionsList(newlist))\r
+ throw new Error("Failed to write new sessionsList!"); // failed to\r
+ // put the\r
+ // sessionList\r
+ // to disk.\r
+ }\r
+ }\r
+ unlockFile();\r
+ } else {\r
+ throw new Error(\r
+ "Couldn't get lock for "\r
+ + ((this.sessionFile == null) ? "Unitialised sessionFile in SessionsFile"\r
+ : this.sessionFile.getAbsolutePath()));\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Adds a SessionHandle to the SessionList file - optionally disambiguating\r
+ * the SessionHandle (modifes the URN). Note: Caller is left to release the\r
+ * lock on the SessionList.\r
+ * \r
+ * @param session\r
+ * @param disambiguate\r
+ * - flag indicating if the URN for me should be disambiguated to\r
+ * differentiate between sessions.\r
+ * @return index of sessionHandle in new list, or -1-position of existing\r
+ * sessionHandle (if disambiguate is true)\r
+ */\r
+ protected int addSession(SessionHandle session, boolean disambiguate) {\r
+ int newsession = 0;\r
+ int tries = 5;\r
+ while (tries-- > 0 && !lockFile())\r
+ try {\r
+ Thread.sleep(1);\r
+ } catch (Exception e) {\r
+ }\r
+ ;\r
+ if (lockFile()) {\r
+ SessionHandle[] sessions = retrieveSessionHandles();\r
+\r
+ if (sessions == null) {\r
+ sessions = new SessionHandle[1];\r
+ sessions[0] = session;\r
+ newsession = 1;\r
+ } else {\r
+ int k = 0;\r
+ for (int i = 0, j = sessions.length; i < j; i++) {\r
+ if (sessions[i].equals(session)) {\r
+ if (disambiguate) {\r
+ while (sessions[i].equals(session)) {\r
+ // me.setClientUrn(me.getClientUrn() + k++); // TODO: make a\r
+ // better\r
+ // disambiguation of\r
+ // urn.\r
+ }\r
+ } else {\r
+ // will not write the ambiguous clientHandle to disk, just return\r
+ // its index.\r
+ return -1 - i;\r
+ }\r
+ }\r
+ }\r
+ int i, j;\r
+ SessionHandle[] newlist = new SessionHandle[sessions.length + 1];\r
+ for (i = 0, j = sessions.length; i < j; i++)\r
+ newlist[i] = sessions[i];\r
+ newlist[j] = session;\r
+ sessions = newlist;\r
+ newsession = j + 1;\r
+ }\r
+ if (!putSessionsList(sessions))\r
+ return 0; // failed to put the clientList to disk.\r
+ }\r
+ return newsession;\r
+ }\r
+\r
+ /**\r
+ * safely writes sessions array to the file referred to by sessionFile.\r
+ * \r
+ * @param clients\r
+ * @return true if successful write. Throws Errors otherwise.\r
+ */\r
+ protected boolean putSessionsList(SessionHandle[] clients) {\r
+ if (lockFile()) {\r
+ File templist = null;\r
+ if (!this.backup || (templist = backupSessionFile()) != null) {\r
+ int retries = 3;\r
+ while (retries-- > 0) {\r
+ try {\r
+ ObjectOutputStream os = new ObjectOutputStream(this.fileLock\r
+ .getBufferedOutputStream(true));\r
+ log.debug("About to write " + clients.length\r
+ + " sessionHandles to output stream.");\r
+ os.writeObject(clients);\r
+ // os.flush();\r
+ os.close();\r
+ // All done - remove the backup.\r
+ if (this.backup)\r
+ templist.delete();\r
+ templist = null;\r
+ retries = -1;\r
+ } catch (Exception e) {\r
+ // System.err\r
+ // .println("Serious - problems writing to sessionFile.");\r
+ log.error("Serious - problems writing to sessionFile.", e);\r
+ if (retries > 0 && templist != null) {\r
+ // System.err.println("Recovering from Backup in "\r
+ // + templist.getAbsolutePath());\r
+ log.error("Recovering from Backup in "\r
+ + templist.getAbsolutePath());\r
+ templist.renameTo(this.fileLock.target);\r
+ }\r
+ // e.printStackTrace(System.err);\r
+ log.error(e);\r
+ }\r
+ }\r
+ if (retries > -2) {\r
+ // System.err\r
+ // .println("Serious - problems writing to sessionFile. Giving Up.");\r
+ log.error("Serious - problems writing to sessionFile. Giving Up.");\r
+ return false;\r
+ }\r
+ } else {\r
+ throw new Error(\r
+ "Couldn't create backup of the clientList before writing to it!");\r
+ }\r
+ } else {\r
+ throw new Error("Could not lock the clientList: "\r
+ + ((this.sessionFile == null) ? "Unitialized ClientsFile"\r
+ : " failed to get lock on " + this.sessionFile.getAbsolutePath()));\r
+ }\r
+ // successful!\r
+ return true;\r
+ }\r
+\r
+ public void clearList() {\r
+ if (lockFile()) {\r
+ try {\r
+ FileOutputStream fout = this.fileLock.getFileOutputStream(true);\r
+ fout.flush();\r
+ fout.close();\r
+ } catch (Exception e) {\r
+ throw new Error("Problems trying to clear clientlist!", e);\r
+\r
+ }\r
+ }\r
+\r
+ }\r
+}\r
/*
- * Created on 15-Sep-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.vamsas.client.simpleclient;
* @author jimp
*/
public class SimpleClient implements IClient {
-
+
private static Log log = LogFactory.getLog(SimpleClient.class);
-
+
protected UserHandle user = null;
-
+
protected SessionUrn session = null;
+
protected VamsasSession _session;
+
protected ClientHandle client = null;
+
protected EventGeneratorThread evgen = null;
+
protected ClientDocument cdocument = null;
-
-
-
-
+
private Lock activeClientFilelock = null;
- private File clientlockFile = null;
-
+
+ private File clientlockFile = null;
+
/**
- * object hash table that persists in each client holding vorbaIds and hash values after a document write
+ * object hash table that persists in each client holding vorbaIds and hash
+ * values after a document write
*/
- protected Hashtable extantobjects=null;
+ protected Hashtable extantobjects = null;
+
/**
- * construct a transient IdFactory instance - this should last only as long as the
- * SimpleClient object holds the lock on the vamsas document being created/manipulated.
+ * construct a transient IdFactory instance - this should last only as long as
+ * the SimpleClient object holds the lock on the vamsas document being
+ * created/manipulated.
+ *
* @return
*/
private IdFactory makeVorbaIdFactory() {
- if (extantobjects==null)
- extantobjects=new Hashtable();
+ if (extantobjects == null)
+ extantobjects = new Hashtable();
return new IdFactory(getSessionHandle(), client, user, extantobjects);
}
-
+
/**
- * construct SimpleClient for user, client and VamsasSession directory
- * use the SimpleClientFactory rather than this constructor directly.
+ * construct SimpleClient for user, client and VamsasSession directory use the
+ * SimpleClientFactory rather than this constructor directly.
+ *
* @param user
* @param client
* @param sess
*/
- protected SimpleClient(UserHandle user, ClientHandle client, VamsasSession sess) throws InvalidSessionUrnException {
+ protected SimpleClient(UserHandle user, ClientHandle client,
+ VamsasSession sess) throws InvalidSessionUrnException {
// TODO: validate user/client/session
_session = sess;
this.user = user;
this.client = client;
- //try {
- log.debug("Creating new session for "+_session);
- session = new SessionUrn(_session);
- log.debug("Creating new Event Generator");
- evgen = new EventGeneratorThread(_session, this, handlers);
- /*} catch (MalformedURLException e) {
- log.error("Couldn't form a valid SessionUrn object!",e);
- throw new InvalidSessionUrnException(_session.toString());
- }*/
- log.debug("SimpleClient constructed for session "+session.getSessionUrn());
-
+ // try {
+ log.debug("Creating new session for " + _session);
+ session = new SessionUrn(_session);
+ log.debug("Creating new Event Generator");
+ evgen = new EventGeneratorThread(_session, this, handlers);
+ /*
+ * } catch (MalformedURLException e) {
+ * log.error("Couldn't form a valid SessionUrn object!",e); throw new
+ * InvalidSessionUrnException(_session.toString()); }
+ */
+ log
+ .debug("SimpleClient constructed for session "
+ + session.getSessionUrn());
+
}
+
/**
- * construct new SimpleClientsession by importing objects from an existing vamsas document
+ * construct new SimpleClientsession by importing objects from an existing
+ * vamsas document
+ *
* @param user
* @param client
* @param sess
* @param importingArchive
- * @throws Exception IOExceptions for Session IO problems, and general Exception if importing document is invalid.
- protected SimpleClient(UserHandle user, ClientHandle client, VamsasSession sess, File importingArchive) throws Exception {
- this(user, client, sess);
- if (log.isDebugEnabled())
- {
- log.debug("Attempting to overwrite session document with file: "+importingArchive);
- }
- // TODO: write provenance entry for new session indicating the import.
-
- }
+ * @throws Exception
+ * IOExceptions for Session IO problems, and general Exception if
+ * importing document is invalid. protected SimpleClient(UserHandle
+ * user, ClientHandle client, VamsasSession sess, File
+ * importingArchive) throws Exception { this(user, client, sess); if
+ * (log.isDebugEnabled()) {
+ * log.debug("Attempting to overwrite session document with file: "
+ * +importingArchive); } // TODO: write provenance entry for new
+ * session indicating the import.
+ *
+ * }
*/
-
+
/*
- * (non-Javadoc)
- * LATER: check that build substitution variables are correct
+ * (non-Javadoc) LATER: check that build substitution variables are correct
+ *
* @see uk.ac.vamsas.client.IClient#getAbout()
*/
public String getAbout() {
return new String("VORBA SimpleClient version $version$ build $build$");
}
-
+
/*
* (non-Javadoc)
*
public String getSessionUrn() {
return session.getSessionUrn();
}
-
+
/*
* (non-Javadoc)
*
SessionHandle sh = new SessionHandle(session.getSessionUrn());
return sh;
}
-
+
/*
* (non-Javadoc)
*
public ClientHandle getClientHandle() {
return client;
}
-
+
/*
* (non-Javadoc)
*
public UserHandle getUserHandle() {
return user;
}
+
/**
*
* @return user field for a provenance entry
protected String getProvenanceUser() {
return new String(user.getFullName());
}
+
/**
- * construct a provenance entry for this client with the specified action string.
+ * construct a provenance entry for this client with the specified action
+ * string.
+ *
* @param action
* @return properly completed provenance entry
*/
protected Entry getProvenanceEntry(String action) {
- Entry prov = ProvenanceStuff.newProvenanceEntry(client.getClientUrn(), getProvenanceUser(), action);
+ Entry prov = ProvenanceStuff.newProvenanceEntry(client.getClientUrn(),
+ getProvenanceUser(), action);
return prov;
}
+
private Hashtable handlers = initHandlers();
-
+
private Vector listeners = new Vector();
-
+
/**
- * make all the PropertyChangeSupport objects for the
- * events described in uk.ac.vamsas.client.Event
+ * make all the PropertyChangeSupport objects for the events described in
+ * uk.ac.vamsas.client.Event
+ *
* @return
*/
private static Hashtable initHandlers() {
}
return events;
}
-
+
/*
* (non-Javadoc)
*
- * @see uk.ac.vamsas.client.IClient#addDocumentUpdateHandler(java.util.EventListener)
+ * @see
+ * uk.ac.vamsas.client.IClient#addDocumentUpdateHandler(java.util.EventListener
+ * )
*/
public void addDocumentUpdateHandler(PropertyChangeListener evt) {
this.addVorbaEventHandler(Events.DOCUMENT_UPDATE, evt);
}
- boolean finalized=false;
+
+ boolean finalized = false;
+
private void haltPickmanager() {
- if (pickmanager!=null) {
- final SimpleClient dying=this;
+ if (pickmanager != null) {
+ final SimpleClient dying = this;
new Thread() {
public void run() {
SimpleClient.log.debug("Stopping pickManager..");
}.start();
}
}
+
/*
* (non-Javadoc)
*
*/
public void finalizeClient() {
if (finalized)
- throw new Error("VAMSAS Client Implementation Error: Finalized called twice for same client instance.");
+ throw new Error(
+ "VAMSAS Client Implementation Error: Finalized called twice for same client instance.");
// mark this instance as finalized
- finalized=true;
-
+ finalized = true;
+
// TODO: determine if this is last client in session
-
- // TODO: raise events like : ((lst_client && document.request.to.close), (client_finalization), (
- evgen._raise(Events.CLIENT_FINALIZATION, null, this,null);
+
+ // TODO: raise events like : ((lst_client && document.request.to.close),
+ // (client_finalization), (
+ evgen._raise(Events.CLIENT_FINALIZATION, null, this, null);
// if (handlers.containsKey(Events.))
// if (handlers.containsKey(Events.CLIENT_FINALIZATION))
// deregister listeners.
log.debug("Stopping pickManager");
haltPickmanager();
-
+
log.debug("Deregistering Client");
_session.removeClient(this);
- //log.debug("Stopping EventGenerator..");
- //evgen.stopWatching();
+ // log.debug("Stopping EventGenerator..");
+ // evgen.stopWatching();
this.cdocument = null;
SimpleClient.log.debug("EventGenerator halted.");
log.debug("finalization Complete.");
}
-
+
/*
* (non-Javadoc)
*
*/
public IClientDocument getClientDocument() throws IOException {
log.debug("getClientDocument");
- if (cdocument!=null) {
- // cdocument is non-nill if the ClientDocument.finalise() method hasn't been called.
+ if (cdocument != null) {
+ // cdocument is non-nill if the ClientDocument.finalise() method hasn't
+ // been called.
return cdocument;
}
evgen.disableDocumentWatch();
try {
// LATER: bail out if it takes too long to get the lock ?
va = _session.getVamsasDocument();
- }
- catch (IOException e) {
+ } catch (IOException e) {
throw new IOException("Failed to get lock on session document");
}
- VamsasDocument doc=null;
+ VamsasDocument doc = null;
IdFactory vorba = null;
- // TODO: LATER: reduce size of vorba ids generated from these parameters to IdFactory (mainly sessionHandle rationalization ?)
+ // TODO: LATER: reduce size of vorba ids generated from these parameters to
+ // IdFactory (mainly sessionHandle rationalization ?)
try {
- va.setVorba(vorba=makeVorbaIdFactory());
+ va.setVorba(vorba = makeVorbaIdFactory());
// if session currently holds data - read it in - or get a dummy
log.debug("Accessing document");
- doc =
- va.getVamsasDocument(getProvenanceUser(),
- "created new session document.", null);
- if (doc!=null)
+ doc = va.getVamsasDocument(getProvenanceUser(),
+ "created new session document.", null);
+ if (doc != null)
log.debug("Successfully retrieved document.");
else
log.error("Unexpectedly retrieved null document!");
- }
- catch (Exception e) {
- log.error("Failed to get session document for session directory '"+_session.sessionDir+"'", e);
- throw new IOException("Failed to get session document for session directory '"+_session.sessionDir+"'");
+ } catch (Exception e) {
+ log.error("Failed to get session document for session directory '"
+ + _session.sessionDir + "'", e);
+ throw new IOException(
+ "Failed to get session document for session directory '"
+ + _session.sessionDir + "'");
}
// Construct the IClientDocument instance
-
+
cdocument = new ClientDocument(doc, va, vorba, this);
return cdocument;
}
-
+
/*
* (non-Javadoc)
+ *
* @throws Errors for invalid newdoc parameter
- * @see uk.ac.vamsas.client.IClient#updateDocument(uk.ac.vamsas.client.IClientDocument)
+ *
+ * @see
+ * uk.ac.vamsas.client.IClient#updateDocument(uk.ac.vamsas.client.IClientDocument
+ * )
*/
public void updateDocument(IClientDocument newdoc) {
log.debug("updateDocument:");
- // Check validity of simpleclient instance and that it holds a lock on the session's document
+ // Check validity of simpleclient instance and that it holds a lock on the
+ // session's document
if (!(newdoc instanceof ClientDocument)) {
throw new Error("Invalid IClientDocument passsed to SimpleClient.");
}
- if (cdocument==null)
- throw new Error("Client Error - updateDocument() called before getClientDocument() on this SimpleClient instance.");
- if (newdoc!=cdocument)
- throw new Error("Client Error - SimpleClient.updateDocument() can only take the IClientDocument instance returned from SimpleClient.getClientDocument()");
-
+ if (cdocument == null)
+ throw new Error(
+ "Client Error - updateDocument() called before getClientDocument() on this SimpleClient instance.");
+ if (newdoc != cdocument)
+ throw new Error(
+ "Client Error - SimpleClient.updateDocument() can only take the IClientDocument instance returned from SimpleClient.getClientDocument()");
+
if (evgen.isDocumentWatchEnabled())
- throw new Error("Probable Client Error (did you remember to call SimpleClient.updateDocument(clientdoc) at the end of the document update handler?) - or Library Bug : Document watcher still enabled whilst ClientDocument instance exists.");
- if (cdocument.isInvalidModification())
- {
- log.info("Client has corrupted the vamsas document. It will not be written back to the session - sorry.");
- // TODO: modify updateDocument signature: We should really raise an exception here to tell the client that it broke the datamodel.
+ throw new Error(
+ "Probable Client Error (did you remember to call SimpleClient.updateDocument(clientdoc) at the end of the document update handler?) - or Library Bug : Document watcher still enabled whilst ClientDocument instance exists.");
+ if (cdocument.isInvalidModification()) {
+ log
+ .info("Client has corrupted the vamsas document. It will not be written back to the session - sorry.");
+ // TODO: modify updateDocument signature: We should really raise an
+ // exception here to tell the client that it broke the datamodel.
} else {
// actually try to write - if necessary.
if (!cdocument.isModified()) {
- // client document is silently got rid of, with no session update events.
+ // client document is silently got rid of, with no session update
+ // events.
if (log.isDebugEnabled())
- log.debug("updateDocument for "+session.getSessionUrn()+" with unmodified IClientDocument (skipping the write)");
+ log.debug("updateDocument for " + session.getSessionUrn()
+ + " with unmodified IClientDocument (skipping the write)");
} else {
writeSessionDocument();
}
}
// release locks, reset and start to receive events again
- tidyAwaySessionDocumentState();
+ tidyAwaySessionDocumentState();
}
+
/**
* garbage collect the ClientDocument instance and re-enable watchers.
*/
log.debug("Finalizing ClientDocument instance.");
cdocument.finalize();
} catch (Throwable e) {
- log.error("Exception when trying to garbage collect ClientDocument for "+session.getSessionUrn(), e);
+ log.error("Exception when trying to garbage collect ClientDocument for "
+ + session.getSessionUrn(), e);
}
cdocument = null; // this is probably done by finalize
_session.unlockVamsasDocument();
evgen.enableDocumentWatch();
} catch (IOException e) {
- log.warn("IO Problems when releasing lock on session document!",e);
- _session.slog.error("IO problems when attempting to release lock on session document.");
+ log.warn("IO Problems when releasing lock on session document!", e);
+ _session.slog
+ .error("IO problems when attempting to release lock on session document.");
}
}
*/
private void writeSessionDocument() {
try {
- boolean updated=cdocument.updateSessionDocument();
- boolean hasContent=cdocument.isModified();
+ boolean updated = cdocument.updateSessionDocument();
+ boolean hasContent = cdocument.isModified();
if (!updated) {
- log.warn("Session document did not update properly for session directory "+_session.sessionDir);
- // cdocument.archive.cancelArchive(); // LATER: could be done - would need to prevent updateSessionDocument closing the iohandler.
- _session.slog.warn("Session Document updated but may not be valid (false return from org.vamsas.simpleclient.ClientDocument.updateSessionDocument()");
+ log
+ .warn("Session document did not update properly for session directory "
+ + _session.sessionDir);
+ // cdocument.archive.cancelArchive(); // LATER: could be done - would
+ // need to prevent updateSessionDocument closing the iohandler.
+ _session.slog
+ .warn("Session Document updated but may not be valid (false return from org.vamsas.simpleclient.ClientDocument.updateSessionDocument()");
} else {
log.debug("Document update successful.");
}
- if (hasContent)
- {
+ if (hasContent) {
_session.setUnsavedFlag();
}
- }
- catch (IOException e) {
- log.warn("IO Problems when updating document!",e);
+ } catch (IOException e) {
+ log.warn("IO Problems when updating document!", e);
_session.slog.error("IO problems when attempting to update document.");
}
}
* @see uk.ac.vamsas.client.IClient#storeDocument(java.io.File)
*/
public void storeDocument(File location) {
- if (location==null)
- throw new Error("Vamsas Client API Usage Error: storeDocument called with null location.");
- log.debug("StoreDocument to "+location);
+ if (location == null)
+ throw new Error(
+ "Vamsas Client API Usage Error: storeDocument called with null location.");
+ log.debug("StoreDocument to " + location);
// write storeDocument file to inform other clients that they should raise
Lock vamlock = evgen.want_to_store();
// Events.DOCUMENT_FINALIZEAPPDATA
try {
_session.writeVamsasDocument(location, vamlock);
- _session.clearUnsavedFlag();
+ _session.clearUnsavedFlag();
} catch (Exception e) {
- log.warn("Exception whilst trying to store document in "+location,e);
+ log.warn("Exception whilst trying to store document in " + location, e);
}
vamlock.release();
}
-
+
/*
* (non-Javadoc)
*
* @see uk.ac.vamsas.client.IClient#addVorbaEventHandler(java.lang.String,
- * java.beans.PropertyChangeListener)
+ * java.beans.PropertyChangeListener)
*/
public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt) {
if (handlers.containsKey(EventChain)) {
- log.debug("Adding new handler for "+EventChain);
+ log.debug("Adding new handler for " + EventChain);
Object handler;
((PropertyChangeSupport) (handler = handlers.get(EventChain)))
- .addPropertyChangeListener(evt);
+ .addPropertyChangeListener(evt);
listeners.add(handler);
listeners.add((Object) evt);
}
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see uk.ac.vamsas.client.IClient#pollUpdate()
*/
public void pollUpdate() {
log.debug("pollUpdate");
- if (evgen==null) {
+ if (evgen == null) {
log.warn("pollUpdate called on incomplete SimpleClient object.");
return;
}
-
+
if (!evgen.isWatcherAlive()) {
log.warn("pollUpdate called before joinSession() - trying to do this.");
try {
joinSession();
} catch (Exception e) {
- log.error("Unexpected exception on default call to joinSession",e);
+ log.error("Unexpected exception on default call to joinSession", e);
}
}
-
- //TODO ensure event generator robustly handles these interrupts.
+
+ // TODO ensure event generator robustly handles these interrupts.
log.debug("interrrupting event generator.");
evgen.interruptWatching();
log.debug("interrrupted event generator.");
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see uk.ac.vamsas.client.IClient#joinSession()
*/
public void joinSession() throws Exception {
log.debug("Joining Session.");
// start the EventGenerator thread.
- if (evgen==null) {
+ if (evgen == null) {
log.warn("joinSession called on incomplete SimpleClient object.");
return;
}
if (evgen.isWatcherAlive())
- throw new Error("Join session called twice for the same SimpleClient (IClient instance).");
+ throw new Error(
+ "Join session called twice for the same SimpleClient (IClient instance).");
evgen.startWatching();
if (evgen.isWatcherAlive())
log.debug("Started EventGenerator thread.");
else {
log.warn("Failed to start EventGenerator thread.");
- throw new Exception("Failed to start event generator thread - client cannot be instantiated.");
+ throw new Exception(
+ "Failed to start event generator thread - client cannot be instantiated.");
}
- if (evgen.countHandlersFor(Events.DOCUMENT_CREATE)>0) {
- //TODO: LATER: is this application connecting to a newly created session document ?
- //evgen.raise(Events.DOCUMENT_CREATE);
+ if (evgen.countHandlersFor(Events.DOCUMENT_CREATE) > 0) {
+ // TODO: LATER: is this application connecting to a newly created session
+ // document ?
+ // evgen.raise(Events.DOCUMENT_CREATE);
}
-
+
}
-
-
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see uk.ac.vamsas.client.IClient#importDocument(java.io.File)
*/
public void importDocument(File location) {
// TODO LATER: implement SimpleClient.importDocument()
- // if (numberOfClients<1 or document file is empty/new, then can import directly.)
- // more complex if data is already present in document. Could have a 'clearSession' method, too, or dump and overwrite instead.
- log.error("importDocument is not yet implemented for a SimpleClient Session.");
-
- /*try {
- this._session.setVamsasDocument(location);
- } catch (IOException e) {
- log.error("importDocument failed.");
- }*/
+ // if (numberOfClients<1 or document file is empty/new, then can import
+ // directly.)
+ // more complex if data is already present in document. Could have a
+ // 'clearSession' method, too, or dump and overwrite instead.
+ log
+ .error("importDocument is not yet implemented for a SimpleClient Session.");
+
+ /*
+ * try { this._session.setVamsasDocument(location); } catch (IOException e)
+ * { log.error("importDocument failed."); }
+ */
}
public IObjectUpdate getUpdateHandler(Class rootObject) {
public void removeUpdateHandler(Class rootObject) {
// TODO Auto-generated method stub
-
+
}
public void setUpdateHandler(IObjectUpdate handler) {
// TODO Auto-generated method stub
-
+
}
/**
* retrieves the current VamsasSession to which belong the client
+ *
* @return the _session
*/
protected VamsasSession get_session() {
return this._session;
}
- SimplePickManager pickmanager=null;
- /* (non-Javadoc)
+
+ SimplePickManager pickmanager = null;
+
+ /*
+ * (non-Javadoc)
+ *
* @see uk.ac.vamsas.client.IClient#getPickManager()
*/
public IPickManager getPickManager() {
}
private void createPickManager() {
- if (pickmanager==null){
+ if (pickmanager == null) {
// TODO: Construct PickManager for session using details from sessionURN!
log.debug("Creating PickManager (not from sessionURN yet)");
- pickmanager = new SimplePickManager(new uk.ac.vamsas.client.picking.SocketManager());
+ pickmanager = new SimplePickManager(
+ new uk.ac.vamsas.client.picking.SocketManager());
}
}
-
-
- protected void releaseActiveClientFile() throws IOException
- {
-
+
+ protected void releaseActiveClientFile() throws IOException {
+
log.debug("Releasing active client locks");
- if( activeClientFilelock != null)
- {// Release the lock
+ if (activeClientFilelock != null) {// Release the lock
log.debug("Releasing lock on active client lock file");
activeClientFilelock.release();
- log.debug("ReleaseActiveClientFile called when client has no lock on its clientLockFile");
+ log
+ .debug("ReleaseActiveClientFile called when client has no lock on its clientLockFile");
activeClientFilelock = null;
} else {
- log.debug("ReleaseActiveClientFile called when client has no lock on its clientLockFile");
+ log
+ .debug("ReleaseActiveClientFile called when client has no lock on its clientLockFile");
}
- if (this.clientlockFile != null)
- {
+ if (this.clientlockFile != null) {
log.debug("trying to delete active client lock file");
- if (this.clientlockFile.exists())
- {
+ if (this.clientlockFile.exists()) {
this.clientlockFile.delete();
log.debug("deleted active client lock file");
}
} else {
- log.debug("ReleaseActiveClientFile called when client has no clientLockFile");
+ log
+ .debug("ReleaseActiveClientFile called when client has no clientLockFile");
}
}
-
- protected void createActiveClientFile() throws IOException
- {
- if(this.clientlockFile != null )return;
- log.debug("createActiveClientFile");
- //create, if need, subdirectory to contain client files
- File clientlockFileDir = new File ( this.get_session().sessionDir, this.get_session().clientFileDirectory);
- if( !clientlockFileDir.exists())
- {//the directory does not exist, create it
- if (! clientlockFileDir.mkdirs())
- {
- throw new IOException("Failed to create sub directory to session directory for client lock files'"+clientlockFileDir.getAbsolutePath()+"'");
- }
+
+ protected void createActiveClientFile() throws IOException {
+ if (this.clientlockFile != null)
+ return;
+ log.debug("createActiveClientFile");
+ // create, if need, subdirectory to contain client files
+ File clientlockFileDir = new File(this.get_session().sessionDir, this
+ .get_session().clientFileDirectory);
+ if (!clientlockFileDir.exists()) {// the directory does not exist, create it
+ if (!clientlockFileDir.mkdirs()) {
+ throw new IOException(
+ "Failed to create sub directory to session directory for client lock files'"
+ + clientlockFileDir.getAbsolutePath() + "'");
+ }
+ } else {
+ if (!(clientlockFileDir.isDirectory() && clientlockFileDir.canWrite())) {
+ throw new IOException(
+ "Directory for client lock files is not a directory or is not accessibl: '"
+ + clientlockFileDir.getAbsolutePath() + "'");
}
- else
- {
- if (!(clientlockFileDir.isDirectory() && clientlockFileDir.canWrite()))
- {
- throw new IOException("Directory for client lock files is not a directory or is not accessibl: '"+clientlockFileDir.getAbsolutePath()+"'");
- }
}
- this.clientlockFile = new File (clientlockFileDir, this.getClientHandle().getClientUrn().replaceAll("[:;/\\\\]+",""));
-
- log.debug("Creating active client lock file "+ this.clientlockFile.getAbsolutePath());
- Lock clientLock = uk.ac.vamsas.client.simpleclient.LockFactory.getLock(clientlockFile, false);
- if (clientLock==null || !clientLock.isLocked())
- {
- log.fatal("IMPLEMENTATION ERROR: Couldn't get a lock for the client lock file "+clientlockFile);
+ this.clientlockFile = new File(clientlockFileDir, this.getClientHandle()
+ .getClientUrn().replaceAll("[:;/\\\\]+", ""));
+
+ log.debug("Creating active client lock file "
+ + this.clientlockFile.getAbsolutePath());
+ Lock clientLock = uk.ac.vamsas.client.simpleclient.LockFactory.getLock(
+ clientlockFile, false);
+ if (clientLock == null || !clientLock.isLocked()) {
+ log
+ .fatal("IMPLEMENTATION ERROR: Couldn't get a lock for the client lock file "
+ + clientlockFile);
}
activeClientFilelock = clientLock;
}
+
/**
* @return the clientlockFile
*/
protected File getClientlockFile() {
return clientlockFile;
}
+
/**
*
* @return the lock for the client in the session
protected Lock getClientLock() {
return activeClientFilelock;
}
+
SimpleClientConfig _config = null;
+
public SimpleClientConfig getSimpleClientConfig() {
- if (_config==null)
- {
+ if (_config == null) {
_config = new SimpleClientConfig();
}
return _config;
-/**
- *
- */
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Vector;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.AppDataInputStream;
-import uk.ac.vamsas.client.AppDataOutputStream;
-import uk.ac.vamsas.client.IClientAppdata;
-import uk.ac.vamsas.objects.core.AppData;
-import uk.ac.vamsas.objects.core.ApplicationData;
-import uk.ac.vamsas.objects.core.User;
-import uk.ac.vamsas.objects.utils.AppDataReference;
-
-/**
- * @author jimp
- * Access interface to data chunks read from a VamsasArchiveReader stream
- * (or byte buffer input stream) or written to a VamsasArchive stream.
- * // TODO: get VamsasArchiveReader from sclient
- */
-public class SimpleClientAppdata implements IClientAppdata {
- private static Log log = LogFactory.getLog(SimpleClientAppdata.class);
- /**
- * has the session's document been accessed to get the AppData entrys?
- */
- protected boolean accessedDocument = false;
- /**
- * has the user datablock been modified ?
- * temporary file containing new user specific application data chunk
- */
- SessionFile newUserData=null;
- JarOutputStream newUserDataStream = null;
- /**
- * has the apps global datablock been modified ?
- * temporary file containing new global application data chunk
- */
- SessionFile newAppData=null;
- JarOutputStream newAppDataStream=null;
- /**
- * set by extractAppData
- */
- protected ApplicationData appsGlobal = null;
- /**
- * set by extractAppData
- */
- protected User usersData = null;
-
- ClientDocument clientdoc;
- /**
- * state flags
- * - accessed ClientAppdata
- * - accessed UserAppdata
- * => inputStream from embedded xml or jar entry of backup has been created
- * - set ClientAppdata
- * - set UserAppdata
- * => an output stream has been created and written to - or a data chunk has been written.
- * - need flag for switching between embedded and jar entry mode ? - always write a jar entry for a stream.
- * - need code for rewind and overwriting if the set*Appdata methods are called more than once.
- * - need flags for streams to except a call to set*Appdata when an output stream exists and is open.
- * - need
- * @param clientdoc The ClientDocument instance that this IClientAppData is accessing
- */
- protected SimpleClientAppdata(ClientDocument clientdoc) {
- if (clientdoc==null) {
- log.fatal("Implementation error - Null ClientDocument for SimpleClientAppdata construction.");
- throw new Error("Implementation error - Null ClientDocument for SimpleClientAppdata construction.");
- }
- this.clientdoc = clientdoc;
- }
- /**
- * ensures that the appData information for this client
- * instance has been extracted from the vamsas document provided by clientdoc.
- */
- private void extractAppData()
- {
- if (!accessedDocument)
- _extractAppData(clientdoc.getVamsasDocument());
- }
- /**
- * gets appropriate app data for the application, if it exists in this dataset
- * Called by every accessor to ensure data has been retrieved from document.
- */
- private void _extractAppData(uk.ac.vamsas.objects.core.VamsasDocument doc) {
- if (doc==null) {
- log.debug("extractAppData called for null document object");
- return;
- }
- if (accessedDocument) {
- return;
- }
- Vector apldataset = AppDataReference.getUserandApplicationsData(
- doc, clientdoc.sclient.getUserHandle(), clientdoc.sclient.getClientHandle());
- accessedDocument = true;
- if (apldataset!=null) {
- if (apldataset.size()>0) {
- AppData clientdat = (AppData) apldataset.get(0);
- if (clientdat instanceof ApplicationData) {
- appsGlobal = (ApplicationData) clientdat;
- if (apldataset.size()>1) {
- clientdat = (AppData) apldataset.get(1);
- if (clientdat instanceof User) {
- usersData = (User) clientdat;
- }
- if (apldataset.size()>2)
- log.info("Ignoring additional ("+(apldataset.size()-2)+") AppDatas returned by document appdata query.");
- }
- } else {
- log.warn("Unexpected entry in AppDataReference query: id="+clientdat.getVorbaId()+" type="+clientdat.getClass().getName());
- }
- apldataset.removeAllElements(); // destroy references.
- }
- }
- }
- /**
- * LATER: generalize this for different low-level session implementations (it may not always be a Jar)
- * @param appdata
- * @param docreader
- * @return
- */
- private InputStream getAppDataStream(AppData appdata, VamsasArchiveReader docreader) {
- String entryRef = appdata.getDataReference();
- if (entryRef!=null) {
- log.debug("Resolving appData reference +"+entryRef);
- InputStream entry = docreader.getAppdataStream(entryRef);
- if (entry!=null) {
- return entry;
- // log.warn("Implementation problem - docreader didn't return a JarInputStream entry.");
- }
- } else {
- log.debug("GetAppDataStream called for an AppData without a data reference.");
- }
- return null;
- }
- /**
- * yuk - size of buffer used for slurping appData JarEntry into a byte array.
- */
- private final int _TRANSFER_BUFFER=4096*4;
-
- /**
- * Resolve AppData object to a byte array.
- * @param appdata
- * @param archiveReader
- * @return null or the application data as a byte array
- */
- private byte[] getAppDataAsByteArray(AppData appdata, VamsasArchiveReader docreader) {
- if (appdata.getData()==null) {
- if (docreader==null) {
- log.warn("Silently failing getAppDataAsByteArray with null docreader.",new Exception());
- return null;
- }
- // resolve and load data
- InputStream entry = getAppDataStream(appdata, docreader);
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- try {
- byte buff[] = new byte[_TRANSFER_BUFFER];
- int olen=0;
- while (entry!=null && entry.available()>0) {
- int len = entry.read(buff, 0, _TRANSFER_BUFFER);
- if (len>-1)
- { bytes.write(buff, 0, len);
- olen+=len;
- }
- }
- buff=null;
- } catch (Exception e) {
- log.warn("Unexpected exception - probable truncation when accessing VamsasDocument entry "+appdata.getDataReference(), e);
- }
- if (bytes.size()>0) {
- // LATER: deal with probable OutOfMemoryErrors here
- log.debug("Got "+bytes.size()+" bytes from AppDataReference "+appdata.getDataReference());
- byte data[] = bytes.toByteArray();
- bytes = null;
- return data;
- }
- return null;
- } else {
- log.debug("Returning inline AppData block for "+appdata.getVorbaId());
- return appdata.getData();
- }
- }
- /**
- * internal method for getting a DataInputStream from an AppData object.
- * @param appdata
- * @param docreader
- * @return data in object or null if no data is accessible
- */
- private AppDataInputStream getAppDataAsDataInputStream(AppData appdata, VamsasArchiveReader docreader) {
- if (appdata!=null && docreader!=null) {
- String entryRef = appdata.getDataReference();
- if (entryRef!=null) {
- log.debug("Resolving AppData reference for "+entryRef);
- InputStream jstrm = docreader.getAppdataStream(entryRef);
- if (jstrm!=null)
- return new AppDataInputStream(jstrm);
- else {
- log.debug("Returning null input stream for unresolved reference ("+entryRef+") id="+appdata.getVorbaId());
- return null;
- }
- } else {
- // return a byteArray input stream
- byte[] data=appdata.getData();
- if (data.length>0) {
- ByteArrayInputStream stream = new ByteArrayInputStream(data);
- return new AppDataInputStream(stream);
- } else {
- log.debug("Returning null input stream for empty Appdata data block in id="+appdata.getVorbaId());
- return null;
- }
- }
- } else {
- log.debug("Returning null DataInputStream for appdata entry:"+appdata.getVorbaId());
- }
- return null;
- }
-
- /**
- * internal method for getting ByteArray from AppData object
- * @param clientOrUser - true for returning userData, otherwise return Client AppData.
- * @return null or byte array
- */
- private byte[] _getappdataByteArray(boolean clientOrUser) {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- byte[] data=null;
- String appdName;
- if (!clientOrUser) {
- appdName = "Client's Appdata";
- } else {
- appdName = "User's Appdata";
- }
- log.debug("getting "+appdName+" as a byte array");
- extractAppData();
- AppData object;
- if (!clientOrUser) {
- object = appsGlobal;
- } else {
- object = usersData;
- }
- if (object!=null) {
- log.debug("Trying to resolve "+appdName+" object to byte array.");
- data = getAppDataAsByteArray(object, clientdoc.getVamsasArchiveReader());
- }
- if (data == null)
- log.debug("Returning null for "+appdName+"ClientAppdata byte[] array");
- return data;
-
- }
-
- /**
- * common method for Client and User AppData->InputStream accessor
- * @param clientOrUser - the appData to resolve - false for client, true for user appdata.
- * @return null or the DataInputStream desired.
- */
- private AppDataInputStream _getappdataInputStream(boolean clientOrUser) {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- String appdName;
- if (!clientOrUser) {
- appdName = "Client's Appdata";
- } else {
- appdName = "User's Appdata";
- }
- if (log.isDebugEnabled())
- log.debug("getting "+appdName+" as an input stream.");
- extractAppData();
- AppData object;
- if (!clientOrUser) {
- object = appsGlobal;
- } else {
- object = usersData;
- }
- if (object!=null) {
- log.debug("Trying to resolve ClientAppdata object to an input stream.");
- return getAppDataAsDataInputStream(object, clientdoc.getVamsasArchiveReader());
- }
- log.debug("getClientInputStream returning null.");
- return null;
- }
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#getClientAppdata()
- */
- public byte[] getClientAppdata() {
- return _getappdataByteArray(false);
- }
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#getClientInputStream()
- */
- public AppDataInputStream getClientInputStream() {
- return _getappdataInputStream(false);
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#getUserAppdata()
- */
- public byte[] getUserAppdata() {
- return _getappdataByteArray(true);
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#getUserInputStream()
- */
- public AppDataInputStream getUserInputStream() {
- return _getappdataInputStream(true);
- }
- /**
- * methods for writing new AppData entries.
- */
- private AppDataOutputStream _getAppdataOutputStream(boolean clientOrUser) {
- // Must access document to get any existing references
- extractAppData();
- String apdname;
- SessionFile apdfile=null;
- if (!clientOrUser) {
- apdname = "clientAppData";
- apdfile = newAppData;
- } else {
- apdname = "userAppData";
- apdfile = newUserData;
- }
- try {
- if (apdfile==null) {
- apdfile=clientdoc.sclient._session.getTempSessionFile(apdname,".jar");
- log.debug("Successfully made temp appData file for "+apdname);
- } else {
- // truncate to remove existing data.
- apdfile.fileLock.getRaFile().setLength(0);
- log.debug("Successfully truncated existing temp appData for "+apdname);
- }
- } catch (Exception e) {
- log.error("Whilst opening temp file in directory "+clientdoc.sclient._session.sessionDir, e);
- }
- // we do not make another file for the new entry if one exists already
- if (!clientOrUser) {
- newAppData = apdfile;
- } else {
- newUserData = apdfile;
- }
- try {
- apdfile.lockFile();
- // LATER: Refactor these local AppDatastream IO stuff to their own class.
- JarOutputStream dstrm =
- new JarOutputStream(apdfile.fileLock.getBufferedOutputStream(true));
- if (!clientOrUser) {
- newAppDataStream = dstrm;
- } else {
- newUserDataStream = dstrm;
- }
- dstrm.putNextEntry(new JarEntry("appData_entry.dat"));
- // LATER: there may be trouble ahead if an AppDataOutputStream is written to by one thread when another truncates the file. This situation should be prevented if possible
- return new AppDataOutputStream(dstrm);
- }
- catch (Exception e) {
- log.error("Whilst opening jar output stream for file "+apdfile.sessionFile);
- }
- // tidy up and return null
- apdfile.unlockFile();
- return null;
- }
- /**
- * copy data from the appData jar file to an appropriately
- * referenced jar or Data entry for the given ApplicationData
- * Assumes the JarFile is properly closed.
- * @param vdoc session Document handler
- * @param appd the AppData whose block is being updated
- * @param apdjar the new data in a Jar written by this class
- */
- protected void updateAnAppdataEntry(VamsasArchive vdoc, AppData appd, SessionFile apdjar) throws IOException {
- if (apdjar==null || apdjar.sessionFile==null || !apdjar.sessionFile.exists()) {
- throw new IOException("No temporary Appdata to recover and transfer.");
- }
- if (vdoc==null) {
- log.fatal("FATAL! NO DOCUMENT TO WRITE TO!");
- throw new IOException("FATAL! NO DOCUMENT TO WRITE TO!");
- }
- log.debug("Recovering AppData entry from "+apdjar.sessionFile);
- JarInputStream istrm = new JarInputStream(apdjar.getBufferedInputStream(true));
- JarEntry je=null;
- while (istrm.available()>0 && (je=istrm.getNextJarEntry())!=null && !je.getName().equals("appData_entry.dat")) {
- if (je!=null)
- log.debug("Ignoring extraneous entry "+je.getName());
- }
- if (istrm.available()>0 && je!=null) {
- log.debug("Found appData_entry.dat in Jar");
- String ref = appd.getDataReference();
- if (ref==null) {
- throw new IOException("Null AppData.DataReference passed.");
- }
- log.debug("Writing appData_entry.dat as "+ref);
- if (vdoc.writeAppdataFromStream(ref, istrm)) {
- log.debug("Entry updated successfully.");
- } else {
- throw new IOException("writeAppdataFromStream did not return true - expect future badness."); // LATER - verify why this might occur.
- }
- } else {
- throw new IOException("Couldn't find appData_entry.dat in temporary jar file "+apdjar.sessionFile.getAbsolutePath());
- }
- istrm.close();
- }
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#getClientOutputStream()
- */
- public AppDataOutputStream getClientOutputStream() {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- if (log.isDebugEnabled())
- log.debug("trying to getClientOutputStream for "+clientdoc.sclient.client.getClientUrn());
- return _getAppdataOutputStream(false);
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#getUserOutputStream()
- */
- public AppDataOutputStream getUserOutputStream() {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- if (log.isDebugEnabled())
- log.debug("trying to getUserOutputStream for ("
- +clientdoc.sclient.getUserHandle().getFullName()+")"+clientdoc.sclient.client.getClientUrn());
- return _getAppdataOutputStream(true);
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#hasClientAppdata()
- */
- public boolean hasClientAppdata() {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- extractAppData();
- // LATER - check validity of a DataReference before we return true
- // TODO: return true if usersData is null but we have already written a new data stream
- if ((appsGlobal!=null) && (appsGlobal.getDataReference()!=null || appsGlobal.getData()!=null))
- return true;
- return false;
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#hasUserAppdata()
- */
- public boolean hasUserAppdata() {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- extractAppData();
- // LATER - check validity of a DataReference before we return true
- // TODO: return true if usersData is null but we have already written a new data stream
- if ((usersData!=null) && (usersData.getDataReference()!=null || usersData.getData()!=null))
- return true;
- return false;
- }
- private boolean _writeAppDataStream(JarOutputStream ostrm, byte[] data) {
- try {
- if (data!=null && data.length>0)
- ostrm.write(data);
- ostrm.closeEntry();
- return true;
- }
- catch (Exception e) {
- log.error("Serious! - IO error when writing AppDataStream to file "+newAppData.sessionFile, e);
- }
- return false;
- }
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#setClientAppdata(byte[])
- */
- public void setClientAppdata(byte[] data) {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- _getAppdataOutputStream(false);
- if (newAppDataStream==null) {
- // LATER: define an exception for this ? - operation may fail even if file i/o not involved
- log.error("Serious! - couldn't open new AppDataStream in session directory "+clientdoc.sclient._session.sessionDir);
- } else {
- _writeAppDataStream(newAppDataStream, data);
- // LATER: deal with error case - do we make session read only, or what ?
- }
- }
-
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientAppdata#setUserAppdata(byte[])
- */
- public void setUserAppdata(byte[] data) {
- if (clientdoc==null)
- throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
- _getAppdataOutputStream(true);
- if (newUserDataStream==null) {
- // LATER: define an exception for this ? - operation may fail even if file i/o not involved
- log.error("Serious! - couldn't open new UserDataStream in session directory "+clientdoc.sclient._session.sessionDir);
- } else {
- _writeAppDataStream(newUserDataStream, data);
- // LATER: deal with error case - do we make session read only, or what ?
- }
- }
- /**
- * flush and close outstanding output streams.
- * - do this before checking data length.
- * @throws IOException
- */
- protected void closeForWriting() throws IOException {
- if (newAppDataStream!=null) {
- newAppDataStream.flush();
- newAppDataStream.closeEntry();
- newAppDataStream.close();
- }
- if (newUserDataStream!=null) {
- newUserDataStream.flush();
- newUserDataStream.closeEntry();
- newUserDataStream.close();
- }
- }
-
-
- /**
- *
- * @return true if any AppData blocks have to be updated in session Jar
- */
- protected boolean isModified() {
- // LATER differentiate between core xml modification and Jar Entry modification.
- if ((newAppData!=null && newAppData.sessionFile.exists()) || (newUserData!=null && newUserData.sessionFile.exists()))
- return true;
- return false;
- }
- /* (non-Javadoc)
- * @see java.lang.Object#finalize()
- */
- protected void finalize() throws Throwable {
- if (newAppDataStream!=null) {
- newAppDataStream = null;
- }
- if (newAppDataStream!=null) {
- newUserDataStream = null;
- }
- if (newAppData!=null) {
- newAppData.eraseExistence();
- newAppData = null;
- }
- if (newUserData!=null) {
- newUserData.eraseExistence();
- newUserData = null;
- }
- super.finalize();
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.BufferedOutputStream;\r
+import java.io.ByteArrayInputStream;\r
+import java.io.ByteArrayOutputStream;\r
+import java.io.DataInput;\r
+import java.io.DataInputStream;\r
+import java.io.DataOutput;\r
+import java.io.DataOutputStream;\r
+import java.io.FileInputStream;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.util.Vector;\r
+import java.util.jar.JarEntry;\r
+import java.util.jar.JarInputStream;\r
+import java.util.jar.JarOutputStream;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.AppDataInputStream;\r
+import uk.ac.vamsas.client.AppDataOutputStream;\r
+import uk.ac.vamsas.client.IClientAppdata;\r
+import uk.ac.vamsas.objects.core.AppData;\r
+import uk.ac.vamsas.objects.core.ApplicationData;\r
+import uk.ac.vamsas.objects.core.User;\r
+import uk.ac.vamsas.objects.utils.AppDataReference;\r
+\r
+/**\r
+ * @author jimp Access interface to data chunks read from a VamsasArchiveReader\r
+ * stream (or byte buffer input stream) or written to a VamsasArchive\r
+ * stream. // TODO: get VamsasArchiveReader from sclient\r
+ */\r
+public class SimpleClientAppdata implements IClientAppdata {\r
+ private static Log log = LogFactory.getLog(SimpleClientAppdata.class);\r
+\r
+ /**\r
+ * has the session's document been accessed to get the AppData entrys?\r
+ */\r
+ protected boolean accessedDocument = false;\r
+\r
+ /**\r
+ * has the user datablock been modified ? temporary file containing new user\r
+ * specific application data chunk\r
+ */\r
+ SessionFile newUserData = null;\r
+\r
+ JarOutputStream newUserDataStream = null;\r
+\r
+ /**\r
+ * has the apps global datablock been modified ? temporary file containing new\r
+ * global application data chunk\r
+ */\r
+ SessionFile newAppData = null;\r
+\r
+ JarOutputStream newAppDataStream = null;\r
+\r
+ /**\r
+ * set by extractAppData\r
+ */\r
+ protected ApplicationData appsGlobal = null;\r
+\r
+ /**\r
+ * set by extractAppData\r
+ */\r
+ protected User usersData = null;\r
+\r
+ ClientDocument clientdoc;\r
+\r
+ /**\r
+ * state flags - accessed ClientAppdata - accessed UserAppdata => inputStream\r
+ * from embedded xml or jar entry of backup has been created - set\r
+ * ClientAppdata - set UserAppdata => an output stream has been created and\r
+ * written to - or a data chunk has been written. - need flag for switching\r
+ * between embedded and jar entry mode ? - always write a jar entry for a\r
+ * stream. - need code for rewind and overwriting if the set*Appdata methods\r
+ * are called more than once. - need flags for streams to except a call to\r
+ * set*Appdata when an output stream exists and is open. - need\r
+ * \r
+ * @param clientdoc\r
+ * The ClientDocument instance that this IClientAppData is accessing\r
+ */\r
+ protected SimpleClientAppdata(ClientDocument clientdoc) {\r
+ if (clientdoc == null) {\r
+ log\r
+ .fatal("Implementation error - Null ClientDocument for SimpleClientAppdata construction.");\r
+ throw new Error(\r
+ "Implementation error - Null ClientDocument for SimpleClientAppdata construction.");\r
+ }\r
+ this.clientdoc = clientdoc;\r
+ }\r
+\r
+ /**\r
+ * ensures that the appData information for this client instance has been\r
+ * extracted from the vamsas document provided by clientdoc.\r
+ */\r
+ private void extractAppData() {\r
+ if (!accessedDocument)\r
+ _extractAppData(clientdoc.getVamsasDocument());\r
+ }\r
+\r
+ /**\r
+ * gets appropriate app data for the application, if it exists in this dataset\r
+ * Called by every accessor to ensure data has been retrieved from document.\r
+ */\r
+ private void _extractAppData(uk.ac.vamsas.objects.core.VamsasDocument doc) {\r
+ if (doc == null) {\r
+ log.debug("extractAppData called for null document object");\r
+ return;\r
+ }\r
+ if (accessedDocument) {\r
+ return;\r
+ }\r
+ Vector apldataset = AppDataReference.getUserandApplicationsData(doc,\r
+ clientdoc.sclient.getUserHandle(), clientdoc.sclient.getClientHandle());\r
+ accessedDocument = true;\r
+ if (apldataset != null) {\r
+ if (apldataset.size() > 0) {\r
+ AppData clientdat = (AppData) apldataset.get(0);\r
+ if (clientdat instanceof ApplicationData) {\r
+ appsGlobal = (ApplicationData) clientdat;\r
+ if (apldataset.size() > 1) {\r
+ clientdat = (AppData) apldataset.get(1);\r
+ if (clientdat instanceof User) {\r
+ usersData = (User) clientdat;\r
+ }\r
+ if (apldataset.size() > 2)\r
+ log.info("Ignoring additional (" + (apldataset.size() - 2)\r
+ + ") AppDatas returned by document appdata query.");\r
+ }\r
+ } else {\r
+ log.warn("Unexpected entry in AppDataReference query: id="\r
+ + clientdat.getVorbaId() + " type="\r
+ + clientdat.getClass().getName());\r
+ }\r
+ apldataset.removeAllElements(); // destroy references.\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * LATER: generalize this for different low-level session implementations (it\r
+ * may not always be a Jar)\r
+ * \r
+ * @param appdata\r
+ * @param docreader\r
+ * @return\r
+ */\r
+ private InputStream getAppDataStream(AppData appdata,\r
+ VamsasArchiveReader docreader) {\r
+ String entryRef = appdata.getDataReference();\r
+ if (entryRef != null) {\r
+ log.debug("Resolving appData reference +" + entryRef);\r
+ InputStream entry = docreader.getAppdataStream(entryRef);\r
+ if (entry != null) {\r
+ return entry;\r
+ // log.warn("Implementation problem - docreader didn't return a JarInputStream entry.");\r
+ }\r
+ } else {\r
+ log\r
+ .debug("GetAppDataStream called for an AppData without a data reference.");\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * yuk - size of buffer used for slurping appData JarEntry into a byte array.\r
+ */\r
+ private final int _TRANSFER_BUFFER = 4096 * 4;\r
+\r
+ /**\r
+ * Resolve AppData object to a byte array.\r
+ * \r
+ * @param appdata\r
+ * @param archiveReader\r
+ * @return null or the application data as a byte array\r
+ */\r
+ private byte[] getAppDataAsByteArray(AppData appdata,\r
+ VamsasArchiveReader docreader) {\r
+ if (appdata.getData() == null) {\r
+ if (docreader == null) {\r
+ log.warn("Silently failing getAppDataAsByteArray with null docreader.",\r
+ new Exception());\r
+ return null;\r
+ }\r
+ // resolve and load data\r
+ InputStream entry = getAppDataStream(appdata, docreader);\r
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();\r
+ try {\r
+ byte buff[] = new byte[_TRANSFER_BUFFER];\r
+ int olen = 0;\r
+ while (entry != null && entry.available() > 0) {\r
+ int len = entry.read(buff, 0, _TRANSFER_BUFFER);\r
+ if (len > -1) {\r
+ bytes.write(buff, 0, len);\r
+ olen += len;\r
+ }\r
+ }\r
+ buff = null;\r
+ } catch (Exception e) {\r
+ log\r
+ .warn(\r
+ "Unexpected exception - probable truncation when accessing VamsasDocument entry "\r
+ + appdata.getDataReference(), e);\r
+ }\r
+ if (bytes.size() > 0) {\r
+ // LATER: deal with probable OutOfMemoryErrors here\r
+ log.debug("Got " + bytes.size() + " bytes from AppDataReference "\r
+ + appdata.getDataReference());\r
+ byte data[] = bytes.toByteArray();\r
+ bytes = null;\r
+ return data;\r
+ }\r
+ return null;\r
+ } else {\r
+ log.debug("Returning inline AppData block for " + appdata.getVorbaId());\r
+ return appdata.getData();\r
+ }\r
+ }\r
+\r
+ /**\r
+ * internal method for getting a DataInputStream from an AppData object.\r
+ * \r
+ * @param appdata\r
+ * @param docreader\r
+ * @return data in object or null if no data is accessible\r
+ */\r
+ private AppDataInputStream getAppDataAsDataInputStream(AppData appdata,\r
+ VamsasArchiveReader docreader) {\r
+ if (appdata != null && docreader != null) {\r
+ String entryRef = appdata.getDataReference();\r
+ if (entryRef != null) {\r
+ log.debug("Resolving AppData reference for " + entryRef);\r
+ InputStream jstrm = docreader.getAppdataStream(entryRef);\r
+ if (jstrm != null)\r
+ return new AppDataInputStream(jstrm);\r
+ else {\r
+ log.debug("Returning null input stream for unresolved reference ("\r
+ + entryRef + ") id=" + appdata.getVorbaId());\r
+ return null;\r
+ }\r
+ } else {\r
+ // return a byteArray input stream\r
+ byte[] data = appdata.getData();\r
+ if (data.length > 0) {\r
+ ByteArrayInputStream stream = new ByteArrayInputStream(data);\r
+ return new AppDataInputStream(stream);\r
+ } else {\r
+ log\r
+ .debug("Returning null input stream for empty Appdata data block in id="\r
+ + appdata.getVorbaId());\r
+ return null;\r
+ }\r
+ }\r
+ } else {\r
+ log.debug("Returning null DataInputStream for appdata entry:"\r
+ + appdata.getVorbaId());\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * internal method for getting ByteArray from AppData object\r
+ * \r
+ * @param clientOrUser\r
+ * - true for returning userData, otherwise return Client AppData.\r
+ * @return null or byte array\r
+ */\r
+ private byte[] _getappdataByteArray(boolean clientOrUser) {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ byte[] data = null;\r
+ String appdName;\r
+ if (!clientOrUser) {\r
+ appdName = "Client's Appdata";\r
+ } else {\r
+ appdName = "User's Appdata";\r
+ }\r
+ log.debug("getting " + appdName + " as a byte array");\r
+ extractAppData();\r
+ AppData object;\r
+ if (!clientOrUser) {\r
+ object = appsGlobal;\r
+ } else {\r
+ object = usersData;\r
+ }\r
+ if (object != null) {\r
+ log.debug("Trying to resolve " + appdName + " object to byte array.");\r
+ data = getAppDataAsByteArray(object, clientdoc.getVamsasArchiveReader());\r
+ }\r
+ if (data == null)\r
+ log\r
+ .debug("Returning null for " + appdName\r
+ + "ClientAppdata byte[] array");\r
+ return data;\r
+\r
+ }\r
+\r
+ /**\r
+ * common method for Client and User AppData->InputStream accessor\r
+ * \r
+ * @param clientOrUser\r
+ * - the appData to resolve - false for client, true for user\r
+ * appdata.\r
+ * @return null or the DataInputStream desired.\r
+ */\r
+ private AppDataInputStream _getappdataInputStream(boolean clientOrUser) {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ String appdName;\r
+ if (!clientOrUser) {\r
+ appdName = "Client's Appdata";\r
+ } else {\r
+ appdName = "User's Appdata";\r
+ }\r
+ if (log.isDebugEnabled())\r
+ log.debug("getting " + appdName + " as an input stream.");\r
+ extractAppData();\r
+ AppData object;\r
+ if (!clientOrUser) {\r
+ object = appsGlobal;\r
+ } else {\r
+ object = usersData;\r
+ }\r
+ if (object != null) {\r
+ log.debug("Trying to resolve ClientAppdata object to an input stream.");\r
+ return getAppDataAsDataInputStream(object, clientdoc\r
+ .getVamsasArchiveReader());\r
+ }\r
+ log.debug("getClientInputStream returning null.");\r
+ return null;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#getClientAppdata()\r
+ */\r
+ public byte[] getClientAppdata() {\r
+ return _getappdataByteArray(false);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#getClientInputStream()\r
+ */\r
+ public AppDataInputStream getClientInputStream() {\r
+ return _getappdataInputStream(false);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#getUserAppdata()\r
+ */\r
+ public byte[] getUserAppdata() {\r
+ return _getappdataByteArray(true);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#getUserInputStream()\r
+ */\r
+ public AppDataInputStream getUserInputStream() {\r
+ return _getappdataInputStream(true);\r
+ }\r
+\r
+ /**\r
+ * methods for writing new AppData entries.\r
+ */\r
+ private AppDataOutputStream _getAppdataOutputStream(boolean clientOrUser) {\r
+ // Must access document to get any existing references\r
+ extractAppData();\r
+ String apdname;\r
+ SessionFile apdfile = null;\r
+ if (!clientOrUser) {\r
+ apdname = "clientAppData";\r
+ apdfile = newAppData;\r
+ } else {\r
+ apdname = "userAppData";\r
+ apdfile = newUserData;\r
+ }\r
+ try {\r
+ if (apdfile == null) {\r
+ apdfile = clientdoc.sclient._session\r
+ .getTempSessionFile(apdname, ".jar");\r
+ log.debug("Successfully made temp appData file for " + apdname);\r
+ } else {\r
+ // truncate to remove existing data.\r
+ apdfile.fileLock.getRaFile().setLength(0);\r
+ log\r
+ .debug("Successfully truncated existing temp appData for "\r
+ + apdname);\r
+ }\r
+ } catch (Exception e) {\r
+ log.error("Whilst opening temp file in directory "\r
+ + clientdoc.sclient._session.sessionDir, e);\r
+ }\r
+ // we do not make another file for the new entry if one exists already\r
+ if (!clientOrUser) {\r
+ newAppData = apdfile;\r
+ } else {\r
+ newUserData = apdfile;\r
+ }\r
+ try {\r
+ apdfile.lockFile();\r
+ // LATER: Refactor these local AppDatastream IO stuff to their own class.\r
+ JarOutputStream dstrm = new JarOutputStream(apdfile.fileLock\r
+ .getBufferedOutputStream(true));\r
+ if (!clientOrUser) {\r
+ newAppDataStream = dstrm;\r
+ } else {\r
+ newUserDataStream = dstrm;\r
+ }\r
+ dstrm.putNextEntry(new JarEntry("appData_entry.dat"));\r
+ // LATER: there may be trouble ahead if an AppDataOutputStream is written\r
+ // to by one thread when another truncates the file. This situation should\r
+ // be prevented if possible\r
+ return new AppDataOutputStream(dstrm);\r
+ } catch (Exception e) {\r
+ log.error("Whilst opening jar output stream for file "\r
+ + apdfile.sessionFile);\r
+ }\r
+ // tidy up and return null\r
+ apdfile.unlockFile();\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * copy data from the appData jar file to an appropriately referenced jar or\r
+ * Data entry for the given ApplicationData Assumes the JarFile is properly\r
+ * closed.\r
+ * \r
+ * @param vdoc\r
+ * session Document handler\r
+ * @param appd\r
+ * the AppData whose block is being updated\r
+ * @param apdjar\r
+ * the new data in a Jar written by this class\r
+ */\r
+ protected void updateAnAppdataEntry(VamsasArchive vdoc, AppData appd,\r
+ SessionFile apdjar) throws IOException {\r
+ if (apdjar == null || apdjar.sessionFile == null\r
+ || !apdjar.sessionFile.exists()) {\r
+ throw new IOException("No temporary Appdata to recover and transfer.");\r
+ }\r
+ if (vdoc == null) {\r
+ log.fatal("FATAL! NO DOCUMENT TO WRITE TO!");\r
+ throw new IOException("FATAL! NO DOCUMENT TO WRITE TO!");\r
+ }\r
+ log.debug("Recovering AppData entry from " + apdjar.sessionFile);\r
+ JarInputStream istrm = new JarInputStream(apdjar\r
+ .getBufferedInputStream(true));\r
+ JarEntry je = null;\r
+ while (istrm.available() > 0 && (je = istrm.getNextJarEntry()) != null\r
+ && !je.getName().equals("appData_entry.dat")) {\r
+ if (je != null)\r
+ log.debug("Ignoring extraneous entry " + je.getName());\r
+ }\r
+ if (istrm.available() > 0 && je != null) {\r
+ log.debug("Found appData_entry.dat in Jar");\r
+ String ref = appd.getDataReference();\r
+ if (ref == null) {\r
+ throw new IOException("Null AppData.DataReference passed.");\r
+ }\r
+ log.debug("Writing appData_entry.dat as " + ref);\r
+ if (vdoc.writeAppdataFromStream(ref, istrm)) {\r
+ log.debug("Entry updated successfully.");\r
+ } else {\r
+ throw new IOException(\r
+ "writeAppdataFromStream did not return true - expect future badness."); // LATER\r
+ // -\r
+ // verify\r
+ // why\r
+ // this\r
+ // might\r
+ // occur.\r
+ }\r
+ } else {\r
+ throw new IOException(\r
+ "Couldn't find appData_entry.dat in temporary jar file "\r
+ + apdjar.sessionFile.getAbsolutePath());\r
+ }\r
+ istrm.close();\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#getClientOutputStream()\r
+ */\r
+ public AppDataOutputStream getClientOutputStream() {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ if (log.isDebugEnabled())\r
+ log.debug("trying to getClientOutputStream for "\r
+ + clientdoc.sclient.client.getClientUrn());\r
+ return _getAppdataOutputStream(false);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#getUserOutputStream()\r
+ */\r
+ public AppDataOutputStream getUserOutputStream() {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ if (log.isDebugEnabled())\r
+ log.debug("trying to getUserOutputStream for ("\r
+ + clientdoc.sclient.getUserHandle().getFullName() + ")"\r
+ + clientdoc.sclient.client.getClientUrn());\r
+ return _getAppdataOutputStream(true);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#hasClientAppdata()\r
+ */\r
+ public boolean hasClientAppdata() {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ extractAppData();\r
+ // LATER - check validity of a DataReference before we return true\r
+ // TODO: return true if usersData is null but we have already written a new\r
+ // data stream\r
+ if ((appsGlobal != null)\r
+ && (appsGlobal.getDataReference() != null || appsGlobal.getData() != null))\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#hasUserAppdata()\r
+ */\r
+ public boolean hasUserAppdata() {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ extractAppData();\r
+ // LATER - check validity of a DataReference before we return true\r
+ // TODO: return true if usersData is null but we have already written a new\r
+ // data stream\r
+ if ((usersData != null)\r
+ && (usersData.getDataReference() != null || usersData.getData() != null))\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean _writeAppDataStream(JarOutputStream ostrm, byte[] data) {\r
+ try {\r
+ if (data != null && data.length > 0)\r
+ ostrm.write(data);\r
+ ostrm.closeEntry();\r
+ return true;\r
+ } catch (Exception e) {\r
+ log.error("Serious! - IO error when writing AppDataStream to file "\r
+ + newAppData.sessionFile, e);\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#setClientAppdata(byte[])\r
+ */\r
+ public void setClientAppdata(byte[] data) {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ _getAppdataOutputStream(false);\r
+ if (newAppDataStream == null) {\r
+ // LATER: define an exception for this ? - operation may fail even if file\r
+ // i/o not involved\r
+ log\r
+ .error("Serious! - couldn't open new AppDataStream in session directory "\r
+ + clientdoc.sclient._session.sessionDir);\r
+ } else {\r
+ _writeAppDataStream(newAppDataStream, data);\r
+ // LATER: deal with error case - do we make session read only, or what ?\r
+ }\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientAppdata#setUserAppdata(byte[])\r
+ */\r
+ public void setUserAppdata(byte[] data) {\r
+ if (clientdoc == null)\r
+ throw new Error(\r
+ "Implementation error, Improperly initialized SimpleClientAppdata.");\r
+ _getAppdataOutputStream(true);\r
+ if (newUserDataStream == null) {\r
+ // LATER: define an exception for this ? - operation may fail even if file\r
+ // i/o not involved\r
+ log\r
+ .error("Serious! - couldn't open new UserDataStream in session directory "\r
+ + clientdoc.sclient._session.sessionDir);\r
+ } else {\r
+ _writeAppDataStream(newUserDataStream, data);\r
+ // LATER: deal with error case - do we make session read only, or what ?\r
+ }\r
+ }\r
+\r
+ /**\r
+ * flush and close outstanding output streams. - do this before checking data\r
+ * length.\r
+ * \r
+ * @throws IOException\r
+ */\r
+ protected void closeForWriting() throws IOException {\r
+ if (newAppDataStream != null) {\r
+ newAppDataStream.flush();\r
+ newAppDataStream.closeEntry();\r
+ newAppDataStream.close();\r
+ }\r
+ if (newUserDataStream != null) {\r
+ newUserDataStream.flush();\r
+ newUserDataStream.closeEntry();\r
+ newUserDataStream.close();\r
+ }\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return true if any AppData blocks have to be updated in session Jar\r
+ */\r
+ protected boolean isModified() {\r
+ // LATER differentiate between core xml modification and Jar Entry\r
+ // modification.\r
+ if ((newAppData != null && newAppData.sessionFile.exists())\r
+ || (newUserData != null && newUserData.sessionFile.exists()))\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.lang.Object#finalize()\r
+ */\r
+ protected void finalize() throws Throwable {\r
+ if (newAppDataStream != null) {\r
+ newAppDataStream = null;\r
+ }\r
+ if (newAppDataStream != null) {\r
+ newUserDataStream = null;\r
+ }\r
+ if (newAppData != null) {\r
+ newAppData.eraseExistence();\r
+ newAppData = null;\r
+ }\r
+ if (newUserData != null) {\r
+ newUserData.eraseExistence();\r
+ newUserData = null;\r
+ }\r
+ super.finalize();\r
+ }\r
+\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
+\r
/**\r
* Config for SimpleClient - a basic Vamsas Client Interface implementation.\r
+ * \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class SimpleClientConfig {\r
- public boolean _validatemergedroots=false;\r
- public boolean _validateupdatedroots=false;\r
+ public boolean _validatemergedroots = false;\r
+\r
+ public boolean _validateupdatedroots = false;\r
+\r
/**\r
- * New VAMSAS roots added (merged) into the document\r
- * will be validated before actually being added. \r
+ * New VAMSAS roots added (merged) into the document will be validated before\r
+ * actually being added.\r
+ * \r
* @return\r
*/\r
public boolean validateMergedRoots() {\r
}\r
\r
/**\r
- * existing VAMSAS roots that may have been modified \r
- * will be validated before the updated document can\r
- * be written. \r
+ * existing VAMSAS roots that may have been modified will be validated before\r
+ * the updated document can be written.\r
+ * \r
* @return\r
*/\r
public boolean validateUpdatedRoots() {\r
return _validateupdatedroots;\r
}\r
- \r
+\r
}\r
-/**
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
*
- * VAMSAS Project
- *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * Dec 13, 2006
- *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.client.simpleclient;
import java.io.File;
/**
* @see uk.ac.vamsas.client.IClientFactory#getIClient(uk.ac.vamsas.client.ClientHandle)
*
- * Creates a IClient object, using default UserHandle with system
- * variables:"user.name" or "USERNAME")), "host.name" or "HOSTNAME"
+ * Creates a IClient object, using default UserHandle with system
+ * variables:"user.name" or "USERNAME")), "host.name" or "HOSTNAME"
*/
public IClient getIClient(ClientHandle applicationHandle)
throws NoDefaultSessionException {
.debug("found session directory "
+ sessionDirectory.getAbsolutePath());
VamsasSession vamsasSession = new VamsasSession(sessionDirectory);
-
+
/*
* if (userId == null) { //create a default userHandle //with current OS
- * user and hostname userId = new UserHandle(System.getProperty("user.name",
+ * user and hostname userId = new
+ * UserHandle(System.getProperty("user.name",
* System.getProperty("USERNAME","Joe Doe")),
- * System.getProperty("host.name",System.getProperty("HOSTNAME", "Unknown")
- * ));// clientName, clientVersion, sessionPath); }
+ * System.getProperty("host.name",System.getProperty("HOSTNAME",
+ * "Unknown") ));// clientName, clientVersion, sessionPath); }
*
*
* //create simple client client = new SimpleClient(userId,
* applicationHandle, vamsasSession);
*/
- client = this.initClient(sessionDirectory, userId, applicationHandle, null);
+ client = this.initClient(sessionDirectory, userId, applicationHandle,
+ null);
} catch (MalformedURLException e) {
log.error("error while creating new IClient: incorrect session urn", e);
client = null;
- } catch (InvalidSessionDocumentException e)
- {
- log.error("error while creating new IClient: invalid session document", e);
+ } catch (InvalidSessionDocumentException e) {
+ log
+ .error("error while creating new IClient: invalid session document",
+ e);
client = null;
} catch (InvalidSessionUrnException e) {
log.error("error while creating new IClient: incorrect session urn", e);
}
return client;
}
+
/**
- * initialise the vamsas session state and create a SimpleClient object to connect to it
- * @param sessdir newly created or existing session directory
- * @param userId
+ * initialise the vamsas session state and create a SimpleClient object to
+ * connect to it
+ *
+ * @param sessdir
+ * newly created or existing session directory
+ * @param userId
* @param clientHandle
- * @param vamsasDocument null or a document to pass to SimpleCLient to write into the sessdir
+ * @param vamsasDocument
+ * null or a document to pass to SimpleCLient to write into the
+ * sessdir
* @return the client
- * @throws IOException if there are problems in session or client creation or if the session already has a vamsasDocument
- * @throws InvalidSessionUrnException for a malformed sessdir
+ * @throws IOException
+ * if there are problems in session or client creation or if the
+ * session already has a vamsasDocument
+ * @throws InvalidSessionUrnException
+ * for a malformed sessdir
*/
private IClient initClient(File sessdir, UserHandle userId,
- ClientHandle clientHandle, File vamsasDocument) throws IOException, InvalidSessionUrnException, InvalidSessionDocumentException {
+ ClientHandle clientHandle, File vamsasDocument) throws IOException,
+ InvalidSessionUrnException, InvalidSessionDocumentException {
IClient client = null;
// create session
VamsasSession vamsasSession = null;
- if (vamsasDocument==null)
- {
+ if (vamsasDocument == null) {
vamsasSession = new VamsasSession(sessdir);
} else {
vamsasSession = new VamsasSession(sessdir, vamsasDocument);
// check if any available session(s)
String[] availableSessions = this.getCurrentSessions();
if (availableSessions != null) {// there are available sessions
- if (availableSessions.length > 1) {// more than one session if available... can not choose
+ if (availableSessions.length > 1) {// more than one session if
+ // available... can not choose
// represents list of session as String
StringBuffer sessionURNs = new StringBuffer("");
// no session available - create a new one
try {
client = clientInNewSession(userId, clientHandle, null);
- } catch (Exception e)
- {
- throw new Error("IMPLEMENTATION ERROR: unexpected exception when creating a new session to connect to.",e);
+ } catch (Exception e) {
+ throw new Error(
+ "IMPLEMENTATION ERROR: unexpected exception when creating a new session to connect to.",
+ e);
}
return client;
}
/**
- * create a new session directory and possibly import an existing document into it
+ * create a new session directory and possibly import an existing document
+ * into it
+ *
* @param userId
* @param clientHandle
- * @param vamsasDocument null or a document file to copy into the new session
+ * @param vamsasDocument
+ * null or a document file to copy into the new session
* @return null or a valid IClient instance
*/
private IClient clientInNewSession(UserHandle userId,
- ClientHandle clientHandle, File vamsasDocument) throws InvalidSessionDocumentException, InvalidSessionUrnException{
+ ClientHandle clientHandle, File vamsasDocument)
+ throws InvalidSessionDocumentException, InvalidSessionUrnException {
IClient client = null;
try {
// try and make a friendly session name
String sesspref = "";
- if (vamsasDocument!=null)
- {
- sesspref = vamsasDocument.getName().replaceAll("([^-A-Za-z0-9]|\\.vdj)", "");
+ if (vamsasDocument != null) {
+ sesspref = vamsasDocument.getName().replaceAll(
+ "([^-A-Za-z0-9]|\\.vdj)", "");
}
- sesspref += (new java.util.Date()).toString().replaceAll("[^-A-Za-z0-9]","_");
+ sesspref += (new java.util.Date()).toString().replaceAll("[^-A-Za-z0-9]",
+ "_");
// create sessionDirectory
- File sessdir = new File(sessionArena, sesspref+".simpleclient");
- if (sessdir.exists())
- {
+ File sessdir = new File(sessionArena, sesspref + ".simpleclient");
+ if (sessdir.exists()) {
// make a unique session name
- sessdir = File.createTempFile(sesspref, ".simpleclient",
- sessionArena);
+ sessdir = File.createTempFile(sesspref, ".simpleclient", sessionArena);
} else {
- if (!sessdir.createNewFile())
- {
- throw new Error("VAMSAS Implementation error : sesspref friendly session name is invalid on this platform - please tell the authors!");
+ if (!sessdir.createNewFile()) {
+ throw new Error(
+ "VAMSAS Implementation error : sesspref friendly session name is invalid on this platform - please tell the authors!");
}
}
log.debug("Creating new session directory");
} catch (IOException e) {
log.error("error while creating new IClient", e);
} catch (InvalidSessionUrnException e) {
- log.error("Unable to create new IClient. The new session urn is malformed.",
- e);
+ log.error(
+ "Unable to create new IClient. The new session urn is malformed.", e);
}
return client;
public IClient getNewSessionIClient(ClientHandle applicationHandle) {
try {
return clientInNewSession(null, applicationHandle, null);
- }
- catch (Exception e) {
- log.error("Failed to create new session for app with default user.",e);
+ } catch (Exception e) {
+ log.error("Failed to create new session for app with default user.", e);
}
return null;
}
try {
return clientInNewSession(userId, applicationHandle, null);
} catch (Exception e) {
- log.error("Failed to create new session for app and user.",e);
+ log.error("Failed to create new session for app and user.", e);
}
return null;
}
- private void checkImportedDocument(File vamsasDocument) throws InvalidSessionDocumentException
- {
- if (!vamsasDocument.exists())
- {
- throw new InvalidSessionDocumentException("File "+vamsasDocument+" does not exist");
+
+ private void checkImportedDocument(File vamsasDocument)
+ throws InvalidSessionDocumentException {
+ if (!vamsasDocument.exists()) {
+ throw new InvalidSessionDocumentException("File " + vamsasDocument
+ + " does not exist");
}
- if (!vamsasDocument.canRead())
- {
- throw new InvalidSessionDocumentException("File "+vamsasDocument+" does not exist");
+ if (!vamsasDocument.canRead()) {
+ throw new InvalidSessionDocumentException("File " + vamsasDocument
+ + " does not exist");
}
}
+
public IClient openAsNewSessionIClient(ClientHandle applicationHandle,
File vamsasDocument) throws InvalidSessionDocumentException {
- checkImportedDocument(vamsasDocument);
+ checkImportedDocument(vamsasDocument);
try {
return clientInNewSession(null, applicationHandle, vamsasDocument);
- } catch (InvalidSessionUrnException e)
- {
+ } catch (InvalidSessionUrnException e) {
throw new InvalidSessionDocumentException("Unexpected exception", e);
}
}
public IClient openAsNewSessionIClient(ClientHandle applicationHandle,
- UserHandle userId, File vamsasDocument) throws InvalidSessionDocumentException {
- checkImportedDocument(vamsasDocument);
+ UserHandle userId, File vamsasDocument)
+ throws InvalidSessionDocumentException {
+ checkImportedDocument(vamsasDocument);
try {
- return clientInNewSession(userId, applicationHandle, vamsasDocument);
- } catch (InvalidSessionUrnException e)
- {
- throw new InvalidSessionDocumentException("Unexpected exception", e);
+ return clientInNewSession(userId, applicationHandle, vamsasDocument);
+ } catch (InvalidSessionUrnException e) {
+ throw new InvalidSessionDocumentException("Unexpected exception", e);
}
}
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Vector;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.Vobject;
-import uk.ac.vamsas.client.VorbaIdFactory;
-import uk.ac.vamsas.client.VorbaXmlBinder;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-import uk.ac.vamsas.objects.utils.AppDataReference;
-import uk.ac.vamsas.objects.utils.DocumentStuff;
-import uk.ac.vamsas.objects.utils.ProvenanceStuff;
-import uk.ac.vamsas.objects.utils.document.VersionEntries;
-
-/**
- * Base class for SimpleClient Vamsas Document Object Manipulation
- * holds static vamsasDocument from XML routines and
- * state objects for a particular unmarshalled Document instance.
- * @author jimp
- */
-
-
-public class SimpleDocBinding {
-
- protected VorbaIdFactory vorba;
- protected static Log log = LogFactory.getLog(SimpleDocBinding.class);
-
- /**
- * @return Returns the vorba.
- */
- public VorbaIdFactory getVorba() {
- return vorba;
- }
-
- /**
- * @param vorba The vorba to set.
- */
- public void setVorba(VorbaIdFactory vorba) {
- this.vorba = vorba;
- }
-
- /**
- * Uses VorbaXmlBinder to retrieve the VamsasDocument from the given stream
- */
- public VamsasDocument getVamsasDocument(VamsasArchiveReader oReader) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- if (oReader!=null) {
- // check the factory
- if (vorba==null) {
- log.error("Invalid SimpleDocument construction - no VorbaIdFactory defined!");
- return null;
- }
-
- if (oReader.isValid()) {
- // Read vamsasDocument.xsd instance
- InputStreamReader vdoc = new InputStreamReader(oReader.getVamsasDocumentStream());
- Object unmarsh[] = VorbaXmlBinder.getVamsasObjects(vdoc, vorba, new VamsasDocument());
- if (unmarsh==null)
- log.fatal("Couldn't unmarshall document!");
-
- Vobject vobjs = (Vobject) unmarsh[0];
- if (vobjs!=null) {
- VamsasDocument doc=(VamsasDocument) vobjs;
- if (doc!=null)
- return doc;
- }
- log.debug("Found no VamsasDocument object in properly formatted Vamsas Archive.");
- } else {
- // deprecated data handler (vamsas.xsd instance)
- InputStream vxmlis = oReader.getVamsasXmlStream();
- if (vxmlis!=null) { // Might be an old vamsas file.
- BufferedInputStream ixml = new BufferedInputStream(oReader.getVamsasXmlStream());
- InputStreamReader vxml = new InputStreamReader(ixml);
- Object unmarsh[] = VorbaXmlBinder.getVamsasObjects(vxml, vorba, new VAMSAS());
-
- if (unmarsh==null)
- log.fatal("Couldn't unmarshall document!");
-
- VAMSAS root[]= new VAMSAS[] { null};
- root[0] = (VAMSAS) unmarsh[0];
-
- if (root[0]==null) {
- log.debug("Found no VAMSAS object in VamsasXML stream.");
- } else {
- log.debug("Making new VamsasDocument from VamsasXML stream.");
- VamsasDocument doc = DocumentStuff.newVamsasDocument(root,
- ProvenanceStuff.newProvenance(
- vorba.getUserHandle().getFullName(),
- "Vamsas Document constructed from vamsas.xml"), VersionEntries.ALPHA_VERSION);
- // VAMSAS: decide on 'system' operations provenance form
- // LATER: implement classes for translating Vorba properties into provenance user fields.
- // VAMSAS: decide on machine readable info embedding in provenance should be done
- root[0]=null;
- root=null;
- return doc;
- }
- }
- }
- }
- // otherwise - there was no valid original document to read.
- return null;
- }
-
- /**
- * Extract all jarEntries in an archive referenced by the vamsas document
- * LATER: a family of methods for finding extraneous jarEntries , and invalid appDataReferences
- * @param doc
- * @param oReader
- * @return array of the subset of JarEntry names that are referenced in doc
- */
- public Vector getReferencedEntries(VamsasDocument doc, VamsasArchiveReader oReader) {
- if (oReader==null)
- return null;
- if (doc==null) {
- try { doc = getVamsasDocument(oReader); }
- catch (Exception e) { log.warn("Failed to get document from "+oReader.jfileName); };
- }
- Vector docrefs = AppDataReference.getAppDataReferences(doc);
- if (docrefs==null)
- return null;
- Vector entries = oReader.getExtraEntries();
- if (entries!=null && entries.size()>0 && docrefs.size()>0) {
- int i=0, j=entries.size();
- do {
- if (!docrefs.contains(entries.get(i))) {
- entries.remove(i);
- j--;
- } else
- i++;
- } while (i<j);
- }
- return entries;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+import java.util.Vector;\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.Vobject;\r
+import uk.ac.vamsas.client.VorbaIdFactory;\r
+import uk.ac.vamsas.client.VorbaXmlBinder;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+import uk.ac.vamsas.objects.utils.AppDataReference;\r
+import uk.ac.vamsas.objects.utils.DocumentStuff;\r
+import uk.ac.vamsas.objects.utils.ProvenanceStuff;\r
+import uk.ac.vamsas.objects.utils.document.VersionEntries;\r
+\r
+/**\r
+ * Base class for SimpleClient Vamsas Document Object Manipulation holds static\r
+ * vamsasDocument from XML routines and state objects for a particular\r
+ * unmarshalled Document instance.\r
+ * \r
+ * @author jimp\r
+ */\r
+\r
+public class SimpleDocBinding {\r
+\r
+ protected VorbaIdFactory vorba;\r
+\r
+ protected static Log log = LogFactory.getLog(SimpleDocBinding.class);\r
+\r
+ /**\r
+ * @return Returns the vorba.\r
+ */\r
+ public VorbaIdFactory getVorba() {\r
+ return vorba;\r
+ }\r
+\r
+ /**\r
+ * @param vorba\r
+ * The vorba to set.\r
+ */\r
+ public void setVorba(VorbaIdFactory vorba) {\r
+ this.vorba = vorba;\r
+ }\r
+\r
+ /**\r
+ * Uses VorbaXmlBinder to retrieve the VamsasDocument from the given stream\r
+ */\r
+ public VamsasDocument getVamsasDocument(VamsasArchiveReader oReader)\r
+ throws IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ if (oReader != null) {\r
+ // check the factory\r
+ if (vorba == null) {\r
+ log\r
+ .error("Invalid SimpleDocument construction - no VorbaIdFactory defined!");\r
+ return null;\r
+ }\r
+\r
+ if (oReader.isValid()) {\r
+ // Read vamsasDocument.xsd instance\r
+ InputStreamReader vdoc = new InputStreamReader(oReader\r
+ .getVamsasDocumentStream());\r
+ Object unmarsh[] = VorbaXmlBinder.getVamsasObjects(vdoc, vorba,\r
+ new VamsasDocument());\r
+ if (unmarsh == null)\r
+ log.fatal("Couldn't unmarshall document!");\r
+\r
+ Vobject vobjs = (Vobject) unmarsh[0];\r
+ if (vobjs != null) {\r
+ VamsasDocument doc = (VamsasDocument) vobjs;\r
+ if (doc != null)\r
+ return doc;\r
+ }\r
+ log\r
+ .debug("Found no VamsasDocument object in properly formatted Vamsas Archive.");\r
+ } else {\r
+ // deprecated data handler (vamsas.xsd instance)\r
+ InputStream vxmlis = oReader.getVamsasXmlStream();\r
+ if (vxmlis != null) { // Might be an old vamsas file.\r
+ BufferedInputStream ixml = new BufferedInputStream(oReader\r
+ .getVamsasXmlStream());\r
+ InputStreamReader vxml = new InputStreamReader(ixml);\r
+ Object unmarsh[] = VorbaXmlBinder.getVamsasObjects(vxml, vorba,\r
+ new VAMSAS());\r
+\r
+ if (unmarsh == null)\r
+ log.fatal("Couldn't unmarshall document!");\r
+\r
+ VAMSAS root[] = new VAMSAS[] { null };\r
+ root[0] = (VAMSAS) unmarsh[0];\r
+\r
+ if (root[0] == null) {\r
+ log.debug("Found no VAMSAS object in VamsasXML stream.");\r
+ } else {\r
+ log.debug("Making new VamsasDocument from VamsasXML stream.");\r
+ VamsasDocument doc = DocumentStuff.newVamsasDocument(root,\r
+ ProvenanceStuff.newProvenance(vorba.getUserHandle()\r
+ .getFullName(),\r
+ "Vamsas Document constructed from vamsas.xml"),\r
+ VersionEntries.ALPHA_VERSION);\r
+ // VAMSAS: decide on 'system' operations provenance form\r
+ // LATER: implement classes for translating Vorba properties into\r
+ // provenance user fields.\r
+ // VAMSAS: decide on machine readable info embedding in provenance\r
+ // should be done\r
+ root[0] = null;\r
+ root = null;\r
+ return doc;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ // otherwise - there was no valid original document to read.\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Extract all jarEntries in an archive referenced by the vamsas document\r
+ * LATER: a family of methods for finding extraneous jarEntries , and invalid\r
+ * appDataReferences\r
+ * \r
+ * @param doc\r
+ * @param oReader\r
+ * @return array of the subset of JarEntry names that are referenced in doc\r
+ */\r
+ public Vector getReferencedEntries(VamsasDocument doc,\r
+ VamsasArchiveReader oReader) {\r
+ if (oReader == null)\r
+ return null;\r
+ if (doc == null) {\r
+ try {\r
+ doc = getVamsasDocument(oReader);\r
+ } catch (Exception e) {\r
+ log.warn("Failed to get document from " + oReader.jfileName);\r
+ }\r
+ ;\r
+ }\r
+ Vector docrefs = AppDataReference.getAppDataReferences(doc);\r
+ if (docrefs == null)\r
+ return null;\r
+ Vector entries = oReader.getExtraEntries();\r
+ if (entries != null && entries.size() > 0 && docrefs.size() > 0) {\r
+ int i = 0, j = entries.size();\r
+ do {\r
+ if (!docrefs.contains(entries.get(i))) {\r
+ entries.remove(i);\r
+ j--;\r
+ } else\r
+ i++;\r
+ } while (i < j);\r
+ }\r
+ return entries;\r
+ }\r
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.VorbaIdFactory;
-
-/**
- * @see SimpleDocBinding
- * Additional constructors for 'headless' Vamsas Document access
- * @author jimp
- */
-public class SimpleDocument extends SimpleDocBinding {
- private static Log log = LogFactory.getLog(SimpleDocument.class);
-
- private VorbaIdFactory makeDefaultFactory(String name) {
- return IdFactory.getDummyFactory(name);
- }
-
- public SimpleDocument(String name) {
- vorba = makeDefaultFactory(name);
- }
- public SimpleDocument(VorbaIdFactory Vorba) {
- if (Vorba!=null)
- vorba = Vorba;
- else
- log.error("Invalid SimpleDocument construction - no VorbaIdFactory defined!");
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.VorbaIdFactory;\r
+\r
+/**\r
+ * @see SimpleDocBinding Additional constructors for 'headless' Vamsas Document\r
+ * access\r
+ * @author jimp\r
+ */\r
+public class SimpleDocument extends SimpleDocBinding {\r
+ private static Log log = LogFactory.getLog(SimpleDocument.class);\r
+\r
+ private VorbaIdFactory makeDefaultFactory(String name) {\r
+ return IdFactory.getDummyFactory(name);\r
+ }\r
+\r
+ public SimpleDocument(String name) {\r
+ vorba = makeDefaultFactory(name);\r
+ }\r
+\r
+ public SimpleDocument(VorbaIdFactory Vorba) {\r
+ if (Vorba != null)\r
+ vorba = Vorba;\r
+ else\r
+ log\r
+ .error("Invalid SimpleDocument construction - no VorbaIdFactory defined!");\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
import org.apache.commons.logging.*;\r
import uk.ac.vamsas.client.picking.IPickManager;\r
import uk.ac.vamsas.client.picking.Message;\r
import uk.ac.vamsas.client.picking.SocketManager;\r
+\r
/**\r
* Blocking message handler\r
+ * \r
* @author\r
- *\r
+ * \r
*/\r
public class SimplePickManager implements IPickManager {\r
private Log log = LogFactory.getLog(SimplePickManager.class);\r
- \r
- SocketManager manager=null;\r
+\r
+ SocketManager manager = null;\r
+\r
SimplePickManager(SocketManager manager) {\r
- this.manager=manager;\r
- final SimplePickManager me=this;\r
+ this.manager = manager;\r
+ final SimplePickManager me = this;\r
/**\r
* add a handler that calls the SimplePickManager message handler\r
*/\r
me.handleMessage(message);\r
}\r
});\r
- \r
+\r
}\r
+\r
/**\r
* when false, messages are queued in a FIFO until thread can restart.\r
*/\r
- private boolean passThru=true;\r
+ private boolean passThru = true;\r
+\r
/**\r
- * internal flag - set to true to sleep until passThru is true before passing on a message\r
+ * internal flag - set to true to sleep until passThru is true before passing\r
+ * on a message\r
*/\r
- private boolean qUEUE=false;\r
+ private boolean qUEUE = false;\r
+\r
/**\r
* the client apps message handler\r
*/\r
- IMessageHandler pickHandler=null;\r
+ IMessageHandler pickHandler = null;\r
+\r
public void registerMessageHandler(IMessageHandler handler) {\r
- pickHandler=handler; \r
- \r
+ pickHandler = handler;\r
+\r
}\r
\r
public synchronized void sendMessage(Message message) {\r
// throw away messages whilst we block\r
- if (passThru && manager!=null)\r
+ if (passThru && manager != null)\r
manager.sendMessage(message);\r
}\r
+\r
/**\r
- * pass message onto the Apps handler, or wait until\r
- * passThru is true before passing message on.\r
+ * pass message onto the Apps handler, or wait until passThru is true before\r
+ * passing message on.\r
+ * \r
* @param message\r
*/\r
protected synchronized void handleMessage(Message message) {\r
if (qUEUE) {\r
- while (!passThru && manager!=null) {\r
- log.debug("Not passing through.");\r
- try {\r
- Thread.sleep(5);\r
- } catch (InterruptedException e) {};\r
- } \r
+ while (!passThru && manager != null) {\r
+ log.debug("Not passing through.");\r
+ try {\r
+ Thread.sleep(5);\r
+ } catch (InterruptedException e) {\r
+ }\r
+ ;\r
+ }\r
}\r
- if (passThru && manager!=null)\r
+ if (passThru && manager != null)\r
pickHandler.handleMessage(message);\r
}\r
\r
}\r
\r
/**\r
- * @param true to pass messages on to handlers, false to hold messages in queue\r
+ * @param true to pass messages on to handlers, false to hold messages in\r
+ * queue\r
*/\r
public void setPassThru(boolean passThru) {\r
this.passThru = passThru;\r
}\r
+\r
/**\r
* shutdown the pickmanager and remove all references to it\r
*/\r
public void shutdown() {\r
- passThru=false;\r
+ passThru = false;\r
manager.registerMessageHandler(null);\r
SocketManager dying = manager;\r
- manager=null;\r
- dying.shutdown();\r
+ manager = null;\r
+ dying.shutdown();\r
}\r
}\r
-/*
-* VAMSAS Project
-*
-* Dec 15, 2006
-*
-*/
-
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-import java.io.IOException;
-
-import uk.ac.vamsas.client.SessionHandle;
-
-/**
- * Class to deal with sessions
- *
- * retrieves list of available sessions
- *
- * adds an active session
- *
- * removes a close session (the last client has been closed)
- *
- *
- */
-public class SimpleSessionManager
-{
- private SessionsFile sessionFile = null;
-
-
- protected SimpleSessionManager(File sessionsFile) throws IOException
- {
- this.initManagerObjects(sessionsFile);
- }
-
-/**
- * construct SessionFile objects and watchers for each
- */
-private void initManagerObjects(File sessionsFile) throws IOException
- {
- if (this.sessionFile!=null )
- throw new IOException("initFactoryObjects called for initialised ClientFactory object.");
- this.sessionFile = new SessionsFile(sessionsFile);
- }
-
-
-/**
- * make a new watcher object for the sessionsFile
- * @return new SessionsFile watcher instance
- */
-public FileWatcher getSessionsWatcher() {
- return new FileWatcher(this.getSessionFile().sessionFile);
-}
-
-/**
- * @see uk.ac.vamsas.client.IClientFactory#getCurrentSessions()
- */
-public String[] getCurrentSessions()
-{
- String[] sessions = null;
- if (this.sessionFile!=null )
- {
- SessionHandle[] sessionHandles = this.sessionFile.retrieveSessionsList();
- if (sessionHandles != null)
- {
- sessions = new String[sessionHandles.length];
- for (int i = sessionHandles.length -1; i > -1; i--)
- {
- SessionHandle sessionHandle = sessionHandles[i];
- sessions [i] = sessionHandle.getSessionUrn();
- }
- }
- }
- return sessions;
-}
-
-/**
- * adds SessionHandle me to the sessionList
- * @param newSession session to add to the session list
- * @return session index in list or 0 if lock was invalid or addSession operation failed.
- */
-public int addSession(SessionHandle newSession)
- {
- return this.sessionFile.addSession(newSession, false,this.getSessionsWatcher().getChangedState());
- }
-
-/**
- * @return the sessionFile
- */
-private SessionsFile getSessionFile()
- {
- return this.sessionFile;
- }
-
-/**
- * Removes a session from the list of currently active session
- *
- * @param session SessionHandle of the session to remove
- */
-protected void removeSession(SessionHandle session)
- {
- this.getSessionFile().removeSession(session,this.getSessionsWatcher().getChangedState());
- }
-}
-
-
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+\r
+import uk.ac.vamsas.client.SessionHandle;\r
+\r
+/**\r
+ * Class to deal with sessions\r
+ * \r
+ * retrieves list of available sessions\r
+ * \r
+ * adds an active session\r
+ * \r
+ * removes a close session (the last client has been closed)\r
+ * \r
+ * \r
+ */\r
+public class SimpleSessionManager {\r
+ private SessionsFile sessionFile = null;\r
+\r
+ protected SimpleSessionManager(File sessionsFile) throws IOException {\r
+ this.initManagerObjects(sessionsFile);\r
+ }\r
+\r
+ /**\r
+ * construct SessionFile objects and watchers for each\r
+ */\r
+ private void initManagerObjects(File sessionsFile) throws IOException {\r
+ if (this.sessionFile != null)\r
+ throw new IOException(\r
+ "initFactoryObjects called for initialised ClientFactory object.");\r
+ this.sessionFile = new SessionsFile(sessionsFile);\r
+ }\r
+\r
+ /**\r
+ * make a new watcher object for the sessionsFile\r
+ * \r
+ * @return new SessionsFile watcher instance\r
+ */\r
+ public FileWatcher getSessionsWatcher() {\r
+ return new FileWatcher(this.getSessionFile().sessionFile);\r
+ }\r
+\r
+ /**\r
+ * @see uk.ac.vamsas.client.IClientFactory#getCurrentSessions()\r
+ */\r
+ public String[] getCurrentSessions() {\r
+ String[] sessions = null;\r
+ if (this.sessionFile != null) {\r
+ SessionHandle[] sessionHandles = this.sessionFile.retrieveSessionsList();\r
+ if (sessionHandles != null) {\r
+ sessions = new String[sessionHandles.length];\r
+ for (int i = sessionHandles.length - 1; i > -1; i--) {\r
+ SessionHandle sessionHandle = sessionHandles[i];\r
+ sessions[i] = sessionHandle.getSessionUrn();\r
+ }\r
+ }\r
+ }\r
+ return sessions;\r
+ }\r
+\r
+ /**\r
+ * adds SessionHandle me to the sessionList\r
+ * \r
+ * @param newSession\r
+ * session to add to the session list\r
+ * @return session index in list or 0 if lock was invalid or addSession\r
+ * operation failed.\r
+ */\r
+ public int addSession(SessionHandle newSession) {\r
+ return this.sessionFile.addSession(newSession, false, this\r
+ .getSessionsWatcher().getChangedState());\r
+ }\r
+\r
+ /**\r
+ * @return the sessionFile\r
+ */\r
+ private SessionsFile getSessionFile() {\r
+ return this.sessionFile;\r
+ }\r
+\r
+ /**\r
+ * Removes a session from the list of currently active session\r
+ * \r
+ * @param session\r
+ * SessionHandle of the session to remove\r
+ */\r
+ protected void removeSession(SessionHandle session) {\r
+ this.getSessionFile().removeSession(session,\r
+ this.getSessionsWatcher().getChangedState());\r
+ }\r
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-import java.util.jar.JarEntry;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.AppDataOutputStream;
-import uk.ac.vamsas.client.ClientHandle;
-import uk.ac.vamsas.client.IVorbaIdFactory;
-import uk.ac.vamsas.client.SessionHandle;
-import uk.ac.vamsas.client.UserHandle;
-import uk.ac.vamsas.client.Vobject;
-import uk.ac.vamsas.client.VorbaIdFactory;
-import uk.ac.vamsas.client.VorbaXmlBinder;
-import uk.ac.vamsas.objects.core.ApplicationData;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-import uk.ac.vamsas.objects.utils.AppDataReference;
-import uk.ac.vamsas.objects.utils.DocumentStuff;
-import uk.ac.vamsas.objects.utils.ProvenanceStuff;
-import uk.ac.vamsas.objects.utils.document.VersionEntries;
-
-/**
- * Class for high-level io and Jar manipulation involved in creating
- * or updating a vamsas archive (with backups).
- * Writes to a temporary file and then swaps new file for backup.
- * uses the sessionFile locking mechanism for safe I/O
- * @author jimp
- *
- */
-public class VamsasArchive {
- private static Log log = LogFactory.getLog(VamsasArchive.class);
- /**
- * Access original document if it exists, and get VAMSAS root objects.
- * @return vector of vamsas roots from original document
- * @throws IOException
- */
- public static Vobject[] getOriginalRoots(VamsasArchive ths) throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- VamsasArchiveReader oReader = ths.getOriginalArchiveReader();
- if (oReader!=null) {
-
- if (oReader.isValid()) {
- InputStreamReader vdoc = new InputStreamReader(oReader.getVamsasDocumentStream());
- VamsasDocument doc = VamsasDocument.unmarshal(vdoc);
- if (doc!=null)
- return doc.getVAMSAS();
- // TODO ensure embedded appDatas are garbage collected to save memory
- } else {
- InputStream vxmlis = oReader.getVamsasXmlStream();
- if (vxmlis!=null) { // Might be an old vamsas file.
- BufferedInputStream ixml = new BufferedInputStream(oReader.getVamsasXmlStream());
- InputStreamReader vxml = new InputStreamReader(ixml);
- VAMSAS root[] = new VAMSAS[1];
- root[0] = VAMSAS.unmarshal(vxml);
- if (root[0]!=null)
- return root;
- }
- }
- }
- return null;
- }
- /**
- * Access the original vamsas document for a VamsasArchive class, and return it.
- * Users of the VamsasArchive class should use the getVamsasDocument method to retrieve
- * the current document - only use this one if you want the 'backup' version.
- * TODO: catch OutOfMemoryError - they are likely to occur here.
- * NOTE: vamsas.xml datastreams are constructed as 'ALPHA_VERSION' vamsas documents.
- * @param ths
- * @return null if no document exists.
- * @throws IOException
- * @throws org.exolab.castor.xml.MarshalException
- * @throws org.exolab.castor.xml.ValidationException
- */
- public static VamsasDocument getOriginalVamsasDocument(VamsasArchive ths) throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return VamsasArchive.getOriginalVamsasDocument(ths, null);
- }
- /**
- * Uses VorbaXmlBinder to retrieve the VamsasDocument from the original archive referred to by ths
- * @param ths
- * @param vorba
- * @return
- * @throws IOException
- * @throws org.exolab.castor.xml.MarshalException
- * @throws org.exolab.castor.xml.ValidationException
- */
- public static VamsasDocument getOriginalVamsasDocument(VamsasArchive ths, VorbaIdFactory vorba) throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- VamsasArchiveReader oReader = ths.getOriginalArchiveReader();
- if (oReader!=null) {
- ths.setVorba(vorba);
- return ths.vorba.getVamsasDocument(oReader);
- }
- // otherwise - there was no valid original document to read.
- return null;
- }
- /**
- * destination of new archive data (tempfile if virginarchive=true, original archive location otherwise)
- */
- java.io.File archive=null;
- /**
- * locked IO handler for new archive file
- */
- SessionFile rchive=null;
- /**
- * original archive file to be updated (or null if virgin) where new data will finally reside
- */
- java.io.File original=null;
- /**
- * original archive IO handler
- */
- SessionFile odoclock = null;
- Lock destinationLock = null;
- /**
- * Original archive reader class
- */
- VamsasArchiveReader odoc = null;
- /**
- * true if a real vamsas document is being written.
- */
- boolean vamsasdocument=true;
- /**
- * Output stream for archived data
- */
- org.apache.tools.zip.ZipOutputStream newarchive=null;
- /**
- * JarEntries written to archive
- */
- Hashtable entries = null;
-
- /**
- * true if we aren't just updating an archive
- */
- private boolean virginArchive=false;
-
- /**
- * name of backup of existing archive that has been updated/overwritten.
- * only one backup will be made - and this is it.
- */
- File originalBackup = null;
-
- boolean donotdeletebackup=false;
- private final int _TRANSFER_BUFFER=4096*4;
- protected SimpleDocument vorba = null;
- /**
- * LATER: ? CUT'n'Paste error ?
- * Access and return current vamsas Document, if it exists, or create a new one
- * (without affecting VamsasArchive object state - so is NOT THREAD SAFE)
- * _TODO: possibly modify internal state to lock low-level files
- * (like the IClientDocument interface instance constructer would do)
- * @see org.vamsas.simpleclient.VamsasArchive.getOriginalVamsasDocument for additional caveats
- *
- * @return
- * @throws IOException
- * @throws org.exolab.castor.xml.MarshalException
- * @throws org.exolab.castor.xml.ValidationException
- * ????? where does this live JBPNote ?
- */
- private VamsasDocument _doc=null;
-
- /**
- * Create a new vamsas archive
- * File locks are made immediately to avoid contention
- *
- * @param archive - file spec for new vamsas archive
- * @param vamsasdocument true if archive is to be a fully fledged vamsas document archive
- * @throws IOException if call to accessOriginal failed for updates, or openArchive failed.
- */
- public VamsasArchive(File archive, boolean vamsasdocument) throws IOException {
- this(archive, false, vamsasdocument, null);
- }
- public VamsasArchive(File archive, boolean vamsasdocument, boolean overwrite) throws IOException {
- this(archive, overwrite, vamsasdocument, null);
- }
- /**
- * Constructor for accessing Files under file-lock management (ie a session file)
- * @param archive
- * @param vamsasdocument
- * @param overwrite
- * @throws IOException
- */
- public VamsasArchive(VamsasFile archive, boolean vamsasdocument, boolean overwrite) throws IOException {
- this(archive.sessionFile, overwrite, vamsasdocument, archive);
- // log.debug("using non-functional lock-IO stream jar access constructor");
- }
- /**
- * read and write to archive - will not overwrite original contents, and will always write an up to date vamsas document structure.
- * @param archive
- * @throws IOException
- */
- public VamsasArchive(VamsasFile archive) throws IOException {
- this(archive, true, false);
- }
- /**
- *
- * @param archive file to write
- * @param overwrite true if original contents should be deleted
- * @param vamsasdocument true if a proper VamsasDocument archive is to be written.
- * @param extantLock SessionFile object holding a lock for the <object>archive</object>
- * @throws IOException
- */
- public VamsasArchive(File archive, boolean overwrite, boolean vamsasdocument, SessionFile extantLock) throws IOException {
- super();
- if (archive==null || (archive!=null && !(archive.getAbsoluteFile().getParentFile().canWrite() && (!archive.exists() || archive.canWrite())))) {
- log.fatal("Expect Badness! -- Invalid parameters for VamsasArchive constructor:"+((archive!=null)
- ? "File cannot be overwritten." : "Null Object not valid constructor parameter"));
- return;
- }
-
- this.vamsasdocument = vamsasdocument;
- if (archive.exists() && !overwrite) {
- this.original = archive;
- if (extantLock!=null) {
- this.odoclock = extantLock;
- if (odoclock.fileLock==null || !odoclock.fileLock.isLocked())
- odoclock.lockFile();
- } else {
- this.odoclock = new SessionFile(archive);
- }
- odoclock.lockFile(); // lock the file *immediatly*
- this.archive = null; // archive will be a temp file when the open method is called
- virginArchive=false;
- try {
- this.accessOriginal();
- } catch (IOException e) {
- throw new IOException("Lock failed for existing archive"+archive);
- }
- } else {
- this.original = null;
- this.archive = archive; // archive is written in place.
- if (extantLock!=null)
- rchive=extantLock;
- else
- rchive = new SessionFile(archive);
- rchive.lockFile();
- if (rchive.fileLock==null || !rchive.fileLock.isLocked())
- throw new IOException("Lock failed for new archive"+archive);
- rchive.fileLock.getRaFile().setLength(0); // empty the archive.
- virginArchive = true;
- }
- this.openArchive(); // open archive
- }
- /**
- * open original archive file for exclusive (locked) reading.
- * @throws IOException
- */
- private void accessOriginal() throws IOException {
- if (original!=null && original.exists()) {
- if (odoclock==null)
- odoclock = new SessionFile(original);
- odoclock.lockFile();
- if (odoc == null)
- odoc = new VamsasArchiveReader(original);
- // this constructor is not implemented yet odoc = new VamsasArchiveReader(odoclock.fileLock);
- }
- }
-
- /**
- * Add unique entry strings to internal JarEntries list.
- * @param entry
- * @return true if entry was unique and was added.
- */
- private boolean addEntry(String entry) {
- if (entries==null)
- entries=new Hashtable();
- if (log.isDebugEnabled())
- {
- log.debug("validating '"+entry+"' in hash for "+this);
- }
- if (entries.containsKey(entry))
- return false;
- entries.put(entry, new Integer(entries.size()));
- return true;
- }
- /**
- * adds named entry to newarchive or returns false.
- * @param entry
- * @return true if entry was unique and could be added
- * @throws IOException if entry name was invalid or a new entry could not be made on newarchive
- */
- private boolean addValidEntry(String entry) throws IOException {
- org.apache.tools.zip.ZipEntry je = new org.apache.tools.zip.ZipEntry(entry);
- // je.setExsetExtra(null);
- if (!addEntry(entry))
- return false;
- newarchive.flush();
- newarchive.putNextEntry(je);
- return true;
- }
- /**
- * called by app to get name of backup if it was made.
- * If this is called, the caller app *must* delete the backup themselves.
- * @return null or a valid file object
- */
- public File backupFile() {
-
- if (!virginArchive) {
- makeBackup();
- donotdeletebackup=true; // external reference has been made.
- return ((original!=null) ? originalBackup : null);
- }
- return null;
- }
-
- /**
- * Stops any current write to archive, and reverts to the backup if it exists.
- * All existing locks on the original will be released. All backup files are removed.
- */
- public boolean cancelArchive() {
- if (newarchive!=null) {
- try {
- newarchive.closeEntry();
- newarchive.putNextEntry(new org.apache.tools.zip.ZipEntry("deleted"));
- newarchive.closeEntry();
- newarchive.close();
-
- } catch (Exception e) {
- log.debug("Whilst closing newarchive",e);
- };
- if (!virginArchive) {
- // then there is something to recover.
- try {
- recoverBackup();
- }
- catch (Exception e) {
- log.warn("Problems when trying to cancel Archive "+archive.getAbsolutePath(), e);
- return false;
- }
- }
-
- } else {
- log.warn("Client Error: cancelArchive called before archive("+original.getAbsolutePath()+") has been opened!");
- }
- closeAndReset(); // tidy up and release locks.
- return true;
- }
-
- /**
- * only do this if you want to destroy the current file output stream
- *
- */
- private void closeAndReset() {
- if (rchive!=null) {
- rchive.unlockFile();
- rchive=null;
- }
- if (original!=null) {
- if (odoc!=null) {
- odoc.close();
- odoc=null;
- }
- if (archive!=null)
- archive.delete();
- if (odoclock!=null) {
- odoclock.unlockFile();
- odoclock = null;
- }
- }
- removeBackup();
- newarchive=null;
- original=null;
- entries=null;
- }
- /**
- * Tidies up and closes archive, removing any backups that were created.
- * NOTE: It is up to the caller to delete the original archive backup obtained from backupFile()
- * TODO: ensure all extant AppDataReference jar entries are transferred to new Jar
- * TODO: provide convenient mechanism for generating new unique AppDataReferences and adding them to the document
- */
- public void closeArchive() throws IOException {
- if (newarchive!=null) {
- newarchive.flush();
- newarchive.closeEntry();
- if (!isDocumentWritten())
- log.warn("Premature closure of archive '"+archive.getAbsolutePath()+"': No document has been written.");
- newarchive.finish();// close(); // use newarchive.finish(); for a stream IO
- newarchive.flush();
- //
- updateOriginal();
- closeAndReset();
- } else {
- log.warn("Attempt to close archive that has not been opened for writing.");
- }
- }
- /**
- * Opens and returns the applicationData output stream for the appdataReference string.
- * @param appdataReference
- * @return Output stream to write to
- * @throws IOException
- */
- public AppDataOutputStream getAppDataStream(String appdataReference) throws IOException {
- if (newarchive==null)
- throw new IOException("Attempt to write to closed VamsasArchive object.");
- if (addValidEntry(appdataReference)) {
- return new AppDataOutputStream(newarchive);
- }
- return null;
- }
-
- /**
- *
- * @return JarEntry name for the vamsas XML stream in this archive
- */
- protected String getDocumentJarEntry() {
- if (vamsasdocument)
- return VamsasArchiveReader.VAMSASDOC;
- return VamsasArchiveReader.VAMSASXML;
- }
- /**
- * Safely initializes the VAMSAS XML document Jar Entry.
- * @return Writer to pass to the marshalling function.
- * @throws IOException if a document entry has already been written.
- */
- public PrintWriter getDocumentOutputStream() throws IOException {
- if (newarchive==null)
- openArchive();
- if (!isDocumentWritten()) {
- try {
- if (addValidEntry(getDocumentJarEntry()))
- return new PrintWriter(new java.io.OutputStreamWriter(newarchive, "UTF-8"));
- } catch (Exception e) {
- log.warn("Problems opening XML document JarEntry stream",e);
- }
- } else {
- throw new IOException("Vamsas Document output stream is already written.");
- }
- return null;
- }
-
- /**
- * Access original archive if it exists, pass the reader to the client
- * Note: this is NOT thread safe and a call to closeArchive() will by necessity
- * close and invalidate the VamsasArchiveReader object.
- * @return null if no original archive exists.
- */
- public VamsasArchiveReader getOriginalArchiveReader() throws IOException {
- if (!virginArchive) {
- accessOriginal();
- return odoc;
- }
- return null;
- }
- /**
- * returns original document's root vamsas elements.
- * @return
- * @throws IOException
- * @throws org.exolab.castor.xml.MarshalException
- * @throws org.exolab.castor.xml.ValidationException
- */
- public Vobject[] getOriginalRoots() throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return VamsasArchive.getOriginalRoots(this);
- }
- /**
- * @return original document or a new empty document (with default provenance)
- * @throws IOException
- * @throws org.exolab.castor.xml.MarshalException
- * @throws org.exolab.castor.xml.ValidationException
- */
- public VamsasDocument getVamsasDocument() throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return getVamsasDocument("org.vamsas.simpleclient.VamsasArchive", "Created new empty document", null);
- }
- /**
- * Return the original document or a new empty document with initial provenance entry.
- * @param provenance_user (null sets user to be the class name)
- * @param provenance_action (null sets action to be 'created new document')
- * @param version (null means use latest version)
- * @return (original document or a new vamsas document with supplied provenance and version info)
- * @throws IOException
- * @throws org.exolab.castor.xml.MarshalException
- * @throws org.exolab.castor.xml.ValidationException
- */
- public VamsasDocument getVamsasDocument(String provenance_user, String provenance_action, String version) throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- if (_doc!=null)
- return _doc;
- _doc = getOriginalVamsasDocument(this, getVorba());
- if (_doc!=null)
- return _doc;
- // validate parameters
- if (provenance_user==null)
- provenance_user = "org.vamsas.simpleclient.VamsasArchive";
- if (provenance_action == null)
- provenance_action="Created new empty document";
- if (version==null)
- version = VersionEntries.latestVersion();
- // Create a new document and return it
- _doc = DocumentStuff.newVamsasDocument(new VAMSAS[] { new VAMSAS()},
- ProvenanceStuff.newProvenance(provenance_user, provenance_action), version);
- return _doc;
- }
- /**
- * @return Returns the current VorbaIdFactory for the archive.
- */
- public VorbaIdFactory getVorba() {
- if (vorba==null)
- vorba = new SimpleDocument("simpleclient.VamsasArchive");
- return vorba.getVorba();
- }
- /**
- * @return true if Vamsas Document has been written to archive
- */
- protected boolean isDocumentWritten() {
- if (newarchive==null)
- log.warn("isDocumentWritten() called for unopened archive.");
- if (entries!=null) {
- if (entries.containsKey(getDocumentJarEntry()))
- return true;
- }
- return false;
- }
- private void makeBackup() {
- if (!virginArchive) {
- if (originalBackup==null && original!=null && original.exists()) {
- try {
- accessOriginal();
- originalBackup = odoclock.backupSessionFile(null, original.getName(), ".bak", original.getParentFile());
- }
- catch (IOException e) {
- log.warn("Problem whilst making a backup of original archive.",e);
- }
- }
- }
- }
- /**
- * opens the new archive ready for writing. If the new archive is replacing an existing one,
- * then the existing archive will be locked, and the new archive written to a temporary file.
- * The new archive will be put in place once close() is called.
- * @param doclock LATER - pass existing lock on document, if it exists.... no need yet?
- * @throws IOException
- */
- private void openArchive() throws IOException {
-
- if (newarchive!=null) {
- log.warn("openArchive() called multiple times.");
- throw new IOException("Vamsas Archive '"+archive.getAbsolutePath()+"' is already open.");
- }
- if (archive==null && (virginArchive || original==null)) {
- log.warn("openArchive called on uninitialised VamsasArchive object.");
- throw new IOException("Badly initialised VamsasArchive object - no archive file specified.");
- }
- if (!virginArchive) {
- // lock the original
- accessOriginal();
- // make a temporary file to write to
- archive = File.createTempFile(original.getName(), ".new",original.getParentFile());
- } else {
- if (archive.exists())
- log.warn("New archive file name already in use! Possible lock failure imminent?");
- }
-
- if (rchive==null)
- rchive = new SessionFile(archive);
- if (!rchive.lockFile())
- throw new IOException("Failed to get lock on file "+archive);
- // LATER: locked IO stream based access.
- // Manifest newmanifest = new Manifest();
- newarchive = new org.apache.tools.zip.ZipOutputStream(rchive.fileLock.getBufferedOutputStream(true));// , newmanifest);
- //newarchive = new JarOutputStream(new BufferedOutputStream(new java.io.FileOutputStream(archive)));
- entries = new Hashtable();
- }
- public void putVamsasDocument(VamsasDocument doc) throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- putVamsasDocument(doc, getVorba());
- }
- /**
- *
- * @param doc
- * @param vorba
- * @return (vorbaId string, Vobjhash) pairs for last hash of each object in document
- * @throws IOException
- * @throws org.exolab.castor.xml.MarshalException
- * @throws org.exolab.castor.xml.ValidationException
- */
- public void putVamsasDocument(VamsasDocument doc, VorbaIdFactory vorba) throws IOException,
- org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- if (vamsasdocument)
- doc.setVersion(VersionEntries.latestVersion()); // LATER: ensure this does the correct thing.
- VorbaXmlBinder.putVamsasDocument(getDocumentOutputStream(), vorba, doc);
- }
-
- /**
- * recovers the original file's contents from the (temporary) backup.
- * @throws Exception if any SessionFile or file removal operations fail.
- */
- private void recoverBackup() throws Exception {
- if (originalBackup!=null) {
- // backup has been made.
- // revert from backup and delete it (changing backup filename)
- if (rchive==null) {
- rchive = new SessionFile(original);
- }
- SessionFile bckup = new SessionFile(originalBackup);
-
- rchive.updateFrom(null, bckup); // recover from backup file.
- bckup.unlockFile();
- bckup=null;
- removeBackup();
- }
- }
-
- /**
- * forget about any backup that was made - removing it first if it was only temporary.
- */
- private void removeBackup() {
- if (originalBackup!=null) {
- log.debug("Removing backup in "+originalBackup.getAbsolutePath());
- if (!donotdeletebackup)
- if (!originalBackup.delete())
- log.info("VamsasArchive couldn't remove temporary backup "+originalBackup.getAbsolutePath());
- originalBackup=null;
- }
- }
- /**
- * @param vorba the VorbaIdFactory to use for accessing vamsas objects.
- */
- public void setVorba(VorbaIdFactory Vorba) {
- if (Vorba!=null) {
- if (vorba==null)
- vorba = new SimpleDocument(Vorba);
- else
- vorba.setVorba(Vorba);
- } else
- getVorba();
- }
- /**
- * Convenience method to copy over the referred entry from the backup to the new version.
- * Warning messages are raised if no backup exists or the
- * entry doesn't exist in the backed-up original.
- * Duplicate writes return true - but a warning message will also be raised.
- * @param AppDataReference
- * @return true if AppDataReference now exists in the new document
- * @throws IOException
- */
- public boolean transferAppDataEntry(String AppDataReference) throws IOException {
- return transferAppDataEntry(AppDataReference, AppDataReference);
- }
- /**
- * Validates the AppDataReference: not null and not already written to archive.
- * @param AppDataReference
- * @return true if valid. false if not
- * @throws IOException for really broken references!
- */
- protected boolean _validNewAppDataReference(String newAppDataReference) throws IOException {
- // LATER: Specify valid AppDataReference form in all VamsasArchive handlers
- if (newAppDataReference==null)
- throw new IOException("null newAppDataReference!");
- if (entries.containsKey(newAppDataReference)) {
- log.warn("Attempt to write '"+newAppDataReference+"' twice! - IGNORED");
- // LATER: fix me? warning message should raise an exception here.
- return false;
- }
- return true;
- }
- /**
- * Transfers an AppDataReference from old to new vamsas archive, with a name change.
- * @see transferAppDataEntry(String AppDataReference)
- * @param AppDataReference
- * @param NewAppDataReference - AppDataReference in new Archive
- * @return
- * @throws IOException
- */
- public boolean transferAppDataEntry(String AppDataReference, String NewAppDataReference) throws IOException {
- if (original==null || !original.exists()) {
- log.warn("No backup archive exists.");
- return false;
- }
- if (AppDataReference==null)
- throw new IOException("null AppDataReference!");
-
- if (!_validNewAppDataReference(NewAppDataReference))
- return false;
-
- accessOriginal();
-
- java.io.InputStream adstream = odoc.getAppdataStream(AppDataReference);
-
- if (adstream==null) {
- log.warn("AppDataReference '"+AppDataReference+"' doesn't exist in backup archive.");
- return false;
- }
-
- java.io.OutputStream adout = getAppDataStream(NewAppDataReference);
- // copy over the bytes
- int written=-1;
- long count=0;
- byte[] buffer = new byte[_TRANSFER_BUFFER]; // conservative estimate of a sensible buffer
- do {
- if ((written = adstream.read(buffer))>-1) {
- adout.write(buffer, 0, written);
- log.debug("Transferring "+written+".");
- count+=written;
- }
- } while (written>-1);
- log.debug("Sucessfully transferred AppData for '"
- +AppDataReference+"' as '"+NewAppDataReference+"' ("+count+" bytes)");
- return true;
- }
- /**
- * write data from a stream into an appData reference.
- * @param AppDataReference - New AppDataReference not already written to archive
- * @param adstream Source of data for appData reference - read until .read(buffer) returns -1
- * @return true on success.
- * @throws IOException for file IO or invalid AppDataReference string
- */
- public boolean writeAppdataFromStream(String AppDataReference, java.io.InputStream adstream) throws IOException {
- if (!_validNewAppDataReference(AppDataReference)) {
- log.warn("Invalid AppDataReference passed to writeAppdataFromStream");
- throw new IOException("Invalid AppDataReference! (null, or maybe non-unique)!");
- }
-
- if (AppDataReference==null) {
- log.warn("null appdata passed.");
- throw new IOException("Null AppDataReference");
- }
-
- java.io.OutputStream adout = getAppDataStream(AppDataReference);
- // copy over the bytes
- int written=-1;
- long count=0;
- byte[] buffer = new byte[_TRANSFER_BUFFER]; // conservative estimate of a sensible buffer
- do {
- if ((written = adstream.read(buffer))>-1) {
- adout.write(buffer, 0, written);
- log.debug("Transferring "+written+".");
- count+=written;
- }
- } while (written>-1);
- return true;
- }
- /**
- * transfers any AppDataReferences existing in the old document
- * that haven't already been transferred to the new one
- * LATER: do the same for transfers requiring a namechange - more document dependent.
- * @return true if data was transferred.
- */
- public boolean transferRemainingAppDatas() throws IOException {
- boolean transfered=false;
- if (original==null || !original.exists()) {
- log.warn("No backup archive exists.");
- return false;
- }
- accessOriginal();
-
- if (getVorba()!=null) {
- Vector originalRefs=null;
- try {
- originalRefs = vorba.getReferencedEntries(getVamsasDocument(), getOriginalArchiveReader());
- } catch (Exception e) {
- log.warn("Problems accessing original document entries!",e);
- }
- if (originalRefs!=null) {
- Iterator ref = originalRefs.iterator();
- while (ref.hasNext()) {
- String oldentry = (String) ref.next();
- if (oldentry!=null && !entries.containsKey(oldentry)) {
- log.debug("Transferring remaining entry '"+oldentry+"'");
- transfered |= transferAppDataEntry(oldentry);
- }
- }
- }
- }
- return transfered;
- }
- /**
- * called after archive is written to put file in its final place
- */
- private void updateOriginal() {
- if (!virginArchive) {
- // make sure original document really is backed up and then overwrite it.
- if (odoc!=null) {
- // try to shut the odoc reader.
- odoc.close();
- odoc = null;
- }
- // Make a backup if it isn't done already
- makeBackup();
- try {
- // copy new Archive data that was writen to a temporary file
- odoclock.updateFrom(null, rchive);
- }
- catch (IOException e) {
- // LATER: decide if leaving nastily named backup files around is necessary.
- File backupFile=backupFile();
- if (backupFile!=null)
- log.error("Problem updating archive from temporary file! - backup left in '"
- +backupFile().getAbsolutePath()+"'",e);
- else
- log.error("Problems updating, and failed to even make a backup file. Ooops!", e);
- }
- // Tidy up if necessary.
- removeBackup();
- } else {
-
-
- }
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.BufferedOutputStream;\r
+import java.io.DataOutputStream;\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+import java.io.OutputStream;\r
+import java.io.OutputStreamWriter;\r
+import java.io.PrintWriter;\r
+import java.util.Hashtable;\r
+import java.util.Iterator;\r
+import java.util.Vector;\r
+import java.util.jar.JarEntry;\r
+import java.util.jar.JarOutputStream;\r
+import java.util.jar.Manifest;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.AppDataOutputStream;\r
+import uk.ac.vamsas.client.ClientHandle;\r
+import uk.ac.vamsas.client.IVorbaIdFactory;\r
+import uk.ac.vamsas.client.SessionHandle;\r
+import uk.ac.vamsas.client.UserHandle;\r
+import uk.ac.vamsas.client.Vobject;\r
+import uk.ac.vamsas.client.VorbaIdFactory;\r
+import uk.ac.vamsas.client.VorbaXmlBinder;\r
+import uk.ac.vamsas.objects.core.ApplicationData;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+import uk.ac.vamsas.objects.utils.AppDataReference;\r
+import uk.ac.vamsas.objects.utils.DocumentStuff;\r
+import uk.ac.vamsas.objects.utils.ProvenanceStuff;\r
+import uk.ac.vamsas.objects.utils.document.VersionEntries;\r
+\r
+/**\r
+ * Class for high-level io and Jar manipulation involved in creating or updating\r
+ * a vamsas archive (with backups). Writes to a temporary file and then swaps\r
+ * new file for backup. uses the sessionFile locking mechanism for safe I/O\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class VamsasArchive {\r
+ private static Log log = LogFactory.getLog(VamsasArchive.class);\r
+\r
+ /**\r
+ * Access original document if it exists, and get VAMSAS root objects.\r
+ * \r
+ * @return vector of vamsas roots from original document\r
+ * @throws IOException\r
+ */\r
+ public static Vobject[] getOriginalRoots(VamsasArchive ths)\r
+ throws IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ VamsasArchiveReader oReader = ths.getOriginalArchiveReader();\r
+ if (oReader != null) {\r
+\r
+ if (oReader.isValid()) {\r
+ InputStreamReader vdoc = new InputStreamReader(oReader\r
+ .getVamsasDocumentStream());\r
+ VamsasDocument doc = VamsasDocument.unmarshal(vdoc);\r
+ if (doc != null)\r
+ return doc.getVAMSAS();\r
+ // TODO ensure embedded appDatas are garbage collected to save memory\r
+ } else {\r
+ InputStream vxmlis = oReader.getVamsasXmlStream();\r
+ if (vxmlis != null) { // Might be an old vamsas file.\r
+ BufferedInputStream ixml = new BufferedInputStream(oReader\r
+ .getVamsasXmlStream());\r
+ InputStreamReader vxml = new InputStreamReader(ixml);\r
+ VAMSAS root[] = new VAMSAS[1];\r
+ root[0] = VAMSAS.unmarshal(vxml);\r
+ if (root[0] != null)\r
+ return root;\r
+ }\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Access the original vamsas document for a VamsasArchive class, and return\r
+ * it. Users of the VamsasArchive class should use the getVamsasDocument\r
+ * method to retrieve the current document - only use this one if you want the\r
+ * 'backup' version. TODO: catch OutOfMemoryError - they are likely to occur\r
+ * here. NOTE: vamsas.xml datastreams are constructed as 'ALPHA_VERSION'\r
+ * vamsas documents.\r
+ * \r
+ * @param ths\r
+ * @return null if no document exists.\r
+ * @throws IOException\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ */\r
+ public static VamsasDocument getOriginalVamsasDocument(VamsasArchive ths)\r
+ throws IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return VamsasArchive.getOriginalVamsasDocument(ths, null);\r
+ }\r
+\r
+ /**\r
+ * Uses VorbaXmlBinder to retrieve the VamsasDocument from the original\r
+ * archive referred to by ths\r
+ * \r
+ * @param ths\r
+ * @param vorba\r
+ * @return\r
+ * @throws IOException\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ */\r
+ public static VamsasDocument getOriginalVamsasDocument(VamsasArchive ths,\r
+ VorbaIdFactory vorba) throws IOException,\r
+ org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ VamsasArchiveReader oReader = ths.getOriginalArchiveReader();\r
+ if (oReader != null) {\r
+ ths.setVorba(vorba);\r
+ return ths.vorba.getVamsasDocument(oReader);\r
+ }\r
+ // otherwise - there was no valid original document to read.\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * destination of new archive data (tempfile if virginarchive=true, original\r
+ * archive location otherwise)\r
+ */\r
+ java.io.File archive = null;\r
+\r
+ /**\r
+ * locked IO handler for new archive file\r
+ */\r
+ SessionFile rchive = null;\r
+\r
+ /**\r
+ * original archive file to be updated (or null if virgin) where new data will\r
+ * finally reside\r
+ */\r
+ java.io.File original = null;\r
+\r
+ /**\r
+ * original archive IO handler\r
+ */\r
+ SessionFile odoclock = null;\r
+\r
+ Lock destinationLock = null;\r
+\r
+ /**\r
+ * Original archive reader class\r
+ */\r
+ VamsasArchiveReader odoc = null;\r
+\r
+ /**\r
+ * true if a real vamsas document is being written.\r
+ */\r
+ boolean vamsasdocument = true;\r
+\r
+ /**\r
+ * Output stream for archived data\r
+ */\r
+ org.apache.tools.zip.ZipOutputStream newarchive = null;\r
+\r
+ /**\r
+ * JarEntries written to archive\r
+ */\r
+ Hashtable entries = null;\r
+\r
+ /**\r
+ * true if we aren't just updating an archive\r
+ */\r
+ private boolean virginArchive = false;\r
+\r
+ /**\r
+ * name of backup of existing archive that has been updated/overwritten. only\r
+ * one backup will be made - and this is it.\r
+ */\r
+ File originalBackup = null;\r
+\r
+ boolean donotdeletebackup = false;\r
+\r
+ private final int _TRANSFER_BUFFER = 4096 * 4;\r
+\r
+ protected SimpleDocument vorba = null;\r
+\r
+ /**\r
+ * LATER: ? CUT'n'Paste error ? Access and return current vamsas Document, if\r
+ * it exists, or create a new one (without affecting VamsasArchive object\r
+ * state - so is NOT THREAD SAFE) _TODO: possibly modify internal state to\r
+ * lock low-level files (like the IClientDocument interface instance\r
+ * constructer would do)\r
+ * \r
+ * @see org.vamsas.simpleclient.VamsasArchive.getOriginalVamsasDocument for\r
+ * additional caveats\r
+ * \r
+ * @return\r
+ * @throws IOException\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * ????? where does this live JBPNote ?\r
+ */\r
+ private VamsasDocument _doc = null;\r
+\r
+ /**\r
+ * Create a new vamsas archive File locks are made immediately to avoid\r
+ * contention\r
+ * \r
+ * @param archive\r
+ * - file spec for new vamsas archive\r
+ * @param vamsasdocument\r
+ * true if archive is to be a fully fledged vamsas document archive\r
+ * @throws IOException\r
+ * if call to accessOriginal failed for updates, or openArchive\r
+ * failed.\r
+ */\r
+ public VamsasArchive(File archive, boolean vamsasdocument) throws IOException {\r
+ this(archive, false, vamsasdocument, null);\r
+ }\r
+\r
+ public VamsasArchive(File archive, boolean vamsasdocument, boolean overwrite)\r
+ throws IOException {\r
+ this(archive, overwrite, vamsasdocument, null);\r
+ }\r
+\r
+ /**\r
+ * Constructor for accessing Files under file-lock management (ie a session\r
+ * file)\r
+ * \r
+ * @param archive\r
+ * @param vamsasdocument\r
+ * @param overwrite\r
+ * @throws IOException\r
+ */\r
+ public VamsasArchive(VamsasFile archive, boolean vamsasdocument,\r
+ boolean overwrite) throws IOException {\r
+ this(archive.sessionFile, overwrite, vamsasdocument, archive);\r
+ // log.debug("using non-functional lock-IO stream jar access constructor");\r
+ }\r
+\r
+ /**\r
+ * read and write to archive - will not overwrite original contents, and will\r
+ * always write an up to date vamsas document structure.\r
+ * \r
+ * @param archive\r
+ * @throws IOException\r
+ */\r
+ public VamsasArchive(VamsasFile archive) throws IOException {\r
+ this(archive, true, false);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @param archive\r
+ * file to write\r
+ * @param overwrite\r
+ * true if original contents should be deleted\r
+ * @param vamsasdocument\r
+ * true if a proper VamsasDocument archive is to be written.\r
+ * @param extantLock\r
+ * SessionFile object holding a lock for the <object>archive</object>\r
+ * @throws IOException\r
+ */\r
+ public VamsasArchive(File archive, boolean overwrite, boolean vamsasdocument,\r
+ SessionFile extantLock) throws IOException {\r
+ super();\r
+ if (archive == null\r
+ || (archive != null && !(archive.getAbsoluteFile().getParentFile()\r
+ .canWrite() && (!archive.exists() || archive.canWrite())))) {\r
+ log\r
+ .fatal("Expect Badness! -- Invalid parameters for VamsasArchive constructor:"\r
+ + ((archive != null) ? "File cannot be overwritten."\r
+ : "Null Object not valid constructor parameter"));\r
+ return;\r
+ }\r
+\r
+ this.vamsasdocument = vamsasdocument;\r
+ if (archive.exists() && !overwrite) {\r
+ this.original = archive;\r
+ if (extantLock != null) {\r
+ this.odoclock = extantLock;\r
+ if (odoclock.fileLock == null || !odoclock.fileLock.isLocked())\r
+ odoclock.lockFile();\r
+ } else {\r
+ this.odoclock = new SessionFile(archive);\r
+ }\r
+ odoclock.lockFile(); // lock the file *immediatly*\r
+ this.archive = null; // archive will be a temp file when the open method\r
+ // is called\r
+ virginArchive = false;\r
+ try {\r
+ this.accessOriginal();\r
+ } catch (IOException e) {\r
+ throw new IOException("Lock failed for existing archive" + archive);\r
+ }\r
+ } else {\r
+ this.original = null;\r
+ this.archive = archive; // archive is written in place.\r
+ if (extantLock != null)\r
+ rchive = extantLock;\r
+ else\r
+ rchive = new SessionFile(archive);\r
+ rchive.lockFile();\r
+ if (rchive.fileLock == null || !rchive.fileLock.isLocked())\r
+ throw new IOException("Lock failed for new archive" + archive);\r
+ rchive.fileLock.getRaFile().setLength(0); // empty the archive.\r
+ virginArchive = true;\r
+ }\r
+ this.openArchive(); // open archive\r
+ }\r
+\r
+ /**\r
+ * open original archive file for exclusive (locked) reading.\r
+ * \r
+ * @throws IOException\r
+ */\r
+ private void accessOriginal() throws IOException {\r
+ if (original != null && original.exists()) {\r
+ if (odoclock == null)\r
+ odoclock = new SessionFile(original);\r
+ odoclock.lockFile();\r
+ if (odoc == null)\r
+ odoc = new VamsasArchiveReader(original);\r
+ // this constructor is not implemented yet odoc = new\r
+ // VamsasArchiveReader(odoclock.fileLock);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Add unique entry strings to internal JarEntries list.\r
+ * \r
+ * @param entry\r
+ * @return true if entry was unique and was added.\r
+ */\r
+ private boolean addEntry(String entry) {\r
+ if (entries == null)\r
+ entries = new Hashtable();\r
+ if (log.isDebugEnabled()) {\r
+ log.debug("validating '" + entry + "' in hash for " + this);\r
+ }\r
+ if (entries.containsKey(entry))\r
+ return false;\r
+ entries.put(entry, new Integer(entries.size()));\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * adds named entry to newarchive or returns false.\r
+ * \r
+ * @param entry\r
+ * @return true if entry was unique and could be added\r
+ * @throws IOException\r
+ * if entry name was invalid or a new entry could not be made on\r
+ * newarchive\r
+ */\r
+ private boolean addValidEntry(String entry) throws IOException {\r
+ org.apache.tools.zip.ZipEntry je = new org.apache.tools.zip.ZipEntry(entry);\r
+ // je.setExsetExtra(null);\r
+ if (!addEntry(entry))\r
+ return false;\r
+ newarchive.flush();\r
+ newarchive.putNextEntry(je);\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * called by app to get name of backup if it was made. If this is called, the\r
+ * caller app *must* delete the backup themselves.\r
+ * \r
+ * @return null or a valid file object\r
+ */\r
+ public File backupFile() {\r
+\r
+ if (!virginArchive) {\r
+ makeBackup();\r
+ donotdeletebackup = true; // external reference has been made.\r
+ return ((original != null) ? originalBackup : null);\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Stops any current write to archive, and reverts to the backup if it exists.\r
+ * All existing locks on the original will be released. All backup files are\r
+ * removed.\r
+ */\r
+ public boolean cancelArchive() {\r
+ if (newarchive != null) {\r
+ try {\r
+ newarchive.closeEntry();\r
+ newarchive.putNextEntry(new org.apache.tools.zip.ZipEntry("deleted"));\r
+ newarchive.closeEntry();\r
+ newarchive.close();\r
+\r
+ } catch (Exception e) {\r
+ log.debug("Whilst closing newarchive", e);\r
+ }\r
+ ;\r
+ if (!virginArchive) {\r
+ // then there is something to recover.\r
+ try {\r
+ recoverBackup();\r
+ } catch (Exception e) {\r
+ log.warn("Problems when trying to cancel Archive "\r
+ + archive.getAbsolutePath(), e);\r
+ return false;\r
+ }\r
+ }\r
+\r
+ } else {\r
+ log.warn("Client Error: cancelArchive called before archive("\r
+ + original.getAbsolutePath() + ") has been opened!");\r
+ }\r
+ closeAndReset(); // tidy up and release locks.\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * only do this if you want to destroy the current file output stream\r
+ * \r
+ */\r
+ private void closeAndReset() {\r
+ if (rchive != null) {\r
+ rchive.unlockFile();\r
+ rchive = null;\r
+ }\r
+ if (original != null) {\r
+ if (odoc != null) {\r
+ odoc.close();\r
+ odoc = null;\r
+ }\r
+ if (archive != null)\r
+ archive.delete();\r
+ if (odoclock != null) {\r
+ odoclock.unlockFile();\r
+ odoclock = null;\r
+ }\r
+ }\r
+ removeBackup();\r
+ newarchive = null;\r
+ original = null;\r
+ entries = null;\r
+ }\r
+\r
+ /**\r
+ * Tidies up and closes archive, removing any backups that were created. NOTE:\r
+ * It is up to the caller to delete the original archive backup obtained from\r
+ * backupFile() TODO: ensure all extant AppDataReference jar entries are\r
+ * transferred to new Jar TODO: provide convenient mechanism for generating\r
+ * new unique AppDataReferences and adding them to the document\r
+ */\r
+ public void closeArchive() throws IOException {\r
+ if (newarchive != null) {\r
+ newarchive.flush();\r
+ newarchive.closeEntry();\r
+ if (!isDocumentWritten())\r
+ log.warn("Premature closure of archive '" + archive.getAbsolutePath()\r
+ + "': No document has been written.");\r
+ newarchive.finish();// close(); // use newarchive.finish(); for a stream\r
+ // IO\r
+ newarchive.flush();\r
+ //\r
+ updateOriginal();\r
+ closeAndReset();\r
+ } else {\r
+ log\r
+ .warn("Attempt to close archive that has not been opened for writing.");\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Opens and returns the applicationData output stream for the\r
+ * appdataReference string.\r
+ * \r
+ * @param appdataReference\r
+ * @return Output stream to write to\r
+ * @throws IOException\r
+ */\r
+ public AppDataOutputStream getAppDataStream(String appdataReference)\r
+ throws IOException {\r
+ if (newarchive == null)\r
+ throw new IOException("Attempt to write to closed VamsasArchive object.");\r
+ if (addValidEntry(appdataReference)) {\r
+ return new AppDataOutputStream(newarchive);\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return JarEntry name for the vamsas XML stream in this archive\r
+ */\r
+ protected String getDocumentJarEntry() {\r
+ if (vamsasdocument)\r
+ return VamsasArchiveReader.VAMSASDOC;\r
+ return VamsasArchiveReader.VAMSASXML;\r
+ }\r
+\r
+ /**\r
+ * Safely initializes the VAMSAS XML document Jar Entry.\r
+ * \r
+ * @return Writer to pass to the marshalling function.\r
+ * @throws IOException\r
+ * if a document entry has already been written.\r
+ */\r
+ public PrintWriter getDocumentOutputStream() throws IOException {\r
+ if (newarchive == null)\r
+ openArchive();\r
+ if (!isDocumentWritten()) {\r
+ try {\r
+ if (addValidEntry(getDocumentJarEntry()))\r
+ return new PrintWriter(new java.io.OutputStreamWriter(newarchive,\r
+ "UTF-8"));\r
+ } catch (Exception e) {\r
+ log.warn("Problems opening XML document JarEntry stream", e);\r
+ }\r
+ } else {\r
+ throw new IOException("Vamsas Document output stream is already written.");\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Access original archive if it exists, pass the reader to the client Note:\r
+ * this is NOT thread safe and a call to closeArchive() will by necessity\r
+ * close and invalidate the VamsasArchiveReader object.\r
+ * \r
+ * @return null if no original archive exists.\r
+ */\r
+ public VamsasArchiveReader getOriginalArchiveReader() throws IOException {\r
+ if (!virginArchive) {\r
+ accessOriginal();\r
+ return odoc;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * returns original document's root vamsas elements.\r
+ * \r
+ * @return\r
+ * @throws IOException\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ */\r
+ public Vobject[] getOriginalRoots() throws IOException,\r
+ org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return VamsasArchive.getOriginalRoots(this);\r
+ }\r
+\r
+ /**\r
+ * @return original document or a new empty document (with default provenance)\r
+ * @throws IOException\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ */\r
+ public VamsasDocument getVamsasDocument() throws IOException,\r
+ org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return getVamsasDocument("org.vamsas.simpleclient.VamsasArchive",\r
+ "Created new empty document", null);\r
+ }\r
+\r
+ /**\r
+ * Return the original document or a new empty document with initial\r
+ * provenance entry.\r
+ * \r
+ * @param provenance_user\r
+ * (null sets user to be the class name)\r
+ * @param provenance_action\r
+ * (null sets action to be 'created new document')\r
+ * @param version\r
+ * (null means use latest version)\r
+ * @return (original document or a new vamsas document with supplied\r
+ * provenance and version info)\r
+ * @throws IOException\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ */\r
+ public VamsasDocument getVamsasDocument(String provenance_user,\r
+ String provenance_action, String version) throws IOException,\r
+ org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ if (_doc != null)\r
+ return _doc;\r
+ _doc = getOriginalVamsasDocument(this, getVorba());\r
+ if (_doc != null)\r
+ return _doc;\r
+ // validate parameters\r
+ if (provenance_user == null)\r
+ provenance_user = "org.vamsas.simpleclient.VamsasArchive";\r
+ if (provenance_action == null)\r
+ provenance_action = "Created new empty document";\r
+ if (version == null)\r
+ version = VersionEntries.latestVersion();\r
+ // Create a new document and return it\r
+ _doc = DocumentStuff.newVamsasDocument(new VAMSAS[] { new VAMSAS() },\r
+ ProvenanceStuff.newProvenance(provenance_user, provenance_action),\r
+ version);\r
+ return _doc;\r
+ }\r
+\r
+ /**\r
+ * @return Returns the current VorbaIdFactory for the archive.\r
+ */\r
+ public VorbaIdFactory getVorba() {\r
+ if (vorba == null)\r
+ vorba = new SimpleDocument("simpleclient.VamsasArchive");\r
+ return vorba.getVorba();\r
+ }\r
+\r
+ /**\r
+ * @return true if Vamsas Document has been written to archive\r
+ */\r
+ protected boolean isDocumentWritten() {\r
+ if (newarchive == null)\r
+ log.warn("isDocumentWritten() called for unopened archive.");\r
+ if (entries != null) {\r
+ if (entries.containsKey(getDocumentJarEntry()))\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ private void makeBackup() {\r
+ if (!virginArchive) {\r
+ if (originalBackup == null && original != null && original.exists()) {\r
+ try {\r
+ accessOriginal();\r
+ originalBackup = odoclock.backupSessionFile(null, original.getName(),\r
+ ".bak", original.getParentFile());\r
+ } catch (IOException e) {\r
+ log.warn("Problem whilst making a backup of original archive.", e);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * opens the new archive ready for writing. If the new archive is replacing an\r
+ * existing one, then the existing archive will be locked, and the new archive\r
+ * written to a temporary file. The new archive will be put in place once\r
+ * close() is called.\r
+ * \r
+ * @param doclock\r
+ * LATER - pass existing lock on document, if it exists.... no need\r
+ * yet?\r
+ * @throws IOException\r
+ */\r
+ private void openArchive() throws IOException {\r
+\r
+ if (newarchive != null) {\r
+ log.warn("openArchive() called multiple times.");\r
+ throw new IOException("Vamsas Archive '" + archive.getAbsolutePath()\r
+ + "' is already open.");\r
+ }\r
+ if (archive == null && (virginArchive || original == null)) {\r
+ log.warn("openArchive called on uninitialised VamsasArchive object.");\r
+ throw new IOException(\r
+ "Badly initialised VamsasArchive object - no archive file specified.");\r
+ }\r
+ if (!virginArchive) {\r
+ // lock the original\r
+ accessOriginal();\r
+ // make a temporary file to write to\r
+ archive = File.createTempFile(original.getName(), ".new", original\r
+ .getParentFile());\r
+ } else {\r
+ if (archive.exists())\r
+ log\r
+ .warn("New archive file name already in use! Possible lock failure imminent?");\r
+ }\r
+\r
+ if (rchive == null)\r
+ rchive = new SessionFile(archive);\r
+ if (!rchive.lockFile())\r
+ throw new IOException("Failed to get lock on file " + archive);\r
+ // LATER: locked IO stream based access.\r
+ // Manifest newmanifest = new Manifest();\r
+ newarchive = new org.apache.tools.zip.ZipOutputStream(rchive.fileLock\r
+ .getBufferedOutputStream(true));// , newmanifest);\r
+ // newarchive = new JarOutputStream(new BufferedOutputStream(new\r
+ // java.io.FileOutputStream(archive)));\r
+ entries = new Hashtable();\r
+ }\r
+\r
+ public void putVamsasDocument(VamsasDocument doc) throws IOException,\r
+ org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ putVamsasDocument(doc, getVorba());\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @param doc\r
+ * @param vorba\r
+ * @return (vorbaId string, Vobjhash) pairs for last hash of each object in\r
+ * document\r
+ * @throws IOException\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ */\r
+ public void putVamsasDocument(VamsasDocument doc, VorbaIdFactory vorba)\r
+ throws IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ if (vamsasdocument)\r
+ doc.setVersion(VersionEntries.latestVersion()); // LATER: ensure this does\r
+ // the correct thing.\r
+ VorbaXmlBinder.putVamsasDocument(getDocumentOutputStream(), vorba, doc);\r
+ }\r
+\r
+ /**\r
+ * recovers the original file's contents from the (temporary) backup.\r
+ * \r
+ * @throws Exception\r
+ * if any SessionFile or file removal operations fail.\r
+ */\r
+ private void recoverBackup() throws Exception {\r
+ if (originalBackup != null) {\r
+ // backup has been made.\r
+ // revert from backup and delete it (changing backup filename)\r
+ if (rchive == null) {\r
+ rchive = new SessionFile(original);\r
+ }\r
+ SessionFile bckup = new SessionFile(originalBackup);\r
+\r
+ rchive.updateFrom(null, bckup); // recover from backup file.\r
+ bckup.unlockFile();\r
+ bckup = null;\r
+ removeBackup();\r
+ }\r
+ }\r
+\r
+ /**\r
+ * forget about any backup that was made - removing it first if it was only\r
+ * temporary.\r
+ */\r
+ private void removeBackup() {\r
+ if (originalBackup != null) {\r
+ log.debug("Removing backup in " + originalBackup.getAbsolutePath());\r
+ if (!donotdeletebackup)\r
+ if (!originalBackup.delete())\r
+ log.info("VamsasArchive couldn't remove temporary backup "\r
+ + originalBackup.getAbsolutePath());\r
+ originalBackup = null;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * @param vorba\r
+ * the VorbaIdFactory to use for accessing vamsas objects.\r
+ */\r
+ public void setVorba(VorbaIdFactory Vorba) {\r
+ if (Vorba != null) {\r
+ if (vorba == null)\r
+ vorba = new SimpleDocument(Vorba);\r
+ else\r
+ vorba.setVorba(Vorba);\r
+ } else\r
+ getVorba();\r
+ }\r
+\r
+ /**\r
+ * Convenience method to copy over the referred entry from the backup to the\r
+ * new version. Warning messages are raised if no backup exists or the entry\r
+ * doesn't exist in the backed-up original. Duplicate writes return true - but\r
+ * a warning message will also be raised.\r
+ * \r
+ * @param AppDataReference\r
+ * @return true if AppDataReference now exists in the new document\r
+ * @throws IOException\r
+ */\r
+ public boolean transferAppDataEntry(String AppDataReference)\r
+ throws IOException {\r
+ return transferAppDataEntry(AppDataReference, AppDataReference);\r
+ }\r
+\r
+ /**\r
+ * Validates the AppDataReference: not null and not already written to\r
+ * archive.\r
+ * \r
+ * @param AppDataReference\r
+ * @return true if valid. false if not\r
+ * @throws IOException\r
+ * for really broken references!\r
+ */\r
+ protected boolean _validNewAppDataReference(String newAppDataReference)\r
+ throws IOException {\r
+ // LATER: Specify valid AppDataReference form in all VamsasArchive handlers\r
+ if (newAppDataReference == null)\r
+ throw new IOException("null newAppDataReference!");\r
+ if (entries.containsKey(newAppDataReference)) {\r
+ log.warn("Attempt to write '" + newAppDataReference\r
+ + "' twice! - IGNORED");\r
+ // LATER: fix me? warning message should raise an exception here.\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * Transfers an AppDataReference from old to new vamsas archive, with a name\r
+ * change.\r
+ * \r
+ * @see transferAppDataEntry(String AppDataReference)\r
+ * @param AppDataReference\r
+ * @param NewAppDataReference\r
+ * - AppDataReference in new Archive\r
+ * @return\r
+ * @throws IOException\r
+ */\r
+ public boolean transferAppDataEntry(String AppDataReference,\r
+ String NewAppDataReference) throws IOException {\r
+ if (original == null || !original.exists()) {\r
+ log.warn("No backup archive exists.");\r
+ return false;\r
+ }\r
+ if (AppDataReference == null)\r
+ throw new IOException("null AppDataReference!");\r
+\r
+ if (!_validNewAppDataReference(NewAppDataReference))\r
+ return false;\r
+\r
+ accessOriginal();\r
+\r
+ java.io.InputStream adstream = odoc.getAppdataStream(AppDataReference);\r
+\r
+ if (adstream == null) {\r
+ log.warn("AppDataReference '" + AppDataReference\r
+ + "' doesn't exist in backup archive.");\r
+ return false;\r
+ }\r
+\r
+ java.io.OutputStream adout = getAppDataStream(NewAppDataReference);\r
+ // copy over the bytes\r
+ int written = -1;\r
+ long count = 0;\r
+ byte[] buffer = new byte[_TRANSFER_BUFFER]; // conservative estimate of a\r
+ // sensible buffer\r
+ do {\r
+ if ((written = adstream.read(buffer)) > -1) {\r
+ adout.write(buffer, 0, written);\r
+ log.debug("Transferring " + written + ".");\r
+ count += written;\r
+ }\r
+ } while (written > -1);\r
+ log.debug("Sucessfully transferred AppData for '" + AppDataReference\r
+ + "' as '" + NewAppDataReference + "' (" + count + " bytes)");\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * write data from a stream into an appData reference.\r
+ * \r
+ * @param AppDataReference\r
+ * - New AppDataReference not already written to archive\r
+ * @param adstream\r
+ * Source of data for appData reference - read until .read(buffer)\r
+ * returns -1\r
+ * @return true on success.\r
+ * @throws IOException\r
+ * for file IO or invalid AppDataReference string\r
+ */\r
+ public boolean writeAppdataFromStream(String AppDataReference,\r
+ java.io.InputStream adstream) throws IOException {\r
+ if (!_validNewAppDataReference(AppDataReference)) {\r
+ log.warn("Invalid AppDataReference passed to writeAppdataFromStream");\r
+ throw new IOException(\r
+ "Invalid AppDataReference! (null, or maybe non-unique)!");\r
+ }\r
+\r
+ if (AppDataReference == null) {\r
+ log.warn("null appdata passed.");\r
+ throw new IOException("Null AppDataReference");\r
+ }\r
+\r
+ java.io.OutputStream adout = getAppDataStream(AppDataReference);\r
+ // copy over the bytes\r
+ int written = -1;\r
+ long count = 0;\r
+ byte[] buffer = new byte[_TRANSFER_BUFFER]; // conservative estimate of a\r
+ // sensible buffer\r
+ do {\r
+ if ((written = adstream.read(buffer)) > -1) {\r
+ adout.write(buffer, 0, written);\r
+ log.debug("Transferring " + written + ".");\r
+ count += written;\r
+ }\r
+ } while (written > -1);\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * transfers any AppDataReferences existing in the old document that haven't\r
+ * already been transferred to the new one LATER: do the same for transfers\r
+ * requiring a namechange - more document dependent.\r
+ * \r
+ * @return true if data was transferred.\r
+ */\r
+ public boolean transferRemainingAppDatas() throws IOException {\r
+ boolean transfered = false;\r
+ if (original == null || !original.exists()) {\r
+ log.warn("No backup archive exists.");\r
+ return false;\r
+ }\r
+ accessOriginal();\r
+\r
+ if (getVorba() != null) {\r
+ Vector originalRefs = null;\r
+ try {\r
+ originalRefs = vorba.getReferencedEntries(getVamsasDocument(),\r
+ getOriginalArchiveReader());\r
+ } catch (Exception e) {\r
+ log.warn("Problems accessing original document entries!", e);\r
+ }\r
+ if (originalRefs != null) {\r
+ Iterator ref = originalRefs.iterator();\r
+ while (ref.hasNext()) {\r
+ String oldentry = (String) ref.next();\r
+ if (oldentry != null && !entries.containsKey(oldentry)) {\r
+ log.debug("Transferring remaining entry '" + oldentry + "'");\r
+ transfered |= transferAppDataEntry(oldentry);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return transfered;\r
+ }\r
+\r
+ /**\r
+ * called after archive is written to put file in its final place\r
+ */\r
+ private void updateOriginal() {\r
+ if (!virginArchive) {\r
+ // make sure original document really is backed up and then overwrite it.\r
+ if (odoc != null) {\r
+ // try to shut the odoc reader.\r
+ odoc.close();\r
+ odoc = null;\r
+ }\r
+ // Make a backup if it isn't done already\r
+ makeBackup();\r
+ try {\r
+ // copy new Archive data that was writen to a temporary file\r
+ odoclock.updateFrom(null, rchive);\r
+ } catch (IOException e) {\r
+ // LATER: decide if leaving nastily named backup files around is\r
+ // necessary.\r
+ File backupFile = backupFile();\r
+ if (backupFile != null)\r
+ log.error(\r
+ "Problem updating archive from temporary file! - backup left in '"\r
+ + backupFile().getAbsolutePath() + "'", e);\r
+ else\r
+ log\r
+ .error(\r
+ "Problems updating, and failed to even make a backup file. Ooops!",\r
+ e);\r
+ }\r
+ // Tidy up if necessary.\r
+ removeBackup();\r
+ } else {\r
+\r
+ }\r
+ }\r
+}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.RandomAccessFile;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-import org.apache.tools.zip.*;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.AppDataInputStream;
-import uk.ac.vamsas.objects.utils.document.VersionEntries;
-/**
- * Basic methods for accessing an existing Vamsas Archive,
- * and Jar entry names for creating new vamsas archives.
- *
- * @author jimp
- *
- */
-public class VamsasArchiveReader {
- private static final int JARFILE_OPEN_RETRIES = 50;
- private static final int JARFILE_OPEN_RETRYWAIT = 1;
- private static Log log = LogFactory.getLog(VamsasArchiveReader.class);
- ZipFile jfile=null;
- String jfileName="randomAccessFile";
- boolean stream=false; // true if we are seeking on the stream.
- RandomAccessFile rfile;
- // ZipInputStream jstream=null;
- Hashtable strmentries = null;
- private void streamInit() {
- //throw new Error("VamsasArchiveReader(Stream) Not implemented!");
- if (!stream) {
- log.debug("Skipping init for Jar Stream input.");
- return;
- } else {
- throw new Error("Implementation error - we don't do streams - only files or RA files");
- }
- /*strmentries = new Hashtable();
- log.debug("Jar Stream input Initialisation");
- try {
- rfile.seek(0);
- // no buffering - we need to be able to move around the random access stream.
- jstream = new ZipInputStream(new FileInputStream(rfile.getFD())); // no manifest (probably)
- if (jstream.available()==0)
- log.warn("Can't read from JarInputStream (Locked stream!)");
- ZipEntry entry=null;
- long pos=0;
- do {
- if ((entry=jstream.getNextEntry())!=null) {
- if (strmentries.containsKey(entry.getName())) {
- log.info("Only recording last of duplicate entries '"+entry.getName()+"'");
- }
- strmentries.put(entry.getName(), new Long(pos++));
- jstream.closeEntry();
- }
- } while (entry!=null);
- }
- catch (Exception e) {
- log.warn("Exceptions during init!",e);
- jstream=null;
- } */
- }
-
- public VamsasArchiveReader(File vamsasfile) {
- jfile=null;
- int retries=JARFILE_OPEN_RETRIES;
- Exception ex=null;
- if (vamsasfile.exists()) {
- while (jfile==null && --retries>0)
- {
- try {
- jfile=new ZipFile(vamsasfile);
- jfileName = vamsasfile.toString();
- }
- catch (Exception e) {
- ex = e;
- jfile=null;
- try {
- Thread.sleep(JARFILE_OPEN_RETRYWAIT);
- } catch (Exception w) {};
- }
- }
- if (jfile==null && ex!=null)
- {
- log.debug("non-serious? Exceptions when opening JarFile at "+vamsasfile,ex);
- }
- }
- }
- /**
- * in an ideal world - this constructor will create a reader object
- * for the locked file's random access stream.
- *
- * @param vamsaslock
- */
- public VamsasArchiveReader(Lock vamsaslock) {
- jfile = null;
- if (vamsaslock==null || !vamsaslock.isLocked())
- throw new Error("IMPLEMENTATION ERROR: Cannot create a VamsasArchiveReader without a valid lock.");
- // throw new Error("VamsasArchiveReading from locked IO stream not yet implemented.");
- try {
- rfile = vamsaslock.getRaFile();
- jfile = new ZipFile(rfile);
- if (vamsaslock.target!=null)
- jfileName = vamsaslock.target.toString();
- } catch (Exception e) {
- rfile = null;
- jfile = null;
- log.warn("Unexpected IO Exception when accessing locked vamsas archive stream "+vamsaslock.target,e);
- }
- /*stream = true;
- streamInit();
- if (jstream==null)
- throw new Error("Failed to open archive from Locked random access stream.");
- */
- }
-
- /**
- * the vamsas document version(s) handled by this Reader
- */
- final public static String DOCUMENT_VERSION=VersionEntries.BETA_VERSION;
- /**
- * name of the jarEntry containing a well formatted vamsas XML Document
- */
-
- final public static String VAMSASDOC="vamsasDocument.xml";
-
- /**
- * name of the jarEntry containing a root VAMSAS element, and containing a
- * random sequence of VAMSAS DataSet elements
- */
-
- final public static String VAMSASXML="vamsas.xml";
- /**
- * seeks jstream to the given entry name and reads it.
- * @param entryname
- * @return
- private JarEntry seekEntry(String entryname) {
- if (jstream==null)
- return null;
- if (!strmentries.containsKey(entryname))
- return null;
- Long entrypos = (Long) strmentries.get(entryname);
- if (entrypos==null) {
- log.error("Null entry position for "+entryname);
- return null;
- }
- try {
- jstream=null;
- rfile.seek(0);
- jstream = new ZipInputStream(new FileInputStream(rfile.getFD()));
- ZipEntry entry = null;
- long epos = entrypos.longValue();
- do {
- entry = jstream.getNextEntry();
- } while (entry!=null && --epos>=0);
- // rfile.seek(entrypos.longValue());
- // make a Jar entry from a zip entry.
- return new JarEntry(entry);
- }
- catch (Exception e) {
- log.warn("Whilst seeking for "+entryname, e);
- }
- return null;
- }
- */
- /**
- *
- * @return JarEntry for VamsasArchiveReader.VAMSASDOC
- */
- protected ZipEntry getVamsasDocumentEntry() {
- return getJarEntry(VAMSASDOC);
- }
- /**
- *
- * @return JarEntry for VamsasArchiveReader.VAMSASXML
- */
- protected ZipEntry getVamsasXmlEntry() {
- return getJarEntry(VAMSASXML);
- }
- /**
- * Test for valid vamsas document archive
- * @return true if getVamsasDocumentStream will return a stream likely to contain valid XML
- */
- public boolean isValid() {
- // TODO: check if VAMSASDOC is well formed (follows www.vamsas.ac.uk/schemas/vamsasDocument.xsd) and all appData references are resolvable - preferably as jar entries
- if (jfile!=null) // || jstream!=null)
- return (getVamsasDocumentEntry()!=null);
- return false;
- }
-
-
- protected ZipEntry getAppdataEntry(String AppdataRef) {
- ZipEntry entry;
- if (jfile==null || !isValid() || (entry=getJarEntry(AppdataRef))==null)
- return null;
-
- return entry;
- }
-
- public InputStream getAppdataStream(String AppdataRef) {
- ZipEntry entry=getAppdataEntry(AppdataRef);
- try {
- if (entry!=null)
- return getInputStream(entry);
- } catch (IOException e) {
- log.error("Failed when opening AppdataStream for "+AppdataRef, e);
- }
- return null;
- }
- /**
- * get the VamsasDocument input stream, if it exists.
- * @return null or valid input stream
- */
- public InputStream getVamsasDocumentStream() {
- InputStream vdoc;
- if (jfile==null || !isValid())
- return null;
- try {
- vdoc = getInputStream(getVamsasDocumentEntry());
- } catch (IOException e) {
- log.error("Whilst geting document stream",e);
- vdoc=null;
- }
- return vdoc;
- }
-
- /**
- * get the VamsasXML input stream, if it exists.
- * Note: Deprecated beyond our prealpha testing.
- * @return null or valid input stream.
- */
-
- public InputStream getVamsasXmlStream() {
- // log.warn("Deprecated call");
- ZipEntry xmle=getVamsasXmlEntry();
- InputStream vdoc;
- if (xmle==null)
- return null;
- try {
- vdoc = getInputStream(xmle);
- } catch (IOException e) {
- log.error("Whilst getting VamsasXmlStream",e);
- vdoc=null;
- }
- return vdoc;
- }
-
- /**
- * silently close the jar file.
- *
- */
- public void close() {
- if (jfile!=null) {
- try {
- jfile.close();
- rfile=null;
- }
- catch (Exception e) {
- log.error("Whilst closing JarFile "+jfileName, e);
- }
- }
- }
-
- /**
- * returns all entries not matching the filespec of a vamsas xml entry
- * @return array of entries.
- */
- public Vector getExtraEntries() {
- if (jfile==null || !isValid())
- return null;
- Vector e = new Vector();
- /*if (jstream!=null) {
- Enumeration entries = strmentries.keys();
- if (entries!=null && entries.hasMoreElements()) {
- do {
- JarEntry el = (JarEntry) entries.nextElement();
- if (!el.getName().equals(VAMSASDOC) && !el.getName().equals(VAMSASXML))
- e.add(new String(el.getName())); // avoid references
- } while (entries.hasMoreElements());
- }
- } else */
- Enumeration entries = jfile.getEntries();
- if (entries!=null && entries.hasMoreElements()) {
- do {
- ZipEntry el = (ZipEntry) entries.nextElement();
- if (!el.getName().equals(VAMSASDOC) && !el.getName().equals(VAMSASXML))
- e.add(new String(el.getName())); // avoid references
- } while (entries.hasMoreElements());
- }
- return e;
- }
-
- /* (non-Javadoc)
- * @see java.util.jar.JarFile#getInputStream(java.util.zip.ZipEntry)
- */
- private InputStream getInputStream(ZipEntry ze) throws IOException {
- if (jfile!=null)
- return jfile.getInputStream(ze);
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.util.jar.JarFile#getJarEntry(java.lang.String)
- */
- private ZipEntry getJarEntry(String name) {
- if (jfile!=null)
- return jfile.getEntry(name);
- return null;
- }
- }
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.BufferedInputStream;\r
+import java.io.FileInputStream;\r
+import java.io.RandomAccessFile;\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+import java.util.Iterator;\r
+import java.util.Vector;\r
+import org.apache.tools.zip.*;\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.AppDataInputStream;\r
+import uk.ac.vamsas.objects.utils.document.VersionEntries;\r
+\r
+/**\r
+ * Basic methods for accessing an existing Vamsas Archive, and Jar entry names\r
+ * for creating new vamsas archives.\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class VamsasArchiveReader {\r
+ private static final int JARFILE_OPEN_RETRIES = 50;\r
+\r
+ private static final int JARFILE_OPEN_RETRYWAIT = 1;\r
+\r
+ private static Log log = LogFactory.getLog(VamsasArchiveReader.class);\r
+\r
+ ZipFile jfile = null;\r
+\r
+ String jfileName = "randomAccessFile";\r
+\r
+ boolean stream = false; // true if we are seeking on the stream.\r
+\r
+ RandomAccessFile rfile;\r
+\r
+ // ZipInputStream jstream=null;\r
+ Hashtable strmentries = null;\r
+\r
+ private void streamInit() {\r
+ // throw new Error("VamsasArchiveReader(Stream) Not implemented!");\r
+ if (!stream) {\r
+ log.debug("Skipping init for Jar Stream input.");\r
+ return;\r
+ } else {\r
+ throw new Error(\r
+ "Implementation error - we don't do streams - only files or RA files");\r
+ }\r
+ /*\r
+ * strmentries = new Hashtable();\r
+ * log.debug("Jar Stream input Initialisation"); try { rfile.seek(0); // no\r
+ * buffering - we need to be able to move around the random access stream.\r
+ * jstream = new ZipInputStream(new FileInputStream(rfile.getFD())); // no\r
+ * manifest (probably) if (jstream.available()==0)\r
+ * log.warn("Can't read from JarInputStream (Locked stream!)"); ZipEntry\r
+ * entry=null; long pos=0; do { if ((entry=jstream.getNextEntry())!=null) {\r
+ * if (strmentries.containsKey(entry.getName())) {\r
+ * log.info("Only recording last of duplicate entries '"\r
+ * +entry.getName()+"'"); } strmentries.put(entry.getName(), new\r
+ * Long(pos++)); jstream.closeEntry(); } } while (entry!=null); } catch\r
+ * (Exception e) { log.warn("Exceptions during init!",e); jstream=null; }\r
+ */\r
+ }\r
+\r
+ public VamsasArchiveReader(File vamsasfile) {\r
+ jfile = null;\r
+ int retries = JARFILE_OPEN_RETRIES;\r
+ Exception ex = null;\r
+ if (vamsasfile.exists()) {\r
+ while (jfile == null && --retries > 0) {\r
+ try {\r
+ jfile = new ZipFile(vamsasfile);\r
+ jfileName = vamsasfile.toString();\r
+ } catch (Exception e) {\r
+ ex = e;\r
+ jfile = null;\r
+ try {\r
+ Thread.sleep(JARFILE_OPEN_RETRYWAIT);\r
+ } catch (Exception w) {\r
+ }\r
+ ;\r
+ }\r
+ }\r
+ if (jfile == null && ex != null) {\r
+ log.debug("non-serious? Exceptions when opening JarFile at "\r
+ + vamsasfile, ex);\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * in an ideal world - this constructor will create a reader object for the\r
+ * locked file's random access stream.\r
+ * \r
+ * @param vamsaslock\r
+ */\r
+ public VamsasArchiveReader(Lock vamsaslock) {\r
+ jfile = null;\r
+ if (vamsaslock == null || !vamsaslock.isLocked())\r
+ throw new Error(\r
+ "IMPLEMENTATION ERROR: Cannot create a VamsasArchiveReader without a valid lock.");\r
+ // throw new\r
+ // Error("VamsasArchiveReading from locked IO stream not yet implemented.");\r
+ try {\r
+ rfile = vamsaslock.getRaFile();\r
+ jfile = new ZipFile(rfile);\r
+ if (vamsaslock.target != null)\r
+ jfileName = vamsaslock.target.toString();\r
+ } catch (Exception e) {\r
+ rfile = null;\r
+ jfile = null;\r
+ log.warn(\r
+ "Unexpected IO Exception when accessing locked vamsas archive stream "\r
+ + vamsaslock.target, e);\r
+ }\r
+ /*\r
+ * stream = true; streamInit(); if (jstream==null) throw new\r
+ * Error("Failed to open archive from Locked random access stream.");\r
+ */\r
+ }\r
+\r
+ /**\r
+ * the vamsas document version(s) handled by this Reader\r
+ */\r
+ final public static String DOCUMENT_VERSION = VersionEntries.BETA_VERSION;\r
+\r
+ /**\r
+ * name of the jarEntry containing a well formatted vamsas XML Document\r
+ */\r
+\r
+ final public static String VAMSASDOC = "vamsasDocument.xml";\r
+\r
+ /**\r
+ * name of the jarEntry containing a root VAMSAS element, and containing a\r
+ * random sequence of VAMSAS DataSet elements\r
+ */\r
+\r
+ final public static String VAMSASXML = "vamsas.xml";\r
+\r
+ /**\r
+ * seeks jstream to the given entry name and reads it.\r
+ * \r
+ * @param entryname\r
+ * @return private JarEntry seekEntry(String entryname) { if (jstream==null)\r
+ * return null; if (!strmentries.containsKey(entryname)) return null;\r
+ * Long entrypos = (Long) strmentries.get(entryname); if\r
+ * (entrypos==null) { log.error("Null entry position for "+entryname);\r
+ * return null; } try { jstream=null; rfile.seek(0); jstream = new\r
+ * ZipInputStream(new FileInputStream(rfile.getFD())); ZipEntry entry\r
+ * = null; long epos = entrypos.longValue(); do { entry =\r
+ * jstream.getNextEntry(); } while (entry!=null && --epos>=0); //\r
+ * rfile.seek(entrypos.longValue()); // make a Jar entry from a zip\r
+ * entry. return new JarEntry(entry); } catch (Exception e) {\r
+ * log.warn("Whilst seeking for "+entryname, e); } return null; }\r
+ */\r
+ /**\r
+ * \r
+ * @return JarEntry for VamsasArchiveReader.VAMSASDOC\r
+ */\r
+ protected ZipEntry getVamsasDocumentEntry() {\r
+ return getJarEntry(VAMSASDOC);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return JarEntry for VamsasArchiveReader.VAMSASXML\r
+ */\r
+ protected ZipEntry getVamsasXmlEntry() {\r
+ return getJarEntry(VAMSASXML);\r
+ }\r
+\r
+ /**\r
+ * Test for valid vamsas document archive\r
+ * \r
+ * @return true if getVamsasDocumentStream will return a stream likely to\r
+ * contain valid XML\r
+ */\r
+ public boolean isValid() {\r
+ // TODO: check if VAMSASDOC is well formed (follows\r
+ // www.vamsas.ac.uk/schemas/vamsasDocument.xsd) and all appData references\r
+ // are resolvable - preferably as jar entries\r
+ if (jfile != null) // || jstream!=null)\r
+ return (getVamsasDocumentEntry() != null);\r
+ return false;\r
+ }\r
+\r
+ protected ZipEntry getAppdataEntry(String AppdataRef) {\r
+ ZipEntry entry;\r
+ if (jfile == null || !isValid()\r
+ || (entry = getJarEntry(AppdataRef)) == null)\r
+ return null;\r
+\r
+ return entry;\r
+ }\r
+\r
+ public InputStream getAppdataStream(String AppdataRef) {\r
+ ZipEntry entry = getAppdataEntry(AppdataRef);\r
+ try {\r
+ if (entry != null)\r
+ return getInputStream(entry);\r
+ } catch (IOException e) {\r
+ log.error("Failed when opening AppdataStream for " + AppdataRef, e);\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * get the VamsasDocument input stream, if it exists.\r
+ * \r
+ * @return null or valid input stream\r
+ */\r
+ public InputStream getVamsasDocumentStream() {\r
+ InputStream vdoc;\r
+ if (jfile == null || !isValid())\r
+ return null;\r
+ try {\r
+ vdoc = getInputStream(getVamsasDocumentEntry());\r
+ } catch (IOException e) {\r
+ log.error("Whilst geting document stream", e);\r
+ vdoc = null;\r
+ }\r
+ return vdoc;\r
+ }\r
+\r
+ /**\r
+ * get the VamsasXML input stream, if it exists. Note: Deprecated beyond our\r
+ * prealpha testing.\r
+ * \r
+ * @return null or valid input stream.\r
+ */\r
+\r
+ public InputStream getVamsasXmlStream() {\r
+ // log.warn("Deprecated call");\r
+ ZipEntry xmle = getVamsasXmlEntry();\r
+ InputStream vdoc;\r
+ if (xmle == null)\r
+ return null;\r
+ try {\r
+ vdoc = getInputStream(xmle);\r
+ } catch (IOException e) {\r
+ log.error("Whilst getting VamsasXmlStream", e);\r
+ vdoc = null;\r
+ }\r
+ return vdoc;\r
+ }\r
+\r
+ /**\r
+ * silently close the jar file.\r
+ * \r
+ */\r
+ public void close() {\r
+ if (jfile != null) {\r
+ try {\r
+ jfile.close();\r
+ rfile = null;\r
+ } catch (Exception e) {\r
+ log.error("Whilst closing JarFile " + jfileName, e);\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * returns all entries not matching the filespec of a vamsas xml entry\r
+ * \r
+ * @return array of entries.\r
+ */\r
+ public Vector getExtraEntries() {\r
+ if (jfile == null || !isValid())\r
+ return null;\r
+ Vector e = new Vector();\r
+ /*\r
+ * if (jstream!=null) { Enumeration entries = strmentries.keys(); if\r
+ * (entries!=null && entries.hasMoreElements()) { do { JarEntry el =\r
+ * (JarEntry) entries.nextElement(); if (!el.getName().equals(VAMSASDOC) &&\r
+ * !el.getName().equals(VAMSASXML)) e.add(new String(el.getName())); //\r
+ * avoid references } while (entries.hasMoreElements()); } } else\r
+ */\r
+ Enumeration entries = jfile.getEntries();\r
+ if (entries != null && entries.hasMoreElements()) {\r
+ do {\r
+ ZipEntry el = (ZipEntry) entries.nextElement();\r
+ if (!el.getName().equals(VAMSASDOC) && !el.getName().equals(VAMSASXML))\r
+ e.add(new String(el.getName())); // avoid references\r
+ } while (entries.hasMoreElements());\r
+ }\r
+ return e;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.util.jar.JarFile#getInputStream(java.util.zip.ZipEntry)\r
+ */\r
+ private InputStream getInputStream(ZipEntry ze) throws IOException {\r
+ if (jfile != null)\r
+ return jfile.getInputStream(ze);\r
+ return null;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.util.jar.JarFile#getJarEntry(java.lang.String)\r
+ */\r
+ private ZipEntry getJarEntry(String name) {\r
+ if (jfile != null)\r
+ return jfile.getEntry(name);\r
+ return null;\r
+ }\r
+}\r
-
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
+ */
package uk.ac.vamsas.client.simpleclient;
import java.io.File;
import java.util.jar.JarOutputStream;
/**
- * low level vamsas document management routines
- * analogous to ClientsFile
- * Grew out of io tests on VamsasArchive class in uk.ac.vamsas.test.simpleclient.VamsasArchive
- * This class is not thread safe.
+ * low level vamsas document management routines analogous to ClientsFile Grew
+ * out of io tests on VamsasArchive class in
+ * uk.ac.vamsas.test.simpleclient.VamsasArchive This class is not thread safe.
+ *
* @author jimp
- *
+ *
*/
public class VamsasFile extends SessionFile {
/**
*
- * Connect to an existing Vamsas document in a given sessionDir
- * or create a new one.
+ * Connect to an existing Vamsas document in a given sessionDir or create a
+ * new one.
*
* @param sessionDir
* @throws java.io.IOException
public VamsasFile(File sessionFile) throws java.io.IOException {
super(sessionFile);
}
+
/**
*
* @return the VamsasFile
public File getVamsasFile() {
return sessionFile;
}
+
/**
* Expand a previously stored session into the sessionDir
+ *
* @param sessionDir
* @param storedSession
-
- public VamsasFile(File sessionDir, JarFile storedSession) throws IOException {
- // check if sessionDir is live or not
- if (!sessionDir.exists()) {
- sessionDir.mkdir();
- }
-
- {
- // check its actually a writable directory
- }
-
- File sfile = new File(sessionDir, "vamsas.jar");
- VamsasFile(sfile);
- // if live - try to merge storedSession with sessionDir
- // - will probably fail through duplicate Vobject references needing to be dereferenced.
- // TODO: think of a way of specifying vorba_id scope for an application's references to allow merging of one vamsasDocument with another.
-
- }
- */
+ * public VamsasFile(File sessionDir, JarFile storedSession) throws
+ * IOException { // check if sessionDir is live or not if
+ * (!sessionDir.exists()) { sessionDir.mkdir(); }
+ *
+ * { // check its actually a writable directory }
+ *
+ * File sfile = new File(sessionDir, "vamsas.jar");
+ * VamsasFile(sfile); // if live - try to merge storedSession with
+ * sessionDir // - will probably fail through duplicate Vobject
+ * references needing to be dereferenced. // TODO: think of a way of
+ * specifying vorba_id scope for an application's references to allow
+ * merging of one vamsasDocument with another.
+ *
+ * }
+ */
/**
- * public interface for getting a lock.
- * The lock object is internally referenced
- * so the lock will persist even after the
- * return value of the method goes out of scope.
+ * public interface for getting a lock. The lock object is internally
+ * referenced so the lock will persist even after the return value of the
+ * method goes out of scope.
+ *
* @return null if lock couldn't be got or a valid Lock object.
*/
public Lock getLock() {
return fileLock;
return null;
}
+
/**
*
* @param extantLock
return fileLock;
return null;
}
+
/**
- * explicitly unlocks vamsas file.
- * if you have called getLock() you *must*
+ * explicitly unlocks vamsas file. if you have called getLock() you *must*
* call this to release the lock.
*/
public void unLock() {
this.unlockFile();
}
-
+
}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
-\r
/**\r
- * Element of the VamsasFileWatcherThread event generator chain.\r
- * Keep a reference to this element before adding it to the chain \r
- * in order to control the generation of events with halt and enable.\r
+ * Element of the VamsasFileWatcherThread event generator chain. Keep a\r
+ * reference to this element before adding it to the chain in order to control\r
+ * the generation of events with halt and enable.\r
* \r
* doWatch will do nothing if the element is not enabled.\r
* \r
*/\r
public class VamsasFileWatcherElement extends WatcherElement {\r
- VamsasFile watched=null;\r
+ VamsasFile watched = null;\r
+\r
/**\r
* create a new, enabled watch element\r
- * @param watcher file being watched\r
- * @param handler handler to call on state change\r
+ * \r
+ * @param watcher\r
+ * file being watched\r
+ * @param handler\r
+ * handler to call on state change\r
*/\r
public VamsasFileWatcherElement(VamsasFile watcher, WatcherCallBack handler) {\r
this(watcher, handler, true);\r
}\r
+\r
protected void initWatch() {\r
- if (watched==null)\r
+ if (watched == null)\r
return;\r
watched.unLock(); // very very essential!\r
watcher = new FileWatcher(watched.getVamsasFile());\r
}\r
+\r
protected void endWatch() {\r
// leaves watcher in state its in.\r
}\r
+\r
/**\r
* new watcher with flag to initially skip watching this sessionfile\r
+ * \r
* @param watcher\r
* @param handler\r
* @param enableWatching\r
*/\r
- public VamsasFileWatcherElement(VamsasFile watcher, WatcherCallBack handler, boolean enableWatching) {\r
+ public VamsasFileWatcherElement(VamsasFile watcher, WatcherCallBack handler,\r
+ boolean enableWatching) {\r
super(handler);\r
this.watched = watcher;\r
if (enableWatching)\r
else\r
haltWatch();\r
}\r
+\r
/**\r
* @return the watched\r
*/\r
public VamsasFile getWatched() {\r
return watched;\r
}\r
+\r
protected String getSubject() {\r
return watched.getVamsasFile().toString();\r
}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
import java.util.Iterator;\r
import org.apache.commons.logging.LogFactory;\r
\r
/**\r
- * Watches a bunch of VamsasFile states, calling \r
- * the associated event handler when anything changes.\r
+ * Watches a bunch of VamsasFile states, calling the associated event handler\r
+ * when anything changes.\r
+ * \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class VamsasFileWatcherThread extends Thread {\r
- private Log log = LogFactory.getLog(VamsasFileWatcherThread.class); \r
- /* (non-Javadoc)\r
+ private Log log = LogFactory.getLog(VamsasFileWatcherThread.class);\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see java.lang.Thread#run()\r
*/\r
- EventGeneratorThread client=null;\r
- private Vector elements=null;\r
+ EventGeneratorThread client = null;\r
+\r
+ private Vector elements = null;\r
+\r
public VamsasFileWatcherThread(EventGeneratorThread client) {\r
this.client = client;\r
- elements=new Vector();\r
+ elements = new Vector();\r
}\r
+\r
public void addElement(WatcherElement welement) {\r
elements.addElement(welement);\r
}\r
+\r
public void removeElemenet(WatcherElement welement) {\r
elements.removeElement(welement);\r
}\r
+\r
public void clearElements() {\r
elements.clear();\r
}\r
+\r
/**\r
* true if the thread is running\r
*/\r
- boolean running=false;\r
+ boolean running = false;\r
+\r
/**\r
* true if the watcher loop is in progress\r
*/\r
- boolean watching=false;\r
+ boolean watching = false;\r
+\r
public void haltWatchers() {\r
if (!watching)\r
return;\r
- watching=false;\r
+ watching = false;\r
// wait arount for WATCH_SLEEP milliseconds before returning\r
// in the hope that the watcher loop has stopped\r
try {\r
interrupt();\r
- long time = System.currentTimeMillis()+WATCH_SLEEP;\r
- while (running && time>System.currentTimeMillis()) {\r
+ long time = System.currentTimeMillis() + WATCH_SLEEP;\r
+ while (running && time > System.currentTimeMillis()) {\r
Thread.sleep(1);\r
}\r
- } catch (Exception e) {};\r
+ } catch (Exception e) {\r
+ }\r
+ ;\r
if (running)\r
log.warn("haltWatchers returning whilst thread is still running.");\r
}\r
- \r
+\r
/**\r
* time between checks for changes of state on the file\r
*/\r
- public int WATCH_SLEEP=30; \r
+ public int WATCH_SLEEP = 30;\r
+\r
/**\r
- * check each watcher in sequence, monitoring any events generated.\r
- * Then wait WATCH_SLEEP milliseconds before checking all again (if there were no events)\r
+ * check each watcher in sequence, monitoring any events generated. Then wait\r
+ * WATCH_SLEEP milliseconds before checking all again (if there were no\r
+ * events)\r
*/\r
public void run() {\r
- running=true;\r
- watching=true;\r
+ running = true;\r
+ watching = true;\r
log.debug("Starting WatcherThread poll loop");\r
while (watching) {\r
- boolean wait=true;\r
- Iterator watchers=elements.iterator();\r
+ boolean wait = true;\r
+ Iterator watchers = elements.iterator();\r
while (watching && watchers.hasNext()) {\r
WatcherElement watch = (WatcherElement) watchers.next();\r
if (watch.doWatch()) {\r
- wait=false;\r
- log.debug("Event generated for watcher on "+watch.getWatcher().getSubject());\r
+ wait = false;\r
+ log.debug("Event generated for watcher on "\r
+ + watch.getWatcher().getSubject());\r
}\r
}\r
if (watching && wait) {\r
try {\r
Thread.sleep(WATCH_SLEEP);\r
+ } catch (InterruptedException e) {\r
}\r
- catch (InterruptedException e) {};\r
+ ;\r
}\r
}\r
log.debug("Finishing WatcherThread poll loop");\r
- running=false;\r
+ running = false;\r
}\r
- /* (non-Javadoc)\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see java.lang.Thread#interrupt()\r
*/\r
public void interrupt() {\r
- // TODO: make thread gracefully interrupt watchers so that any handlers finish doing what they were doing\r
+ // TODO: make thread gracefully interrupt watchers so that any handlers\r
+ // finish doing what they were doing\r
// super.interrupt();\r
}\r
- \r
+\r
}\r
-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileChannel;
-import java.nio.channels.OverlappingFileLockException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.log4j.FileAppender;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-
-import uk.ac.vamsas.client.ClientHandle;
-import uk.ac.vamsas.client.Events;
-import uk.ac.vamsas.client.IClient;
-import uk.ac.vamsas.client.SessionHandle;
-import uk.ac.vamsas.client.UserHandle;
-
-/**
- * Does all the IO operations for a SimpleClient instance accessing a
- * SimpleClient vamsas session.
- *
- * Basically, it defines the various standard names for the files in the session
- * directory (that maps to the sessionUrn), provides constructors for the file
- * handlers and watchers of those file entities, and some higher level methods
- * to check and change the state flags for the session.
- *
- * TODO: move the stuff below to the SimpleClientFactory documentation. much may
- * not be valid now : Vamsas client is intialised with a path to create live
- * session directories. This path may contain a vamsas.properties file that sets
- * additional parameters (otherwise client just uses the one on the classpath).
- *
- * A vamsas session consists of : SessionDir - translates to urn of a live
- * session. Contains: Vamsas Document (as a jar), Session client list file, both
- * of which may be locked, and additional temporary versions of these files when
- * write operations are taking place.
- *
- * Zip file entries - vamsasdocument.xml : core info one or more: -
- * <applicationname>.version.sessionnumber.raw (string given in
- * vamsasdocument.xml applicationData entry)
- *
- * Lockfile - filename given in the vamsasdocument.xml. Should be checked for
- * validity by any client and rewritten if necessary. The lockfile can point to
- * the jar itself. Mode of operation. Initially - documentHandler either: -
- * creates a zip for a new session for the client - connect to an existing
- * session zip 1. reads session urn file 2. waits for lock 3. examines session -
- * decide whether to create new application data slice or connect to one stored
- * in session. 4. writes info into session file 5. releases lock and generates
- * local client events. 6. Creates Watcher thread to generate events.
- *
- * During the session - Update watcher checks for file change -
- *
- * Procedures for file based session message exchange - session document
- * modification flag
- *
- */
-
-public class VamsasSession {
- /**
- * indicator file for informing other processes that they should finalise
- * their vamsas datasets for storing into a vamsas archive.
- */
- public static final String CLOSEANDSAVE_FILE = "stored.log";
-
- /**
- * session file storing the last_stored_stat data
- */
- public static final String MODIFIEDDOC_FILE = "modified";
-
- private SimpleSessionManager sessionManager = null;
-
- /**
- * Count of cycles before considering the current client as the last one of
- * the session (if no other client registered as active )
- */
- private final int watchCycleCountBeforeLastClient = 1220;
-
- /**
- * time between checking
- */
- public int WATCH_SLEEP = 30;
-
- protected String clientFileDirectory = "clients";
-
- /**
- * called to clear update flag after a successful offline storage event
- */
- protected void clearUnsavedFlag() {
- SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir,
- MODIFIEDDOC_FILE));
- if (!laststored.clearFlag())
- log.warn("Unsaved flag was not cleared for " + sessionDir);
- }
-
- /**
- * called to indicate session document has been modified.
- *
- */
- protected void setUnsavedFlag() {
- SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir,
- MODIFIEDDOC_FILE));
- if (!laststored.setFlag())
- log.warn("Couldn't set the Unsaved flag for " + sessionDir);
- }
-
- /**
- *
- * @return true if session document has been modified since last offline
- * storage event
- */
- protected boolean getUnsavedFlag() {
- SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir,
- MODIFIEDDOC_FILE));
- return laststored.checkFlag();
- }
-
- /**
- * log file location
- */
- public static final String SESSION_LOG = "Log.txt";
-
- private static Log log = LogFactory.getLog(VamsasSession.class);
-
- protected Logger slog = Logger.getLogger("uk.ac.vamsas.client.SessionLog");
-
- /**
- * the appender that writes to the log file inside the session's directory.
- */
- private FileAppender slogAppender = null;
-
- /**
- * setup the sessionLog using Log4j.
- *
- * @throws IOException
- */
- private void initLog() throws IOException {
- // TODO: fix session event logging
- // LATER: make dedicated appender format for session log.
- /*
- * Appender app = slog.getAppender("log4j.appender.SESSIONLOG"); //
- * slog.addAppender(new FileAppender(app.getLayout(), new File(sessionDir,
- * SESSION_LOG).getAbsolutePath())); // slog.addAppender(new
- * FileAppender(app.getLayout(), new File(sessionDir,
- * SESSION_LOG).getAbsolutePath())); for (Enumeration e =
- * slog.getAllAppenders() ; e.hasMoreElements() ;) {
- * System.out.println(e.nextElement());
- * }
- */
-
- if (slog != null) {
- File sessionLogFile = new File(this.sessionDir, SESSION_LOG);
- slog.addAppender(slogAppender = new FileAppender(new PatternLayout(
- "%-4r [%t] %-5p %c %x - %m%n"), sessionLogFile.getAbsolutePath(),
- true));
- } else {
- log.info("No appender for SessionLog");
- }
- }
-
- private void closeSessionLog() {
- if (slog != null) {
- if (slogAppender != null) {
- slog.removeAppender(slogAppender);
- slogAppender.close();
- slogAppender = null;
- }
- }
- }
-
- /**
- * the sessionDir is given as the session location for new clients.
- */
- protected File sessionDir;
-
- /**
- * holds the list of attached clients
- */
- ClientsFile clist;
-
- public static final String CLIENT_LIST = "Clients.obj";
-
- /**
- * holds the data
- */
- VamsasFile vamArchive;
-
- public static final String VAMSAS_OBJ = "VamDoc.jar";
-
- /**
- * sets up the vamsas session files and watchers in sessionDir1
- *
- * @param sessionDir1
- */
- protected VamsasSession(File sessionDir1) throws IOException {
- this(sessionDir1, null);
- }
-
- /**
- * sets up the vamsas session files and watchers in sessionDir1
- *
- * @param sessionDir1
- * @param extVamDoc
- * null or an existing archive to initialise the session with
- * @throws any
- * IOExceptions from creating session directory and files.
- * @throws error
- * if both extVamDoc and sessionDir1 already exist (cannot import
- * new data into session in this way)
- */
- protected VamsasSession(File sessionDir1, File extVamDoc) throws IOException {
- if (sessionDir1 == null)
- throw new Error("Null directory for VamsasSession.");
- if (!sessionDir1.exists() && !sessionDir1.mkdir()) {
- throw new IOException("Failed to make VamsasSession directory in "
- + sessionDir1);
- }
- if (!sessionDir1.isDirectory() || !sessionDir1.canWrite()
- || !sessionDir1.canRead()) {
- throw new IOException("Cannot access '" + sessionDir1
- + "' as a read/writable Directory.");
- }
- boolean existingSession=checkSessionFiles(sessionDir1);
- if (existingSession)
- {
- if (extVamDoc!=null) {
- throw new Error(
- "Client Initialisation Error: Cannot join an existing session directory with an existing vamsas document to import.");
- } else {
- log
- .debug("Joining an existing session.");
- }
- }
- this.sessionDir = sessionDir1;
- initSessionObjects();
- if (existingSession)
- { slog.debug("Initialising additional VamsasSession instance");
- } else
- {
- slog.debug("Founding client has joined VamsasSession instance");
- }
-
- log.debug("Attached to VamsasSession in " + sessionDir1);
- if (extVamDoc!=null)
- {
- setVamsasDocument(extVamDoc);
- }
- slog.debug("Session directory created.");
- log.debug("Initialised VamsasSession in " + sessionDir1);
- }
-
- /**
- * tests presence of existing sessionfiles files in dir
- *
- * @param dir
- * @return
- */
- private boolean checkSessionFiles(File dir) throws IOException {
- File c_file = new File(dir, CLIENT_LIST);
- File v_doc = new File(dir, VAMSAS_OBJ);
- if (c_file.exists() && v_doc.exists())
- return true;
- return false;
- }
-
- /**
- * create new empty files in dir
- *
- */
- private void createSessionFiles() throws IOException {
- if (sessionDir == null)
- throw new IOException(
- "Invalid call to createSessionFiles() with null sessionDir");
- File c_file = new File(sessionDir, CLIENT_LIST);
- File v_doc = new File(sessionDir, VAMSAS_OBJ);
- if (!c_file.exists() && c_file.createNewFile())
- log.debug("Created new ClientFile " + c_file); // don't care if this
- // works or not
- if (!v_doc.exists()) {
- if (v_doc.createNewFile()) {
- log.debug("Created new Vamsas Session Document File " + v_doc);
- } else {
- log.warn("Didn't create Vamsas Session Document file in " + v_doc);
- }
- }
- }
-
- /**
- * construct SessionFile objects and watchers for each
- */
- private void initSessionObjects() throws IOException {
- createSessionFiles();
- if (clist != null || vamArchive != null)
- throw new IOException(
- "initSessionObjects called for initialised VamsasSession object.");
- clist = new ClientsFile(new File(sessionDir, CLIENT_LIST));
- vamArchive = new VamsasFile(new File(sessionDir, VAMSAS_OBJ));
- storedocfile = new ClientsFile(new File(sessionDir, CLOSEANDSAVE_FILE));
- initLog();
- }
-
- /**
- * make a new watcher object for the clientFile
- *
- * @return new ClientFile watcher instance
- */
- public FileWatcher getClientWatcher() {
- return new FileWatcher(clist.sessionFile);
- }
-
- /**
- * make a new watcher object for the vamsas Document
- *
- * @return new ClientFile watcher instance
- */
- public FileWatcher getDocWatcher() {
- return new FileWatcher(vamArchive.sessionFile);
- }
-
- FileWatcher store_doc_file = null;
-
- public ClientsFile storedocfile = null;
-
- /**
- * make a new watcher object for the messages file
- *
- * @return new watcher instance
- */
- public FileWatcher getStoreWatcher() {
- return new FileWatcher(new File(sessionDir, CLOSEANDSAVE_FILE));
-
- }
-
- /**
- * write to the StoreWatcher file to indicate that a storeDocumentRequest has
- * been made. The local client's storeWatcher FileWatcher object is updated so
- * the initial change is not registered.
- *
- * @param client
- * @param user
- * @return
- */
- public void addStoreDocumentRequest(ClientHandle client, UserHandle user)
- throws IOException {
- // TODO: replace this with clientsFile mechanism
- SessionFile sfw = new SessionFile(new File(sessionDir, CLOSEANDSAVE_FILE));
- while (!sfw.lockFile())
- log.debug("Trying to get lock for " + CLOSEANDSAVE_FILE);
- RandomAccessFile sfwfile = sfw.fileLock.getRaFile();
- sfwfile.setLength(0); // wipe out any old info.
- // TODO: rationalise what gets written to this file (ie do we want other
- // clients to read the id of the requestor?)
- sfwfile.writeUTF(client.getClientUrn() + ":" + user.getFullName() + "@"
- + user.getOrganization());
- sfw.unlockFile();
- if (store_doc_file != null)
- store_doc_file.setState();
- slog.info("FinalizeAppData request from " + user.getFullName() + " using "
- + client.getClientUrn() + "");
- }
-
- /**
- * create a new session with an existing vamsas Document - by copying it into
- * the session.
- *
- * @param archive
- */
- public void setVamsasDocument(File archive) throws IOException {
- log.debug("Transferring vamsas data from " + archive + " to session:"
- + vamArchive.sessionFile);
- SessionFile xtantdoc = new SessionFile(archive);
- while (!vamArchive.lockFile())
- log.info("Trying to get lock for " + vamArchive.sessionFile);
- vamArchive.updateFrom(null, xtantdoc);
- xtantdoc.unlockFile();
- unlockVamsasDocument();
- // TODO: session archive provenance should be updated to reflect import from external source
- log.debug("Transfer complete.");
- }
-
- /**
- * write session as a new vamsas Document (this will overwrite any existing
- * file without warning) TODO: test TODO: verify that lock should be released
- * for vamsas document.
- *
- * @param destarchive
- */
- protected void writeVamsasDocument(File destarchive, Lock extlock)
- throws IOException {
- log.debug("Transferring vamsas data from " + vamArchive.sessionFile
- + " to session:" + destarchive);
- SessionFile newdoc = new SessionFile(destarchive);
- if (extlock == null && !vamArchive.lockFile())
- while (!vamArchive.lockFile())
- log.info("Trying to get lock for " + vamArchive.sessionFile);
- // TODO: LATER: decide if a provenance entry should be written in the
- // exported document recording the export from the session
- newdoc.updateFrom(null, vamArchive);
- // LATER: LATER: fix use of updateFrom for file systems where locks cannot
- // be made (because they don't have a lockManager, ie NFS/Unix, etc).
- vamArchive.unLock();
- newdoc.unlockFile();
- log.debug("Transfer complete.");
- }
-
- /**
- * extant archive IO handler
- */
- VamsasArchive _va = null;
-
- /**
- * Creates a VamsasArchive Vobject for accessing and updating document Note:
- * this will lock the Vamsas Document for exclusive access to the client.
- *
- * @return session vamsas document
- * @throws IOException
- * if locks fail or vamsas document read fails.
- */
- protected VamsasArchive getVamsasDocument() throws IOException {
- // check we haven't already done this once - probably should be done by
- // caller
- if (_va != null)
- return _va;
- // patiently wait for a lock on the document. (from
- // ArchiveClient.getUpdateable())
- long tries = 5000;
- while (vamArchive.getLock() == null && --tries > 0) {
- // Thread.sleep(1);
- log.debug("Trying to get a document lock for the " + tries + "'th time.");
- }
- if (tries == 0)
- throw new IOException("Failed to get lock for vamsas archive.");
-
- VamsasArchive va = new VamsasArchive(vamArchive.sessionFile, false, true,
- vamArchive);
-
- return va;
- }
-
- /**
- * Unlocks the vamsas archive session document after it has been closed.
- *
- * @throws IOException
- */
- protected void unlockVamsasDocument() throws IOException {
- if (_va != null)
- _va.closeArchive();
- _va = null;
- if (vamArchive != null)
- vamArchive.unLock();
-
- }
-
- /**
- * create a uniquely named
- * uk.ac.vamsas.client.simpleclient.ClientsFile.addClient(ClientHandle)ile in
- * the session Directory
- *
- * @see java.io.File.createTempFile
- * @param pref
- * Prefix for name
- * @param suff
- * Suffix for name
- * @return SessionFile object configured for the new file (of length zero)
- * @throws IOException
- */
- protected SessionFile getTempSessionFile(String pref, String suff)
- throws IOException {
- File tfile = File.createTempFile(pref, suff, sessionDir);
- SessionFile tempFile = new SessionFile(tfile);
- return tempFile;
- }
-
- /**
- * add a IClient to the session
- *
- * add the client to the client list file
- *
- * @param client
- * client to add to the session
- */
- protected void addClient(SimpleClient client) {
- if (client == null)
- slog.error("Try to add a null client to the session ");
- else {
- log.debug("Adding client " + client.getClientHandle().getClientUrn());
- getClientWatcherElement().haltWatch();
- clist.addClient(client.getClientHandle());
-
- log.debug("Added.");
- log.debug("Register Client as Active.");
- try {
- client.createActiveClientFile();
- } catch (IOException e) {
- log.debug("Error during active client file creation.");
- }
- // tracks modification to the client list and readds client to the list
- getClientWatcherElement().setHandler(new AddClientWatchCallBack(client));
- getClientWatcherElement().enableWatch();
-
- }
- }
-
- /**
- * Handler for the client watcher.
- *
- * If (the current client is not in the client list, it is added again;)
- */
- private class AddClientWatchCallBack implements WatcherCallBack {
-
- private SimpleClient client;
-
- /**
- * Inits the handler with the client to check in the list
- *
- * @param client
- * client to monitor in the client list
- */
- protected AddClientWatchCallBack(SimpleClient client) {
- this.client = client;
- }
-
- /**
- * If the client list is modified, checks if the current is still in the
- * list. otherwise, readds ti.
- *
- * @return true to enable watcher, or false to disable it in future
- * WatcherThread cycles.
- */
- public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {
- boolean isWatchEnable = watcher.isWatchEnabled();
- if (lock == null)// no update on the list
- return isWatchEnable;
- log.debug("change on the client list ");
- if (client != null) {
-
- // checks if the client is not already in the lists
- ClientHandle[] cl = clist.retrieveClientList(lock);// clist.retrieveClientList();
- boolean found = false;
- if (cl != null) {
- for (int chi = cl.length - 1; !found && chi > -1; chi--) {
- found = cl[chi].equals(this.client.getClientHandle());
- }
-
- }
- if (!found) {
- log.debug("client not in the list ");
- if (log.isDebugEnabled())
- log
- .debug("the client has not been found in the list. Adding it again :"
- + cl);
- addClient(client);
- } else
- log.debug("client is in the list");
-
- }
- log.debug("isWatchEnable " + isWatchEnable);
- return isWatchEnable;
- }
- }
-
- /**
- *
- * removes a client from the current session removes the client from the
- * session client list if the client is the last one from the session
- * (ClientList), the current session is removed from active session list.
- *
- * The active should add them self to the client list. To insure to close the
- * session,when the current client is the lact active client, clears the list
- * of clients and when two cycles to insure there is no more active client,
- * that otherwise would have readd themself to the list
- *
- * @param client
- * client to remove
- */
- protected void removeClient(SimpleClient client)// IClient client)
- {
- if (client == null) {
- log.error("Null client passed to removeClient");
- return;
- }
- // ClientSessionFileWatcherElement cwe=getClientWatcherElement();
- // if (cwe!=null && cwe.isWatchEnabled()) {
- // cwe.haltWatch();
- // };
- // set handler to check is the the last active client of the session
- // Wait for several watchers cycle to see if the current client was the last
- // client active in the session.
- // if yes, close the session
-
- // getClientWatcherElement().setHandler(new RemoveClientWatchCallBack
- // (client));
- // getClientWatcherElement().setTimeoutBeforeLastCycle(this.watchCycleCountBeforeLastClient);
- log.info("remove client from list");
- if (clistWatchElement != null) {
- clistWatchElement.haltWatch();
- clistWatchElement.watched.unlockFile();
- }
- // clist.clearList();
- // clist.unlockFile();
- log.info("list cleared");
- // if (cwe!=null) {
- // cwe.enableWatch();
-
- log.debug("Stopping EventGenerator..");
- client.evgen.stopWatching();
- // cwe.setHandler(null);
- // ask to the client to copy application data into the document
- client.evgen._raise(Events.DOCUMENT_FINALIZEAPPDATA, null, client, null);
- boolean closeSession = isLastActiveClient(client);
- if (closeSession) {
- if (client.get_session().getUnsavedFlag())
- {
- log.debug("Raising request-to-save event");
- client.evgen._raise(Events.DOCUMENT_REQUESTTOCLOSE, null, client, null);
- }
- log.debug("Raising session shutdown event");
- client.evgen._raise(Events.SESSION_SHUTDOWN, null, client
- .getSessionHandle(), null);
- log.debug("All events raised for finalising session "+client.getSessionHandle().toString());
- }
- // cwe.haltWatch();
- client.evgen.stopWatching();
- try {
- log.debug("Attempting to release active client locks");
- client.releaseActiveClientFile();
- } catch (IOException e) {
- log.error("error during active file client release");
- }
- tidyUp();
- if (closeSession) {
- log.debug("Last active client: closing session");
- log.info("Closing session");
- getSessionManager().removeSession(client.getSessionHandle());
- }
- }
-
- /**
- * close every file and stop.
- */
- private void tidyUp() {
- if (clist != null)
- clist.unlockFile();
- clist = null;
- storedocfile.unlockFile();
- storedocfile = null;
- closeSessionLog();
- }
-
- private boolean isLastActiveClient(SimpleClient client) {
- log.debug("Testing if current client is the last one.");
- log
- .debug("current client lockfile is '" + client.getClientlockFile()
- + "'");
- boolean noOtherActiveClient = true;
- // create, if need, subdirectory to contain client files
- File clientlockFileDir = new File(this.sessionDir, clientFileDirectory);
- if (!clientlockFileDir.exists()) {
- log
- .error("Something wrong the active client file does not exits... should not happen");
- return false;
- }
-
- try {
-
- // no check every file in the directory and try to get lock on it.
- File[] clientFiles = clientlockFileDir.listFiles();
- if (clientFiles == null || clientFiles.length == 0) {// there is not file
- // on the directory.
- // the current
- // client should be
- // the last one.
- return true;
- }
-
- for (int i = clientFiles.length - 1; i > -1 && noOtherActiveClient; i--) {
- File clientFile = clientFiles[i];
- log.debug("testing file for lock: " + clientFile.getAbsolutePath());
- if (client.getClientLock().isTargetLockFile(clientFile)) {
- log.debug("current client file found");
- continue;
- }
- if (clientFile != null && clientFile.exists()) {
- try {
- log.debug("Try to acquire a lock on the file");
- // Get a file channel for the file
- FileChannel channel = new RandomAccessFile(clientFile, "rw")
- .getChannel();
-
- // Use the file channel to create a lock on the file.
- // This method blocks until it can retrieve the lock.
- // java.nio.channels.FileLock activeClientFilelock = channel.lock();
-
- // Try acquiring the lock without blocking. This method returns
- // null or throws an exception if the file is already locked.
- try {
- java.nio.channels.FileLock activeClientFilelock = channel
- .tryLock();
-
- // the lock has been acquired.
- // the file was not lock and so the corresponding application
- // seems to have die
- if (activeClientFilelock != null) {
- log
- .debug("lock obtained : file must be from a crashed application");
-
- activeClientFilelock.release();
- log.debug("lock released");
-
- channel.close();
- log.debug("channel closed");
-
- // delete file
- clientFile.delete();
- log.debug("crashed application file deleted");
-
- } else {
- noOtherActiveClient = false;
- log.debug("lock not obtained : another application is active");
- }
- } catch (OverlappingFileLockException e) {
- // File is already locked in this thread or virtual machine
- // that the expected behaviour
- log.debug("lock not accessible ", e);
- }
- } catch (Exception e) {
- log.debug("error during lock testing ", e);
- }
- }
- }
-
- } catch (Exception e) {
- log.error("error during counting active clients");
- }
- return noOtherActiveClient;
- }
-
- /**
- * Handler for the client watcher. after a client have been removed
- *
- * Checks if the client is not the last active one.
- *
- * If (the current client is not in the client list readd it;)
- */
- private class RemoveClientWatchCallBack implements WatcherCallBack {
-
- private SimpleClient client;
-
- private boolean manualCheckOfClientCount = false;
-
- /**
- * Inits the handler with the client to check in the list
- *
- * @param client
- * client to monitor in the client list
- */
- protected RemoveClientWatchCallBack(SimpleClient client) {
- this.client = client;
- }
-
- /**
- * If the client list is modified, checks if the current is still in the
- * list. otherwise, readds ti.
- *
- * @return true to enable watcher, or false to disable it in future
- * WatcherThread cycles.
- */
- public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {
- // if lock is null, no client has been added since last, clear.
- // the client is then the last client
- if (client != null) {
-
- if (lock == null) {
-
- // checks if the client is not already in the lists
- // ClientHandle[] cl =
- // clist.retrieveClientList();//lock);//clist.retrieveClientList();
-
- boolean islastClient = true;
- if (manualCheckOfClientCount) {
- log.debug("manual checking of count of client");
- // checks if the client is not already in the lists
- ClientHandle[] cl = clist.retrieveClientList();// lock);//clist.retrieveClientList();
- if (cl == null || cl.length < 1)
- // {//no client has registered as active
- {
- islastClient = true;
- log.debug("list is empty");
- } else
- islastClient = false;
- log.debug("list is not empty");
- }
- // if(cl == null || cl.length<1 )
- // {//no client has registered as active
- if (islastClient) {
- // the client is the last one, so close current session
- log.info("FROMCLIENTLIST WATCHER: last client removed: closing session");
- closeSession(client);
- }
- } else {
- log.debug("not the last client found ");
- // ask to the client to cpoy application data into the document
- // client.evgen._raise(Events.DOCUMENT_FINALIZEAPPDATA, null,
- // client,null);
-
- // / }
-
- }
- log.debug("Stopping EventGenerator..");
- // TODO: ensure ClientsFile lock is really released!!
- // clist.unlockFile();
- client.evgen.stopWatching();
- }
- watcher.setHandler(null);// Do not check if the client is the last
- // client. watcher will shutdown anyway
- // watcher.haltWatch();
- // watcher.
- return false;
- }
- }
-
- /**
- * closes the current session, and send an event to the last client to close
- * the document
- *
- * @param client
- * the last client of the client
- */
- private void closeSession(SimpleClient client) {
- // close document
- client.evgen._raise(Events.DOCUMENT_REQUESTTOCLOSE, null, client, null);
- log.debug("close document request done");
- closeSession(client.getSessionHandle());
- }
-
- /**
- * CLoses the current session
- *
- * @param sessionHandle
- * sessionHandle of the session to remove
- */
- private void closeSession(SessionHandle sessionHandle) {
- getSessionManager().removeSession(sessionHandle);
- log.debug("Session removed");
- }
-
- /**
- * @return the sessionManager
- */
- protected SimpleSessionManager getSessionManager() {
- return sessionManager;
- }
-
- /**
- * @param sessionManager
- * the sessionManager to set
- */
- protected void setSessionManager(SimpleSessionManager sessionManager) {
- this.sessionManager = sessionManager;
- }
-
- public ClientsFile getStoreDocFile() {
- if (storedocfile == null) {
-
- }
- return storedocfile;
- }
-
- ClientSessionFileWatcherElement clistWatchElement = null;
-
- /**
- * get or create a watcher on clist.
- *
- * @return the contents of clistWatchElement or initialise it
- */
- public ClientSessionFileWatcherElement getClientWatcherElement() {
- if (clistWatchElement == null) {
- clistWatchElement = new ClientSessionFileWatcherElement(clist, null);
- }
- return clistWatchElement;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.RandomAccessFile;\r
+import java.nio.channels.FileChannel;\r
+import java.nio.channels.OverlappingFileLockException;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.apache.log4j.FileAppender;\r
+import org.apache.log4j.Logger;\r
+import org.apache.log4j.PatternLayout;\r
+\r
+import uk.ac.vamsas.client.ClientHandle;\r
+import uk.ac.vamsas.client.Events;\r
+import uk.ac.vamsas.client.IClient;\r
+import uk.ac.vamsas.client.SessionHandle;\r
+import uk.ac.vamsas.client.UserHandle;\r
+\r
+/**\r
+ * Does all the IO operations for a SimpleClient instance accessing a\r
+ * SimpleClient vamsas session.\r
+ * \r
+ * Basically, it defines the various standard names for the files in the session\r
+ * directory (that maps to the sessionUrn), provides constructors for the file\r
+ * handlers and watchers of those file entities, and some higher level methods\r
+ * to check and change the state flags for the session.\r
+ * \r
+ * TODO: move the stuff below to the SimpleClientFactory documentation. much may\r
+ * not be valid now : Vamsas client is intialised with a path to create live\r
+ * session directories. This path may contain a vamsas.properties file that sets\r
+ * additional parameters (otherwise client just uses the one on the classpath).\r
+ * \r
+ * A vamsas session consists of : SessionDir - translates to urn of a live\r
+ * session. Contains: Vamsas Document (as a jar), Session client list file, both\r
+ * of which may be locked, and additional temporary versions of these files when\r
+ * write operations are taking place.\r
+ * \r
+ * Zip file entries - vamsasdocument.xml : core info one or more: -\r
+ * <applicationname>.version.sessionnumber.raw (string given in\r
+ * vamsasdocument.xml applicationData entry)\r
+ * \r
+ * Lockfile - filename given in the vamsasdocument.xml. Should be checked for\r
+ * validity by any client and rewritten if necessary. The lockfile can point to\r
+ * the jar itself. Mode of operation. Initially - documentHandler either: -\r
+ * creates a zip for a new session for the client - connect to an existing\r
+ * session zip 1. reads session urn file 2. waits for lock 3. examines session -\r
+ * decide whether to create new application data slice or connect to one stored\r
+ * in session. 4. writes info into session file 5. releases lock and generates\r
+ * local client events. 6. Creates Watcher thread to generate events.\r
+ * \r
+ * During the session - Update watcher checks for file change -\r
+ * \r
+ * Procedures for file based session message exchange - session document\r
+ * modification flag\r
+ * \r
+ */\r
+\r
+public class VamsasSession {\r
+ /**\r
+ * indicator file for informing other processes that they should finalise\r
+ * their vamsas datasets for storing into a vamsas archive.\r
+ */\r
+ public static final String CLOSEANDSAVE_FILE = "stored.log";\r
+\r
+ /**\r
+ * session file storing the last_stored_stat data\r
+ */\r
+ public static final String MODIFIEDDOC_FILE = "modified";\r
+\r
+ private SimpleSessionManager sessionManager = null;\r
+\r
+ /**\r
+ * Count of cycles before considering the current client as the last one of\r
+ * the session (if no other client registered as active )\r
+ */\r
+ private final int watchCycleCountBeforeLastClient = 1220;\r
+\r
+ /**\r
+ * time between checking\r
+ */\r
+ public int WATCH_SLEEP = 30;\r
+\r
+ protected String clientFileDirectory = "clients";\r
+\r
+ /**\r
+ * called to clear update flag after a successful offline storage event\r
+ */\r
+ protected void clearUnsavedFlag() {\r
+ SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir,\r
+ MODIFIEDDOC_FILE));\r
+ if (!laststored.clearFlag())\r
+ log.warn("Unsaved flag was not cleared for " + sessionDir);\r
+ }\r
+\r
+ /**\r
+ * called to indicate session document has been modified.\r
+ * \r
+ */\r
+ protected void setUnsavedFlag() {\r
+ SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir,\r
+ MODIFIEDDOC_FILE));\r
+ if (!laststored.setFlag())\r
+ log.warn("Couldn't set the Unsaved flag for " + sessionDir);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return true if session document has been modified since last offline\r
+ * storage event\r
+ */\r
+ protected boolean getUnsavedFlag() {\r
+ SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir,\r
+ MODIFIEDDOC_FILE));\r
+ return laststored.checkFlag();\r
+ }\r
+\r
+ /**\r
+ * log file location\r
+ */\r
+ public static final String SESSION_LOG = "Log.txt";\r
+\r
+ private static Log log = LogFactory.getLog(VamsasSession.class);\r
+\r
+ protected Logger slog = Logger.getLogger("uk.ac.vamsas.client.SessionLog");\r
+\r
+ /**\r
+ * the appender that writes to the log file inside the session's directory.\r
+ */\r
+ private FileAppender slogAppender = null;\r
+\r
+ /**\r
+ * setup the sessionLog using Log4j.\r
+ * \r
+ * @throws IOException\r
+ */\r
+ private void initLog() throws IOException {\r
+ // TODO: fix session event logging\r
+ // LATER: make dedicated appender format for session log.\r
+ /*\r
+ * Appender app = slog.getAppender("log4j.appender.SESSIONLOG"); //\r
+ * slog.addAppender(new FileAppender(app.getLayout(), new File(sessionDir,\r
+ * SESSION_LOG).getAbsolutePath())); // slog.addAppender(new\r
+ * FileAppender(app.getLayout(), new File(sessionDir,\r
+ * SESSION_LOG).getAbsolutePath())); for (Enumeration e =\r
+ * slog.getAllAppenders() ; e.hasMoreElements() ;) {\r
+ * System.out.println(e.nextElement()); }\r
+ */\r
+\r
+ if (slog != null) {\r
+ File sessionLogFile = new File(this.sessionDir, SESSION_LOG);\r
+ slog.addAppender(slogAppender = new FileAppender(new PatternLayout(\r
+ "%-4r [%t] %-5p %c %x - %m%n"), sessionLogFile.getAbsolutePath(),\r
+ true));\r
+ } else {\r
+ log.info("No appender for SessionLog");\r
+ }\r
+ }\r
+\r
+ private void closeSessionLog() {\r
+ if (slog != null) {\r
+ if (slogAppender != null) {\r
+ slog.removeAppender(slogAppender);\r
+ slogAppender.close();\r
+ slogAppender = null;\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * the sessionDir is given as the session location for new clients.\r
+ */\r
+ protected File sessionDir;\r
+\r
+ /**\r
+ * holds the list of attached clients\r
+ */\r
+ ClientsFile clist;\r
+\r
+ public static final String CLIENT_LIST = "Clients.obj";\r
+\r
+ /**\r
+ * holds the data\r
+ */\r
+ VamsasFile vamArchive;\r
+\r
+ public static final String VAMSAS_OBJ = "VamDoc.jar";\r
+\r
+ /**\r
+ * sets up the vamsas session files and watchers in sessionDir1\r
+ * \r
+ * @param sessionDir1\r
+ */\r
+ protected VamsasSession(File sessionDir1) throws IOException {\r
+ this(sessionDir1, null);\r
+ }\r
+\r
+ /**\r
+ * sets up the vamsas session files and watchers in sessionDir1\r
+ * \r
+ * @param sessionDir1\r
+ * @param extVamDoc\r
+ * null or an existing archive to initialise the session with\r
+ * @throws any\r
+ * IOExceptions from creating session directory and files.\r
+ * @throws error\r
+ * if both extVamDoc and sessionDir1 already exist (cannot import\r
+ * new data into session in this way)\r
+ */\r
+ protected VamsasSession(File sessionDir1, File extVamDoc) throws IOException {\r
+ if (sessionDir1 == null)\r
+ throw new Error("Null directory for VamsasSession.");\r
+ if (!sessionDir1.exists() && !sessionDir1.mkdir()) {\r
+ throw new IOException("Failed to make VamsasSession directory in "\r
+ + sessionDir1);\r
+ }\r
+ if (!sessionDir1.isDirectory() || !sessionDir1.canWrite()\r
+ || !sessionDir1.canRead()) {\r
+ throw new IOException("Cannot access '" + sessionDir1\r
+ + "' as a read/writable Directory.");\r
+ }\r
+ boolean existingSession = checkSessionFiles(sessionDir1);\r
+ if (existingSession) {\r
+ if (extVamDoc != null) {\r
+ throw new Error(\r
+ "Client Initialisation Error: Cannot join an existing session directory with an existing vamsas document to import.");\r
+ } else {\r
+ log.debug("Joining an existing session.");\r
+ }\r
+ }\r
+ this.sessionDir = sessionDir1;\r
+ initSessionObjects();\r
+ if (existingSession) {\r
+ slog.debug("Initialising additional VamsasSession instance");\r
+ } else {\r
+ slog.debug("Founding client has joined VamsasSession instance");\r
+ }\r
+\r
+ log.debug("Attached to VamsasSession in " + sessionDir1);\r
+ if (extVamDoc != null) {\r
+ setVamsasDocument(extVamDoc);\r
+ }\r
+ slog.debug("Session directory created.");\r
+ log.debug("Initialised VamsasSession in " + sessionDir1);\r
+ }\r
+\r
+ /**\r
+ * tests presence of existing sessionfiles files in dir\r
+ * \r
+ * @param dir\r
+ * @return\r
+ */\r
+ private boolean checkSessionFiles(File dir) throws IOException {\r
+ File c_file = new File(dir, CLIENT_LIST);\r
+ File v_doc = new File(dir, VAMSAS_OBJ);\r
+ if (c_file.exists() && v_doc.exists())\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * create new empty files in dir\r
+ * \r
+ */\r
+ private void createSessionFiles() throws IOException {\r
+ if (sessionDir == null)\r
+ throw new IOException(\r
+ "Invalid call to createSessionFiles() with null sessionDir");\r
+ File c_file = new File(sessionDir, CLIENT_LIST);\r
+ File v_doc = new File(sessionDir, VAMSAS_OBJ);\r
+ if (!c_file.exists() && c_file.createNewFile())\r
+ log.debug("Created new ClientFile " + c_file); // don't care if this\r
+ // works or not\r
+ if (!v_doc.exists()) {\r
+ if (v_doc.createNewFile()) {\r
+ log.debug("Created new Vamsas Session Document File " + v_doc);\r
+ } else {\r
+ log.warn("Didn't create Vamsas Session Document file in " + v_doc);\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * construct SessionFile objects and watchers for each\r
+ */\r
+ private void initSessionObjects() throws IOException {\r
+ createSessionFiles();\r
+ if (clist != null || vamArchive != null)\r
+ throw new IOException(\r
+ "initSessionObjects called for initialised VamsasSession object.");\r
+ clist = new ClientsFile(new File(sessionDir, CLIENT_LIST));\r
+ vamArchive = new VamsasFile(new File(sessionDir, VAMSAS_OBJ));\r
+ storedocfile = new ClientsFile(new File(sessionDir, CLOSEANDSAVE_FILE));\r
+ initLog();\r
+ }\r
+\r
+ /**\r
+ * make a new watcher object for the clientFile\r
+ * \r
+ * @return new ClientFile watcher instance\r
+ */\r
+ public FileWatcher getClientWatcher() {\r
+ return new FileWatcher(clist.sessionFile);\r
+ }\r
+\r
+ /**\r
+ * make a new watcher object for the vamsas Document\r
+ * \r
+ * @return new ClientFile watcher instance\r
+ */\r
+ public FileWatcher getDocWatcher() {\r
+ return new FileWatcher(vamArchive.sessionFile);\r
+ }\r
+\r
+ FileWatcher store_doc_file = null;\r
+\r
+ public ClientsFile storedocfile = null;\r
+\r
+ /**\r
+ * make a new watcher object for the messages file\r
+ * \r
+ * @return new watcher instance\r
+ */\r
+ public FileWatcher getStoreWatcher() {\r
+ return new FileWatcher(new File(sessionDir, CLOSEANDSAVE_FILE));\r
+\r
+ }\r
+\r
+ /**\r
+ * write to the StoreWatcher file to indicate that a storeDocumentRequest has\r
+ * been made. The local client's storeWatcher FileWatcher object is updated so\r
+ * the initial change is not registered.\r
+ * \r
+ * @param client\r
+ * @param user\r
+ * @return\r
+ */\r
+ public void addStoreDocumentRequest(ClientHandle client, UserHandle user)\r
+ throws IOException {\r
+ // TODO: replace this with clientsFile mechanism\r
+ SessionFile sfw = new SessionFile(new File(sessionDir, CLOSEANDSAVE_FILE));\r
+ while (!sfw.lockFile())\r
+ log.debug("Trying to get lock for " + CLOSEANDSAVE_FILE);\r
+ RandomAccessFile sfwfile = sfw.fileLock.getRaFile();\r
+ sfwfile.setLength(0); // wipe out any old info.\r
+ // TODO: rationalise what gets written to this file (ie do we want other\r
+ // clients to read the id of the requestor?)\r
+ sfwfile.writeUTF(client.getClientUrn() + ":" + user.getFullName() + "@"\r
+ + user.getOrganization());\r
+ sfw.unlockFile();\r
+ if (store_doc_file != null)\r
+ store_doc_file.setState();\r
+ slog.info("FinalizeAppData request from " + user.getFullName() + " using "\r
+ + client.getClientUrn() + "");\r
+ }\r
+\r
+ /**\r
+ * create a new session with an existing vamsas Document - by copying it into\r
+ * the session.\r
+ * \r
+ * @param archive\r
+ */\r
+ public void setVamsasDocument(File archive) throws IOException {\r
+ log.debug("Transferring vamsas data from " + archive + " to session:"\r
+ + vamArchive.sessionFile);\r
+ SessionFile xtantdoc = new SessionFile(archive);\r
+ while (!vamArchive.lockFile())\r
+ log.info("Trying to get lock for " + vamArchive.sessionFile);\r
+ vamArchive.updateFrom(null, xtantdoc);\r
+ xtantdoc.unlockFile();\r
+ unlockVamsasDocument();\r
+ // TODO: session archive provenance should be updated to reflect import from\r
+ // external source\r
+ log.debug("Transfer complete.");\r
+ }\r
+\r
+ /**\r
+ * write session as a new vamsas Document (this will overwrite any existing\r
+ * file without warning) TODO: test TODO: verify that lock should be released\r
+ * for vamsas document.\r
+ * \r
+ * @param destarchive\r
+ */\r
+ protected void writeVamsasDocument(File destarchive, Lock extlock)\r
+ throws IOException {\r
+ log.debug("Transferring vamsas data from " + vamArchive.sessionFile\r
+ + " to session:" + destarchive);\r
+ SessionFile newdoc = new SessionFile(destarchive);\r
+ if (extlock == null && !vamArchive.lockFile())\r
+ while (!vamArchive.lockFile())\r
+ log.info("Trying to get lock for " + vamArchive.sessionFile);\r
+ // TODO: LATER: decide if a provenance entry should be written in the\r
+ // exported document recording the export from the session\r
+ newdoc.updateFrom(null, vamArchive);\r
+ // LATER: LATER: fix use of updateFrom for file systems where locks cannot\r
+ // be made (because they don't have a lockManager, ie NFS/Unix, etc).\r
+ vamArchive.unLock();\r
+ newdoc.unlockFile();\r
+ log.debug("Transfer complete.");\r
+ }\r
+\r
+ /**\r
+ * extant archive IO handler\r
+ */\r
+ VamsasArchive _va = null;\r
+\r
+ /**\r
+ * Creates a VamsasArchive Vobject for accessing and updating document Note:\r
+ * this will lock the Vamsas Document for exclusive access to the client.\r
+ * \r
+ * @return session vamsas document\r
+ * @throws IOException\r
+ * if locks fail or vamsas document read fails.\r
+ */\r
+ protected VamsasArchive getVamsasDocument() throws IOException {\r
+ // check we haven't already done this once - probably should be done by\r
+ // caller\r
+ if (_va != null)\r
+ return _va;\r
+ // patiently wait for a lock on the document. (from\r
+ // ArchiveClient.getUpdateable())\r
+ long tries = 5000;\r
+ while (vamArchive.getLock() == null && --tries > 0) {\r
+ // Thread.sleep(1);\r
+ log.debug("Trying to get a document lock for the " + tries + "'th time.");\r
+ }\r
+ if (tries == 0)\r
+ throw new IOException("Failed to get lock for vamsas archive.");\r
+\r
+ VamsasArchive va = new VamsasArchive(vamArchive.sessionFile, false, true,\r
+ vamArchive);\r
+\r
+ return va;\r
+ }\r
+\r
+ /**\r
+ * Unlocks the vamsas archive session document after it has been closed.\r
+ * \r
+ * @throws IOException\r
+ */\r
+ protected void unlockVamsasDocument() throws IOException {\r
+ if (_va != null)\r
+ _va.closeArchive();\r
+ _va = null;\r
+ if (vamArchive != null)\r
+ vamArchive.unLock();\r
+\r
+ }\r
+\r
+ /**\r
+ * create a uniquely named\r
+ * uk.ac.vamsas.client.simpleclient.ClientsFile.addClient(ClientHandle)ile in\r
+ * the session Directory\r
+ * \r
+ * @see java.io.File.createTempFile\r
+ * @param pref\r
+ * Prefix for name\r
+ * @param suff\r
+ * Suffix for name\r
+ * @return SessionFile object configured for the new file (of length zero)\r
+ * @throws IOException\r
+ */\r
+ protected SessionFile getTempSessionFile(String pref, String suff)\r
+ throws IOException {\r
+ File tfile = File.createTempFile(pref, suff, sessionDir);\r
+ SessionFile tempFile = new SessionFile(tfile);\r
+ return tempFile;\r
+ }\r
+\r
+ /**\r
+ * add a IClient to the session\r
+ * \r
+ * add the client to the client list file\r
+ * \r
+ * @param client\r
+ * client to add to the session\r
+ */\r
+ protected void addClient(SimpleClient client) {\r
+ if (client == null)\r
+ slog.error("Try to add a null client to the session ");\r
+ else {\r
+ log.debug("Adding client " + client.getClientHandle().getClientUrn());\r
+ getClientWatcherElement().haltWatch();\r
+ clist.addClient(client.getClientHandle());\r
+\r
+ log.debug("Added.");\r
+ log.debug("Register Client as Active.");\r
+ try {\r
+ client.createActiveClientFile();\r
+ } catch (IOException e) {\r
+ log.debug("Error during active client file creation.");\r
+ }\r
+ // tracks modification to the client list and readds client to the list\r
+ getClientWatcherElement().setHandler(new AddClientWatchCallBack(client));\r
+ getClientWatcherElement().enableWatch();\r
+\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Handler for the client watcher.\r
+ * \r
+ * If (the current client is not in the client list, it is added again;)\r
+ */\r
+ private class AddClientWatchCallBack implements WatcherCallBack {\r
+\r
+ private SimpleClient client;\r
+\r
+ /**\r
+ * Inits the handler with the client to check in the list\r
+ * \r
+ * @param client\r
+ * client to monitor in the client list\r
+ */\r
+ protected AddClientWatchCallBack(SimpleClient client) {\r
+ this.client = client;\r
+ }\r
+\r
+ /**\r
+ * If the client list is modified, checks if the current is still in the\r
+ * list. otherwise, readds ti.\r
+ * \r
+ * @return true to enable watcher, or false to disable it in future\r
+ * WatcherThread cycles.\r
+ */\r
+ public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {\r
+ boolean isWatchEnable = watcher.isWatchEnabled();\r
+ if (lock == null)// no update on the list\r
+ return isWatchEnable;\r
+ log.debug("change on the client list ");\r
+ if (client != null) {\r
+\r
+ // checks if the client is not already in the lists\r
+ ClientHandle[] cl = clist.retrieveClientList(lock);// clist.retrieveClientList();\r
+ boolean found = false;\r
+ if (cl != null) {\r
+ for (int chi = cl.length - 1; !found && chi > -1; chi--) {\r
+ found = cl[chi].equals(this.client.getClientHandle());\r
+ }\r
+\r
+ }\r
+ if (!found) {\r
+ log.debug("client not in the list ");\r
+ if (log.isDebugEnabled())\r
+ log\r
+ .debug("the client has not been found in the list. Adding it again :"\r
+ + cl);\r
+ addClient(client);\r
+ } else\r
+ log.debug("client is in the list");\r
+\r
+ }\r
+ log.debug("isWatchEnable " + isWatchEnable);\r
+ return isWatchEnable;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * \r
+ * removes a client from the current session removes the client from the\r
+ * session client list if the client is the last one from the session\r
+ * (ClientList), the current session is removed from active session list.\r
+ * \r
+ * The active should add them self to the client list. To insure to close the\r
+ * session,when the current client is the lact active client, clears the list\r
+ * of clients and when two cycles to insure there is no more active client,\r
+ * that otherwise would have readd themself to the list\r
+ * \r
+ * @param client\r
+ * client to remove\r
+ */\r
+ protected void removeClient(SimpleClient client)// IClient client)\r
+ {\r
+ if (client == null) {\r
+ log.error("Null client passed to removeClient");\r
+ return;\r
+ }\r
+ // ClientSessionFileWatcherElement cwe=getClientWatcherElement();\r
+ // if (cwe!=null && cwe.isWatchEnabled()) {\r
+ // cwe.haltWatch();\r
+ // };\r
+ // set handler to check is the the last active client of the session\r
+ // Wait for several watchers cycle to see if the current client was the last\r
+ // client active in the session.\r
+ // if yes, close the session\r
+\r
+ // getClientWatcherElement().setHandler(new RemoveClientWatchCallBack\r
+ // (client));\r
+ // getClientWatcherElement().setTimeoutBeforeLastCycle(this.watchCycleCountBeforeLastClient);\r
+ log.info("remove client from list");\r
+ if (clistWatchElement != null) {\r
+ clistWatchElement.haltWatch();\r
+ clistWatchElement.watched.unlockFile();\r
+ }\r
+ // clist.clearList();\r
+ // clist.unlockFile();\r
+ log.info("list cleared");\r
+ // if (cwe!=null) {\r
+ // cwe.enableWatch();\r
+\r
+ log.debug("Stopping EventGenerator..");\r
+ client.evgen.stopWatching();\r
+ // cwe.setHandler(null);\r
+ // ask to the client to copy application data into the document\r
+ client.evgen._raise(Events.DOCUMENT_FINALIZEAPPDATA, null, client, null);\r
+ boolean closeSession = isLastActiveClient(client);\r
+ if (closeSession) {\r
+ if (client.get_session().getUnsavedFlag()) {\r
+ log.debug("Raising request-to-save event");\r
+ client.evgen._raise(Events.DOCUMENT_REQUESTTOCLOSE, null, client, null);\r
+ }\r
+ log.debug("Raising session shutdown event");\r
+ client.evgen._raise(Events.SESSION_SHUTDOWN, null, client\r
+ .getSessionHandle(), null);\r
+ log.debug("All events raised for finalising session "\r
+ + client.getSessionHandle().toString());\r
+ }\r
+ // cwe.haltWatch();\r
+ client.evgen.stopWatching();\r
+ try {\r
+ log.debug("Attempting to release active client locks");\r
+ client.releaseActiveClientFile();\r
+ } catch (IOException e) {\r
+ log.error("error during active file client release");\r
+ }\r
+ tidyUp();\r
+ if (closeSession) {\r
+ log.debug("Last active client: closing session");\r
+ log.info("Closing session");\r
+ getSessionManager().removeSession(client.getSessionHandle());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * close every file and stop.\r
+ */\r
+ private void tidyUp() {\r
+ if (clist != null)\r
+ clist.unlockFile();\r
+ clist = null;\r
+ storedocfile.unlockFile();\r
+ storedocfile = null;\r
+ closeSessionLog();\r
+ }\r
+\r
+ private boolean isLastActiveClient(SimpleClient client) {\r
+ log.debug("Testing if current client is the last one.");\r
+ log\r
+ .debug("current client lockfile is '" + client.getClientlockFile()\r
+ + "'");\r
+ boolean noOtherActiveClient = true;\r
+ // create, if need, subdirectory to contain client files\r
+ File clientlockFileDir = new File(this.sessionDir, clientFileDirectory);\r
+ if (!clientlockFileDir.exists()) {\r
+ log\r
+ .error("Something wrong the active client file does not exits... should not happen");\r
+ return false;\r
+ }\r
+\r
+ try {\r
+\r
+ // no check every file in the directory and try to get lock on it.\r
+ File[] clientFiles = clientlockFileDir.listFiles();\r
+ if (clientFiles == null || clientFiles.length == 0) {// there is not file\r
+ // on the directory.\r
+ // the current\r
+ // client should be\r
+ // the last one.\r
+ return true;\r
+ }\r
+\r
+ for (int i = clientFiles.length - 1; i > -1 && noOtherActiveClient; i--) {\r
+ File clientFile = clientFiles[i];\r
+ log.debug("testing file for lock: " + clientFile.getAbsolutePath());\r
+ if (client.getClientLock().isTargetLockFile(clientFile)) {\r
+ log.debug("current client file found");\r
+ continue;\r
+ }\r
+ if (clientFile != null && clientFile.exists()) {\r
+ try {\r
+ log.debug("Try to acquire a lock on the file");\r
+ // Get a file channel for the file\r
+ FileChannel channel = new RandomAccessFile(clientFile, "rw")\r
+ .getChannel();\r
+\r
+ // Use the file channel to create a lock on the file.\r
+ // This method blocks until it can retrieve the lock.\r
+ // java.nio.channels.FileLock activeClientFilelock = channel.lock();\r
+\r
+ // Try acquiring the lock without blocking. This method returns\r
+ // null or throws an exception if the file is already locked.\r
+ try {\r
+ java.nio.channels.FileLock activeClientFilelock = channel\r
+ .tryLock();\r
+\r
+ // the lock has been acquired.\r
+ // the file was not lock and so the corresponding application\r
+ // seems to have die\r
+ if (activeClientFilelock != null) {\r
+ log\r
+ .debug("lock obtained : file must be from a crashed application");\r
+\r
+ activeClientFilelock.release();\r
+ log.debug("lock released");\r
+\r
+ channel.close();\r
+ log.debug("channel closed");\r
+\r
+ // delete file\r
+ clientFile.delete();\r
+ log.debug("crashed application file deleted");\r
+\r
+ } else {\r
+ noOtherActiveClient = false;\r
+ log.debug("lock not obtained : another application is active");\r
+ }\r
+ } catch (OverlappingFileLockException e) {\r
+ // File is already locked in this thread or virtual machine\r
+ // that the expected behaviour\r
+ log.debug("lock not accessible ", e);\r
+ }\r
+ } catch (Exception e) {\r
+ log.debug("error during lock testing ", e);\r
+ }\r
+ }\r
+ }\r
+\r
+ } catch (Exception e) {\r
+ log.error("error during counting active clients");\r
+ }\r
+ return noOtherActiveClient;\r
+ }\r
+\r
+ /**\r
+ * Handler for the client watcher. after a client have been removed\r
+ * \r
+ * Checks if the client is not the last active one.\r
+ * \r
+ * If (the current client is not in the client list readd it;)\r
+ */\r
+ private class RemoveClientWatchCallBack implements WatcherCallBack {\r
+\r
+ private SimpleClient client;\r
+\r
+ private boolean manualCheckOfClientCount = false;\r
+\r
+ /**\r
+ * Inits the handler with the client to check in the list\r
+ * \r
+ * @param client\r
+ * client to monitor in the client list\r
+ */\r
+ protected RemoveClientWatchCallBack(SimpleClient client) {\r
+ this.client = client;\r
+ }\r
+\r
+ /**\r
+ * If the client list is modified, checks if the current is still in the\r
+ * list. otherwise, readds ti.\r
+ * \r
+ * @return true to enable watcher, or false to disable it in future\r
+ * WatcherThread cycles.\r
+ */\r
+ public boolean handleWatchEvent(WatcherElement watcher, Lock lock) {\r
+ // if lock is null, no client has been added since last, clear.\r
+ // the client is then the last client\r
+ if (client != null) {\r
+\r
+ if (lock == null) {\r
+\r
+ // checks if the client is not already in the lists\r
+ // ClientHandle[] cl =\r
+ // clist.retrieveClientList();//lock);//clist.retrieveClientList();\r
+\r
+ boolean islastClient = true;\r
+ if (manualCheckOfClientCount) {\r
+ log.debug("manual checking of count of client");\r
+ // checks if the client is not already in the lists\r
+ ClientHandle[] cl = clist.retrieveClientList();// lock);//clist.retrieveClientList();\r
+ if (cl == null || cl.length < 1)\r
+ // {//no client has registered as active\r
+ {\r
+ islastClient = true;\r
+ log.debug("list is empty");\r
+ } else\r
+ islastClient = false;\r
+ log.debug("list is not empty");\r
+ }\r
+ // if(cl == null || cl.length<1 )\r
+ // {//no client has registered as active\r
+ if (islastClient) {\r
+ // the client is the last one, so close current session\r
+ log\r
+ .info("FROMCLIENTLIST WATCHER: last client removed: closing session");\r
+ closeSession(client);\r
+ }\r
+ } else {\r
+ log.debug("not the last client found ");\r
+ // ask to the client to cpoy application data into the document\r
+ // client.evgen._raise(Events.DOCUMENT_FINALIZEAPPDATA, null,\r
+ // client,null);\r
+\r
+ // / }\r
+\r
+ }\r
+ log.debug("Stopping EventGenerator..");\r
+ // TODO: ensure ClientsFile lock is really released!!\r
+ // clist.unlockFile();\r
+ client.evgen.stopWatching();\r
+ }\r
+ watcher.setHandler(null);// Do not check if the client is the last\r
+ // client. watcher will shutdown anyway\r
+ // watcher.haltWatch();\r
+ // watcher.\r
+ return false;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * closes the current session, and send an event to the last client to close\r
+ * the document\r
+ * \r
+ * @param client\r
+ * the last client of the client\r
+ */\r
+ private void closeSession(SimpleClient client) {\r
+ // close document\r
+ client.evgen._raise(Events.DOCUMENT_REQUESTTOCLOSE, null, client, null);\r
+ log.debug("close document request done");\r
+ closeSession(client.getSessionHandle());\r
+ }\r
+\r
+ /**\r
+ * CLoses the current session\r
+ * \r
+ * @param sessionHandle\r
+ * sessionHandle of the session to remove\r
+ */\r
+ private void closeSession(SessionHandle sessionHandle) {\r
+ getSessionManager().removeSession(sessionHandle);\r
+ log.debug("Session removed");\r
+ }\r
+\r
+ /**\r
+ * @return the sessionManager\r
+ */\r
+ protected SimpleSessionManager getSessionManager() {\r
+ return sessionManager;\r
+ }\r
+\r
+ /**\r
+ * @param sessionManager\r
+ * the sessionManager to set\r
+ */\r
+ protected void setSessionManager(SimpleSessionManager sessionManager) {\r
+ this.sessionManager = sessionManager;\r
+ }\r
+\r
+ public ClientsFile getStoreDocFile() {\r
+ if (storedocfile == null) {\r
+\r
+ }\r
+ return storedocfile;\r
+ }\r
+\r
+ ClientSessionFileWatcherElement clistWatchElement = null;\r
+\r
+ /**\r
+ * get or create a watcher on clist.\r
+ * \r
+ * @return the contents of clistWatchElement or initialise it\r
+ */\r
+ public ClientSessionFileWatcherElement getClientWatcherElement() {\r
+ if (clistWatchElement == null) {\r
+ clistWatchElement = new ClientSessionFileWatcherElement(clist, null);\r
+ }\r
+ return clistWatchElement;\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
/**\r
- * Interface for VamsasFileWatcherElement call back events generated by the VamsasFileWatcherThread.\r
+ * Interface for VamsasFileWatcherElement call back events generated by the\r
+ * VamsasFileWatcherThread.\r
*/\r
public interface WatcherCallBack {\r
/**\r
* \r
- * @return true to enable watcher, or false to disable it in future WatcherThread cycles.\r
+ * @return true to enable watcher, or false to disable it in future\r
+ * WatcherThread cycles.\r
*/\r
public boolean handleWatchEvent(WatcherElement watcher, Lock lock);\r
}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.client.simpleclient;\r
\r
-\r
-\r
public abstract class WatcherElement {\r
\r
- private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(VamsasFileWatcherElement.class);\r
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getLog(VamsasFileWatcherElement.class);\r
+\r
protected FileWatcher watcher = null;\r
+\r
protected WatcherCallBack handler = null;\r
+\r
/**\r
* set this to false to stop the thread\r
*/\r
protected boolean watchForChange = true;\r
+\r
/**\r
* true when the handler is being called for this watcher\r
*/\r
public WatcherElement(WatcherCallBack handler) {\r
this.handler = handler;\r
}\r
+\r
/**\r
- * will instruct watcher to stop and wait around for one WATCH_SLEEP\r
- * before returning. If no thread is running then it returns immediately.\r
+ * will instruct watcher to stop and wait around for one WATCH_SLEEP before\r
+ * returning. If no thread is running then it returns immediately.\r
*/\r
public void haltWatch() {\r
// set the flag to skip this watch element.\r
- watchForChange=false;\r
+ watchForChange = false;\r
if (log.isDebugEnabled())\r
- log.debug("haltWatch on "+watcher.getSubject());\r
+ log.debug("haltWatch on " + watcher.getSubject());\r
endWatch();\r
if (log.isDebugEnabled())\r
- log.debug("haltWatch completed on "+watcher.getSubject());\r
+ log.debug("haltWatch completed on " + watcher.getSubject());\r
}\r
+\r
/**\r
- * called by haltWatch before \r
- * clearing the FileWatcher reference.\r
- *\r
+ * called by haltWatch before clearing the FileWatcher reference.\r
+ * \r
*/\r
protected abstract void endWatch();\r
+\r
/**\r
- * called to generate the watcher object\r
- * by enableWatch and in doWatch\r
- *\r
+ * called to generate the watcher object by enableWatch and in doWatch\r
+ * \r
*/\r
protected abstract void initWatch();\r
+\r
/**\r
* implemented for debug information purposes.\r
+ * \r
* @return Informative string about what the watcher is watching\r
*/\r
protected abstract String getSubject();\r
+\r
/**\r
- * must be called by implementations of \r
- * enablewatch\r
+ * must be called by implementations of enablewatch\r
*/\r
protected void enableWatch() {\r
if (log.isDebugEnabled())\r
- log.debug("enableWatch on "+getSubject());\r
- watchForChange=true;\r
+ log.debug("enableWatch on " + getSubject());\r
+ watchForChange = true;\r
initWatch();\r
if (log.isDebugEnabled())\r
- log.debug("enableWatch returning on "+getSubject());\r
+ log.debug("enableWatch returning on " + getSubject());\r
}\r
\r
/**\r
* Originally from the uk.ac.vamsas.test.simpleclient.ArchiveClient method\r
+ * \r
* @return true if the handler was called for a changeEvent\r
*/\r
public boolean doWatch() {\r
- if (!watchForChange || handler==null)\r
+ if (!watchForChange || handler == null)\r
return false;\r
- if (watcher==null)\r
+ if (watcher == null)\r
initWatch(); // somehow not done the first time\r
- handlerCalled=false;\r
- Lock doclock=null;\r
+ handlerCalled = false;\r
+ Lock doclock = null;\r
try {\r
- doclock=watcher.getChangedState();\r
+ doclock = watcher.getChangedState();\r
} catch (Exception e) {\r
- log.error("Whilst watching "+watcher.getSubject(), e);\r
+ log.error("Whilst watching " + watcher.getSubject(), e);\r
}\r
- if (doclock==null)\r
+ if (doclock == null)\r
return false;\r
- /* handlerCalled=true;\r
- if (log.isDebugEnabled())\r
- log.debug("Triggering watchEvent for change on "+watcher.getSubject());\r
- boolean finish=!handler.handleWatchEvent(this, doclock);\r
- doclock=null; // TODO: check that lock should really be released rather than dereferenced\r
- if (finish)\r
- haltWatch();\r
- else\r
- enableWatch();\r
- handlerCalled=false;*/\r
+ /*\r
+ * handlerCalled=true; if (log.isDebugEnabled())\r
+ * log.debug("Triggering watchEvent for change on "+watcher.getSubject());\r
+ * boolean finish=!handler.handleWatchEvent(this, doclock); doclock=null; //\r
+ * TODO: check that lock should really be released rather than dereferenced\r
+ * if (finish) haltWatch(); else enableWatch(); handlerCalled=false;\r
+ */\r
this.callHandler(doclock);\r
return true;\r
}\r
/**\r
* Calls the current eventhandler\r
* \r
- * @param doclock the lock on the watch file \r
+ * @param doclock\r
+ * the lock on the watch file\r
*/\r
- protected void callHandler(Lock doclock)\r
- {\r
- if (log.isDebugEnabled())\r
- log.debug("Triggering watchEvent for change on "+watcher.getSubject());\r
- boolean finish=!handler.handleWatchEvent(this, doclock);\r
- doclock=null; // TODO: check that lock should really be released rather than dereferenced\r
- if (finish)\r
- haltWatch();\r
- else\r
- enableWatch();\r
- handlerCalled=false;\r
+ protected void callHandler(Lock doclock) {\r
+ if (log.isDebugEnabled())\r
+ log.debug("Triggering watchEvent for change on " + watcher.getSubject());\r
+ boolean finish = !handler.handleWatchEvent(this, doclock);\r
+ doclock = null; // TODO: check that lock should really be released rather\r
+ // than dereferenced\r
+ if (finish)\r
+ haltWatch();\r
+ else\r
+ enableWatch();\r
+ handlerCalled = false;\r
}\r
- \r
+\r
/**\r
* @return the handler\r
*/\r
public WatcherCallBack getHandler() {\r
return handler;\r
}\r
+\r
/**\r
* @return the handlerCalled\r
*/\r
public boolean isHandlerCalled() {\r
return handlerCalled;\r
}\r
+\r
/**\r
* \r
* @return true if watcher is enabled\r
public boolean isWatchEnabled() {\r
return watchForChange;\r
}\r
+\r
/**\r
- * @param handler the handler to set\r
+ * @param handler\r
+ * the handler to set\r
*/\r
public void setHandler(WatcherCallBack handler) {\r
this.handler = handler;\r
}\r
+\r
/**\r
* @return the watcher\r
*/\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.objects;\r
\r
import uk.ac.vamsas.client.IClientDocument;\r
import uk.ac.vamsas.objects.core.*;\r
+\r
/**\r
- * Implements a depth first traversal over the document tree calling update handlers based on the Vobject.isUpdated() and Vobject.isNewInDocument() state at each backtrack.\r
+ * Implements a depth first traversal over the document tree calling update\r
+ * handlers based on the Vobject.isUpdated() and Vobject.isNewInDocument() state\r
+ * at each backtrack.\r
+ * \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class DocumentUpdaterEngine {\r
- private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(DocumentUpdaterEngine.class);\r
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getLog(DocumentUpdaterEngine.class);\r
+\r
private IDocumentUpdater handler;\r
+\r
/**\r
- * initialise the engine with an implementation\r
- * of the interface.\r
+ * initialise the engine with an implementation of the interface.\r
+ * \r
* @param hander\r
*/\r
public DocumentUpdaterEngine(IDocumentUpdater handler) {\r
super();\r
this.handler = handler;\r
}\r
+\r
/**\r
- * call the necessary update handlers at\r
- * each point on the VamsasDocument OM\r
- * TODO: later: Make this more elegant (use reflection and factor to single update(Object) method) ?\r
- * - we take the plodding, explicit approach rather than a funky generalised one here\r
+ * call the necessary update handlers at each point on the VamsasDocument OM\r
+ * TODO: later: Make this more elegant (use reflection and factor to single\r
+ * update(Object) method) ? - we take the plodding, explicit approach rather\r
+ * than a funky generalised one here\r
*/\r
public void callHandlers(IClientDocument cdoc) {\r
- if (cdoc==null) {\r
+ if (cdoc == null) {\r
log.debug("Null IClientDocument instance.");\r
return;\r
}\r
VAMSAS[] roots = cdoc.getVamsasRoots();\r
- if (roots!=null) {\r
- for (int r=0; r<roots.length; r++) {\r
+ if (roots != null) {\r
+ for (int r = 0; r < roots.length; r++) {\r
if (roots[r].isNewInDocument() || roots[r].isUpdated()) {\r
if (!updateRoot(roots[r])) {\r
log.debug("Calling handler(VAMSAS)");\r
// TODO: determine if the User, private or public appData has changed\r
log.debug("Finished.");\r
}\r
+\r
private boolean updateRoot(VAMSAS vamsas) {\r
- boolean called=false;\r
+ boolean called = false;\r
DataSet[] dset = vamsas.getDataSet();\r
- if (dset!=null) {\r
- for (int ds=0; ds<dset.length; ds++) {\r
+ if (dset != null) {\r
+ for (int ds = 0; ds < dset.length; ds++) {\r
if (dset[ds].isNewInDocument() || dset[ds].isUpdated()) {\r
if (!updateDataset(dset[ds])) {\r
log.debug("Calling handler(Dataset)");\r
handler.update(dset[ds]);\r
- called=true;\r
+ called = true;\r
}\r
}\r
}\r
}\r
return called;\r
}\r
+\r
private boolean updateDataset(DataSet set) {\r
- boolean called=false;\r
+ boolean called = false;\r
// Sequences\r
Sequence[] dseq = set.getSequence();\r
- if (dseq!=null) {\r
- for (int s=0;s<dseq.length; s++) {\r
+ if (dseq != null) {\r
+ for (int s = 0; s < dseq.length; s++) {\r
if (dseq[s].isNewInDocument() || dseq[s].isUpdated()) {\r
if (!updateSequence(dseq[s])) {\r
log.debug("Calling update(Sequence)");\r
handler.update(dseq[s]);\r
- called=true;\r
+ called = true;\r
}\r
}\r
}\r
}\r
// Annotations\r
- DataSetAnnotations[] dann=set.getDataSetAnnotations();\r
- if (dann!=null) {\r
- for (int a=0; a<dann.length; a++) {\r
+ DataSetAnnotations[] dann = set.getDataSetAnnotations();\r
+ if (dann != null) {\r
+ for (int a = 0; a < dann.length; a++) {\r
if (dann[a].isNewInDocument() || dann[a].isUpdated()) {\r
if (!updateDataSetAnnotation(dann[a])) {\r
log.debug("Calling update(DataSetAnnotation)");\r
handler.update(dann[a]);\r
- called=true;\r
+ called = true;\r
}\r
}\r
}\r
}\r
// Alignments\r
- Alignment[] al=set.getAlignment();\r
- if (al!=null) {\r
- for (int a=0;a<al.length;a++) {\r
+ Alignment[] al = set.getAlignment();\r
+ if (al != null) {\r
+ for (int a = 0; a < al.length; a++) {\r
if (al[a].isNewInDocument() || al[a].isUpdated()) {\r
if (!updateAlignment(al[a])) {\r
log.debug("Calling update(Alignment)");\r
handler.update(al[a]);\r
- called=true;\r
+ called = true;\r
}\r
}\r
}\r
}\r
// Trees associated with dataset sequences\r
if (updateTrees(set.getTree())) {\r
- called=true;\r
+ called = true;\r
}\r
return called;\r
}\r
+\r
private boolean updateTrees(Tree[] trees) {\r
- boolean called=false;\r
- if (trees!=null) {\r
- for (int t=0;t<trees.length; t++) {\r
+ boolean called = false;\r
+ if (trees != null) {\r
+ for (int t = 0; t < trees.length; t++) {\r
if (trees[t].isNewInDocument() || trees[t].isUpdated()) {\r
if (!updateTree(trees[t])) {\r
log.debug("Calling update(tree)");\r
handler.update(trees[t]);\r
- called=true;\r
+ called = true;\r
}\r
}\r
}\r
}\r
return called;\r
}\r
+\r
private boolean updateDataSetAnnotation(DataSetAnnotations annotations) {\r
- boolean called=false;\r
+ boolean called = false;\r
return called;\r
}\r
+\r
private boolean updateTree(Tree tree) {\r
// TODO: if (\r
return false;\r
}\r
+\r
private boolean updateAlignment(Alignment alignment) {\r
// TODO Auto-generated method stub\r
return false;\r
}\r
+\r
private boolean updateSequence(Sequence sequence) {\r
// TODO Auto-generated method stub\r
return false;\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.objects;\r
\r
import uk.ac.vamsas.objects.core.*;\r
\r
-public class EmptyDocumentUpdater implements IDocumentUpdater\r
-{\r
- public void update(Alignment vobj) {}\r
- \r
- public void update(AlignmentAnnotation vobj) {}\r
- \r
- public void update(AlignmentSequence vobj) {}\r
- \r
- public void update(AlignmentSequenceAnnotation vobj) {}\r
- \r
- public void update(AnnotationElement vobj) {}\r
- \r
- public void update(AppData vobj) {}\r
- \r
- public void update(ApplicationData vobj) {}\r
- \r
- public void update(Common vobj) {}\r
- \r
- public void update(DataSet vobj) {}\r
- \r
- public void update(DataSetAnnotations vobj) {}\r
- \r
- public void update(DbRef vobj) {}\r
- \r
- public void update(Entry vobj) {}\r
- \r
- public void update(Glyph vobj) {}\r
- \r
- public void update(Input vobj) {}\r
- \r
- public void update(Instance vobj) {}\r
- \r
- public void update(Link vobj) {}\r
- \r
- public void update(LockFile vobj) {}\r
- \r
- public void update(Map vobj) {}\r
- \r
- // TODO: replace with mapRangeType handler public void update(MapList vobj) {}\r
- \r
- public void update(SequenceMapping vobj) {}\r
- \r
- public void update(Newick vobj) {}\r
- \r
- public void update(Param vobj) {}\r
- \r
- public void update(Pos vobj) {}\r
- \r
- public void update(Property vobj) {}\r
- \r
- public void update(Provenance vobj) {}\r
- \r
- public void update(RangeAnnotation vobj) {}\r
- \r
- public void update(RangeType vobj) {}\r
- \r
- public void update(Score vobj) {}\r
- \r
- public void update(Seg vobj) {}\r
- \r
- public void update(Sequence vobj) {}\r
- \r
- public void update(SequenceType vobj) {}\r
- \r
- public void update(Tree vobj) {}\r
- \r
- public void update(User vobj) {}\r
- \r
- public void update(VAMSAS vobj) {}\r
- \r
- public void update(VamsasDocument vobj) {}\r
-}
\ No newline at end of file
+public class EmptyDocumentUpdater implements IDocumentUpdater {\r
+ public void update(Alignment vobj) {\r
+ }\r
+\r
+ public void update(AlignmentAnnotation vobj) {\r
+ }\r
+\r
+ public void update(AlignmentSequence vobj) {\r
+ }\r
+\r
+ public void update(AlignmentSequenceAnnotation vobj) {\r
+ }\r
+\r
+ public void update(AnnotationElement vobj) {\r
+ }\r
+\r
+ public void update(AppData vobj) {\r
+ }\r
+\r
+ public void update(ApplicationData vobj) {\r
+ }\r
+\r
+ public void update(Common vobj) {\r
+ }\r
+\r
+ public void update(DataSet vobj) {\r
+ }\r
+\r
+ public void update(DataSetAnnotations vobj) {\r
+ }\r
+\r
+ public void update(DbRef vobj) {\r
+ }\r
+\r
+ public void update(Entry vobj) {\r
+ }\r
+\r
+ public void update(Glyph vobj) {\r
+ }\r
+\r
+ public void update(Input vobj) {\r
+ }\r
+\r
+ public void update(Instance vobj) {\r
+ }\r
+\r
+ public void update(Link vobj) {\r
+ }\r
+\r
+ public void update(LockFile vobj) {\r
+ }\r
+\r
+ public void update(Map vobj) {\r
+ }\r
+\r
+ // TODO: replace with mapRangeType handler public void update(MapList vobj) {}\r
+\r
+ public void update(SequenceMapping vobj) {\r
+ }\r
+\r
+ public void update(Newick vobj) {\r
+ }\r
+\r
+ public void update(Param vobj) {\r
+ }\r
+\r
+ public void update(Pos vobj) {\r
+ }\r
+\r
+ public void update(Property vobj) {\r
+ }\r
+\r
+ public void update(Provenance vobj) {\r
+ }\r
+\r
+ public void update(RangeAnnotation vobj) {\r
+ }\r
+\r
+ public void update(RangeType vobj) {\r
+ }\r
+\r
+ public void update(Score vobj) {\r
+ }\r
+\r
+ public void update(Seg vobj) {\r
+ }\r
+\r
+ public void update(Sequence vobj) {\r
+ }\r
+\r
+ public void update(SequenceType vobj) {\r
+ }\r
+\r
+ public void update(Tree vobj) {\r
+ }\r
+\r
+ public void update(User vobj) {\r
+ }\r
+\r
+ public void update(VAMSAS vobj) {\r
+ }\r
+\r
+ public void update(VamsasDocument vobj) {\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.objects;\r
\r
import uk.ac.vamsas.objects.core.*;\r
\r
-public interface IDocumentUpdater\r
-{\r
- public void update(Alignment vobj);\r
- \r
- public void update(AlignmentAnnotation vobj);\r
- \r
- public void update(AlignmentSequence vobj);\r
- \r
- public void update(AlignmentSequenceAnnotation vobj);\r
- \r
- public void update(AnnotationElement vobj);\r
- \r
- public void update(AppData vobj);\r
- \r
- public void update(ApplicationData vobj);\r
- \r
- public void update(Common vobj);\r
- \r
- public void update(DataSet vobj);\r
- \r
- public void update(DataSetAnnotations vobj);\r
- \r
- public void update(DbRef vobj);\r
- \r
- public void update(Entry vobj);\r
- \r
- public void update(Glyph vobj);\r
- \r
- public void update(Input vobj);\r
- \r
- public void update(Instance vobj);\r
- \r
- public void update(Link vobj);\r
- \r
- public void update(LockFile vobj);\r
- \r
- public void update(Map vobj);\r
- \r
+public interface IDocumentUpdater {\r
+ public void update(Alignment vobj);\r
+\r
+ public void update(AlignmentAnnotation vobj);\r
+\r
+ public void update(AlignmentSequence vobj);\r
+\r
+ public void update(AlignmentSequenceAnnotation vobj);\r
+\r
+ public void update(AnnotationElement vobj);\r
+\r
+ public void update(AppData vobj);\r
+\r
+ public void update(ApplicationData vobj);\r
+\r
+ public void update(Common vobj);\r
+\r
+ public void update(DataSet vobj);\r
+\r
+ public void update(DataSetAnnotations vobj);\r
+\r
+ public void update(DbRef vobj);\r
+\r
+ public void update(Entry vobj);\r
+\r
+ public void update(Glyph vobj);\r
+\r
+ public void update(Input vobj);\r
+\r
+ public void update(Instance vobj);\r
+\r
+ public void update(Link vobj);\r
+\r
+ public void update(LockFile vobj);\r
+\r
+ public void update(Map vobj);\r
+\r
// TODO: replace with mapRangeType handler public void update(MapList vobj) {}\r
- \r
- public void update(SequenceMapping vobj);\r
- \r
- public void update(Newick vobj);\r
- \r
- public void update(Param vobj);\r
- \r
- public void update(Pos vobj);\r
- \r
- public void update(Property vobj);\r
- \r
- public void update(Provenance vobj);\r
- \r
- public void update(RangeAnnotation vobj);\r
- \r
- public void update(RangeType vobj);\r
- \r
- public void update(Score vobj);\r
- \r
- public void update(Seg vobj);\r
- \r
- public void update(Sequence vobj);\r
- \r
- public void update(SequenceType vobj);\r
- \r
- public void update(Tree vobj);\r
- \r
- public void update(User vobj);\r
- \r
- public void update(VAMSAS vobj);\r
- \r
- public void update(VamsasDocument vobj);\r
-}
\ No newline at end of file
+\r
+ public void update(SequenceMapping vobj);\r
+\r
+ public void update(Newick vobj);\r
+\r
+ public void update(Param vobj);\r
+\r
+ public void update(Pos vobj);\r
+\r
+ public void update(Property vobj);\r
+\r
+ public void update(Provenance vobj);\r
+\r
+ public void update(RangeAnnotation vobj);\r
+\r
+ public void update(RangeType vobj);\r
+\r
+ public void update(Score vobj);\r
+\r
+ public void update(Seg vobj);\r
+\r
+ public void update(Sequence vobj);\r
+\r
+ public void update(SequenceType vobj);\r
+\r
+ public void update(Tree vobj);\r
+\r
+ public void update(User vobj);\r
+\r
+ public void update(VAMSAS vobj);\r
+\r
+ public void update(VamsasDocument vobj);\r
+}\r
-/**\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
* \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package uk.ac.vamsas.objects;\r
\r
import uk.ac.vamsas.client.VorbaId;\r
\r
/**\r
- * Provides methods to map between VorbaIds and arbitrary object references\r
- * for use by a vamsas Application when moving between its own datamodel and the\r
- * Vamsas session objects.\r
- * The implementing class needs a valid client-document instance if it is expected\r
- * to be able to register newly created vObjects. Normally this will be the case if\r
- * the implementing class has been generated by an IClient implementation which will\r
- * also have passed it a reference to the current valid IClientDocument instance for\r
- * that application's document access thread. \r
- * TODO: add remove/clear binding functions - currently you can just pass a null\r
- * to either argument for bindAppsObjectToVamsasObject to remove the binding from memory. \r
+ * Provides methods to map between VorbaIds and arbitrary object references for\r
+ * use by a vamsas Application when moving between its own datamodel and the\r
+ * Vamsas session objects. The implementing class needs a valid client-document\r
+ * instance if it is expected to be able to register newly created vObjects.\r
+ * Normally this will be the case if the implementing class has been generated\r
+ * by an IClient implementation which will also have passed it a reference to\r
+ * the current valid IClientDocument instance for that application's document\r
+ * access thread. TODO: add remove/clear binding functions - currently you can\r
+ * just pass a null to either argument for bindAppsObjectToVamsasObject to\r
+ * remove the binding from memory.\r
+ * \r
* @author JimP\r
* \r
*/\r
public interface IVorbaBinding {\r
-/**\r
- * get the Vamsas session object bound to an internal object.\r
- * @param appObject\r
- * @return valid session object or Null.\r
- */\r
+ /**\r
+ * get the Vamsas session object bound to an internal object.\r
+ * \r
+ * @param appObject\r
+ * @return valid session object or Null.\r
+ */\r
Vobject getVamsasObjectFor(Object appObject);\r
+\r
/**\r
* Get the Application's own object bound to an existing Vamsas session object\r
- * @param vObject - object in vamsas document\r
+ * \r
+ * @param vObject\r
+ * - object in vamsas document\r
* @return apps object bound to the vamsas document object\r
*/\r
Object getAppsObjectFor(uk.ac.vamsas.client.Vobject vObject);\r
\r
/**\r
- * Record a mapping between a vamsas document object and an application's internal object.\r
- * If either appObject or vObject parameters are null then any existing \r
- * binding to the non-null object will be deleted\r
+ * Record a mapping between a vamsas document object and an application's\r
+ * internal object. If either appObject or vObject parameters are null then\r
+ * any existing binding to the non-null object will be deleted\r
+ * \r
* @param appObject\r
- * @param vObject - if newly created then it will be registered using the uk.ac.vamsas.client.IClientDocument.registerObject method.\r
+ * @param vObject\r
+ * - if newly created then it will be registered using the\r
+ * uk.ac.vamsas.client.IClientDocument.registerObject method.\r
*/\r
- void bindAppsObjectToVamsasObject(Object appObject, uk.ac.vamsas.client.Vobject vObject);\r
+ void bindAppsObjectToVamsasObject(Object appObject,\r
+ uk.ac.vamsas.client.Vobject vObject);\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class Alignment.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class Alignment extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _gapChar.
- */
- private java.lang.String _gapChar;
-
- /**
- * Field _aligned.
- */
- private boolean _aligned;
-
- /**
- * keeps track of state for field: _aligned
- */
- private boolean _has_aligned;
-
- /**
- * Primary Key for vamsas object referencing
- *
- */
- private java.lang.String _id;
-
- /**
- * Field _modifiable.
- */
- private java.lang.String _modifiable;
-
- /**
- * This is annotation over the coordinate frame
- * defined by all the columns in the alignment.
- *
- */
- private java.util.Vector _alignmentAnnotationList;
-
- /**
- * Field _treeList.
- */
- private java.util.Vector _treeList;
-
- /**
- * Field _alignmentSequenceList.
- */
- private java.util.Vector _alignmentSequenceList;
-
- /**
- * typical properties may be additional
- * alignment score objects
- */
- private java.util.Vector _propertyList;
-
- /**
- * Field _provenance.
- */
- private uk.ac.vamsas.objects.core.Provenance _provenance;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Alignment() {
- super();
- this._alignmentAnnotationList = new java.util.Vector();
- this._treeList = new java.util.Vector();
- this._alignmentSequenceList = new java.util.Vector();
- this._propertyList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAlignmentAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignmentAnnotation(
- final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentAnnotationList.addElement(vAlignmentAnnotation);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignmentAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignmentAnnotation(
- final int index,
- final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentAnnotationList.add(index, vAlignmentAnnotation);
- }
-
- /**
- *
- *
- * @param vAlignmentSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignmentSequence(
- final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentSequenceList.addElement(vAlignmentSequence);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignmentSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignmentSequence(
- final int index,
- final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentSequenceList.add(index, vAlignmentSequence);
- }
-
- /**
- *
- *
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.addElement(vProperty);
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.add(index, vProperty);
- }
-
- /**
- *
- *
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.addElement(vTree);
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final int index,
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.add(index, vTree);
- }
-
- /**
- */
- public void deleteAligned(
- ) {
- this._has_aligned= false;
- }
-
- /**
- * Method enumerateAlignmentAnnotation.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.AlignmentAnnotation elements
- */
- public java.util.Enumeration enumerateAlignmentAnnotation(
- ) {
- return this._alignmentAnnotationList.elements();
- }
-
- /**
- * Method enumerateAlignmentSequence.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.AlignmentSequence elements
- */
- public java.util.Enumeration enumerateAlignmentSequence(
- ) {
- return this._alignmentSequenceList.elements();
- }
-
- /**
- * Method enumerateProperty.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Property elements
- */
- public java.util.Enumeration enumerateProperty(
- ) {
- return this._propertyList.elements();
- }
-
- /**
- * Method enumerateTree.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Tree elements
- */
- public java.util.Enumeration enumerateTree(
- ) {
- return this._treeList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class Alignment extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _gapChar.
+ */
+ private java.lang.String _gapChar;
+
+ /**
+ * Field _aligned.
+ */
+ private boolean _aligned;
+
+ /**
+ * keeps track of state for field: _aligned
+ */
+ private boolean _has_aligned;
+
+ /**
+ * Primary Key for vamsas object referencing
+ *
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _modifiable.
+ */
+ private java.lang.String _modifiable;
+
+ /**
+ * This is annotation over the coordinate frame defined by all the columns in
+ * the alignment.
+ *
+ */
+ private java.util.Vector _alignmentAnnotationList;
+
+ /**
+ * Field _treeList.
+ */
+ private java.util.Vector _treeList;
+
+ /**
+ * Field _alignmentSequenceList.
+ */
+ private java.util.Vector _alignmentSequenceList;
+
+ /**
+ * typical properties may be additional alignment score objects
+ */
+ private java.util.Vector _propertyList;
+
+ /**
+ * Field _provenance.
+ */
+ private uk.ac.vamsas.objects.core.Provenance _provenance;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Alignment() {
+ super();
+ this._alignmentAnnotationList = new java.util.Vector();
+ this._treeList = new java.util.Vector();
+ this._alignmentSequenceList = new java.util.Vector();
+ this._propertyList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAlignmentAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignmentAnnotation(
+ final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentAnnotationList.addElement(vAlignmentAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignmentAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignmentAnnotation(final int index,
+ final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentAnnotationList.add(index, vAlignmentAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param vAlignmentSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignmentSequence(
+ final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentSequenceList.addElement(vAlignmentSequence);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignmentSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignmentSequence(final int index,
+ final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentSequenceList.add(index, vAlignmentSequence);
+ }
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treeList.addElement(vTree);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final int index,
+ final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treeList.add(index, vTree);
+ }
+
+ /**
+ */
+ public void deleteAligned() {
+ this._has_aligned = false;
+ }
+
+ /**
+ * Method enumerateAlignmentAnnotation.
+ *
+ * @return an Enumeration over all
+ * uk.ac.vamsas.objects.core.AlignmentAnnotation elements
+ */
+ public java.util.Enumeration enumerateAlignmentAnnotation() {
+ return this._alignmentAnnotationList.elements();
+ }
+
+ /**
+ * Method enumerateAlignmentSequence.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.AlignmentSequence
+ * elements
+ */
+ public java.util.Enumeration enumerateAlignmentSequence() {
+ return this._alignmentSequenceList.elements();
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
+ */
+ public java.util.Enumeration enumerateProperty() {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Method enumerateTree.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Tree elements
+ */
+ public java.util.Enumeration enumerateTree() {
+ return this._treeList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof Alignment) {
+
+ Alignment temp = (Alignment) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._gapChar != null) {
+ if (temp._gapChar == null)
+ return false;
+ if (this._gapChar != temp._gapChar) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._gapChar);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._gapChar);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
+ }
+ ;
return false;
-
- if (obj instanceof Alignment) {
-
- Alignment temp = (Alignment)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._gapChar != null) {
- if (temp._gapChar == null) return false;
- if (this._gapChar != temp._gapChar) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._gapChar);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._gapChar);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar); };
- return false;
- }
- if (!thcycle) {
- if (!this._gapChar.equals(temp._gapChar)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
- }
- }
- } else if (temp._gapChar != null)
- return false;
- if (this._aligned != temp._aligned)
- return false;
- if (this._has_aligned != temp._has_aligned)
- return false;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._modifiable != null) {
- if (temp._modifiable == null) return false;
- if (this._modifiable != temp._modifiable) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };
- return false;
- }
- if (!thcycle) {
- if (!this._modifiable.equals(temp._modifiable)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- }
- }
- } else if (temp._modifiable != null)
- return false;
- if (this._alignmentAnnotationList != null) {
- if (temp._alignmentAnnotationList == null) return false;
- if (this._alignmentAnnotationList != temp._alignmentAnnotationList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._alignmentAnnotationList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._alignmentAnnotationList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentAnnotationList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentAnnotationList); };
- return false;
- }
- if (!thcycle) {
- if (!this._alignmentAnnotationList.equals(temp._alignmentAnnotationList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentAnnotationList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentAnnotationList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentAnnotationList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentAnnotationList);
- }
- }
- } else if (temp._alignmentAnnotationList != null)
- return false;
- if (this._treeList != null) {
- if (temp._treeList == null) return false;
- if (this._treeList != temp._treeList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._treeList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._treeList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList); };
- return false;
- }
- if (!thcycle) {
- if (!this._treeList.equals(temp._treeList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
- }
- }
- } else if (temp._treeList != null)
- return false;
- if (this._alignmentSequenceList != null) {
- if (temp._alignmentSequenceList == null) return false;
- if (this._alignmentSequenceList != temp._alignmentSequenceList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._alignmentSequenceList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._alignmentSequenceList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceList); };
- return false;
- }
- if (!thcycle) {
- if (!this._alignmentSequenceList.equals(temp._alignmentSequenceList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceList);
- }
- }
- } else if (temp._alignmentSequenceList != null)
- return false;
- if (this._propertyList != null) {
- if (temp._propertyList == null) return false;
- if (this._propertyList != temp._propertyList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };
- return false;
- }
- if (!thcycle) {
- if (!this._propertyList.equals(temp._propertyList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- }
- }
- } else if (temp._propertyList != null)
- return false;
- if (this._provenance != null) {
- if (temp._provenance == null) return false;
- if (this._provenance != temp._provenance) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };
- return false;
- }
- if (!thcycle) {
- if (!this._provenance.equals(temp._provenance)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- }
- }
- } else if (temp._provenance != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._gapChar.equals(temp._gapChar)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._gapChar);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._gapChar);
+ }
}
+ } else if (temp._gapChar != null)
return false;
- }
-
- /**
- * Returns the value of field 'aligned'.
- *
- * @return the value of field 'Aligned'.
- */
- public boolean getAligned(
- ) {
- return this._aligned;
- }
-
- /**
- * Method getAlignmentAnnotation.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * uk.ac.vamsas.objects.core.AlignmentAnnotation at the given
- * index
- */
- public uk.ac.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentAnnotationList.size()) {
- throw new IndexOutOfBoundsException("getAlignmentAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentAnnotationList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.get(index);
- }
-
- /**
- * Method getAlignmentAnnotation.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation(
- ) {
- uk.ac.vamsas.objects.core.AlignmentAnnotation[] array = new uk.ac.vamsas.objects.core.AlignmentAnnotation[0];
- return (uk.ac.vamsas.objects.core.AlignmentAnnotation[]) this._alignmentAnnotationList.toArray(array);
- }
-
- /**
- * Method getAlignmentAnnotationAsReference.Returns a reference
- * to '_alignmentAnnotationList'. No type checking is performed
- * on any modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getAlignmentAnnotationAsReference(
- ) {
- return this._alignmentAnnotationList;
- }
-
- /**
- * Method getAlignmentAnnotationCount.
- *
- * @return the size of this collection
- */
- public int getAlignmentAnnotationCount(
- ) {
- return this._alignmentAnnotationList.size();
- }
-
- /**
- * Method getAlignmentSequence.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * uk.ac.vamsas.objects.core.AlignmentSequence at the given inde
- */
- public uk.ac.vamsas.objects.core.AlignmentSequence getAlignmentSequence(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentSequenceList.size()) {
- throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.get(index);
- }
-
- /**
- * Method getAlignmentSequence.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence(
- ) {
- uk.ac.vamsas.objects.core.AlignmentSequence[] array = new uk.ac.vamsas.objects.core.AlignmentSequence[0];
- return (uk.ac.vamsas.objects.core.AlignmentSequence[]) this._alignmentSequenceList.toArray(array);
- }
-
- /**
- * Method getAlignmentSequenceAsReference.Returns a reference
- * to '_alignmentSequenceList'. No type checking is performed
- * on any modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getAlignmentSequenceAsReference(
- ) {
- return this._alignmentSequenceList;
- }
-
- /**
- * Method getAlignmentSequenceCount.
- *
- * @return the size of this collection
- */
- public int getAlignmentSequenceCount(
- ) {
- return this._alignmentSequenceList.size();
- }
-
- /**
- * Returns the value of field 'gapChar'.
- *
- * @return the value of field 'GapChar'.
- */
- public java.lang.String getGapChar(
- ) {
- return this._gapChar;
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'modifiable'.
- *
- * @return the value of field 'Modifiable'.
- */
- public java.lang.String getModifiable(
- ) {
- return this._modifiable;
- }
-
- /**
- * Method getProperty.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Property
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Property getProperty(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
- }
-
- /**
- * Method getProperty.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Property[] getProperty(
- ) {
- uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
- return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
- }
-
- /**
- * Method getPropertyAsReference.Returns a reference to
- * '_propertyList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getPropertyAsReference(
- ) {
- return this._propertyList;
- }
-
- /**
- * Method getPropertyCount.
- *
- * @return the size of this collection
- */
- public int getPropertyCount(
- ) {
- return this._propertyList.size();
- }
-
- /**
- * Returns the value of field 'provenance'.
- *
- * @return the value of field 'Provenance'.
- */
- public uk.ac.vamsas.objects.core.Provenance getProvenance(
- ) {
- return this._provenance;
- }
-
- /**
- * Method getTree.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Tree at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Tree getTree(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
- }
-
- /**
- * Method getTree.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Tree[] getTree(
- ) {
- uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
- return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
- }
-
- /**
- * Method getTreeAsReference.Returns a reference to
- * '_treeList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getTreeAsReference(
- ) {
- return this._treeList;
- }
-
- /**
- * Method getTreeCount.
- *
- * @return the size of this collection
- */
- public int getTreeCount(
- ) {
- return this._treeList.size();
- }
-
- /**
- * Method hasAligned.
- *
- * @return true if at least one Aligned has been added
- */
- public boolean hasAligned(
- ) {
- return this._has_aligned;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_gapChar != null
- && !org.castor.util.CycleBreaker.startingToCycle(_gapChar)) {
- result = 37 * result + _gapChar.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_gapChar);
- }
- result = 37 * result + (_aligned?0:1);
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_modifiable != null
- && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
- result = 37 * result + _modifiable.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
- }
- if (_alignmentAnnotationList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_alignmentAnnotationList)) {
- result = 37 * result + _alignmentAnnotationList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentAnnotationList);
- }
- if (_treeList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
- result = 37 * result + _treeList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
- }
- if (_alignmentSequenceList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_alignmentSequenceList)) {
- result = 37 * result + _alignmentSequenceList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentSequenceList);
- }
- if (_propertyList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
- result = 37 * result + _propertyList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
- }
- if (_provenance != null
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
- result = 37 * result + _provenance.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
- }
-
- return result;
- }
-
- /**
- * Returns the value of field 'aligned'.
- *
- * @return the value of field 'Aligned'.
- */
- public boolean isAligned(
- ) {
- return this._aligned;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._aligned != temp._aligned)
+ return false;
+ if (this._has_aligned != temp._has_aligned)
+ return false;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Method removeAlignmentAnnotation.
- *
- * @param vAlignmentAnnotation
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlignmentAnnotation(
- final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation) {
- boolean removed = _alignmentAnnotationList.remove(vAlignmentAnnotation);
- return removed;
- }
-
- /**
- * Method removeAlignmentAnnotationAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotationAt(
- final int index) {
- java.lang.Object obj = this._alignmentAnnotationList.remove(index);
- return (uk.ac.vamsas.objects.core.AlignmentAnnotation) obj;
- }
-
- /**
- * Method removeAlignmentSequence.
- *
- * @param vAlignmentSequence
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlignmentSequence(
- final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence) {
- boolean removed = _alignmentSequenceList.remove(vAlignmentSequence);
- return removed;
- }
-
- /**
- * Method removeAlignmentSequenceAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.AlignmentSequence removeAlignmentSequenceAt(
- final int index) {
- java.lang.Object obj = this._alignmentSequenceList.remove(index);
- return (uk.ac.vamsas.objects.core.AlignmentSequence) obj;
- }
-
- /**
- */
- public void removeAllAlignmentAnnotation(
- ) {
- this._alignmentAnnotationList.clear();
- }
-
- /**
- */
- public void removeAllAlignmentSequence(
- ) {
- this._alignmentSequenceList.clear();
- }
-
- /**
- */
- public void removeAllProperty(
- ) {
- this._propertyList.clear();
- }
-
- /**
- */
- public void removeAllTree(
- ) {
- this._treeList.clear();
- }
-
- /**
- * Method removeProperty.
- *
- * @param vProperty
- * @return true if the object was removed from the collection.
- */
- public boolean removeProperty(
- final uk.ac.vamsas.objects.core.Property vProperty) {
- boolean removed = _propertyList.remove(vProperty);
- return removed;
- }
-
- /**
- * Method removePropertyAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Property removePropertyAt(
- final int index) {
- java.lang.Object obj = this._propertyList.remove(index);
- return (uk.ac.vamsas.objects.core.Property) obj;
- }
-
- /**
- * Method removeTree.
- *
- * @param vTree
- * @return true if the object was removed from the collection.
- */
- public boolean removeTree(
- final uk.ac.vamsas.objects.core.Tree vTree) {
- boolean removed = _treeList.remove(vTree);
- return removed;
- }
-
- /**
- * Method removeTreeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Tree removeTreeAt(
- final int index) {
- java.lang.Object obj = this._treeList.remove(index);
- return (uk.ac.vamsas.objects.core.Tree) obj;
- }
-
- /**
- * Sets the value of field 'aligned'.
- *
- * @param aligned the value of field 'aligned'.
- */
- public void setAligned(
- final boolean aligned) {
- this._aligned = aligned;
- this._has_aligned = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignmentAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAlignmentAnnotation(
- final int index,
- final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentAnnotationList.size()) {
- throw new IndexOutOfBoundsException("setAlignmentAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentAnnotationList.size() - 1) + "]");
- }
-
- this._alignmentAnnotationList.set(index, vAlignmentAnnotation);
- }
-
- /**
- *
- *
- * @param vAlignmentAnnotationArray
- */
- public void setAlignmentAnnotation(
- final uk.ac.vamsas.objects.core.AlignmentAnnotation[] vAlignmentAnnotationArray) {
- //-- copy array
- _alignmentAnnotationList.clear();
-
- for (int i = 0; i < vAlignmentAnnotationArray.length; i++) {
- this._alignmentAnnotationList.add(vAlignmentAnnotationArray[i]);
- }
- }
-
- /**
- * Sets the value of '_alignmentAnnotationList' by copying the
- * given Vector. All elements will be checked for type safety.
- *
- * @param vAlignmentAnnotationList the Vector to copy.
- */
- public void setAlignmentAnnotation(
- final java.util.Vector vAlignmentAnnotationList) {
- // copy vector
- this._alignmentAnnotationList.clear();
-
- this._alignmentAnnotationList.addAll(vAlignmentAnnotationList);
- }
-
- /**
- * Sets the value of '_alignmentAnnotationList' by setting it
- * to the given Vector. No type checking is performed.
- * @deprecated
- *
- * @param alignmentAnnotationVector the Vector to set.
- */
- public void setAlignmentAnnotationAsReference(
- final java.util.Vector alignmentAnnotationVector) {
- this._alignmentAnnotationList = alignmentAnnotationVector;
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignmentSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAlignmentSequence(
- final int index,
- final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentSequenceList.size()) {
- throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceList.size() - 1) + "]");
+ } else if (temp._id != null)
+ return false;
+ if (this._modifiable != null) {
+ if (temp._modifiable == null)
+ return false;
+ if (this._modifiable != temp._modifiable) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._modifiable);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._modifiable);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._modifiable.equals(temp._modifiable)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
}
-
- this._alignmentSequenceList.set(index, vAlignmentSequence);
- }
-
- /**
- *
- *
- * @param vAlignmentSequenceArray
- */
- public void setAlignmentSequence(
- final uk.ac.vamsas.objects.core.AlignmentSequence[] vAlignmentSequenceArray) {
- //-- copy array
- _alignmentSequenceList.clear();
-
- for (int i = 0; i < vAlignmentSequenceArray.length; i++) {
- this._alignmentSequenceList.add(vAlignmentSequenceArray[i]);
+ } else if (temp._modifiable != null)
+ return false;
+ if (this._alignmentAnnotationList != null) {
+ if (temp._alignmentAnnotationList == null)
+ return false;
+ if (this._alignmentAnnotationList != temp._alignmentAnnotationList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._alignmentAnnotationList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._alignmentAnnotationList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentAnnotationList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentAnnotationList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._alignmentAnnotationList
+ .equals(temp._alignmentAnnotationList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentAnnotationList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentAnnotationList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentAnnotationList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentAnnotationList);
+ }
}
- }
-
- /**
- * Sets the value of '_alignmentSequenceList' by copying the
- * given Vector. All elements will be checked for type safety.
- *
- * @param vAlignmentSequenceList the Vector to copy.
- */
- public void setAlignmentSequence(
- final java.util.Vector vAlignmentSequenceList) {
- // copy vector
- this._alignmentSequenceList.clear();
-
- this._alignmentSequenceList.addAll(vAlignmentSequenceList);
- }
-
- /**
- * Sets the value of '_alignmentSequenceList' by setting it to
- * the given Vector. No type checking is performed.
- * @deprecated
- *
- * @param alignmentSequenceVector the Vector to set.
- */
- public void setAlignmentSequenceAsReference(
- final java.util.Vector alignmentSequenceVector) {
- this._alignmentSequenceList = alignmentSequenceVector;
- }
-
- /**
- * Sets the value of field 'gapChar'.
- *
- * @param gapChar the value of field 'gapChar'.
- */
- public void setGapChar(
- final java.lang.String gapChar) {
- this._gapChar = gapChar;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'modifiable'.
- *
- * @param modifiable the value of field 'modifiable'.
- */
- public void setModifiable(
- final java.lang.String modifiable) {
- this._modifiable = modifiable;
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
+ } else if (temp._alignmentAnnotationList != null)
+ return false;
+ if (this._treeList != null) {
+ if (temp._treeList == null)
+ return false;
+ if (this._treeList != temp._treeList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._treeList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._treeList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._treeList.equals(temp._treeList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ }
}
-
- this._propertyList.set(index, vProperty);
- }
-
- /**
- *
- *
- * @param vPropertyArray
- */
- public void setProperty(
- final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
- //-- copy array
- _propertyList.clear();
-
- for (int i = 0; i < vPropertyArray.length; i++) {
- this._propertyList.add(vPropertyArray[i]);
+ } else if (temp._treeList != null)
+ return false;
+ if (this._alignmentSequenceList != null) {
+ if (temp._alignmentSequenceList == null)
+ return false;
+ if (this._alignmentSequenceList != temp._alignmentSequenceList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._alignmentSequenceList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._alignmentSequenceList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentSequenceList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentSequenceList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._alignmentSequenceList
+ .equals(temp._alignmentSequenceList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentSequenceList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentSequenceList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentSequenceList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentSequenceList);
+ }
}
- }
-
- /**
- * Sets the value of '_propertyList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vPropertyList the Vector to copy.
- */
- public void setProperty(
- final java.util.Vector vPropertyList) {
- // copy vector
- this._propertyList.clear();
-
- this._propertyList.addAll(vPropertyList);
- }
-
- /**
- * Sets the value of '_propertyList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param propertyVector the Vector to set.
- */
- public void setPropertyAsReference(
- final java.util.Vector propertyVector) {
- this._propertyList = propertyVector;
- }
-
- /**
- * Sets the value of field 'provenance'.
- *
- * @param provenance the value of field 'provenance'.
- */
- public void setProvenance(
- final uk.ac.vamsas.objects.core.Provenance provenance) {
- this._provenance = provenance;
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setTree(
- final int index,
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ } else if (temp._alignmentSequenceList != null)
+ return false;
+ if (this._propertyList != null) {
+ if (temp._propertyList == null)
+ return false;
+ if (this._propertyList != temp._propertyList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._propertyList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._propertyList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._propertyList.equals(temp._propertyList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
+ }
}
-
- this._treeList.set(index, vTree);
- }
-
- /**
- *
- *
- * @param vTreeArray
- */
- public void setTree(
- final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
- //-- copy array
- _treeList.clear();
-
- for (int i = 0; i < vTreeArray.length; i++) {
- this._treeList.add(vTreeArray[i]);
+ } else if (temp._propertyList != null)
+ return false;
+ if (this._provenance != null) {
+ if (temp._provenance == null)
+ return false;
+ if (this._provenance != temp._provenance) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._provenance);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._provenance);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._provenance.equals(temp._provenance)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
}
- }
-
- /**
- * Sets the value of '_treeList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vTreeList the Vector to copy.
- */
- public void setTree(
- final java.util.Vector vTreeList) {
- // copy vector
- this._treeList.clear();
-
- this._treeList.addAll(vTreeList);
- }
-
- /**
- * Sets the value of '_treeList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param treeVector the Vector to set.
- */
- public void setTreeAsReference(
- final java.util.Vector treeVector) {
- this._treeList = treeVector;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.Alignment
- */
- public static uk.ac.vamsas.objects.core.Alignment unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Alignment.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ } else if (temp._provenance != null)
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'aligned'.
+ *
+ * @return the value of field 'Aligned'.
+ */
+ public boolean getAligned() {
+ return this._aligned;
+ }
+
+ /**
+ * Method getAlignmentAnnotation.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.AlignmentAnnotation at
+ * the given index
+ */
+ public uk.ac.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(
+ final int index) throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentAnnotationList.size()) {
+ throw new IndexOutOfBoundsException(
+ "getAlignmentAnnotation: Index value '" + index
+ + "' not in range [0.."
+ + (this._alignmentAnnotationList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList
+ .get(index);
+ }
+
+ /**
+ * Method getAlignmentAnnotation.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation() {
+ uk.ac.vamsas.objects.core.AlignmentAnnotation[] array = new uk.ac.vamsas.objects.core.AlignmentAnnotation[0];
+ return (uk.ac.vamsas.objects.core.AlignmentAnnotation[]) this._alignmentAnnotationList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAlignmentAnnotationAsReference.Returns a reference to
+ * '_alignmentAnnotationList'. No type checking is performed on any
+ * modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getAlignmentAnnotationAsReference() {
+ return this._alignmentAnnotationList;
+ }
+
+ /**
+ * Method getAlignmentAnnotationCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlignmentAnnotationCount() {
+ return this._alignmentAnnotationList.size();
+ }
+
+ /**
+ * Method getAlignmentSequence.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.AlignmentSequence at the
+ * given inde
+ */
+ public uk.ac.vamsas.objects.core.AlignmentSequence getAlignmentSequence(
+ final int index) throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentSequenceList.size()) {
+ throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"
+ + index + "' not in range [0.."
+ + (this._alignmentSequenceList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList
+ .get(index);
+ }
+
+ /**
+ * Method getAlignmentSequence.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() {
+ uk.ac.vamsas.objects.core.AlignmentSequence[] array = new uk.ac.vamsas.objects.core.AlignmentSequence[0];
+ return (uk.ac.vamsas.objects.core.AlignmentSequence[]) this._alignmentSequenceList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAlignmentSequenceAsReference.Returns a reference to
+ * '_alignmentSequenceList'. No type checking is performed on any
+ * modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getAlignmentSequenceAsReference() {
+ return this._alignmentSequenceList;
+ }
+
+ /**
+ * Method getAlignmentSequenceCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlignmentSequenceCount() {
+ return this._alignmentSequenceList.size();
+ }
+
+ /**
+ * Returns the value of field 'gapChar'.
+ *
+ * @return the value of field 'GapChar'.
+ */
+ public java.lang.String getGapChar() {
+ return this._gapChar;
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'modifiable'.
+ *
+ * @return the value of field 'Modifiable'.
+ */
+ public java.lang.String getModifiable() {
+ return this._modifiable;
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Property at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("getProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Property[] getProperty() {
+ uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
+ return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getPropertyAsReference() {
+ return this._propertyList;
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount() {
+ return this._propertyList.size();
+ }
+
+ /**
+ * Returns the value of field 'provenance'.
+ *
+ * @return the value of field 'Provenance'.
+ */
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {
+ return this._provenance;
+ }
+
+ /**
+ * Method getTree.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Tree at the given index
+ */
+ public uk.ac.vamsas.objects.core.Tree getTree(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size()) {
+ throw new IndexOutOfBoundsException("getTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
+ }
+
+ /**
+ * Method getTree.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Tree[] getTree() {
+ uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
+ return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
+ }
+
+ /**
+ * Method getTreeAsReference.Returns a reference to '_treeList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getTreeAsReference() {
+ return this._treeList;
+ }
+
+ /**
+ * Method getTreeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreeCount() {
+ return this._treeList.size();
+ }
+
+ /**
+ * Method hasAligned.
+ *
+ * @return true if at least one Aligned has been added
+ */
+ public boolean hasAligned() {
+ return this._has_aligned;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_gapChar != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_gapChar)) {
+ result = 37 * result + _gapChar.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_gapChar);
+ }
+ result = 37 * result + (_aligned ? 0 : 1);
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
+ }
+ if (_modifiable != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
+ result = 37 * result + _modifiable.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
+ }
+ if (_alignmentAnnotationList != null
+ && !org.castor.util.CycleBreaker
+ .startingToCycle(_alignmentAnnotationList)) {
+ result = 37 * result + _alignmentAnnotationList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentAnnotationList);
+ }
+ if (_treeList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
+ result = 37 * result + _treeList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
+ }
+ if (_alignmentSequenceList != null
+ && !org.castor.util.CycleBreaker
+ .startingToCycle(_alignmentSequenceList)) {
+ result = 37 * result + _alignmentSequenceList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentSequenceList);
+ }
+ if (_propertyList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
+ result = 37 * result + _propertyList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
+ }
+ if (_provenance != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
+ result = 37 * result + _provenance.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the value of field 'aligned'.
+ *
+ * @return the value of field 'Aligned'.
+ */
+ public boolean isAligned() {
+ return this._aligned;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Method removeAlignmentAnnotation.
+ *
+ * @param vAlignmentAnnotation
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlignmentAnnotation(
+ final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation) {
+ boolean removed = _alignmentAnnotationList.remove(vAlignmentAnnotation);
+ return removed;
+ }
+
+ /**
+ * Method removeAlignmentAnnotationAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotationAt(
+ final int index) {
+ java.lang.Object obj = this._alignmentAnnotationList.remove(index);
+ return (uk.ac.vamsas.objects.core.AlignmentAnnotation) obj;
+ }
+
+ /**
+ * Method removeAlignmentSequence.
+ *
+ * @param vAlignmentSequence
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlignmentSequence(
+ final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence) {
+ boolean removed = _alignmentSequenceList.remove(vAlignmentSequence);
+ return removed;
+ }
+
+ /**
+ * Method removeAlignmentSequenceAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.AlignmentSequence removeAlignmentSequenceAt(
+ final int index) {
+ java.lang.Object obj = this._alignmentSequenceList.remove(index);
+ return (uk.ac.vamsas.objects.core.AlignmentSequence) obj;
+ }
+
+ /**
+ */
+ public void removeAllAlignmentAnnotation() {
+ this._alignmentAnnotationList.clear();
+ }
+
+ /**
+ */
+ public void removeAllAlignmentSequence() {
+ this._alignmentSequenceList.clear();
+ }
+
+ /**
+ */
+ public void removeAllProperty() {
+ this._propertyList.clear();
+ }
+
+ /**
+ */
+ public void removeAllTree() {
+ this._treeList.clear();
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(
+ final uk.ac.vamsas.objects.core.Property vProperty) {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (uk.ac.vamsas.objects.core.Property) obj;
+ }
+
+ /**
+ * Method removeTree.
+ *
+ * @param vTree
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTree(final uk.ac.vamsas.objects.core.Tree vTree) {
+ boolean removed = _treeList.remove(vTree);
+ return removed;
+ }
+
+ /**
+ * Method removeTreeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Tree removeTreeAt(final int index) {
+ java.lang.Object obj = this._treeList.remove(index);
+ return (uk.ac.vamsas.objects.core.Tree) obj;
+ }
+
+ /**
+ * Sets the value of field 'aligned'.
+ *
+ * @param aligned
+ * the value of field 'aligned'.
+ */
+ public void setAligned(final boolean aligned) {
+ this._aligned = aligned;
+ this._has_aligned = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignmentAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlignmentAnnotation(final int index,
+ final uk.ac.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentAnnotationList.size()) {
+ throw new IndexOutOfBoundsException(
+ "setAlignmentAnnotation: Index value '" + index
+ + "' not in range [0.."
+ + (this._alignmentAnnotationList.size() - 1) + "]");
+ }
+
+ this._alignmentAnnotationList.set(index, vAlignmentAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param vAlignmentAnnotationArray
+ */
+ public void setAlignmentAnnotation(
+ final uk.ac.vamsas.objects.core.AlignmentAnnotation[] vAlignmentAnnotationArray) {
+ // -- copy array
+ _alignmentAnnotationList.clear();
+
+ for (int i = 0; i < vAlignmentAnnotationArray.length; i++) {
+ this._alignmentAnnotationList.add(vAlignmentAnnotationArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_alignmentAnnotationList' by copying the given Vector.
+ * All elements will be checked for type safety.
+ *
+ * @param vAlignmentAnnotationList
+ * the Vector to copy.
+ */
+ public void setAlignmentAnnotation(
+ final java.util.Vector vAlignmentAnnotationList) {
+ // copy vector
+ this._alignmentAnnotationList.clear();
+
+ this._alignmentAnnotationList.addAll(vAlignmentAnnotationList);
+ }
+
+ /**
+ * Sets the value of '_alignmentAnnotationList' by setting it to the given
+ * Vector. No type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param alignmentAnnotationVector
+ * the Vector to set.
+ */
+ public void setAlignmentAnnotationAsReference(
+ final java.util.Vector alignmentAnnotationVector) {
+ this._alignmentAnnotationList = alignmentAnnotationVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignmentSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlignmentSequence(final int index,
+ final uk.ac.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentSequenceList.size()) {
+ throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"
+ + index + "' not in range [0.."
+ + (this._alignmentSequenceList.size() - 1) + "]");
+ }
+
+ this._alignmentSequenceList.set(index, vAlignmentSequence);
+ }
+
+ /**
+ *
+ *
+ * @param vAlignmentSequenceArray
+ */
+ public void setAlignmentSequence(
+ final uk.ac.vamsas.objects.core.AlignmentSequence[] vAlignmentSequenceArray) {
+ // -- copy array
+ _alignmentSequenceList.clear();
+
+ for (int i = 0; i < vAlignmentSequenceArray.length; i++) {
+ this._alignmentSequenceList.add(vAlignmentSequenceArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_alignmentSequenceList' by copying the given Vector. All
+ * elements will be checked for type safety.
+ *
+ * @param vAlignmentSequenceList
+ * the Vector to copy.
+ */
+ public void setAlignmentSequence(final java.util.Vector vAlignmentSequenceList) {
+ // copy vector
+ this._alignmentSequenceList.clear();
+
+ this._alignmentSequenceList.addAll(vAlignmentSequenceList);
+ }
+
+ /**
+ * Sets the value of '_alignmentSequenceList' by setting it to the given
+ * Vector. No type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param alignmentSequenceVector
+ * the Vector to set.
+ */
+ public void setAlignmentSequenceAsReference(
+ final java.util.Vector alignmentSequenceVector) {
+ this._alignmentSequenceList = alignmentSequenceVector;
+ }
+
+ /**
+ * Sets the value of field 'gapChar'.
+ *
+ * @param gapChar
+ * the value of field 'gapChar'.
+ */
+ public void setGapChar(final java.lang.String gapChar) {
+ this._gapChar = gapChar;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'modifiable'.
+ *
+ * @param modifiable
+ * the value of field 'modifiable'.
+ */
+ public void setModifiable(final java.lang.String modifiable) {
+ this._modifiable = modifiable;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("setProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
+ }
+
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(
+ final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++) {
+ this._propertyList.add(vPropertyArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_propertyList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vPropertyList
+ * the Vector to copy.
+ */
+ public void setProperty(final java.util.Vector vPropertyList) {
+ // copy vector
+ this._propertyList.clear();
+
+ this._propertyList.addAll(vPropertyList);
+ }
+
+ /**
+ * Sets the value of '_propertyList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param propertyVector
+ * the Vector to set.
+ */
+ public void setPropertyAsReference(final java.util.Vector propertyVector) {
+ this._propertyList = propertyVector;
+ }
+
+ /**
+ * Sets the value of field 'provenance'.
+ *
+ * @param provenance
+ * the value of field 'provenance'.
+ */
+ public void setProvenance(
+ final uk.ac.vamsas.objects.core.Provenance provenance) {
+ this._provenance = provenance;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTree(final int index,
+ final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size()) {
+ throw new IndexOutOfBoundsException("setTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ this._treeList.set(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vTreeArray
+ */
+ public void setTree(final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
+ // -- copy array
+ _treeList.clear();
+
+ for (int i = 0; i < vTreeArray.length; i++) {
+ this._treeList.add(vTreeArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_treeList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vTreeList
+ * the Vector to copy.
+ */
+ public void setTree(final java.util.Vector vTreeList) {
+ // copy vector
+ this._treeList.clear();
+
+ this._treeList.addAll(vTreeList);
+ }
+
+ /**
+ * Sets the value of '_treeList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param treeVector
+ * the Vector to set.
+ */
+ public void setTreeAsReference(final java.util.Vector treeVector) {
+ this._treeList = treeVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Alignment
+ */
+ public static uk.ac.vamsas.objects.core.Alignment unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.Alignment.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * This is annotation over the coordinate frame\r
- * defined by all the columns in the alignment.\r
- * \r
+ * This is annotation over the coordinate frame defined by all the columns in\r
+ * the alignment.\r
+ * \r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AlignmentAnnotation extends uk.ac.vamsas.objects.core.RangeAnnotation \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * TODO: decide if this flag is\r
- * redundant - when true it would suggest that\r
- * the annotationElement values together form a\r
- * graph \r
- */\r
- private boolean _graph;\r
-\r
- /**\r
- * keeps track of state for field: _graph\r
- */\r
- private boolean _has_graph;\r
-\r
- /**\r
- * annotation is associated with\r
- * a range on a particular group of alignment\r
- * sequences\r
- */\r
- private java.util.Vector _seqrefs;\r
-\r
- /**\r
- * Field _provenance.\r
- */\r
- private uk.ac.vamsas.objects.core.Provenance _provenance;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AlignmentAnnotation() {\r
- super();\r
- this._seqrefs = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * \r
- * \r
- * @param vSeqrefs\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addSeqrefs(\r
- final java.lang.Object vSeqrefs)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._seqrefs.addElement(vSeqrefs);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vSeqrefs\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addSeqrefs(\r
- final int index,\r
- final java.lang.Object vSeqrefs)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._seqrefs.add(index, vSeqrefs);\r
- }\r
-\r
- /**\r
- */\r
- public void deleteGraph(\r
- ) {\r
- this._has_graph= false;\r
- }\r
-\r
- /**\r
- * Method enumerateSeqrefs.\r
- * \r
- * @return an Enumeration over all java.lang.Object elements\r
- */\r
- public java.util.Enumeration enumerateSeqrefs(\r
- ) {\r
- return this._seqrefs.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class AlignmentAnnotation extends\r
+ uk.ac.vamsas.objects.core.RangeAnnotation implements java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * TODO: decide if this flag is redundant - when true it would suggest that\r
+ * the annotationElement values together form a graph\r
+ */\r
+ private boolean _graph;\r
+\r
+ /**\r
+ * keeps track of state for field: _graph\r
+ */\r
+ private boolean _has_graph;\r
+\r
+ /**\r
+ * annotation is associated with a range on a particular group of alignment\r
+ * sequences\r
+ */\r
+ private java.util.Vector _seqrefs;\r
+\r
+ /**\r
+ * Field _provenance.\r
+ */\r
+ private uk.ac.vamsas.objects.core.Provenance _provenance;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AlignmentAnnotation() {\r
+ super();\r
+ this._seqrefs = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vSeqrefs\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addSeqrefs(final java.lang.Object vSeqrefs)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._seqrefs.addElement(vSeqrefs);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vSeqrefs\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addSeqrefs(final int index, final java.lang.Object vSeqrefs)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._seqrefs.add(index, vSeqrefs);\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void deleteGraph() {\r
+ this._has_graph = false;\r
+ }\r
+\r
+ /**\r
+ * Method enumerateSeqrefs.\r
+ * \r
+ * @return an Enumeration over all java.lang.Object elements\r
+ */\r
+ public java.util.Enumeration enumerateSeqrefs() {\r
+ return this._seqrefs.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof AlignmentAnnotation) {\r
+\r
+ AlignmentAnnotation temp = (AlignmentAnnotation) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._graph != temp._graph)\r
+ return false;\r
+ if (this._has_graph != temp._has_graph)\r
+ return false;\r
+ if (this._seqrefs != null) {\r
+ if (temp._seqrefs == null)\r
+ return false;\r
+ if (this._seqrefs != temp._seqrefs) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._seqrefs);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._seqrefs);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof AlignmentAnnotation) {\r
- \r
- AlignmentAnnotation temp = (AlignmentAnnotation)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._graph != temp._graph)\r
- return false;\r
- if (this._has_graph != temp._has_graph)\r
- return false;\r
- if (this._seqrefs != null) {\r
- if (temp._seqrefs == null) return false;\r
- if (this._seqrefs != temp._seqrefs) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._seqrefs);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._seqrefs);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._seqrefs.equals(temp._seqrefs)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs);\r
- }\r
- }\r
- } else if (temp._seqrefs != null)\r
- return false;\r
- if (this._provenance != null) {\r
- if (temp._provenance == null) return false;\r
- if (this._provenance != temp._provenance) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._provenance.equals(temp._provenance)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
- }\r
- }\r
- } else if (temp._provenance != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._seqrefs.equals(temp._seqrefs)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._seqrefs);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqrefs);\r
+ }\r
}\r
+ } else if (temp._seqrefs != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'graph'. The field 'graph' has\r
- * the following description: TODO: decide if this flag is\r
- * redundant - when true it would suggest that\r
- * the annotationElement values together form a\r
- * graph \r
- * \r
- * @return the value of field 'Graph'.\r
- */\r
- public boolean getGraph(\r
- ) {\r
- return this._graph;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'provenance'.\r
- * \r
- * @return the value of field 'Provenance'.\r
- */\r
- public uk.ac.vamsas.objects.core.Provenance getProvenance(\r
- ) {\r
- return this._provenance;\r
- }\r
-\r
- /**\r
- * Method getSeqrefs.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the java.lang.Object at the given index\r
- */\r
- public java.lang.Object getSeqrefs(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._seqrefs.size()) {\r
- throw new IndexOutOfBoundsException("getSeqrefs: Index value '" + index + "' not in range [0.." + (this._seqrefs.size() - 1) + "]");\r
- }\r
- \r
- return _seqrefs.get(index);\r
- }\r
-\r
- /**\r
- * Method getSeqrefs.Returns the contents of the collection in\r
- * an Array. <p>Note: Just in case the collection contents\r
- * are changing in another thread, we pass a 0-length Array of\r
- * the correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public java.lang.Object[] getSeqrefs(\r
- ) {\r
- java.lang.Object[] array = new java.lang.Object[0];\r
- return (java.lang.Object[]) this._seqrefs.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getSeqrefsAsReference.Returns a reference to\r
- * '_seqrefs'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getSeqrefsAsReference(\r
- ) {\r
- return this._seqrefs;\r
- }\r
-\r
- /**\r
- * Method getSeqrefsCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getSeqrefsCount(\r
- ) {\r
- return this._seqrefs.size();\r
- }\r
-\r
- /**\r
- * Method hasGraph.\r
- * \r
- * @return true if at least one Graph has been added\r
- */\r
- public boolean hasGraph(\r
- ) {\r
- return this._has_graph;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + (_graph?0:1);\r
- if (_seqrefs != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_seqrefs)) {\r
- result = 37 * result + _seqrefs.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_seqrefs);\r
- }\r
- if (_provenance != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {\r
- result = 37 * result + _provenance.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'graph'. The field 'graph' has\r
- * the following description: TODO: decide if this flag is\r
- * redundant - when true it would suggest that\r
- * the annotationElement values together form a\r
- * graph \r
- * \r
- * @return the value of field 'Graph'.\r
- */\r
- public boolean isGraph(\r
- ) {\r
- return this._graph;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ if (this._provenance != null) {\r
+ if (temp._provenance == null)\r
+ return false;\r
+ if (this._provenance != temp._provenance) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._provenance);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._provenance);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._provenance.equals(temp._provenance)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllSeqrefs(\r
- ) {\r
- this._seqrefs.clear();\r
- }\r
-\r
- /**\r
- * Method removeSeqrefs.\r
- * \r
- * @param vSeqrefs\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeSeqrefs(\r
- final java.lang.Object vSeqrefs) {\r
- boolean removed = _seqrefs.remove(vSeqrefs);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removeSeqrefsAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public java.lang.Object removeSeqrefsAt(\r
- final int index) {\r
- java.lang.Object obj = this._seqrefs.remove(index);\r
- return obj;\r
+ } else if (temp._provenance != null)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Sets the value of field 'graph'. The field 'graph' has the\r
- * following description: TODO: decide if this flag is\r
- * redundant - when true it would suggest that\r
- * the annotationElement values together form a\r
- * graph \r
- * \r
- * @param graph the value of field 'graph'.\r
- */\r
- public void setGraph(\r
- final boolean graph) {\r
- this._graph = graph;\r
- this._has_graph = true;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'graph'. The field 'graph' has the following\r
+ * description: TODO: decide if this flag is redundant - when true it would\r
+ * suggest that the annotationElement values together form a graph\r
+ * \r
+ * @return the value of field 'Graph'.\r
+ */\r
+ public boolean getGraph() {\r
+ return this._graph;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'provenance'.\r
+ * \r
+ * @return the value of field 'Provenance'.\r
+ */\r
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {\r
+ return this._provenance;\r
+ }\r
+\r
+ /**\r
+ * Method getSeqrefs.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the java.lang.Object at the given index\r
+ */\r
+ public java.lang.Object getSeqrefs(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._seqrefs.size()) {\r
+ throw new IndexOutOfBoundsException("getSeqrefs: Index value '" + index\r
+ + "' not in range [0.." + (this._seqrefs.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Sets the value of field 'provenance'.\r
- * \r
- * @param provenance the value of field 'provenance'.\r
- */\r
- public void setProvenance(\r
- final uk.ac.vamsas.objects.core.Provenance provenance) {\r
- this._provenance = provenance;\r
+ return _seqrefs.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getSeqrefs.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public java.lang.Object[] getSeqrefs() {\r
+ java.lang.Object[] array = new java.lang.Object[0];\r
+ return (java.lang.Object[]) this._seqrefs.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getSeqrefsAsReference.Returns a reference to '_seqrefs'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getSeqrefsAsReference() {\r
+ return this._seqrefs;\r
+ }\r
+\r
+ /**\r
+ * Method getSeqrefsCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getSeqrefsCount() {\r
+ return this._seqrefs.size();\r
+ }\r
+\r
+ /**\r
+ * Method hasGraph.\r
+ * \r
+ * @return true if at least one Graph has been added\r
+ */\r
+ public boolean hasGraph() {\r
+ return this._has_graph;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ result = 37 * result + (_graph ? 0 : 1);\r
+ if (_seqrefs != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_seqrefs)) {\r
+ result = 37 * result + _seqrefs.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_seqrefs);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vSeqrefs\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setSeqrefs(\r
- final int index,\r
- final java.lang.Object vSeqrefs)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._seqrefs.size()) {\r
- throw new IndexOutOfBoundsException("setSeqrefs: Index value '" + index + "' not in range [0.." + (this._seqrefs.size() - 1) + "]");\r
- }\r
- \r
- this._seqrefs.set(index, vSeqrefs);\r
+ if (_provenance != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {\r
+ result = 37 * result + _provenance.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param vSeqrefsArray\r
- */\r
- public void setSeqrefs(\r
- final java.lang.Object[] vSeqrefsArray) {\r
- //-- copy array\r
- _seqrefs.clear();\r
- \r
- for (int i = 0; i < vSeqrefsArray.length; i++) {\r
- this._seqrefs.add(vSeqrefsArray[i]);\r
- }\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'graph'. The field 'graph' has the following\r
+ * description: TODO: decide if this flag is redundant - when true it would\r
+ * suggest that the annotationElement values together form a graph\r
+ * \r
+ * @return the value of field 'Graph'.\r
+ */\r
+ public boolean isGraph() {\r
+ return this._graph;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
-\r
- /**\r
- * Sets the value of '_seqrefs' by copying the given Vector.\r
- * All elements will be checked for type safety.\r
- * \r
- * @param vSeqrefsList the Vector to copy.\r
- */\r
- public void setSeqrefs(\r
- final java.util.Vector vSeqrefsList) {\r
- // copy vector\r
- this._seqrefs.clear();\r
- \r
- this._seqrefs.addAll(vSeqrefsList);\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllSeqrefs() {\r
+ this._seqrefs.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removeSeqrefs.\r
+ * \r
+ * @param vSeqrefs\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeSeqrefs(final java.lang.Object vSeqrefs) {\r
+ boolean removed = _seqrefs.remove(vSeqrefs);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeSeqrefsAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public java.lang.Object removeSeqrefsAt(final int index) {\r
+ java.lang.Object obj = this._seqrefs.remove(index);\r
+ return obj;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'graph'. The field 'graph' has the following\r
+ * description: TODO: decide if this flag is redundant - when true it would\r
+ * suggest that the annotationElement values together form a graph\r
+ * \r
+ * @param graph\r
+ * the value of field 'graph'.\r
+ */\r
+ public void setGraph(final boolean graph) {\r
+ this._graph = graph;\r
+ this._has_graph = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'provenance'.\r
+ * \r
+ * @param provenance\r
+ * the value of field 'provenance'.\r
+ */\r
+ public void setProvenance(\r
+ final uk.ac.vamsas.objects.core.Provenance provenance) {\r
+ this._provenance = provenance;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vSeqrefs\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setSeqrefs(final int index, final java.lang.Object vSeqrefs)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._seqrefs.size()) {\r
+ throw new IndexOutOfBoundsException("setSeqrefs: Index value '" + index\r
+ + "' not in range [0.." + (this._seqrefs.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Sets the value of '_seqrefs' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param seqrefsVector the Vector to set.\r
- */\r
- public void setSeqrefsAsReference(\r
- final java.util.Vector seqrefsVector) {\r
- this._seqrefs = seqrefsVector;\r
- }\r
+ this._seqrefs.set(index, vSeqrefs);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
- */\r
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AlignmentAnnotation.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param vSeqrefsArray\r
+ */\r
+ public void setSeqrefs(final java.lang.Object[] vSeqrefsArray) {\r
+ // -- copy array\r
+ _seqrefs.clear();\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ for (int i = 0; i < vSeqrefsArray.length; i++) {\r
+ this._seqrefs.add(vSeqrefsArray[i]);\r
}\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_seqrefs' by copying the given Vector. All elements will\r
+ * be checked for type safety.\r
+ * \r
+ * @param vSeqrefsList\r
+ * the Vector to copy.\r
+ */\r
+ public void setSeqrefs(final java.util.Vector vSeqrefsList) {\r
+ // copy vector\r
+ this._seqrefs.clear();\r
+\r
+ this._seqrefs.addAll(vSeqrefsList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_seqrefs' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param seqrefsVector\r
+ * the Vector to set.\r
+ */\r
+ public void setSeqrefsAsReference(final java.util.Vector seqrefsVector) {\r
+ this._seqrefs = seqrefsVector;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.AlignmentAnnotation.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class AlignmentSequence.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class AlignmentSequence extends uk.ac.vamsas.objects.core.SequenceType
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Primary Key for vamsas object
- * referencing
- */
- private java.lang.String _id;
-
- /**
- * Dataset Sequence from which
- * this alignment sequence is taken from
- *
- */
- private java.lang.Object _refid;
-
- /**
- * Field _alignmentSequenceAnnotationList.
- */
- private java.util.Vector _alignmentSequenceAnnotationList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AlignmentSequence() {
- super();
- this._alignmentSequenceAnnotationList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAlignmentSequenceAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignmentSequenceAnnotation(
- final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentSequenceAnnotationList.addElement(vAlignmentSequenceAnnotation);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignmentSequenceAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignmentSequenceAnnotation(
- final int index,
- final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentSequenceAnnotationList.add(index, vAlignmentSequenceAnnotation);
- }
-
- /**
- * Method enumerateAlignmentSequenceAnnotation.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation element
- */
- public java.util.Enumeration enumerateAlignmentSequenceAnnotation(
- ) {
- return this._alignmentSequenceAnnotationList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class AlignmentSequence extends uk.ac.vamsas.objects.core.SequenceType
+ implements java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Primary Key for vamsas object referencing
+ */
+ private java.lang.String _id;
+
+ /**
+ * Dataset Sequence from which this alignment sequence is taken from
+ *
+ */
+ private java.lang.Object _refid;
+
+ /**
+ * Field _alignmentSequenceAnnotationList.
+ */
+ private java.util.Vector _alignmentSequenceAnnotationList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AlignmentSequence() {
+ super();
+ this._alignmentSequenceAnnotationList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAlignmentSequenceAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignmentSequenceAnnotation(
+ final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentSequenceAnnotationList
+ .addElement(vAlignmentSequenceAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignmentSequenceAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignmentSequenceAnnotation(
+ final int index,
+ final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentSequenceAnnotationList.add(index,
+ vAlignmentSequenceAnnotation);
+ }
+
+ /**
+ * Method enumerateAlignmentSequenceAnnotation.
+ *
+ * @return an Enumeration over all
+ * uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation element
+ */
+ public java.util.Enumeration enumerateAlignmentSequenceAnnotation() {
+ return this._alignmentSequenceAnnotationList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof AlignmentSequence) {
+
+ AlignmentSequence temp = (AlignmentSequence) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
-
- if (obj instanceof AlignmentSequence) {
-
- AlignmentSequence temp = (AlignmentSequence)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._refid != null) {
- if (temp._refid == null) return false;
- if (this._refid != temp._refid) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._refid);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._refid);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._refid); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid); };
- return false;
- }
- if (!thcycle) {
- if (!this._refid.equals(temp._refid)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._refid);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._refid);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid);
- }
- }
- } else if (temp._refid != null)
- return false;
- if (this._alignmentSequenceAnnotationList != null) {
- if (temp._alignmentSequenceAnnotationList == null) return false;
- if (this._alignmentSequenceAnnotationList != temp._alignmentSequenceAnnotationList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._alignmentSequenceAnnotationList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._alignmentSequenceAnnotationList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceAnnotationList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceAnnotationList); };
- return false;
- }
- if (!thcycle) {
- if (!this._alignmentSequenceAnnotationList.equals(temp._alignmentSequenceAnnotationList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceAnnotationList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceAnnotationList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentSequenceAnnotationList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentSequenceAnnotationList);
- }
- }
- } else if (temp._alignmentSequenceAnnotationList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
+ } else if (temp._id != null)
return false;
- }
-
- /**
- * Method getAlignmentSequenceAnnotation.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation at the
- * given index
- */
- public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
- throw new IndexOutOfBoundsException("getAlignmentSequenceAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.get(index);
- }
-
- /**
- * Method getAlignmentSequenceAnnotation.Returns the contents
- * of the collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation(
- ) {
- uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] array = new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[0];
- return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[]) this._alignmentSequenceAnnotationList.toArray(array);
- }
-
- /**
- * Method getAlignmentSequenceAnnotationAsReference.Returns a
- * reference to '_alignmentSequenceAnnotationList'. No type
- * checking is performed on any modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getAlignmentSequenceAnnotationAsReference(
- ) {
- return this._alignmentSequenceAnnotationList;
- }
-
- /**
- * Method getAlignmentSequenceAnnotationCount.
- *
- * @return the size of this collection
- */
- public int getAlignmentSequenceAnnotationCount(
- ) {
- return this._alignmentSequenceAnnotationList.size();
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'refid'. The field 'refid' has
- * the following description: Dataset Sequence from which
- * this alignment sequence is taken from
- *
- *
- * @return the value of field 'Refid'.
- */
- public java.lang.Object getRefid(
- ) {
- return this._refid;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_refid != null
- && !org.castor.util.CycleBreaker.startingToCycle(_refid)) {
- result = 37 * result + _refid.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_refid);
- }
- if (_alignmentSequenceAnnotationList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_alignmentSequenceAnnotationList)) {
- result = 37 * result + _alignmentSequenceAnnotationList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentSequenceAnnotationList);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._refid != null) {
+ if (temp._refid == null)
+ return false;
+ if (this._refid != temp._refid) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._refid);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._refid);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._refid);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._refid.equals(temp._refid)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._refid);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._refid);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._refid);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Method removeAlignmentSequenceAnnotation.
- *
- * @param vAlignmentSequenceAnnotation
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlignmentSequenceAnnotation(
- final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation) {
- boolean removed = _alignmentSequenceAnnotationList.remove(vAlignmentSequenceAnnotation);
- return removed;
- }
-
- /**
- * Method removeAlignmentSequenceAnnotationAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotationAt(
- final int index) {
- java.lang.Object obj = this._alignmentSequenceAnnotationList.remove(index);
- return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) obj;
- }
-
- /**
- */
- public void removeAllAlignmentSequenceAnnotation(
- ) {
- this._alignmentSequenceAnnotationList.clear();
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignmentSequenceAnnotation
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAlignmentSequenceAnnotation(
- final int index,
- final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
- throw new IndexOutOfBoundsException("setAlignmentSequenceAnnotation: Index value '" + index + "' not in range [0.." + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
+ } else if (temp._refid != null)
+ return false;
+ if (this._alignmentSequenceAnnotationList != null) {
+ if (temp._alignmentSequenceAnnotationList == null)
+ return false;
+ if (this._alignmentSequenceAnnotationList != temp._alignmentSequenceAnnotationList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._alignmentSequenceAnnotationList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._alignmentSequenceAnnotationList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentSequenceAnnotationList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentSequenceAnnotationList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._alignmentSequenceAnnotationList
+ .equals(temp._alignmentSequenceAnnotationList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentSequenceAnnotationList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentSequenceAnnotationList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentSequenceAnnotationList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentSequenceAnnotationList);
+ }
}
-
- this._alignmentSequenceAnnotationList.set(index, vAlignmentSequenceAnnotation);
+ } else if (temp._alignmentSequenceAnnotationList != null)
+ return false;
+ return true;
}
-
- /**
- *
- *
- * @param vAlignmentSequenceAnnotationArray
- */
- public void setAlignmentSequenceAnnotation(
- final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] vAlignmentSequenceAnnotationArray) {
- //-- copy array
- _alignmentSequenceAnnotationList.clear();
-
- for (int i = 0; i < vAlignmentSequenceAnnotationArray.length; i++) {
- this._alignmentSequenceAnnotationList.add(vAlignmentSequenceAnnotationArray[i]);
- }
+ return false;
+ }
+
+ /**
+ * Method getAlignmentSequenceAnnotation.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the
+ * uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(
+ final int index) throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
+ throw new IndexOutOfBoundsException(
+ "getAlignmentSequenceAnnotation: Index value '" + index
+ + "' not in range [0.."
+ + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
}
- /**
- * Sets the value of '_alignmentSequenceAnnotationList' by
- * copying the given Vector. All elements will be checked for
- * type safety.
- *
- * @param vAlignmentSequenceAnnotationList the Vector to copy.
- */
- public void setAlignmentSequenceAnnotation(
- final java.util.Vector vAlignmentSequenceAnnotationList) {
- // copy vector
- this._alignmentSequenceAnnotationList.clear();
-
- this._alignmentSequenceAnnotationList.addAll(vAlignmentSequenceAnnotationList);
+ return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList
+ .get(index);
+ }
+
+ /**
+ * Method getAlignmentSequenceAnnotation.Returns the contents of the
+ * collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation() {
+ uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] array = new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[0];
+ return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[]) this._alignmentSequenceAnnotationList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAlignmentSequenceAnnotationAsReference.Returns a reference to
+ * '_alignmentSequenceAnnotationList'. No type checking is performed on any
+ * modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getAlignmentSequenceAnnotationAsReference() {
+ return this._alignmentSequenceAnnotationList;
+ }
+
+ /**
+ * Method getAlignmentSequenceAnnotationCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlignmentSequenceAnnotationCount() {
+ return this._alignmentSequenceAnnotationList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'refid'. The field 'refid' has the following
+ * description: Dataset Sequence from which this alignment sequence is taken
+ * from
+ *
+ *
+ * @return the value of field 'Refid'.
+ */
+ public java.lang.Object getRefid() {
+ return this._refid;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
}
-
- /**
- * Sets the value of '_alignmentSequenceAnnotationList' by
- * setting it to the given Vector. No type checking is
- * performed.
- * @deprecated
- *
- * @param alignmentSequenceAnnotationVector the Vector to set.
- */
- public void setAlignmentSequenceAnnotationAsReference(
- final java.util.Vector alignmentSequenceAnnotationVector) {
- this._alignmentSequenceAnnotationList = alignmentSequenceAnnotationVector;
+ if (_refid != null && !org.castor.util.CycleBreaker.startingToCycle(_refid)) {
+ result = 37 * result + _refid.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_refid);
}
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
+ if (_alignmentSequenceAnnotationList != null
+ && !org.castor.util.CycleBreaker
+ .startingToCycle(_alignmentSequenceAnnotationList)) {
+ result = 37 * result + _alignmentSequenceAnnotationList.hashCode();
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(_alignmentSequenceAnnotationList);
}
- /**
- * Sets the value of field 'refid'. The field 'refid' has the
- * following description: Dataset Sequence from which
- * this alignment sequence is taken from
- *
- *
- * @param refid the value of field 'refid'.
- */
- public void setRefid(
- final java.lang.Object refid) {
- this._refid = refid;
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Method removeAlignmentSequenceAnnotation.
+ *
+ * @param vAlignmentSequenceAnnotation
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlignmentSequenceAnnotation(
+ final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation) {
+ boolean removed = _alignmentSequenceAnnotationList
+ .remove(vAlignmentSequenceAnnotation);
+ return removed;
+ }
+
+ /**
+ * Method removeAlignmentSequenceAnnotationAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotationAt(
+ final int index) {
+ java.lang.Object obj = this._alignmentSequenceAnnotationList.remove(index);
+ return (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) obj;
+ }
+
+ /**
*/
- public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AlignmentSequence.class, reader);
+ public void removeAllAlignmentSequenceAnnotation() {
+ this._alignmentSequenceAnnotationList.clear();
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignmentSequenceAnnotation
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlignmentSequenceAnnotation(
+ final int index,
+ final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentSequenceAnnotationList.size()) {
+ throw new IndexOutOfBoundsException(
+ "setAlignmentSequenceAnnotation: Index value '" + index
+ + "' not in range [0.."
+ + (this._alignmentSequenceAnnotationList.size() - 1) + "]");
}
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._alignmentSequenceAnnotationList.set(index,
+ vAlignmentSequenceAnnotation);
+ }
+
+ /**
+ *
+ *
+ * @param vAlignmentSequenceAnnotationArray
+ */
+ public void setAlignmentSequenceAnnotation(
+ final uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation[] vAlignmentSequenceAnnotationArray) {
+ // -- copy array
+ _alignmentSequenceAnnotationList.clear();
+
+ for (int i = 0; i < vAlignmentSequenceAnnotationArray.length; i++) {
+ this._alignmentSequenceAnnotationList
+ .add(vAlignmentSequenceAnnotationArray[i]);
}
+ }
+
+ /**
+ * Sets the value of '_alignmentSequenceAnnotationList' by copying the given
+ * Vector. All elements will be checked for type safety.
+ *
+ * @param vAlignmentSequenceAnnotationList
+ * the Vector to copy.
+ */
+ public void setAlignmentSequenceAnnotation(
+ final java.util.Vector vAlignmentSequenceAnnotationList) {
+ // copy vector
+ this._alignmentSequenceAnnotationList.clear();
+
+ this._alignmentSequenceAnnotationList
+ .addAll(vAlignmentSequenceAnnotationList);
+ }
+
+ /**
+ * Sets the value of '_alignmentSequenceAnnotationList' by setting it to the
+ * given Vector. No type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param alignmentSequenceAnnotationVector
+ * the Vector to set.
+ */
+ public void setAlignmentSequenceAnnotationAsReference(
+ final java.util.Vector alignmentSequenceAnnotationVector) {
+ this._alignmentSequenceAnnotationList = alignmentSequenceAnnotationVector;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'refid'. The field 'refid' has the following
+ * description: Dataset Sequence from which this alignment sequence is taken
+ * from
+ *
+ *
+ * @param refid
+ * the value of field 'refid'.
+ */
+ public void setRefid(final java.lang.Object refid) {
+ this._refid = refid;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
+ */
+ public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.AlignmentSequence.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AlignmentSequenceAnnotation extends uk.ac.vamsas.objects.core.RangeAnnotation \r
-implements java.io.Serializable\r
-{\r
+public class AlignmentSequenceAnnotation extends\r
+ uk.ac.vamsas.objects.core.RangeAnnotation implements java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * TODO: decide if this flag is redundant - when true it would suggest that\r
+ * the annotationElement values together form a graph\r
+ * \r
+ */\r
+ private boolean _graph;\r
\r
- /**\r
- * TODO:\r
- * decide if this flag is\r
- * redundant - when true it\r
- * would suggest that the\r
- * annotationElement values\r
- * together form a graph\r
- * \r
- */\r
- private boolean _graph;\r
+ /**\r
+ * keeps track of state for field: _graph\r
+ */\r
+ private boolean _has_graph;\r
\r
- /**\r
- * keeps track of state for field: _graph\r
- */\r
- private boolean _has_graph;\r
+ /**\r
+ * Field _provenance.\r
+ */\r
+ private uk.ac.vamsas.objects.core.Provenance _provenance;\r
\r
- /**\r
- * Field _provenance.\r
- */\r
- private uk.ac.vamsas.objects.core.Provenance _provenance;\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public AlignmentSequenceAnnotation() {\r
+ super();\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public AlignmentSequenceAnnotation() {\r
- super();\r
- }\r
+ /**\r
+ */\r
+ public void deleteGraph() {\r
+ this._has_graph = false;\r
+ }\r
\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- */\r
- public void deleteGraph(\r
- ) {\r
- this._has_graph= false;\r
- }\r
+ if (obj instanceof AlignmentSequenceAnnotation) {\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ AlignmentSequenceAnnotation temp = (AlignmentSequenceAnnotation) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._graph != temp._graph)\r
+ return false;\r
+ if (this._has_graph != temp._has_graph)\r
+ return false;\r
+ if (this._provenance != null) {\r
+ if (temp._provenance == null)\r
+ return false;\r
+ if (this._provenance != temp._provenance) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._provenance);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._provenance);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof AlignmentSequenceAnnotation) {\r
- \r
- AlignmentSequenceAnnotation temp = (AlignmentSequenceAnnotation)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._graph != temp._graph)\r
- return false;\r
- if (this._has_graph != temp._has_graph)\r
- return false;\r
- if (this._provenance != null) {\r
- if (temp._provenance == null) return false;\r
- if (this._provenance != temp._provenance) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._provenance.equals(temp._provenance)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
- }\r
- }\r
- } else if (temp._provenance != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._provenance.equals(temp._provenance)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ }\r
}\r
+ } else if (temp._provenance != null)\r
return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'graph'. The field 'graph' has\r
- * the following description: TODO:\r
- * decide if this flag is\r
- * redundant - when true it\r
- * would suggest that the\r
- * annotationElement values\r
- * together form a graph\r
- * \r
- * \r
- * @return the value of field 'Graph'.\r
- */\r
- public boolean getGraph(\r
- ) {\r
- return this._graph;\r
- }\r
+ /**\r
+ * Returns the value of field 'graph'. The field 'graph' has the following\r
+ * description: TODO: decide if this flag is redundant - when true it would\r
+ * suggest that the annotationElement values together form a graph\r
+ * \r
+ * \r
+ * @return the value of field 'Graph'.\r
+ */\r
+ public boolean getGraph() {\r
+ return this._graph;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'provenance'.\r
- * \r
- * @return the value of field 'Provenance'.\r
- */\r
- public uk.ac.vamsas.objects.core.Provenance getProvenance(\r
- ) {\r
- return this._provenance;\r
- }\r
+ /**\r
+ * Returns the value of field 'provenance'.\r
+ * \r
+ * @return the value of field 'Provenance'.\r
+ */\r
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {\r
+ return this._provenance;\r
+ }\r
\r
- /**\r
- * Method hasGraph.\r
- * \r
- * @return true if at least one Graph has been added\r
- */\r
- public boolean hasGraph(\r
- ) {\r
- return this._has_graph;\r
- }\r
+ /**\r
+ * Method hasGraph.\r
+ * \r
+ * @return true if at least one Graph has been added\r
+ */\r
+ public boolean hasGraph() {\r
+ return this._has_graph;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + (_graph?0:1);\r
- if (_provenance != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {\r
- result = 37 * result + _provenance.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Returns the value of field 'graph'. The field 'graph' has\r
- * the following description: TODO:\r
- * decide if this flag is\r
- * redundant - when true it\r
- * would suggest that the\r
- * annotationElement values\r
- * together form a graph\r
- * \r
- * \r
- * @return the value of field 'Graph'.\r
- */\r
- public boolean isGraph(\r
- ) {\r
- return this._graph;\r
+ long tmp;\r
+ result = 37 * result + (_graph ? 0 : 1);\r
+ if (_provenance != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {\r
+ result = 37 * result + _provenance.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);\r
}\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
+ /**\r
+ * Returns the value of field 'graph'. The field 'graph' has the following\r
+ * description: TODO: decide if this flag is redundant - when true it would\r
+ * suggest that the annotationElement values together form a graph\r
+ * \r
+ * \r
+ * @return the value of field 'Graph'.\r
+ */\r
+ public boolean isGraph() {\r
+ return this._graph;\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'graph'. The field 'graph' has the\r
- * following description: TODO:\r
- * decide if this flag is\r
- * redundant - when true it\r
- * would suggest that the\r
- * annotationElement values\r
- * together form a graph\r
- * \r
- * \r
- * @param graph the value of field 'graph'.\r
- */\r
- public void setGraph(\r
- final boolean graph) {\r
- this._graph = graph;\r
- this._has_graph = true;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Sets the value of field 'provenance'.\r
- * \r
- * @param provenance the value of field 'provenance'.\r
- */\r
- public void setProvenance(\r
- final uk.ac.vamsas.objects.core.Provenance provenance) {\r
- this._provenance = provenance;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
- */\r
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation.class, reader);\r
- }\r
+ /**\r
+ * Sets the value of field 'graph'. The field 'graph' has the following\r
+ * description: TODO: decide if this flag is redundant - when true it would\r
+ * suggest that the annotationElement values together form a graph\r
+ * \r
+ * \r
+ * @param graph\r
+ * the value of field 'graph'.\r
+ */\r
+ public void setGraph(final boolean graph) {\r
+ this._graph = graph;\r
+ this._has_graph = true;\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'provenance'.\r
+ * \r
+ * @param provenance\r
+ * the value of field 'provenance'.\r
+ */\r
+ public void setProvenance(\r
+ final uk.ac.vamsas.objects.core.Provenance provenance) {\r
+ this._provenance = provenance;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class AnnotationElement.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class AnnotationElement extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * position with respect to the coordinate frame defined by a
- * rangeType specification
- */
- private long _position;
-
- /**
- * keeps track of state for field: _position
- */
- private boolean _has_position;
-
- /**
- * true means the annotation element appears between the
- * specified position and the next
- */
- private boolean _after = false;
-
- /**
- * keeps track of state for field: _after
- */
- private boolean _has_after;
-
- /**
- * Primary Key for vamsas object referencing
- */
- private java.lang.String _id;
-
- /**
- * Free text at this position
- */
- private java.lang.String _description;
-
- /**
- * Discrete symbol - possibly graphically represented
- *
- */
- private java.util.Vector _glyphList;
-
- /**
- * Ordered set of float values - an application may treat
- * the values together as a vector with common support for a
- * set of
- * annotation elements - but this is, again, not validated so
- * applications
- * should deal gracefully with varying numbers of dimensions
- *
- */
- private java.util.Vector _valueList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public AnnotationElement() {
- super();
- this._glyphList = new java.util.Vector();
- this._valueList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vGlyph
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addGlyph(
- final uk.ac.vamsas.objects.core.Glyph vGlyph)
- throws java.lang.IndexOutOfBoundsException {
- this._glyphList.addElement(vGlyph);
- }
-
- /**
- *
- *
- * @param index
- * @param vGlyph
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addGlyph(
- final int index,
- final uk.ac.vamsas.objects.core.Glyph vGlyph)
- throws java.lang.IndexOutOfBoundsException {
- this._glyphList.add(index, vGlyph);
- }
-
- /**
- *
- *
- * @param vValue
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addValue(
- final float vValue)
- throws java.lang.IndexOutOfBoundsException {
- this._valueList.addElement(new java.lang.Float(vValue));
- }
-
- /**
- *
- *
- * @param index
- * @param vValue
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addValue(
- final int index,
- final float vValue)
- throws java.lang.IndexOutOfBoundsException {
- this._valueList.add(index, new java.lang.Float(vValue));
- }
-
- /**
- */
- public void deleteAfter(
- ) {
- this._has_after= false;
- }
-
- /**
- */
- public void deletePosition(
- ) {
- this._has_position= false;
- }
-
- /**
- * Method enumerateGlyph.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Glyph elements
- */
- public java.util.Enumeration enumerateGlyph(
- ) {
- return this._glyphList.elements();
- }
-
- /**
- * Method enumerateValue.
- *
- * @return an Enumeration over all float elements
- */
- public java.util.Enumeration enumerateValue(
- ) {
- return this._valueList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class AnnotationElement extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * position with respect to the coordinate frame defined by a rangeType
+ * specification
+ */
+ private long _position;
+
+ /**
+ * keeps track of state for field: _position
+ */
+ private boolean _has_position;
+
+ /**
+ * true means the annotation element appears between the specified position
+ * and the next
+ */
+ private boolean _after = false;
+
+ /**
+ * keeps track of state for field: _after
+ */
+ private boolean _has_after;
+
+ /**
+ * Primary Key for vamsas object referencing
+ */
+ private java.lang.String _id;
+
+ /**
+ * Free text at this position
+ */
+ private java.lang.String _description;
+
+ /**
+ * Discrete symbol - possibly graphically represented
+ *
+ */
+ private java.util.Vector _glyphList;
+
+ /**
+ * Ordered set of float values - an application may treat the values together
+ * as a vector with common support for a set of annotation elements - but this
+ * is, again, not validated so applications should deal gracefully with
+ * varying numbers of dimensions
+ *
+ */
+ private java.util.Vector _valueList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public AnnotationElement() {
+ super();
+ this._glyphList = new java.util.Vector();
+ this._valueList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vGlyph
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addGlyph(final uk.ac.vamsas.objects.core.Glyph vGlyph)
+ throws java.lang.IndexOutOfBoundsException {
+ this._glyphList.addElement(vGlyph);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vGlyph
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addGlyph(final int index,
+ final uk.ac.vamsas.objects.core.Glyph vGlyph)
+ throws java.lang.IndexOutOfBoundsException {
+ this._glyphList.add(index, vGlyph);
+ }
+
+ /**
+ *
+ *
+ * @param vValue
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addValue(final float vValue)
+ throws java.lang.IndexOutOfBoundsException {
+ this._valueList.addElement(new java.lang.Float(vValue));
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vValue
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addValue(final int index, final float vValue)
+ throws java.lang.IndexOutOfBoundsException {
+ this._valueList.add(index, new java.lang.Float(vValue));
+ }
+
+ /**
+ */
+ public void deleteAfter() {
+ this._has_after = false;
+ }
+
+ /**
+ */
+ public void deletePosition() {
+ this._has_position = false;
+ }
+
+ /**
+ * Method enumerateGlyph.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Glyph elements
+ */
+ public java.util.Enumeration enumerateGlyph() {
+ return this._glyphList.elements();
+ }
+
+ /**
+ * Method enumerateValue.
+ *
+ * @return an Enumeration over all float elements
+ */
+ public java.util.Enumeration enumerateValue() {
+ return this._valueList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof AnnotationElement) {
+
+ AnnotationElement temp = (AnnotationElement) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._position != temp._position)
+ return false;
+ if (this._has_position != temp._has_position)
+ return false;
+ if (this._after != temp._after)
+ return false;
+ if (this._has_after != temp._has_after)
+ return false;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
-
- if (obj instanceof AnnotationElement) {
-
- AnnotationElement temp = (AnnotationElement)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._position != temp._position)
- return false;
- if (this._has_position != temp._has_position)
- return false;
- if (this._after != temp._after)
- return false;
- if (this._has_after != temp._has_after)
- return false;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._description != null) {
- if (temp._description == null) return false;
- if (this._description != temp._description) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._description);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._description);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._description); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._description); };
- return false;
- }
- if (!thcycle) {
- if (!this._description.equals(temp._description)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
- }
- }
- } else if (temp._description != null)
- return false;
- if (this._glyphList != null) {
- if (temp._glyphList == null) return false;
- if (this._glyphList != temp._glyphList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._glyphList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._glyphList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._glyphList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._glyphList); };
- return false;
- }
- if (!thcycle) {
- if (!this._glyphList.equals(temp._glyphList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._glyphList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._glyphList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._glyphList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._glyphList);
- }
- }
- } else if (temp._glyphList != null)
- return false;
- if (this._valueList != null) {
- if (temp._valueList == null) return false;
- if (this._valueList != temp._valueList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._valueList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._valueList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._valueList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._valueList); };
- return false;
- }
- if (!thcycle) {
- if (!this._valueList.equals(temp._valueList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._valueList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._valueList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._valueList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._valueList);
- }
- }
- } else if (temp._valueList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
+ } else if (temp._id != null)
return false;
- }
-
- /**
- * Returns the value of field 'after'. The field 'after' has
- * the following description: true means the annotation element
- * appears between the
- * specified position and the next
- *
- * @return the value of field 'After'.
- */
- public boolean getAfter(
- ) {
- return this._after;
- }
-
- /**
- * Returns the value of field 'description'. The field
- * 'description' has the following description: Free text at
- * this position
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Method getGlyph.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Glyph at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Glyph getGlyph(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._glyphList.size()) {
- throw new IndexOutOfBoundsException("getGlyph: Index value '" + index + "' not in range [0.." + (this._glyphList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Glyph) _glyphList.get(index);
- }
-
- /**
- * Method getGlyph.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Glyph[] getGlyph(
- ) {
- uk.ac.vamsas.objects.core.Glyph[] array = new uk.ac.vamsas.objects.core.Glyph[0];
- return (uk.ac.vamsas.objects.core.Glyph[]) this._glyphList.toArray(array);
- }
-
- /**
- * Method getGlyphAsReference.Returns a reference to
- * '_glyphList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getGlyphAsReference(
- ) {
- return this._glyphList;
- }
-
- /**
- * Method getGlyphCount.
- *
- * @return the size of this collection
- */
- public int getGlyphCount(
- ) {
- return this._glyphList.size();
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'position'. The field 'position'
- * has the following description: position with respect to the
- * coordinate frame defined by a
- * rangeType specification
- *
- * @return the value of field 'Position'.
- */
- public long getPosition(
- ) {
- return this._position;
- }
-
- /**
- * Method getValue.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the float at the given index
- */
- public float getValue(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._valueList.size()) {
- throw new IndexOutOfBoundsException("getValue: Index value '" + index + "' not in range [0.." + (this._valueList.size() - 1) + "]");
- }
-
- return ((java.lang.Float) _valueList.get(index)).floatValue();
- }
-
- /**
- * Method getValue.Returns the contents of the collection in an
- * Array.
- *
- * @return this collection as an Array
- */
- public float[] getValue(
- ) {
- int size = this._valueList.size();
- float[] array = new float[size];
- java.util.Iterator iter = _valueList.iterator();
- for (int index = 0; index < size; index++) {
- array[index] = ((java.lang.Float) iter.next()).floatValue();
- }
- return array;
- }
-
- /**
- * Method getValueAsReference.Returns a reference to
- * '_valueList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getValueAsReference(
- ) {
- return this._valueList;
- }
-
- /**
- * Method getValueCount.
- *
- * @return the size of this collection
- */
- public int getValueCount(
- ) {
- return this._valueList.size();
- }
-
- /**
- * Method hasAfter.
- *
- * @return true if at least one After has been added
- */
- public boolean hasAfter(
- ) {
- return this._has_after;
- }
-
- /**
- * Method hasPosition.
- *
- * @return true if at least one Position has been added
- */
- public boolean hasPosition(
- ) {
- return this._has_position;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- result = 37 * result + (int)(_position^(_position>>>32));
- result = 37 * result + (_after?0:1);
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_description != null
- && !org.castor.util.CycleBreaker.startingToCycle(_description)) {
- result = 37 * result + _description.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_description);
- }
- if (_glyphList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_glyphList)) {
- result = 37 * result + _glyphList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_glyphList);
- }
- if (_valueList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_valueList)) {
- result = 37 * result + _valueList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_valueList);
- }
-
- return result;
- }
-
- /**
- * Returns the value of field 'after'. The field 'after' has
- * the following description: true means the annotation element
- * appears between the
- * specified position and the next
- *
- * @return the value of field 'After'.
- */
- public boolean isAfter(
- ) {
- return this._after;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._description != null) {
+ if (temp._description == null)
+ return false;
+ if (this._description != temp._description) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._description);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._description);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._description);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._description);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._description.equals(temp._description)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._description);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._description);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllGlyph(
- ) {
- this._glyphList.clear();
- }
-
- /**
- */
- public void removeAllValue(
- ) {
- this._valueList.clear();
- }
-
- /**
- * Method removeGlyph.
- *
- * @param vGlyph
- * @return true if the object was removed from the collection.
- */
- public boolean removeGlyph(
- final uk.ac.vamsas.objects.core.Glyph vGlyph) {
- boolean removed = _glyphList.remove(vGlyph);
- return removed;
- }
-
- /**
- * Method removeGlyphAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Glyph removeGlyphAt(
- final int index) {
- java.lang.Object obj = this._glyphList.remove(index);
- return (uk.ac.vamsas.objects.core.Glyph) obj;
- }
-
- /**
- * Method removeValue.
- *
- * @param vValue
- * @return true if the object was removed from the collection.
- */
- public boolean removeValue(
- final float vValue) {
- boolean removed = _valueList.remove(new java.lang.Float(vValue));
- return removed;
- }
-
- /**
- * Method removeValueAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public float removeValueAt(
- final int index) {
- java.lang.Object obj = this._valueList.remove(index);
- return ((java.lang.Float) obj).floatValue();
- }
-
- /**
- * Sets the value of field 'after'. The field 'after' has the
- * following description: true means the annotation element
- * appears between the
- * specified position and the next
- *
- * @param after the value of field 'after'.
- */
- public void setAfter(
- final boolean after) {
- this._after = after;
- this._has_after = true;
- }
-
- /**
- * Sets the value of field 'description'. The field
- * 'description' has the following description: Free text at
- * this position
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- *
- *
- * @param index
- * @param vGlyph
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setGlyph(
- final int index,
- final uk.ac.vamsas.objects.core.Glyph vGlyph)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._glyphList.size()) {
- throw new IndexOutOfBoundsException("setGlyph: Index value '" + index + "' not in range [0.." + (this._glyphList.size() - 1) + "]");
- }
-
- this._glyphList.set(index, vGlyph);
- }
-
- /**
- *
- *
- * @param vGlyphArray
- */
- public void setGlyph(
- final uk.ac.vamsas.objects.core.Glyph[] vGlyphArray) {
- //-- copy array
- _glyphList.clear();
-
- for (int i = 0; i < vGlyphArray.length; i++) {
- this._glyphList.add(vGlyphArray[i]);
- }
- }
-
- /**
- * Sets the value of '_glyphList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vGlyphList the Vector to copy.
- */
- public void setGlyph(
- final java.util.Vector vGlyphList) {
- // copy vector
- this._glyphList.clear();
-
- this._glyphList.addAll(vGlyphList);
- }
-
- /**
- * Sets the value of '_glyphList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param glyphVector the Vector to set.
- */
- public void setGlyphAsReference(
- final java.util.Vector glyphVector) {
- this._glyphList = glyphVector;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'position'. The field 'position' has
- * the following description: position with respect to the
- * coordinate frame defined by a
- * rangeType specification
- *
- * @param position the value of field 'position'.
- */
- public void setPosition(
- final long position) {
- this._position = position;
- this._has_position = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vValue
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setValue(
- final int index,
- final float vValue)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._valueList.size()) {
- throw new IndexOutOfBoundsException("setValue: Index value '" + index + "' not in range [0.." + (this._valueList.size() - 1) + "]");
+ } else if (temp._description != null)
+ return false;
+ if (this._glyphList != null) {
+ if (temp._glyphList == null)
+ return false;
+ if (this._glyphList != temp._glyphList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._glyphList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._glyphList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._glyphList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._glyphList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._glyphList.equals(temp._glyphList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._glyphList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._glyphList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._glyphList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._glyphList);
+ }
}
-
- this._valueList.set(index, new java.lang.Float(vValue));
- }
-
- /**
- *
- *
- * @param vValueArray
- */
- public void setValue(
- final float[] vValueArray) {
- //-- copy array
- _valueList.clear();
-
- for (int i = 0; i < vValueArray.length; i++) {
- this._valueList.add(new java.lang.Float(vValueArray[i]));
+ } else if (temp._glyphList != null)
+ return false;
+ if (this._valueList != null) {
+ if (temp._valueList == null)
+ return false;
+ if (this._valueList != temp._valueList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._valueList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._valueList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._valueList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._valueList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._valueList.equals(temp._valueList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._valueList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._valueList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._valueList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._valueList);
+ }
}
- }
-
- /**
- * Sets the value of '_valueList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vValueList the Vector to copy.
- */
- public void setValue(
- final java.util.Vector vValueList) {
- // copy vector
- this._valueList.clear();
-
- this._valueList.addAll(vValueList);
- }
-
- /**
- * Sets the value of '_valueList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param valueVector the Vector to set.
- */
- public void setValueAsReference(
- final java.util.Vector valueVector) {
- this._valueList = valueVector;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * uk.ac.vamsas.objects.core.AnnotationElement
- */
- public static uk.ac.vamsas.objects.core.AnnotationElement unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.AnnotationElement) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AnnotationElement.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ } else if (temp._valueList != null)
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'after'. The field 'after' has the following
+ * description: true means the annotation element appears between the
+ * specified position and the next
+ *
+ * @return the value of field 'After'.
+ */
+ public boolean getAfter() {
+ return this._after;
+ }
+
+ /**
+ * Returns the value of field 'description'. The field 'description' has the
+ * following description: Free text at this position
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription() {
+ return this._description;
+ }
+
+ /**
+ * Method getGlyph.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Glyph at the given index
+ */
+ public uk.ac.vamsas.objects.core.Glyph getGlyph(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._glyphList.size()) {
+ throw new IndexOutOfBoundsException("getGlyph: Index value '" + index
+ + "' not in range [0.." + (this._glyphList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Glyph) _glyphList.get(index);
+ }
+
+ /**
+ * Method getGlyph.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Glyph[] getGlyph() {
+ uk.ac.vamsas.objects.core.Glyph[] array = new uk.ac.vamsas.objects.core.Glyph[0];
+ return (uk.ac.vamsas.objects.core.Glyph[]) this._glyphList.toArray(array);
+ }
+
+ /**
+ * Method getGlyphAsReference.Returns a reference to '_glyphList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getGlyphAsReference() {
+ return this._glyphList;
+ }
+
+ /**
+ * Method getGlyphCount.
+ *
+ * @return the size of this collection
+ */
+ public int getGlyphCount() {
+ return this._glyphList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'position'. The field 'position' has the
+ * following description: position with respect to the coordinate frame
+ * defined by a rangeType specification
+ *
+ * @return the value of field 'Position'.
+ */
+ public long getPosition() {
+ return this._position;
+ }
+
+ /**
+ * Method getValue.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the float at the given index
+ */
+ public float getValue(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._valueList.size()) {
+ throw new IndexOutOfBoundsException("getValue: Index value '" + index
+ + "' not in range [0.." + (this._valueList.size() - 1) + "]");
+ }
+
+ return ((java.lang.Float) _valueList.get(index)).floatValue();
+ }
+
+ /**
+ * Method getValue.Returns the contents of the collection in an Array.
+ *
+ * @return this collection as an Array
+ */
+ public float[] getValue() {
+ int size = this._valueList.size();
+ float[] array = new float[size];
+ java.util.Iterator iter = _valueList.iterator();
+ for (int index = 0; index < size; index++) {
+ array[index] = ((java.lang.Float) iter.next()).floatValue();
+ }
+ return array;
+ }
+
+ /**
+ * Method getValueAsReference.Returns a reference to '_valueList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getValueAsReference() {
+ return this._valueList;
+ }
+
+ /**
+ * Method getValueCount.
+ *
+ * @return the size of this collection
+ */
+ public int getValueCount() {
+ return this._valueList.size();
+ }
+
+ /**
+ * Method hasAfter.
+ *
+ * @return true if at least one After has been added
+ */
+ public boolean hasAfter() {
+ return this._has_after;
+ }
+
+ /**
+ * Method hasPosition.
+ *
+ * @return true if at least one Position has been added
+ */
+ public boolean hasPosition() {
+ return this._has_position;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ result = 37 * result + (int) (_position ^ (_position >>> 32));
+ result = 37 * result + (_after ? 0 : 1);
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
+ }
+ if (_description != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_description)) {
+ result = 37 * result + _description.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_description);
+ }
+ if (_glyphList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_glyphList)) {
+ result = 37 * result + _glyphList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_glyphList);
+ }
+ if (_valueList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_valueList)) {
+ result = 37 * result + _valueList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_valueList);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the value of field 'after'. The field 'after' has the following
+ * description: true means the annotation element appears between the
+ * specified position and the next
+ *
+ * @return the value of field 'After'.
+ */
+ public boolean isAfter() {
+ return this._after;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllGlyph() {
+ this._glyphList.clear();
+ }
+
+ /**
+ */
+ public void removeAllValue() {
+ this._valueList.clear();
+ }
+
+ /**
+ * Method removeGlyph.
+ *
+ * @param vGlyph
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeGlyph(final uk.ac.vamsas.objects.core.Glyph vGlyph) {
+ boolean removed = _glyphList.remove(vGlyph);
+ return removed;
+ }
+
+ /**
+ * Method removeGlyphAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Glyph removeGlyphAt(final int index) {
+ java.lang.Object obj = this._glyphList.remove(index);
+ return (uk.ac.vamsas.objects.core.Glyph) obj;
+ }
+
+ /**
+ * Method removeValue.
+ *
+ * @param vValue
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeValue(final float vValue) {
+ boolean removed = _valueList.remove(new java.lang.Float(vValue));
+ return removed;
+ }
+
+ /**
+ * Method removeValueAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public float removeValueAt(final int index) {
+ java.lang.Object obj = this._valueList.remove(index);
+ return ((java.lang.Float) obj).floatValue();
+ }
+
+ /**
+ * Sets the value of field 'after'. The field 'after' has the following
+ * description: true means the annotation element appears between the
+ * specified position and the next
+ *
+ * @param after
+ * the value of field 'after'.
+ */
+ public void setAfter(final boolean after) {
+ this._after = after;
+ this._has_after = true;
+ }
+
+ /**
+ * Sets the value of field 'description'. The field 'description' has the
+ * following description: Free text at this position
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description) {
+ this._description = description;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vGlyph
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setGlyph(final int index,
+ final uk.ac.vamsas.objects.core.Glyph vGlyph)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._glyphList.size()) {
+ throw new IndexOutOfBoundsException("setGlyph: Index value '" + index
+ + "' not in range [0.." + (this._glyphList.size() - 1) + "]");
+ }
+
+ this._glyphList.set(index, vGlyph);
+ }
+
+ /**
+ *
+ *
+ * @param vGlyphArray
+ */
+ public void setGlyph(final uk.ac.vamsas.objects.core.Glyph[] vGlyphArray) {
+ // -- copy array
+ _glyphList.clear();
+
+ for (int i = 0; i < vGlyphArray.length; i++) {
+ this._glyphList.add(vGlyphArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_glyphList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vGlyphList
+ * the Vector to copy.
+ */
+ public void setGlyph(final java.util.Vector vGlyphList) {
+ // copy vector
+ this._glyphList.clear();
+
+ this._glyphList.addAll(vGlyphList);
+ }
+
+ /**
+ * Sets the value of '_glyphList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param glyphVector
+ * the Vector to set.
+ */
+ public void setGlyphAsReference(final java.util.Vector glyphVector) {
+ this._glyphList = glyphVector;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'position'. The field 'position' has the following
+ * description: position with respect to the coordinate frame defined by a
+ * rangeType specification
+ *
+ * @param position
+ * the value of field 'position'.
+ */
+ public void setPosition(final long position) {
+ this._position = position;
+ this._has_position = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vValue
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setValue(final int index, final float vValue)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._valueList.size()) {
+ throw new IndexOutOfBoundsException("setValue: Index value '" + index
+ + "' not in range [0.." + (this._valueList.size() - 1) + "]");
+ }
+
+ this._valueList.set(index, new java.lang.Float(vValue));
+ }
+
+ /**
+ *
+ *
+ * @param vValueArray
+ */
+ public void setValue(final float[] vValueArray) {
+ // -- copy array
+ _valueList.clear();
+
+ for (int i = 0; i < vValueArray.length; i++) {
+ this._valueList.add(new java.lang.Float(vValueArray[i]));
+ }
+ }
+
+ /**
+ * Sets the value of '_valueList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vValueList
+ * the Vector to copy.
+ */
+ public void setValue(final java.util.Vector vValueList) {
+ // copy vector
+ this._valueList.clear();
+
+ this._valueList.addAll(vValueList);
+ }
+
+ /**
+ * Sets the value of '_valueList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param valueVector
+ * the Vector to set.
+ */
+ public void setValueAsReference(final java.util.Vector valueVector) {
+ this._valueList = valueVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.AnnotationElement
+ */
+ public static uk.ac.vamsas.objects.core.AnnotationElement unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.AnnotationElement) Unmarshaller
+ .unmarshal(uk.ac.vamsas.objects.core.AnnotationElement.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AppData extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
+public class AppData extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * Internal choice value storage\r
+ */\r
+ private java.lang.Object _choiceValue;\r
\r
- /**\r
- * Internal choice value storage\r
- */\r
- private java.lang.Object _choiceValue;\r
+ /**\r
+ * Field _data.\r
+ */\r
+ private byte[] _data;\r
\r
- /**\r
- * Field _data.\r
- */\r
- private byte[] _data;\r
+ /**\r
+ * Field _dataReference.\r
+ */\r
+ private java.lang.String _dataReference;\r
\r
- /**\r
- * Field _dataReference.\r
- */\r
- private java.lang.String _dataReference;\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public AppData() {\r
+ super();\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public AppData() {\r
- super();\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (obj instanceof AppData) {\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ AppData temp = (AppData) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._choiceValue != null) {\r
+ if (temp._choiceValue == null)\r
+ return false;\r
+ if (this._choiceValue != temp._choiceValue) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._choiceValue);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._choiceValue);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._choiceValue);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._choiceValue);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof AppData) {\r
- \r
- AppData temp = (AppData)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._choiceValue != null) {\r
- if (temp._choiceValue == null) return false;\r
- if (this._choiceValue != temp._choiceValue) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._choiceValue);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._choiceValue);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._choiceValue.equals(temp._choiceValue)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
- }\r
- }\r
- } else if (temp._choiceValue != null)\r
- return false;\r
- if (this._data != null) {\r
- if (temp._data == null) return false;\r
- if (this._data != temp._data) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._data);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._data);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._data); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._data); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!java.util.Arrays.equals(this._data, temp._data)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._data);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._data);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._data);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._data);\r
- }\r
- }\r
- } else if (temp._data != null)\r
- return false;\r
- if (this._dataReference != null) {\r
- if (temp._dataReference == null) return false;\r
- if (this._dataReference != temp._dataReference) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dataReference);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dataReference);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dataReference); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataReference); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._dataReference.equals(temp._dataReference)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dataReference);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataReference);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dataReference);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataReference);\r
- }\r
- }\r
- } else if (temp._dataReference != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._choiceValue.equals(temp._choiceValue)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._choiceValue);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._choiceValue);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
+ }\r
}\r
+ } else if (temp._choiceValue != null)\r
return false;\r
+ if (this._data != null) {\r
+ if (temp._data == null)\r
+ return false;\r
+ if (this._data != temp._data) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._data);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._data);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._data);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._data);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!java.util.Arrays.equals(this._data, temp._data)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._data);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._data);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._data);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._data);\r
+ }\r
+ }\r
+ } else if (temp._data != null)\r
+ return false;\r
+ if (this._dataReference != null) {\r
+ if (temp._dataReference == null)\r
+ return false;\r
+ if (this._dataReference != temp._dataReference) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._dataReference);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._dataReference);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._dataReference);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._dataReference);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._dataReference.equals(temp._dataReference)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._dataReference);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._dataReference);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._dataReference);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._dataReference);\r
+ }\r
+ }\r
+ } else if (temp._dataReference != null)\r
+ return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'choiceValue'. The field\r
- * 'choiceValue' has the following description: Internal choice\r
- * value storage\r
- * \r
- * @return the value of field 'ChoiceValue'.\r
- */\r
- public java.lang.Object getChoiceValue(\r
- ) {\r
- return this._choiceValue;\r
- }\r
+ /**\r
+ * Returns the value of field 'choiceValue'. The field 'choiceValue' has the\r
+ * following description: Internal choice value storage\r
+ * \r
+ * @return the value of field 'ChoiceValue'.\r
+ */\r
+ public java.lang.Object getChoiceValue() {\r
+ return this._choiceValue;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'data'.\r
- * \r
- * @return the value of field 'Data'.\r
- */\r
- public byte[] getData(\r
- ) {\r
- return this._data;\r
- }\r
+ /**\r
+ * Returns the value of field 'data'.\r
+ * \r
+ * @return the value of field 'Data'.\r
+ */\r
+ public byte[] getData() {\r
+ return this._data;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'dataReference'.\r
- * \r
- * @return the value of field 'DataReference'.\r
- */\r
- public java.lang.String getDataReference(\r
- ) {\r
- return this._dataReference;\r
- }\r
+ /**\r
+ * Returns the value of field 'dataReference'.\r
+ * \r
+ * @return the value of field 'DataReference'.\r
+ */\r
+ public java.lang.String getDataReference() {\r
+ return this._dataReference;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_choiceValue != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_choiceValue)) {\r
- result = 37 * result + _choiceValue.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_choiceValue);\r
- }\r
- if (_data != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_data)) {\r
- result = 37 * result + _data.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_data);\r
- }\r
- if (_dataReference != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_dataReference)) {\r
- result = 37 * result + _dataReference.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_dataReference);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ if (_choiceValue != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_choiceValue)) {\r
+ result = 37 * result + _choiceValue.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_choiceValue);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
+ if (_data != null && !org.castor.util.CycleBreaker.startingToCycle(_data)) {\r
+ result = 37 * result + _data.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_data);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
+ if (_dataReference != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_dataReference)) {\r
+ result = 37 * result + _dataReference.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_dataReference);\r
}\r
\r
- /**\r
- * Sets the value of field 'data'.\r
- * \r
- * @param data the value of field 'data'.\r
- */\r
- public void setData(\r
- final byte[] data) {\r
- this._data = data;\r
- this._choiceValue = data;\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'dataReference'.\r
- * \r
- * @param dataReference the value of field 'dataReference'.\r
- */\r
- public void setDataReference(\r
- final java.lang.String dataReference) {\r
- this._dataReference = dataReference;\r
- this._choiceValue = dataReference;\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
- */\r
- public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.AppData.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'data'.\r
+ * \r
+ * @param data\r
+ * the value of field 'data'.\r
+ */\r
+ public void setData(final byte[] data) {\r
+ this._data = data;\r
+ this._choiceValue = data;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'dataReference'.\r
+ * \r
+ * @param dataReference\r
+ * the value of field 'dataReference'.\r
+ */\r
+ public void setDataReference(final java.lang.String dataReference) {\r
+ this._dataReference = dataReference;\r
+ this._choiceValue = dataReference;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
+ */\r
+ public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.AppData.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class ApplicationData.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class ApplicationData extends uk.ac.vamsas.objects.core.AppData
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Version string describing the application specific
- * data storage version used
- */
- private java.lang.String _version;
-
- /**
- * Canonical name of application
- */
- private java.lang.String _name;
-
- /**
- * Field _userList.
- */
- private java.util.Vector _userList;
-
- /**
- * Field _common.
- */
- private uk.ac.vamsas.objects.core.Common _common;
-
- /**
- * Field _instanceList.
- */
- private java.util.Vector _instanceList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public ApplicationData() {
- super();
- this._userList = new java.util.Vector();
- this._instanceList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vInstance
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addInstance(
- final uk.ac.vamsas.objects.core.Instance vInstance)
- throws java.lang.IndexOutOfBoundsException {
- this._instanceList.addElement(vInstance);
- }
-
- /**
- *
- *
- * @param index
- * @param vInstance
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addInstance(
- final int index,
- final uk.ac.vamsas.objects.core.Instance vInstance)
- throws java.lang.IndexOutOfBoundsException {
- this._instanceList.add(index, vInstance);
- }
-
- /**
- *
- *
- * @param vUser
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addUser(
- final uk.ac.vamsas.objects.core.User vUser)
- throws java.lang.IndexOutOfBoundsException {
- this._userList.addElement(vUser);
- }
-
- /**
- *
- *
- * @param index
- * @param vUser
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addUser(
- final int index,
- final uk.ac.vamsas.objects.core.User vUser)
- throws java.lang.IndexOutOfBoundsException {
- this._userList.add(index, vUser);
- }
-
- /**
- * Method enumerateInstance.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Instance elements
- */
- public java.util.Enumeration enumerateInstance(
- ) {
- return this._instanceList.elements();
- }
-
- /**
- * Method enumerateUser.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.User elements
- */
- public java.util.Enumeration enumerateUser(
- ) {
- return this._userList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class ApplicationData extends uk.ac.vamsas.objects.core.AppData
+ implements java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Version string describing the application specific data storage version
+ * used
+ */
+ private java.lang.String _version;
+
+ /**
+ * Canonical name of application
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _userList.
+ */
+ private java.util.Vector _userList;
+
+ /**
+ * Field _common.
+ */
+ private uk.ac.vamsas.objects.core.Common _common;
+
+ /**
+ * Field _instanceList.
+ */
+ private java.util.Vector _instanceList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public ApplicationData() {
+ super();
+ this._userList = new java.util.Vector();
+ this._instanceList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vInstance
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addInstance(final uk.ac.vamsas.objects.core.Instance vInstance)
+ throws java.lang.IndexOutOfBoundsException {
+ this._instanceList.addElement(vInstance);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vInstance
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addInstance(final int index,
+ final uk.ac.vamsas.objects.core.Instance vInstance)
+ throws java.lang.IndexOutOfBoundsException {
+ this._instanceList.add(index, vInstance);
+ }
+
+ /**
+ *
+ *
+ * @param vUser
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addUser(final uk.ac.vamsas.objects.core.User vUser)
+ throws java.lang.IndexOutOfBoundsException {
+ this._userList.addElement(vUser);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vUser
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addUser(final int index,
+ final uk.ac.vamsas.objects.core.User vUser)
+ throws java.lang.IndexOutOfBoundsException {
+ this._userList.add(index, vUser);
+ }
+
+ /**
+ * Method enumerateInstance.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Instance elements
+ */
+ public java.util.Enumeration enumerateInstance() {
+ return this._instanceList.elements();
+ }
+
+ /**
+ * Method enumerateUser.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.User elements
+ */
+ public java.util.Enumeration enumerateUser() {
+ return this._userList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof ApplicationData) {
+
+ ApplicationData temp = (ApplicationData) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._version != null) {
+ if (temp._version == null)
+ return false;
+ if (this._version != temp._version) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._version);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._version);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ }
+ ;
return false;
-
- if (obj instanceof ApplicationData) {
-
- ApplicationData temp = (ApplicationData)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._version != null) {
- if (temp._version == null) return false;
- if (this._version != temp._version) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._version);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._version);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._version); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._version); };
- return false;
- }
- if (!thcycle) {
- if (!this._version.equals(temp._version)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
- }
- }
- } else if (temp._version != null)
- return false;
- if (this._name != null) {
- if (temp._name == null) return false;
- if (this._name != temp._name) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };
- return false;
- }
- if (!thcycle) {
- if (!this._name.equals(temp._name)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
- }
- }
- } else if (temp._name != null)
- return false;
- if (this._userList != null) {
- if (temp._userList == null) return false;
- if (this._userList != temp._userList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._userList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._userList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._userList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList); };
- return false;
- }
- if (!thcycle) {
- if (!this._userList.equals(temp._userList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._userList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._userList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList);
- }
- }
- } else if (temp._userList != null)
- return false;
- if (this._common != null) {
- if (temp._common == null) return false;
- if (this._common != temp._common) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._common);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._common);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._common); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._common); };
- return false;
- }
- if (!thcycle) {
- if (!this._common.equals(temp._common)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._common);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._common);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._common);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._common);
- }
- }
- } else if (temp._common != null)
- return false;
- if (this._instanceList != null) {
- if (temp._instanceList == null) return false;
- if (this._instanceList != temp._instanceList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._instanceList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._instanceList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._instanceList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._instanceList); };
- return false;
- }
- if (!thcycle) {
- if (!this._instanceList.equals(temp._instanceList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._instanceList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._instanceList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._instanceList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._instanceList);
- }
- }
- } else if (temp._instanceList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._version.equals(temp._version)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ }
}
+ } else if (temp._version != null)
return false;
- }
-
- /**
- * Returns the value of field 'common'.
- *
- * @return the value of field 'Common'.
- */
- public uk.ac.vamsas.objects.core.Common getCommon(
- ) {
- return this._common;
- }
-
- /**
- * Method getInstance.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Instance
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Instance getInstance(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._instanceList.size()) {
- throw new IndexOutOfBoundsException("getInstance: Index value '" + index + "' not in range [0.." + (this._instanceList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Instance) _instanceList.get(index);
- }
-
- /**
- * Method getInstance.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Instance[] getInstance(
- ) {
- uk.ac.vamsas.objects.core.Instance[] array = new uk.ac.vamsas.objects.core.Instance[0];
- return (uk.ac.vamsas.objects.core.Instance[]) this._instanceList.toArray(array);
- }
-
- /**
- * Method getInstanceAsReference.Returns a reference to
- * '_instanceList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getInstanceAsReference(
- ) {
- return this._instanceList;
- }
-
- /**
- * Method getInstanceCount.
- *
- * @return the size of this collection
- */
- public int getInstanceCount(
- ) {
- return this._instanceList.size();
- }
-
- /**
- * Returns the value of field 'name'. The field 'name' has the
- * following description: Canonical name of application
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Method getUser.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.User at
- * the given index
- */
- public uk.ac.vamsas.objects.core.User getUser(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._userList.size()) {
- throw new IndexOutOfBoundsException("getUser: Index value '" + index + "' not in range [0.." + (this._userList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.User) _userList.get(index);
- }
-
- /**
- * Method getUser.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.User[] getUser(
- ) {
- uk.ac.vamsas.objects.core.User[] array = new uk.ac.vamsas.objects.core.User[0];
- return (uk.ac.vamsas.objects.core.User[]) this._userList.toArray(array);
- }
-
- /**
- * Method getUserAsReference.Returns a reference to
- * '_userList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getUserAsReference(
- ) {
- return this._userList;
- }
-
- /**
- * Method getUserCount.
- *
- * @return the size of this collection
- */
- public int getUserCount(
- ) {
- return this._userList.size();
- }
-
- /**
- * Returns the value of field 'version'. The field 'version'
- * has the following description: Version string describing the
- * application specific
- * data storage version used
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_version != null
- && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
- result = 37 * result + _version.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_version);
- }
- if (_name != null
- && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
- result = 37 * result + _name.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_name);
- }
- if (_userList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_userList)) {
- result = 37 * result + _userList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_userList);
- }
- if (_common != null
- && !org.castor.util.CycleBreaker.startingToCycle(_common)) {
- result = 37 * result + _common.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_common);
- }
- if (_instanceList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_instanceList)) {
- result = 37 * result + _instanceList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_instanceList);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._name != null) {
+ if (temp._name == null)
+ return false;
+ if (this._name != temp._name) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._name);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._name);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._name.equals(temp._name)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllInstance(
- ) {
- this._instanceList.clear();
- }
-
- /**
- */
- public void removeAllUser(
- ) {
- this._userList.clear();
- }
-
- /**
- * Method removeInstance.
- *
- * @param vInstance
- * @return true if the object was removed from the collection.
- */
- public boolean removeInstance(
- final uk.ac.vamsas.objects.core.Instance vInstance) {
- boolean removed = _instanceList.remove(vInstance);
- return removed;
- }
-
- /**
- * Method removeInstanceAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Instance removeInstanceAt(
- final int index) {
- java.lang.Object obj = this._instanceList.remove(index);
- return (uk.ac.vamsas.objects.core.Instance) obj;
- }
-
- /**
- * Method removeUser.
- *
- * @param vUser
- * @return true if the object was removed from the collection.
- */
- public boolean removeUser(
- final uk.ac.vamsas.objects.core.User vUser) {
- boolean removed = _userList.remove(vUser);
- return removed;
- }
-
- /**
- * Method removeUserAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.User removeUserAt(
- final int index) {
- java.lang.Object obj = this._userList.remove(index);
- return (uk.ac.vamsas.objects.core.User) obj;
- }
-
- /**
- * Sets the value of field 'common'.
- *
- * @param common the value of field 'common'.
- */
- public void setCommon(
- final uk.ac.vamsas.objects.core.Common common) {
- this._common = common;
- }
-
- /**
- *
- *
- * @param index
- * @param vInstance
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setInstance(
- final int index,
- final uk.ac.vamsas.objects.core.Instance vInstance)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._instanceList.size()) {
- throw new IndexOutOfBoundsException("setInstance: Index value '" + index + "' not in range [0.." + (this._instanceList.size() - 1) + "]");
- }
-
- this._instanceList.set(index, vInstance);
- }
-
- /**
- *
- *
- * @param vInstanceArray
- */
- public void setInstance(
- final uk.ac.vamsas.objects.core.Instance[] vInstanceArray) {
- //-- copy array
- _instanceList.clear();
-
- for (int i = 0; i < vInstanceArray.length; i++) {
- this._instanceList.add(vInstanceArray[i]);
+ } else if (temp._name != null)
+ return false;
+ if (this._userList != null) {
+ if (temp._userList == null)
+ return false;
+ if (this._userList != temp._userList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._userList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._userList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._userList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._userList.equals(temp._userList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._userList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._userList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._userList);
+ }
}
- }
-
- /**
- * Sets the value of '_instanceList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vInstanceList the Vector to copy.
- */
- public void setInstance(
- final java.util.Vector vInstanceList) {
- // copy vector
- this._instanceList.clear();
-
- this._instanceList.addAll(vInstanceList);
- }
-
- /**
- * Sets the value of '_instanceList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param instanceVector the Vector to set.
- */
- public void setInstanceAsReference(
- final java.util.Vector instanceVector) {
- this._instanceList = instanceVector;
- }
-
- /**
- * Sets the value of field 'name'. The field 'name' has the
- * following description: Canonical name of application
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- *
- *
- * @param index
- * @param vUser
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setUser(
- final int index,
- final uk.ac.vamsas.objects.core.User vUser)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._userList.size()) {
- throw new IndexOutOfBoundsException("setUser: Index value '" + index + "' not in range [0.." + (this._userList.size() - 1) + "]");
+ } else if (temp._userList != null)
+ return false;
+ if (this._common != null) {
+ if (temp._common == null)
+ return false;
+ if (this._common != temp._common) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._common);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._common);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._common);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._common);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._common.equals(temp._common)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._common);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._common);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._common);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._common);
+ }
}
-
- this._userList.set(index, vUser);
- }
-
- /**
- *
- *
- * @param vUserArray
- */
- public void setUser(
- final uk.ac.vamsas.objects.core.User[] vUserArray) {
- //-- copy array
- _userList.clear();
-
- for (int i = 0; i < vUserArray.length; i++) {
- this._userList.add(vUserArray[i]);
+ } else if (temp._common != null)
+ return false;
+ if (this._instanceList != null) {
+ if (temp._instanceList == null)
+ return false;
+ if (this._instanceList != temp._instanceList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._instanceList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._instanceList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._instanceList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._instanceList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._instanceList.equals(temp._instanceList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._instanceList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._instanceList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._instanceList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._instanceList);
+ }
}
- }
-
- /**
- * Sets the value of '_userList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vUserList the Vector to copy.
- */
- public void setUser(
- final java.util.Vector vUserList) {
- // copy vector
- this._userList.clear();
-
- this._userList.addAll(vUserList);
- }
-
- /**
- * Sets the value of '_userList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param userVector the Vector to set.
- */
- public void setUserAsReference(
- final java.util.Vector userVector) {
- this._userList = userVector;
- }
-
- /**
- * Sets the value of field 'version'. The field 'version' has
- * the following description: Version string describing the
- * application specific
- * data storage version used
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.AppData
- */
- public static uk.ac.vamsas.objects.core.AppData unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.ApplicationData.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ } else if (temp._instanceList != null)
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'common'.
+ *
+ * @return the value of field 'Common'.
+ */
+ public uk.ac.vamsas.objects.core.Common getCommon() {
+ return this._common;
+ }
+
+ /**
+ * Method getInstance.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Instance at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Instance getInstance(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._instanceList.size()) {
+ throw new IndexOutOfBoundsException("getInstance: Index value '" + index
+ + "' not in range [0.." + (this._instanceList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Instance) _instanceList.get(index);
+ }
+
+ /**
+ * Method getInstance.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Instance[] getInstance() {
+ uk.ac.vamsas.objects.core.Instance[] array = new uk.ac.vamsas.objects.core.Instance[0];
+ return (uk.ac.vamsas.objects.core.Instance[]) this._instanceList
+ .toArray(array);
+ }
+
+ /**
+ * Method getInstanceAsReference.Returns a reference to '_instanceList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getInstanceAsReference() {
+ return this._instanceList;
+ }
+
+ /**
+ * Method getInstanceCount.
+ *
+ * @return the size of this collection
+ */
+ public int getInstanceCount() {
+ return this._instanceList.size();
+ }
+
+ /**
+ * Returns the value of field 'name'. The field 'name' has the following
+ * description: Canonical name of application
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName() {
+ return this._name;
+ }
+
+ /**
+ * Method getUser.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.User at the given index
+ */
+ public uk.ac.vamsas.objects.core.User getUser(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._userList.size()) {
+ throw new IndexOutOfBoundsException("getUser: Index value '" + index
+ + "' not in range [0.." + (this._userList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.User) _userList.get(index);
+ }
+
+ /**
+ * Method getUser.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.User[] getUser() {
+ uk.ac.vamsas.objects.core.User[] array = new uk.ac.vamsas.objects.core.User[0];
+ return (uk.ac.vamsas.objects.core.User[]) this._userList.toArray(array);
+ }
+
+ /**
+ * Method getUserAsReference.Returns a reference to '_userList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getUserAsReference() {
+ return this._userList;
+ }
+
+ /**
+ * Method getUserCount.
+ *
+ * @return the size of this collection
+ */
+ public int getUserCount() {
+ return this._userList.size();
+ }
+
+ /**
+ * Returns the value of field 'version'. The field 'version' has the following
+ * description: Version string describing the application specific data
+ * storage version used
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion() {
+ return this._version;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_version != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
+ result = 37 * result + _version.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_version);
+ }
+ if (_name != null && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
+ result = 37 * result + _name.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_name);
+ }
+ if (_userList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_userList)) {
+ result = 37 * result + _userList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_userList);
+ }
+ if (_common != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_common)) {
+ result = 37 * result + _common.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_common);
+ }
+ if (_instanceList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_instanceList)) {
+ result = 37 * result + _instanceList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_instanceList);
+ }
+
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllInstance() {
+ this._instanceList.clear();
+ }
+
+ /**
+ */
+ public void removeAllUser() {
+ this._userList.clear();
+ }
+
+ /**
+ * Method removeInstance.
+ *
+ * @param vInstance
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeInstance(
+ final uk.ac.vamsas.objects.core.Instance vInstance) {
+ boolean removed = _instanceList.remove(vInstance);
+ return removed;
+ }
+
+ /**
+ * Method removeInstanceAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Instance removeInstanceAt(final int index) {
+ java.lang.Object obj = this._instanceList.remove(index);
+ return (uk.ac.vamsas.objects.core.Instance) obj;
+ }
+
+ /**
+ * Method removeUser.
+ *
+ * @param vUser
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeUser(final uk.ac.vamsas.objects.core.User vUser) {
+ boolean removed = _userList.remove(vUser);
+ return removed;
+ }
+
+ /**
+ * Method removeUserAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.User removeUserAt(final int index) {
+ java.lang.Object obj = this._userList.remove(index);
+ return (uk.ac.vamsas.objects.core.User) obj;
+ }
+
+ /**
+ * Sets the value of field 'common'.
+ *
+ * @param common
+ * the value of field 'common'.
+ */
+ public void setCommon(final uk.ac.vamsas.objects.core.Common common) {
+ this._common = common;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vInstance
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setInstance(final int index,
+ final uk.ac.vamsas.objects.core.Instance vInstance)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._instanceList.size()) {
+ throw new IndexOutOfBoundsException("setInstance: Index value '" + index
+ + "' not in range [0.." + (this._instanceList.size() - 1) + "]");
+ }
+
+ this._instanceList.set(index, vInstance);
+ }
+
+ /**
+ *
+ *
+ * @param vInstanceArray
+ */
+ public void setInstance(
+ final uk.ac.vamsas.objects.core.Instance[] vInstanceArray) {
+ // -- copy array
+ _instanceList.clear();
+
+ for (int i = 0; i < vInstanceArray.length; i++) {
+ this._instanceList.add(vInstanceArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_instanceList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vInstanceList
+ * the Vector to copy.
+ */
+ public void setInstance(final java.util.Vector vInstanceList) {
+ // copy vector
+ this._instanceList.clear();
+
+ this._instanceList.addAll(vInstanceList);
+ }
+
+ /**
+ * Sets the value of '_instanceList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param instanceVector
+ * the Vector to set.
+ */
+ public void setInstanceAsReference(final java.util.Vector instanceVector) {
+ this._instanceList = instanceVector;
+ }
+
+ /**
+ * Sets the value of field 'name'. The field 'name' has the following
+ * description: Canonical name of application
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name) {
+ this._name = name;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vUser
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setUser(final int index,
+ final uk.ac.vamsas.objects.core.User vUser)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._userList.size()) {
+ throw new IndexOutOfBoundsException("setUser: Index value '" + index
+ + "' not in range [0.." + (this._userList.size() - 1) + "]");
+ }
+
+ this._userList.set(index, vUser);
+ }
+
+ /**
+ *
+ *
+ * @param vUserArray
+ */
+ public void setUser(final uk.ac.vamsas.objects.core.User[] vUserArray) {
+ // -- copy array
+ _userList.clear();
+
+ for (int i = 0; i < vUserArray.length; i++) {
+ this._userList.add(vUserArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_userList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vUserList
+ * the Vector to copy.
+ */
+ public void setUser(final java.util.Vector vUserList) {
+ // copy vector
+ this._userList.clear();
+
+ this._userList.addAll(vUserList);
+ }
+
+ /**
+ * Sets the value of '_userList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param userVector
+ * the Vector to set.
+ */
+ public void setUserAsReference(final java.util.Vector userVector) {
+ this._userList = userVector;
+ }
+
+ /**
+ * Sets the value of field 'version'. The field 'version' has the following
+ * description: Version string describing the application specific data
+ * storage version used
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version) {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.AppData
+ */
+ public static uk.ac.vamsas.objects.core.AppData unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.ApplicationData.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Attachment extends uk.ac.vamsas.objects.core.AppData \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * true implies data will be decompresses with Zip\r
- * before presenting to application \r
- */\r
- private boolean _compressed = false;\r
-\r
- /**\r
- * keeps track of state for field: _compressed\r
+public class Attachment extends uk.ac.vamsas.objects.core.AppData implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * true implies data will be decompresses with Zip before presenting to\r
+ * application\r
+ */\r
+ private boolean _compressed = false;\r
+\r
+ /**\r
+ * keeps track of state for field: _compressed\r
+ */\r
+ private boolean _has_compressed;\r
+\r
+ /**\r
+ * Type of arbitrary data - TODO: decide format - use (extended) MIME types ?\r
+ */\r
+ private java.lang.String _type;\r
+\r
+ /**\r
+ * Object the arbitrary data is associated with\r
+ * \r
+ */\r
+ private java.lang.Object _objectref;\r
+\r
+ /**\r
+ * Primary Key for vamsas object referencing\r
+ * \r
+ */\r
+ private java.lang.String _id;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Attachment() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
*/\r
- private boolean _has_compressed;\r
-\r
- /**\r
- * Type of arbitrary data - TODO: decide format - use\r
- * (extended) MIME types ? \r
- */\r
- private java.lang.String _type;\r
-\r
- /**\r
- * Object the arbitrary data is associated with\r
- * \r
- */\r
- private java.lang.Object _objectref;\r
-\r
- /**\r
- * Primary Key for vamsas object referencing\r
- * \r
- */\r
- private java.lang.String _id;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Attachment() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- */\r
- public void deleteCompressed(\r
- ) {\r
- this._has_compressed= false;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ public void deleteCompressed() {\r
+ this._has_compressed = false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Attachment) {\r
+\r
+ Attachment temp = (Attachment) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._compressed != temp._compressed)\r
+ return false;\r
+ if (this._has_compressed != temp._has_compressed)\r
+ return false;\r
+ if (this._type != null) {\r
+ if (temp._type == null)\r
+ return false;\r
+ if (this._type != temp._type) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._type);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Attachment) {\r
- \r
- Attachment temp = (Attachment)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._compressed != temp._compressed)\r
- return false;\r
- if (this._has_compressed != temp._has_compressed)\r
- return false;\r
- if (this._type != null) {\r
- if (temp._type == null) return false;\r
- if (this._type != temp._type) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._type);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._type); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._type.equals(temp._type)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- }\r
- }\r
- } else if (temp._type != null)\r
- return false;\r
- if (this._objectref != null) {\r
- if (temp._objectref == null) return false;\r
- if (this._objectref != temp._objectref) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._objectref);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._objectref);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._objectref.equals(temp._objectref)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref);\r
- }\r
- }\r
- } else if (temp._objectref != null)\r
- return false;\r
- if (this._id != null) {\r
- if (temp._id == null) return false;\r
- if (this._id != temp._id) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._id.equals(temp._id)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- }\r
- }\r
- } else if (temp._id != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._type.equals(temp._type)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
}\r
+ } else if (temp._type != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'compressed'. The field\r
- * 'compressed' has the following description: true implies\r
- * data will be decompresses with Zip\r
- * before presenting to application \r
- * \r
- * @return the value of field 'Compressed'.\r
- */\r
- public boolean getCompressed(\r
- ) {\r
- return this._compressed;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing\r
- * \r
- * \r
- * @return the value of field 'Id'.\r
- */\r
- public java.lang.String getId(\r
- ) {\r
- return this._id;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'objectref'. The field\r
- * 'objectref' has the following description: Object the\r
- * arbitrary data is associated with\r
- * \r
- * \r
- * @return the value of field 'Objectref'.\r
- */\r
- public java.lang.Object getObjectref(\r
- ) {\r
- return this._objectref;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'type'. The field 'type' has the\r
- * following description: Type of arbitrary data - TODO: decide\r
- * format - use\r
- * (extended) MIME types ? \r
- * \r
- * @return the value of field 'Type'.\r
- */\r
- public java.lang.String getType(\r
- ) {\r
- return this._type;\r
- }\r
-\r
- /**\r
- * Method hasCompressed.\r
- * \r
- * @return true if at least one Compressed has been added\r
- */\r
- public boolean hasCompressed(\r
- ) {\r
- return this._has_compressed;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + (_compressed?0:1);\r
- if (_type != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
- result = 37 * result + _type.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
- }\r
- if (_objectref != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_objectref)) {\r
- result = 37 * result + _objectref.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_objectref);\r
- }\r
- if (_id != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
- result = 37 * result + _id.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
+ if (this._objectref != null) {\r
+ if (temp._objectref == null)\r
+ return false;\r
+ if (this._objectref != temp._objectref) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._objectref);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._objectref);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._objectref.equals(temp._objectref)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._objectref);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._objectref);\r
+ }\r
}\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'compressed'. The field\r
- * 'compressed' has the following description: true implies\r
- * data will be decompresses with Zip\r
- * before presenting to application \r
- * \r
- * @return the value of field 'Compressed'.\r
- */\r
- public boolean isCompressed(\r
- ) {\r
- return this._compressed;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ } else if (temp._objectref != null)\r
+ return false;\r
+ if (this._id != null) {\r
+ if (temp._id == null)\r
+ return false;\r
+ if (this._id != temp._id) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._id.equals(temp._id)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'compressed'. The field 'compressed'\r
- * has the following description: true implies data will be\r
- * decompresses with Zip\r
- * before presenting to application \r
- * \r
- * @param compressed the value of field 'compressed'.\r
- */\r
- public void setCompressed(\r
- final boolean compressed) {\r
- this._compressed = compressed;\r
- this._has_compressed = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing\r
- * \r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(\r
- final java.lang.String id) {\r
- this._id = id;\r
+ } else if (temp._id != null)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Sets the value of field 'objectref'. The field 'objectref'\r
- * has the following description: Object the arbitrary data is\r
- * associated with\r
- * \r
- * \r
- * @param objectref the value of field 'objectref'.\r
- */\r
- public void setObjectref(\r
- final java.lang.Object objectref) {\r
- this._objectref = objectref;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'compressed'. The field 'compressed' has the\r
+ * following description: true implies data will be decompresses with Zip\r
+ * before presenting to application\r
+ * \r
+ * @return the value of field 'Compressed'.\r
+ */\r
+ public boolean getCompressed() {\r
+ return this._compressed;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'id'. The field 'id' has the following\r
+ * description: Primary Key for vamsas object referencing\r
+ * \r
+ * \r
+ * @return the value of field 'Id'.\r
+ */\r
+ public java.lang.String getId() {\r
+ return this._id;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'objectref'. The field 'objectref' has the\r
+ * following description: Object the arbitrary data is associated with\r
+ * \r
+ * \r
+ * @return the value of field 'Objectref'.\r
+ */\r
+ public java.lang.Object getObjectref() {\r
+ return this._objectref;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'type'. The field 'type' has the following\r
+ * description: Type of arbitrary data - TODO: decide format - use (extended)\r
+ * MIME types ?\r
+ * \r
+ * @return the value of field 'Type'.\r
+ */\r
+ public java.lang.String getType() {\r
+ return this._type;\r
+ }\r
+\r
+ /**\r
+ * Method hasCompressed.\r
+ * \r
+ * @return true if at least one Compressed has been added\r
+ */\r
+ public boolean hasCompressed() {\r
+ return this._has_compressed;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ result = 37 * result + (_compressed ? 0 : 1);\r
+ if (_type != null && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
+ result = 37 * result + _type.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
}\r
-\r
- /**\r
- * Sets the value of field 'type'. The field 'type' has the\r
- * following description: Type of arbitrary data - TODO: decide\r
- * format - use\r
- * (extended) MIME types ? \r
- * \r
- * @param type the value of field 'type'.\r
- */\r
- public void setType(\r
- final java.lang.String type) {\r
- this._type = type;\r
+ if (_objectref != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_objectref)) {\r
+ result = 37 * result + _objectref.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_objectref);\r
}\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
- */\r
- public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Attachment.class, reader);\r
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
+ result = 37 * result + _id.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'compressed'. The field 'compressed' has the\r
+ * following description: true implies data will be decompresses with Zip\r
+ * before presenting to application\r
+ * \r
+ * @return the value of field 'Compressed'.\r
+ */\r
+ public boolean isCompressed() {\r
+ return this._compressed;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'compressed'. The field 'compressed' has the\r
+ * following description: true implies data will be decompresses with Zip\r
+ * before presenting to application\r
+ * \r
+ * @param compressed\r
+ * the value of field 'compressed'.\r
+ */\r
+ public void setCompressed(final boolean compressed) {\r
+ this._compressed = compressed;\r
+ this._has_compressed = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'id'. The field 'id' has the following description:\r
+ * Primary Key for vamsas object referencing\r
+ * \r
+ * \r
+ * @param id\r
+ * the value of field 'id'.\r
+ */\r
+ public void setId(final java.lang.String id) {\r
+ this._id = id;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'objectref'. The field 'objectref' has the\r
+ * following description: Object the arbitrary data is associated with\r
+ * \r
+ * \r
+ * @param objectref\r
+ * the value of field 'objectref'.\r
+ */\r
+ public void setObjectref(final java.lang.Object objectref) {\r
+ this._objectref = objectref;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'type'. The field 'type' has the following\r
+ * description: Type of arbitrary data - TODO: decide format - use (extended)\r
+ * MIME types ?\r
+ * \r
+ * @param type\r
+ * the value of field 'type'.\r
+ */\r
+ public void setType(final java.lang.String type) {\r
+ this._type = type;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
+ */\r
+ public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Attachment.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Common extends uk.ac.vamsas.objects.core.AppData \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Common() {\r
- super();\r
- }\r
+public class Common extends uk.ac.vamsas.objects.core.AppData implements\r
+ java.io.Serializable {\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Common) {\r
- \r
- return true;\r
- }\r
- return false;\r
- }\r
+ public Common() {\r
+ super();\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- \r
- return result;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ if (obj instanceof Common) {\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
- */\r
- public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Common.class, reader);\r
+ return true;\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
+ */\r
+ public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Common.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class DataSet.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class DataSet extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Primary Key for vamsas object referencing
- */
- private java.lang.String _id;
-
- /**
- * Field _sequenceList.
- */
- private java.util.Vector _sequenceList;
-
- /**
- * Field _sequenceMappingList.
- */
- private java.util.Vector _sequenceMappingList;
-
- /**
- * Field _dataSetAnnotationsList.
- */
- private java.util.Vector _dataSetAnnotationsList;
-
- /**
- * Field _alignmentList.
- */
- private java.util.Vector _alignmentList;
-
- /**
- * Field _treeList.
- */
- private java.util.Vector _treeList;
-
- /**
- * Field _provenance.
- */
- private uk.ac.vamsas.objects.core.Provenance _provenance;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public DataSet() {
- super();
- this._sequenceList = new java.util.Vector();
- this._sequenceMappingList = new java.util.Vector();
- this._dataSetAnnotationsList = new java.util.Vector();
- this._alignmentList = new java.util.Vector();
- this._treeList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vAlignment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignment(
- final uk.ac.vamsas.objects.core.Alignment vAlignment)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentList.addElement(vAlignment);
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAlignment(
- final int index,
- final uk.ac.vamsas.objects.core.Alignment vAlignment)
- throws java.lang.IndexOutOfBoundsException {
- this._alignmentList.add(index, vAlignment);
- }
-
- /**
- *
- *
- * @param vDataSetAnnotations
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDataSetAnnotations(
- final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
- throws java.lang.IndexOutOfBoundsException {
- this._dataSetAnnotationsList.addElement(vDataSetAnnotations);
- }
-
- /**
- *
- *
- * @param index
- * @param vDataSetAnnotations
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDataSetAnnotations(
- final int index,
- final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
- throws java.lang.IndexOutOfBoundsException {
- this._dataSetAnnotationsList.add(index, vDataSetAnnotations);
- }
-
- /**
- *
- *
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequence(
- final uk.ac.vamsas.objects.core.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceList.addElement(vSequence);
- }
-
- /**
- *
- *
- * @param index
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequence(
- final int index,
- final uk.ac.vamsas.objects.core.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceList.add(index, vSequence);
- }
-
- /**
- *
- *
- * @param vSequenceMapping
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceMapping(
- final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceMappingList.addElement(vSequenceMapping);
- }
-
- /**
- *
- *
- * @param index
- * @param vSequenceMapping
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSequenceMapping(
- final int index,
- final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
- throws java.lang.IndexOutOfBoundsException {
- this._sequenceMappingList.add(index, vSequenceMapping);
- }
-
- /**
- *
- *
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.addElement(vTree);
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final int index,
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.add(index, vTree);
- }
-
- /**
- * Method enumerateAlignment.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Alignment elements
- */
- public java.util.Enumeration enumerateAlignment(
- ) {
- return this._alignmentList.elements();
- }
-
- /**
- * Method enumerateDataSetAnnotations.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.DataSetAnnotations elements
- */
- public java.util.Enumeration enumerateDataSetAnnotations(
- ) {
- return this._dataSetAnnotationsList.elements();
- }
-
- /**
- * Method enumerateSequence.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Sequence elements
- */
- public java.util.Enumeration enumerateSequence(
- ) {
- return this._sequenceList.elements();
- }
-
- /**
- * Method enumerateSequenceMapping.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.SequenceMapping elements
- */
- public java.util.Enumeration enumerateSequenceMapping(
- ) {
- return this._sequenceMappingList.elements();
- }
-
- /**
- * Method enumerateTree.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Tree elements
- */
- public java.util.Enumeration enumerateTree(
- ) {
- return this._treeList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class DataSet extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Primary Key for vamsas object referencing
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _sequenceList.
+ */
+ private java.util.Vector _sequenceList;
+
+ /**
+ * Field _sequenceMappingList.
+ */
+ private java.util.Vector _sequenceMappingList;
+
+ /**
+ * Field _dataSetAnnotationsList.
+ */
+ private java.util.Vector _dataSetAnnotationsList;
+
+ /**
+ * Field _alignmentList.
+ */
+ private java.util.Vector _alignmentList;
+
+ /**
+ * Field _treeList.
+ */
+ private java.util.Vector _treeList;
+
+ /**
+ * Field _provenance.
+ */
+ private uk.ac.vamsas.objects.core.Provenance _provenance;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public DataSet() {
+ super();
+ this._sequenceList = new java.util.Vector();
+ this._sequenceMappingList = new java.util.Vector();
+ this._dataSetAnnotationsList = new java.util.Vector();
+ this._alignmentList = new java.util.Vector();
+ this._treeList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vAlignment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignment(final uk.ac.vamsas.objects.core.Alignment vAlignment)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentList.addElement(vAlignment);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAlignment(final int index,
+ final uk.ac.vamsas.objects.core.Alignment vAlignment)
+ throws java.lang.IndexOutOfBoundsException {
+ this._alignmentList.add(index, vAlignment);
+ }
+
+ /**
+ *
+ *
+ * @param vDataSetAnnotations
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDataSetAnnotations(
+ final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
+ throws java.lang.IndexOutOfBoundsException {
+ this._dataSetAnnotationsList.addElement(vDataSetAnnotations);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDataSetAnnotations
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDataSetAnnotations(final int index,
+ final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
+ throws java.lang.IndexOutOfBoundsException {
+ this._dataSetAnnotationsList.add(index, vDataSetAnnotations);
+ }
+
+ /**
+ *
+ *
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequence(final uk.ac.vamsas.objects.core.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException {
+ this._sequenceList.addElement(vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequence(final int index,
+ final uk.ac.vamsas.objects.core.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException {
+ this._sequenceList.add(index, vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceMapping
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceMapping(
+ final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
+ throws java.lang.IndexOutOfBoundsException {
+ this._sequenceMappingList.addElement(vSequenceMapping);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceMapping
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSequenceMapping(final int index,
+ final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
+ throws java.lang.IndexOutOfBoundsException {
+ this._sequenceMappingList.add(index, vSequenceMapping);
+ }
+
+ /**
+ *
+ *
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treeList.addElement(vTree);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final int index,
+ final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treeList.add(index, vTree);
+ }
+
+ /**
+ * Method enumerateAlignment.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Alignment
+ * elements
+ */
+ public java.util.Enumeration enumerateAlignment() {
+ return this._alignmentList.elements();
+ }
+
+ /**
+ * Method enumerateDataSetAnnotations.
+ *
+ * @return an Enumeration over all
+ * uk.ac.vamsas.objects.core.DataSetAnnotations elements
+ */
+ public java.util.Enumeration enumerateDataSetAnnotations() {
+ return this._dataSetAnnotationsList.elements();
+ }
+
+ /**
+ * Method enumerateSequence.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Sequence elements
+ */
+ public java.util.Enumeration enumerateSequence() {
+ return this._sequenceList.elements();
+ }
+
+ /**
+ * Method enumerateSequenceMapping.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.SequenceMapping
+ * elements
+ */
+ public java.util.Enumeration enumerateSequenceMapping() {
+ return this._sequenceMappingList.elements();
+ }
+
+ /**
+ * Method enumerateTree.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Tree elements
+ */
+ public java.util.Enumeration enumerateTree() {
+ return this._treeList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof DataSet) {
+
+ DataSet temp = (DataSet) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
-
- if (obj instanceof DataSet) {
-
- DataSet temp = (DataSet)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._sequenceList != null) {
- if (temp._sequenceList == null) return false;
- if (this._sequenceList != temp._sequenceList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._sequenceList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._sequenceList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceList); };
- return false;
- }
- if (!thcycle) {
- if (!this._sequenceList.equals(temp._sequenceList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceList);
- }
- }
- } else if (temp._sequenceList != null)
- return false;
- if (this._sequenceMappingList != null) {
- if (temp._sequenceMappingList == null) return false;
- if (this._sequenceMappingList != temp._sequenceMappingList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._sequenceMappingList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._sequenceMappingList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceMappingList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceMappingList); };
- return false;
- }
- if (!thcycle) {
- if (!this._sequenceMappingList.equals(temp._sequenceMappingList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceMappingList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceMappingList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceMappingList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceMappingList);
- }
- }
- } else if (temp._sequenceMappingList != null)
- return false;
- if (this._dataSetAnnotationsList != null) {
- if (temp._dataSetAnnotationsList == null) return false;
- if (this._dataSetAnnotationsList != temp._dataSetAnnotationsList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dataSetAnnotationsList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dataSetAnnotationsList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetAnnotationsList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetAnnotationsList); };
- return false;
- }
- if (!thcycle) {
- if (!this._dataSetAnnotationsList.equals(temp._dataSetAnnotationsList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetAnnotationsList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetAnnotationsList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetAnnotationsList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetAnnotationsList);
- }
- }
- } else if (temp._dataSetAnnotationsList != null)
- return false;
- if (this._alignmentList != null) {
- if (temp._alignmentList == null) return false;
- if (this._alignmentList != temp._alignmentList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._alignmentList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._alignmentList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentList); };
- return false;
- }
- if (!thcycle) {
- if (!this._alignmentList.equals(temp._alignmentList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._alignmentList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._alignmentList);
- }
- }
- } else if (temp._alignmentList != null)
- return false;
- if (this._treeList != null) {
- if (temp._treeList == null) return false;
- if (this._treeList != temp._treeList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._treeList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._treeList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList); };
- return false;
- }
- if (!thcycle) {
- if (!this._treeList.equals(temp._treeList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
- }
- }
- } else if (temp._treeList != null)
- return false;
- if (this._provenance != null) {
- if (temp._provenance == null) return false;
- if (this._provenance != temp._provenance) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };
- return false;
- }
- if (!thcycle) {
- if (!this._provenance.equals(temp._provenance)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- }
- }
- } else if (temp._provenance != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
+ } else if (temp._id != null)
return false;
- }
-
- /**
- * Method getAlignment.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Alignment
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Alignment getAlignment(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentList.size()) {
- throw new IndexOutOfBoundsException("getAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Alignment) _alignmentList.get(index);
- }
-
- /**
- * Method getAlignment.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Alignment[] getAlignment(
- ) {
- uk.ac.vamsas.objects.core.Alignment[] array = new uk.ac.vamsas.objects.core.Alignment[0];
- return (uk.ac.vamsas.objects.core.Alignment[]) this._alignmentList.toArray(array);
- }
-
- /**
- * Method getAlignmentAsReference.Returns a reference to
- * '_alignmentList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getAlignmentAsReference(
- ) {
- return this._alignmentList;
- }
-
- /**
- * Method getAlignmentCount.
- *
- * @return the size of this collection
- */
- public int getAlignmentCount(
- ) {
- return this._alignmentList.size();
- }
-
- /**
- * Method getDataSetAnnotations.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * uk.ac.vamsas.objects.core.DataSetAnnotations at the given
- * index
- */
- public uk.ac.vamsas.objects.core.DataSetAnnotations getDataSetAnnotations(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._dataSetAnnotationsList.size()) {
- throw new IndexOutOfBoundsException("getDataSetAnnotations: Index value '" + index + "' not in range [0.." + (this._dataSetAnnotationsList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.DataSetAnnotations) _dataSetAnnotationsList.get(index);
- }
-
- /**
- * Method getDataSetAnnotations.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.DataSetAnnotations[] getDataSetAnnotations(
- ) {
- uk.ac.vamsas.objects.core.DataSetAnnotations[] array = new uk.ac.vamsas.objects.core.DataSetAnnotations[0];
- return (uk.ac.vamsas.objects.core.DataSetAnnotations[]) this._dataSetAnnotationsList.toArray(array);
- }
-
- /**
- * Method getDataSetAnnotationsAsReference.Returns a reference
- * to '_dataSetAnnotationsList'. No type checking is performed
- * on any modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getDataSetAnnotationsAsReference(
- ) {
- return this._dataSetAnnotationsList;
- }
-
- /**
- * Method getDataSetAnnotationsCount.
- *
- * @return the size of this collection
- */
- public int getDataSetAnnotationsCount(
- ) {
- return this._dataSetAnnotationsList.size();
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'provenance'.
- *
- * @return the value of field 'Provenance'.
- */
- public uk.ac.vamsas.objects.core.Provenance getProvenance(
- ) {
- return this._provenance;
- }
-
- /**
- * Method getSequence.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Sequence
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Sequence getSequence(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceList.size()) {
- throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Sequence) _sequenceList.get(index);
- }
-
- /**
- * Method getSequence.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Sequence[] getSequence(
- ) {
- uk.ac.vamsas.objects.core.Sequence[] array = new uk.ac.vamsas.objects.core.Sequence[0];
- return (uk.ac.vamsas.objects.core.Sequence[]) this._sequenceList.toArray(array);
- }
-
- /**
- * Method getSequenceAsReference.Returns a reference to
- * '_sequenceList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getSequenceAsReference(
- ) {
- return this._sequenceList;
- }
-
- /**
- * Method getSequenceCount.
- *
- * @return the size of this collection
- */
- public int getSequenceCount(
- ) {
- return this._sequenceList.size();
- }
-
- /**
- * Method getSequenceMapping.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * uk.ac.vamsas.objects.core.SequenceMapping at the given index
- */
- public uk.ac.vamsas.objects.core.SequenceMapping getSequenceMapping(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceMappingList.size()) {
- throw new IndexOutOfBoundsException("getSequenceMapping: Index value '" + index + "' not in range [0.." + (this._sequenceMappingList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.SequenceMapping) _sequenceMappingList.get(index);
- }
-
- /**
- * Method getSequenceMapping.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.SequenceMapping[] getSequenceMapping(
- ) {
- uk.ac.vamsas.objects.core.SequenceMapping[] array = new uk.ac.vamsas.objects.core.SequenceMapping[0];
- return (uk.ac.vamsas.objects.core.SequenceMapping[]) this._sequenceMappingList.toArray(array);
- }
-
- /**
- * Method getSequenceMappingAsReference.Returns a reference to
- * '_sequenceMappingList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getSequenceMappingAsReference(
- ) {
- return this._sequenceMappingList;
- }
-
- /**
- * Method getSequenceMappingCount.
- *
- * @return the size of this collection
- */
- public int getSequenceMappingCount(
- ) {
- return this._sequenceMappingList.size();
- }
-
- /**
- * Method getTree.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Tree at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Tree getTree(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
- }
-
- /**
- * Method getTree.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Tree[] getTree(
- ) {
- uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
- return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
- }
-
- /**
- * Method getTreeAsReference.Returns a reference to
- * '_treeList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getTreeAsReference(
- ) {
- return this._treeList;
- }
-
- /**
- * Method getTreeCount.
- *
- * @return the size of this collection
- */
- public int getTreeCount(
- ) {
- return this._treeList.size();
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_sequenceList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_sequenceList)) {
- result = 37 * result + _sequenceList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_sequenceList);
- }
- if (_sequenceMappingList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_sequenceMappingList)) {
- result = 37 * result + _sequenceMappingList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_sequenceMappingList);
- }
- if (_dataSetAnnotationsList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_dataSetAnnotationsList)) {
- result = 37 * result + _dataSetAnnotationsList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_dataSetAnnotationsList);
- }
- if (_alignmentList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_alignmentList)) {
- result = 37 * result + _alignmentList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentList);
- }
- if (_treeList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
- result = 37 * result + _treeList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
- }
- if (_provenance != null
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
- result = 37 * result + _provenance.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._sequenceList != null) {
+ if (temp._sequenceList == null)
+ return false;
+ if (this._sequenceList != temp._sequenceList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._sequenceList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._sequenceList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._sequenceList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._sequenceList);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._sequenceList.equals(temp._sequenceList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._sequenceList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._sequenceList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._sequenceList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequenceList);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Method removeAlignment.
- *
- * @param vAlignment
- * @return true if the object was removed from the collection.
- */
- public boolean removeAlignment(
- final uk.ac.vamsas.objects.core.Alignment vAlignment) {
- boolean removed = _alignmentList.remove(vAlignment);
- return removed;
- }
-
- /**
- * Method removeAlignmentAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Alignment removeAlignmentAt(
- final int index) {
- java.lang.Object obj = this._alignmentList.remove(index);
- return (uk.ac.vamsas.objects.core.Alignment) obj;
- }
-
- /**
- */
- public void removeAllAlignment(
- ) {
- this._alignmentList.clear();
- }
-
- /**
- */
- public void removeAllDataSetAnnotations(
- ) {
- this._dataSetAnnotationsList.clear();
- }
-
- /**
- */
- public void removeAllSequence(
- ) {
- this._sequenceList.clear();
- }
-
- /**
- */
- public void removeAllSequenceMapping(
- ) {
- this._sequenceMappingList.clear();
- }
-
- /**
- */
- public void removeAllTree(
- ) {
- this._treeList.clear();
- }
-
- /**
- * Method removeDataSetAnnotations.
- *
- * @param vDataSetAnnotations
- * @return true if the object was removed from the collection.
- */
- public boolean removeDataSetAnnotations(
- final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations) {
- boolean removed = _dataSetAnnotationsList.remove(vDataSetAnnotations);
- return removed;
- }
-
- /**
- * Method removeDataSetAnnotationsAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.DataSetAnnotations removeDataSetAnnotationsAt(
- final int index) {
- java.lang.Object obj = this._dataSetAnnotationsList.remove(index);
- return (uk.ac.vamsas.objects.core.DataSetAnnotations) obj;
- }
-
- /**
- * Method removeSequence.
- *
- * @param vSequence
- * @return true if the object was removed from the collection.
- */
- public boolean removeSequence(
- final uk.ac.vamsas.objects.core.Sequence vSequence) {
- boolean removed = _sequenceList.remove(vSequence);
- return removed;
- }
-
- /**
- * Method removeSequenceAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Sequence removeSequenceAt(
- final int index) {
- java.lang.Object obj = this._sequenceList.remove(index);
- return (uk.ac.vamsas.objects.core.Sequence) obj;
- }
-
- /**
- * Method removeSequenceMapping.
- *
- * @param vSequenceMapping
- * @return true if the object was removed from the collection.
- */
- public boolean removeSequenceMapping(
- final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping) {
- boolean removed = _sequenceMappingList.remove(vSequenceMapping);
- return removed;
- }
-
- /**
- * Method removeSequenceMappingAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.SequenceMapping removeSequenceMappingAt(
- final int index) {
- java.lang.Object obj = this._sequenceMappingList.remove(index);
- return (uk.ac.vamsas.objects.core.SequenceMapping) obj;
- }
-
- /**
- * Method removeTree.
- *
- * @param vTree
- * @return true if the object was removed from the collection.
- */
- public boolean removeTree(
- final uk.ac.vamsas.objects.core.Tree vTree) {
- boolean removed = _treeList.remove(vTree);
- return removed;
- }
-
- /**
- * Method removeTreeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Tree removeTreeAt(
- final int index) {
- java.lang.Object obj = this._treeList.remove(index);
- return (uk.ac.vamsas.objects.core.Tree) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vAlignment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAlignment(
- final int index,
- final uk.ac.vamsas.objects.core.Alignment vAlignment)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._alignmentList.size()) {
- throw new IndexOutOfBoundsException("setAlignment: Index value '" + index + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
- }
-
- this._alignmentList.set(index, vAlignment);
- }
-
- /**
- *
- *
- * @param vAlignmentArray
- */
- public void setAlignment(
- final uk.ac.vamsas.objects.core.Alignment[] vAlignmentArray) {
- //-- copy array
- _alignmentList.clear();
-
- for (int i = 0; i < vAlignmentArray.length; i++) {
- this._alignmentList.add(vAlignmentArray[i]);
- }
- }
-
- /**
- * Sets the value of '_alignmentList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vAlignmentList the Vector to copy.
- */
- public void setAlignment(
- final java.util.Vector vAlignmentList) {
- // copy vector
- this._alignmentList.clear();
-
- this._alignmentList.addAll(vAlignmentList);
- }
-
- /**
- * Sets the value of '_alignmentList' by setting it to the
- * given Vector. No type checking is performed.
- * @deprecated
- *
- * @param alignmentVector the Vector to set.
- */
- public void setAlignmentAsReference(
- final java.util.Vector alignmentVector) {
- this._alignmentList = alignmentVector;
- }
-
- /**
- *
- *
- * @param index
- * @param vDataSetAnnotations
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setDataSetAnnotations(
- final int index,
- final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._dataSetAnnotationsList.size()) {
- throw new IndexOutOfBoundsException("setDataSetAnnotations: Index value '" + index + "' not in range [0.." + (this._dataSetAnnotationsList.size() - 1) + "]");
- }
-
- this._dataSetAnnotationsList.set(index, vDataSetAnnotations);
- }
-
- /**
- *
- *
- * @param vDataSetAnnotationsArray
- */
- public void setDataSetAnnotations(
- final uk.ac.vamsas.objects.core.DataSetAnnotations[] vDataSetAnnotationsArray) {
- //-- copy array
- _dataSetAnnotationsList.clear();
-
- for (int i = 0; i < vDataSetAnnotationsArray.length; i++) {
- this._dataSetAnnotationsList.add(vDataSetAnnotationsArray[i]);
- }
- }
-
- /**
- * Sets the value of '_dataSetAnnotationsList' by copying the
- * given Vector. All elements will be checked for type safety.
- *
- * @param vDataSetAnnotationsList the Vector to copy.
- */
- public void setDataSetAnnotations(
- final java.util.Vector vDataSetAnnotationsList) {
- // copy vector
- this._dataSetAnnotationsList.clear();
-
- this._dataSetAnnotationsList.addAll(vDataSetAnnotationsList);
- }
-
- /**
- * Sets the value of '_dataSetAnnotationsList' by setting it to
- * the given Vector. No type checking is performed.
- * @deprecated
- *
- * @param dataSetAnnotationsVector the Vector to set.
- */
- public void setDataSetAnnotationsAsReference(
- final java.util.Vector dataSetAnnotationsVector) {
- this._dataSetAnnotationsList = dataSetAnnotationsVector;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'provenance'.
- *
- * @param provenance the value of field 'provenance'.
- */
- public void setProvenance(
- final uk.ac.vamsas.objects.core.Provenance provenance) {
- this._provenance = provenance;
- }
-
- /**
- *
- *
- * @param index
- * @param vSequence
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSequence(
- final int index,
- final uk.ac.vamsas.objects.core.Sequence vSequence)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceList.size()) {
- throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
- }
-
- this._sequenceList.set(index, vSequence);
- }
-
- /**
- *
- *
- * @param vSequenceArray
- */
- public void setSequence(
- final uk.ac.vamsas.objects.core.Sequence[] vSequenceArray) {
- //-- copy array
- _sequenceList.clear();
-
- for (int i = 0; i < vSequenceArray.length; i++) {
- this._sequenceList.add(vSequenceArray[i]);
+ } else if (temp._sequenceList != null)
+ return false;
+ if (this._sequenceMappingList != null) {
+ if (temp._sequenceMappingList == null)
+ return false;
+ if (this._sequenceMappingList != temp._sequenceMappingList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._sequenceMappingList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._sequenceMappingList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._sequenceMappingList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._sequenceMappingList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._sequenceMappingList.equals(temp._sequenceMappingList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._sequenceMappingList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._sequenceMappingList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._sequenceMappingList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._sequenceMappingList);
+ }
}
- }
-
- /**
- * Sets the value of '_sequenceList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vSequenceList the Vector to copy.
- */
- public void setSequence(
- final java.util.Vector vSequenceList) {
- // copy vector
- this._sequenceList.clear();
-
- this._sequenceList.addAll(vSequenceList);
- }
-
- /**
- * Sets the value of '_sequenceList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param sequenceVector the Vector to set.
- */
- public void setSequenceAsReference(
- final java.util.Vector sequenceVector) {
- this._sequenceList = sequenceVector;
- }
-
- /**
- *
- *
- * @param index
- * @param vSequenceMapping
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSequenceMapping(
- final int index,
- final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._sequenceMappingList.size()) {
- throw new IndexOutOfBoundsException("setSequenceMapping: Index value '" + index + "' not in range [0.." + (this._sequenceMappingList.size() - 1) + "]");
+ } else if (temp._sequenceMappingList != null)
+ return false;
+ if (this._dataSetAnnotationsList != null) {
+ if (temp._dataSetAnnotationsList == null)
+ return false;
+ if (this._dataSetAnnotationsList != temp._dataSetAnnotationsList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._dataSetAnnotationsList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._dataSetAnnotationsList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._dataSetAnnotationsList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._dataSetAnnotationsList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._dataSetAnnotationsList
+ .equals(temp._dataSetAnnotationsList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._dataSetAnnotationsList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._dataSetAnnotationsList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._dataSetAnnotationsList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._dataSetAnnotationsList);
+ }
}
-
- this._sequenceMappingList.set(index, vSequenceMapping);
- }
-
- /**
- *
- *
- * @param vSequenceMappingArray
- */
- public void setSequenceMapping(
- final uk.ac.vamsas.objects.core.SequenceMapping[] vSequenceMappingArray) {
- //-- copy array
- _sequenceMappingList.clear();
-
- for (int i = 0; i < vSequenceMappingArray.length; i++) {
- this._sequenceMappingList.add(vSequenceMappingArray[i]);
+ } else if (temp._dataSetAnnotationsList != null)
+ return false;
+ if (this._alignmentList != null) {
+ if (temp._alignmentList == null)
+ return false;
+ if (this._alignmentList != temp._alignmentList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._alignmentList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._alignmentList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._alignmentList.equals(temp._alignmentList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._alignmentList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._alignmentList);
+ }
}
- }
-
- /**
- * Sets the value of '_sequenceMappingList' by copying the
- * given Vector. All elements will be checked for type safety.
- *
- * @param vSequenceMappingList the Vector to copy.
- */
- public void setSequenceMapping(
- final java.util.Vector vSequenceMappingList) {
- // copy vector
- this._sequenceMappingList.clear();
-
- this._sequenceMappingList.addAll(vSequenceMappingList);
- }
-
- /**
- * Sets the value of '_sequenceMappingList' by setting it to
- * the given Vector. No type checking is performed.
- * @deprecated
- *
- * @param sequenceMappingVector the Vector to set.
- */
- public void setSequenceMappingAsReference(
- final java.util.Vector sequenceMappingVector) {
- this._sequenceMappingList = sequenceMappingVector;
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setTree(
- final int index,
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ } else if (temp._alignmentList != null)
+ return false;
+ if (this._treeList != null) {
+ if (temp._treeList == null)
+ return false;
+ if (this._treeList != temp._treeList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._treeList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._treeList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._treeList.equals(temp._treeList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ }
}
-
- this._treeList.set(index, vTree);
- }
-
- /**
- *
- *
- * @param vTreeArray
- */
- public void setTree(
- final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
- //-- copy array
- _treeList.clear();
-
- for (int i = 0; i < vTreeArray.length; i++) {
- this._treeList.add(vTreeArray[i]);
+ } else if (temp._treeList != null)
+ return false;
+ if (this._provenance != null) {
+ if (temp._provenance == null)
+ return false;
+ if (this._provenance != temp._provenance) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._provenance);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._provenance);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._provenance.equals(temp._provenance)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
}
- }
-
- /**
- * Sets the value of '_treeList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vTreeList the Vector to copy.
- */
- public void setTree(
- final java.util.Vector vTreeList) {
- // copy vector
- this._treeList.clear();
-
- this._treeList.addAll(vTreeList);
- }
-
- /**
- * Sets the value of '_treeList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param treeVector the Vector to set.
- */
- public void setTreeAsReference(
- final java.util.Vector treeVector) {
- this._treeList = treeVector;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.DataSet
- */
- public static uk.ac.vamsas.objects.core.DataSet unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.DataSet) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.DataSet.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ } else if (temp._provenance != null)
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method getAlignment.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Alignment at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Alignment getAlignment(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentList.size()) {
+ throw new IndexOutOfBoundsException("getAlignment: Index value '" + index
+ + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Alignment) _alignmentList.get(index);
+ }
+
+ /**
+ * Method getAlignment.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Alignment[] getAlignment() {
+ uk.ac.vamsas.objects.core.Alignment[] array = new uk.ac.vamsas.objects.core.Alignment[0];
+ return (uk.ac.vamsas.objects.core.Alignment[]) this._alignmentList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAlignmentAsReference.Returns a reference to '_alignmentList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getAlignmentAsReference() {
+ return this._alignmentList;
+ }
+
+ /**
+ * Method getAlignmentCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAlignmentCount() {
+ return this._alignmentList.size();
+ }
+
+ /**
+ * Method getDataSetAnnotations.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.DataSetAnnotations at
+ * the given index
+ */
+ public uk.ac.vamsas.objects.core.DataSetAnnotations getDataSetAnnotations(
+ final int index) throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._dataSetAnnotationsList.size()) {
+ throw new IndexOutOfBoundsException(
+ "getDataSetAnnotations: Index value '" + index
+ + "' not in range [0.."
+ + (this._dataSetAnnotationsList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.DataSetAnnotations) _dataSetAnnotationsList
+ .get(index);
+ }
+
+ /**
+ * Method getDataSetAnnotations.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.DataSetAnnotations[] getDataSetAnnotations() {
+ uk.ac.vamsas.objects.core.DataSetAnnotations[] array = new uk.ac.vamsas.objects.core.DataSetAnnotations[0];
+ return (uk.ac.vamsas.objects.core.DataSetAnnotations[]) this._dataSetAnnotationsList
+ .toArray(array);
+ }
+
+ /**
+ * Method getDataSetAnnotationsAsReference.Returns a reference to
+ * '_dataSetAnnotationsList'. No type checking is performed on any
+ * modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getDataSetAnnotationsAsReference() {
+ return this._dataSetAnnotationsList;
+ }
+
+ /**
+ * Method getDataSetAnnotationsCount.
+ *
+ * @return the size of this collection
+ */
+ public int getDataSetAnnotationsCount() {
+ return this._dataSetAnnotationsList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'provenance'.
+ *
+ * @return the value of field 'Provenance'.
+ */
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {
+ return this._provenance;
+ }
+
+ /**
+ * Method getSequence.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Sequence at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Sequence getSequence(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceList.size()) {
+ throw new IndexOutOfBoundsException("getSequence: Index value '" + index
+ + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Sequence) _sequenceList.get(index);
+ }
+
+ /**
+ * Method getSequence.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Sequence[] getSequence() {
+ uk.ac.vamsas.objects.core.Sequence[] array = new uk.ac.vamsas.objects.core.Sequence[0];
+ return (uk.ac.vamsas.objects.core.Sequence[]) this._sequenceList
+ .toArray(array);
+ }
+
+ /**
+ * Method getSequenceAsReference.Returns a reference to '_sequenceList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getSequenceAsReference() {
+ return this._sequenceList;
+ }
+
+ /**
+ * Method getSequenceCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSequenceCount() {
+ return this._sequenceList.size();
+ }
+
+ /**
+ * Method getSequenceMapping.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.SequenceMapping at the
+ * given index
+ */
+ public uk.ac.vamsas.objects.core.SequenceMapping getSequenceMapping(
+ final int index) throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceMappingList.size()) {
+ throw new IndexOutOfBoundsException("getSequenceMapping: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceMappingList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.SequenceMapping) _sequenceMappingList
+ .get(index);
+ }
+
+ /**
+ * Method getSequenceMapping.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.SequenceMapping[] getSequenceMapping() {
+ uk.ac.vamsas.objects.core.SequenceMapping[] array = new uk.ac.vamsas.objects.core.SequenceMapping[0];
+ return (uk.ac.vamsas.objects.core.SequenceMapping[]) this._sequenceMappingList
+ .toArray(array);
+ }
+
+ /**
+ * Method getSequenceMappingAsReference.Returns a reference to
+ * '_sequenceMappingList'. No type checking is performed on any modifications
+ * to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getSequenceMappingAsReference() {
+ return this._sequenceMappingList;
+ }
+
+ /**
+ * Method getSequenceMappingCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSequenceMappingCount() {
+ return this._sequenceMappingList.size();
+ }
+
+ /**
+ * Method getTree.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Tree at the given index
+ */
+ public uk.ac.vamsas.objects.core.Tree getTree(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size()) {
+ throw new IndexOutOfBoundsException("getTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
+ }
+
+ /**
+ * Method getTree.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Tree[] getTree() {
+ uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
+ return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
+ }
+
+ /**
+ * Method getTreeAsReference.Returns a reference to '_treeList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getTreeAsReference() {
+ return this._treeList;
+ }
+
+ /**
+ * Method getTreeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreeCount() {
+ return this._treeList.size();
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
+ }
+ if (_sequenceList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_sequenceList)) {
+ result = 37 * result + _sequenceList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_sequenceList);
+ }
+ if (_sequenceMappingList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_sequenceMappingList)) {
+ result = 37 * result + _sequenceMappingList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_sequenceMappingList);
+ }
+ if (_dataSetAnnotationsList != null
+ && !org.castor.util.CycleBreaker
+ .startingToCycle(_dataSetAnnotationsList)) {
+ result = 37 * result + _dataSetAnnotationsList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_dataSetAnnotationsList);
+ }
+ if (_alignmentList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_alignmentList)) {
+ result = 37 * result + _alignmentList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_alignmentList);
+ }
+ if (_treeList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
+ result = 37 * result + _treeList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
+ }
+ if (_provenance != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
+ result = 37 * result + _provenance.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
+ }
+
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Method removeAlignment.
+ *
+ * @param vAlignment
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAlignment(
+ final uk.ac.vamsas.objects.core.Alignment vAlignment) {
+ boolean removed = _alignmentList.remove(vAlignment);
+ return removed;
+ }
+
+ /**
+ * Method removeAlignmentAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Alignment removeAlignmentAt(final int index) {
+ java.lang.Object obj = this._alignmentList.remove(index);
+ return (uk.ac.vamsas.objects.core.Alignment) obj;
+ }
+
+ /**
+ */
+ public void removeAllAlignment() {
+ this._alignmentList.clear();
+ }
+
+ /**
+ */
+ public void removeAllDataSetAnnotations() {
+ this._dataSetAnnotationsList.clear();
+ }
+
+ /**
+ */
+ public void removeAllSequence() {
+ this._sequenceList.clear();
+ }
+
+ /**
+ */
+ public void removeAllSequenceMapping() {
+ this._sequenceMappingList.clear();
+ }
+
+ /**
+ */
+ public void removeAllTree() {
+ this._treeList.clear();
+ }
+
+ /**
+ * Method removeDataSetAnnotations.
+ *
+ * @param vDataSetAnnotations
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeDataSetAnnotations(
+ final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations) {
+ boolean removed = _dataSetAnnotationsList.remove(vDataSetAnnotations);
+ return removed;
+ }
+
+ /**
+ * Method removeDataSetAnnotationsAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.DataSetAnnotations removeDataSetAnnotationsAt(
+ final int index) {
+ java.lang.Object obj = this._dataSetAnnotationsList.remove(index);
+ return (uk.ac.vamsas.objects.core.DataSetAnnotations) obj;
+ }
+
+ /**
+ * Method removeSequence.
+ *
+ * @param vSequence
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSequence(
+ final uk.ac.vamsas.objects.core.Sequence vSequence) {
+ boolean removed = _sequenceList.remove(vSequence);
+ return removed;
+ }
+
+ /**
+ * Method removeSequenceAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Sequence removeSequenceAt(final int index) {
+ java.lang.Object obj = this._sequenceList.remove(index);
+ return (uk.ac.vamsas.objects.core.Sequence) obj;
+ }
+
+ /**
+ * Method removeSequenceMapping.
+ *
+ * @param vSequenceMapping
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSequenceMapping(
+ final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping) {
+ boolean removed = _sequenceMappingList.remove(vSequenceMapping);
+ return removed;
+ }
+
+ /**
+ * Method removeSequenceMappingAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.SequenceMapping removeSequenceMappingAt(
+ final int index) {
+ java.lang.Object obj = this._sequenceMappingList.remove(index);
+ return (uk.ac.vamsas.objects.core.SequenceMapping) obj;
+ }
+
+ /**
+ * Method removeTree.
+ *
+ * @param vTree
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTree(final uk.ac.vamsas.objects.core.Tree vTree) {
+ boolean removed = _treeList.remove(vTree);
+ return removed;
+ }
+
+ /**
+ * Method removeTreeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Tree removeTreeAt(final int index) {
+ java.lang.Object obj = this._treeList.remove(index);
+ return (uk.ac.vamsas.objects.core.Tree) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAlignment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAlignment(final int index,
+ final uk.ac.vamsas.objects.core.Alignment vAlignment)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._alignmentList.size()) {
+ throw new IndexOutOfBoundsException("setAlignment: Index value '" + index
+ + "' not in range [0.." + (this._alignmentList.size() - 1) + "]");
+ }
+
+ this._alignmentList.set(index, vAlignment);
+ }
+
+ /**
+ *
+ *
+ * @param vAlignmentArray
+ */
+ public void setAlignment(
+ final uk.ac.vamsas.objects.core.Alignment[] vAlignmentArray) {
+ // -- copy array
+ _alignmentList.clear();
+
+ for (int i = 0; i < vAlignmentArray.length; i++) {
+ this._alignmentList.add(vAlignmentArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_alignmentList' by copying the given Vector. All
+ * elements will be checked for type safety.
+ *
+ * @param vAlignmentList
+ * the Vector to copy.
+ */
+ public void setAlignment(final java.util.Vector vAlignmentList) {
+ // copy vector
+ this._alignmentList.clear();
+
+ this._alignmentList.addAll(vAlignmentList);
+ }
+
+ /**
+ * Sets the value of '_alignmentList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param alignmentVector
+ * the Vector to set.
+ */
+ public void setAlignmentAsReference(final java.util.Vector alignmentVector) {
+ this._alignmentList = alignmentVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDataSetAnnotations
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setDataSetAnnotations(final int index,
+ final uk.ac.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._dataSetAnnotationsList.size()) {
+ throw new IndexOutOfBoundsException(
+ "setDataSetAnnotations: Index value '" + index
+ + "' not in range [0.."
+ + (this._dataSetAnnotationsList.size() - 1) + "]");
+ }
+
+ this._dataSetAnnotationsList.set(index, vDataSetAnnotations);
+ }
+
+ /**
+ *
+ *
+ * @param vDataSetAnnotationsArray
+ */
+ public void setDataSetAnnotations(
+ final uk.ac.vamsas.objects.core.DataSetAnnotations[] vDataSetAnnotationsArray) {
+ // -- copy array
+ _dataSetAnnotationsList.clear();
+
+ for (int i = 0; i < vDataSetAnnotationsArray.length; i++) {
+ this._dataSetAnnotationsList.add(vDataSetAnnotationsArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_dataSetAnnotationsList' by copying the given Vector.
+ * All elements will be checked for type safety.
+ *
+ * @param vDataSetAnnotationsList
+ * the Vector to copy.
+ */
+ public void setDataSetAnnotations(
+ final java.util.Vector vDataSetAnnotationsList) {
+ // copy vector
+ this._dataSetAnnotationsList.clear();
+
+ this._dataSetAnnotationsList.addAll(vDataSetAnnotationsList);
+ }
+
+ /**
+ * Sets the value of '_dataSetAnnotationsList' by setting it to the given
+ * Vector. No type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param dataSetAnnotationsVector
+ * the Vector to set.
+ */
+ public void setDataSetAnnotationsAsReference(
+ final java.util.Vector dataSetAnnotationsVector) {
+ this._dataSetAnnotationsList = dataSetAnnotationsVector;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'provenance'.
+ *
+ * @param provenance
+ * the value of field 'provenance'.
+ */
+ public void setProvenance(
+ final uk.ac.vamsas.objects.core.Provenance provenance) {
+ this._provenance = provenance;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequence
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSequence(final int index,
+ final uk.ac.vamsas.objects.core.Sequence vSequence)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceList.size()) {
+ throw new IndexOutOfBoundsException("setSequence: Index value '" + index
+ + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");
+ }
+
+ this._sequenceList.set(index, vSequence);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceArray
+ */
+ public void setSequence(
+ final uk.ac.vamsas.objects.core.Sequence[] vSequenceArray) {
+ // -- copy array
+ _sequenceList.clear();
+
+ for (int i = 0; i < vSequenceArray.length; i++) {
+ this._sequenceList.add(vSequenceArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_sequenceList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vSequenceList
+ * the Vector to copy.
+ */
+ public void setSequence(final java.util.Vector vSequenceList) {
+ // copy vector
+ this._sequenceList.clear();
+
+ this._sequenceList.addAll(vSequenceList);
+ }
+
+ /**
+ * Sets the value of '_sequenceList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param sequenceVector
+ * the Vector to set.
+ */
+ public void setSequenceAsReference(final java.util.Vector sequenceVector) {
+ this._sequenceList = sequenceVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSequenceMapping
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSequenceMapping(final int index,
+ final uk.ac.vamsas.objects.core.SequenceMapping vSequenceMapping)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._sequenceMappingList.size()) {
+ throw new IndexOutOfBoundsException("setSequenceMapping: Index value '"
+ + index + "' not in range [0.."
+ + (this._sequenceMappingList.size() - 1) + "]");
+ }
+
+ this._sequenceMappingList.set(index, vSequenceMapping);
+ }
+
+ /**
+ *
+ *
+ * @param vSequenceMappingArray
+ */
+ public void setSequenceMapping(
+ final uk.ac.vamsas.objects.core.SequenceMapping[] vSequenceMappingArray) {
+ // -- copy array
+ _sequenceMappingList.clear();
+
+ for (int i = 0; i < vSequenceMappingArray.length; i++) {
+ this._sequenceMappingList.add(vSequenceMappingArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_sequenceMappingList' by copying the given Vector. All
+ * elements will be checked for type safety.
+ *
+ * @param vSequenceMappingList
+ * the Vector to copy.
+ */
+ public void setSequenceMapping(final java.util.Vector vSequenceMappingList) {
+ // copy vector
+ this._sequenceMappingList.clear();
+
+ this._sequenceMappingList.addAll(vSequenceMappingList);
+ }
+
+ /**
+ * Sets the value of '_sequenceMappingList' by setting it to the given Vector.
+ * No type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param sequenceMappingVector
+ * the Vector to set.
+ */
+ public void setSequenceMappingAsReference(
+ final java.util.Vector sequenceMappingVector) {
+ this._sequenceMappingList = sequenceMappingVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTree(final int index,
+ final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size()) {
+ throw new IndexOutOfBoundsException("setTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ this._treeList.set(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vTreeArray
+ */
+ public void setTree(final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
+ // -- copy array
+ _treeList.clear();
+
+ for (int i = 0; i < vTreeArray.length; i++) {
+ this._treeList.add(vTreeArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_treeList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vTreeList
+ * the Vector to copy.
+ */
+ public void setTree(final java.util.Vector vTreeList) {
+ // copy vector
+ this._treeList.clear();
+
+ this._treeList.addAll(vTreeList);
+ }
+
+ /**
+ * Sets the value of '_treeList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param treeVector
+ * the Vector to set.
+ */
+ public void setTreeAsReference(final java.util.Vector treeVector) {
+ this._treeList = treeVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.DataSet
+ */
+ public static uk.ac.vamsas.objects.core.DataSet unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.DataSet) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.DataSet.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class DataSetAnnotations.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class DataSetAnnotations extends uk.ac.vamsas.objects.core.RangeAnnotation
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * annotation is associated with a
- * particular dataset sequence
- */
- private java.util.Vector _seqRef;
-
- /**
- * Field _provenance.
- */
- private uk.ac.vamsas.objects.core.Provenance _provenance;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public DataSetAnnotations() {
- super();
- this._seqRef = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vSeqRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSeqRef(
- final java.lang.Object vSeqRef)
- throws java.lang.IndexOutOfBoundsException {
- this._seqRef.addElement(vSeqRef);
- }
-
- /**
- *
- *
- * @param index
- * @param vSeqRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addSeqRef(
- final int index,
- final java.lang.Object vSeqRef)
- throws java.lang.IndexOutOfBoundsException {
- this._seqRef.add(index, vSeqRef);
- }
-
- /**
- * Method enumerateSeqRef.
- *
- * @return an Enumeration over all java.lang.Object elements
- */
- public java.util.Enumeration enumerateSeqRef(
- ) {
- return this._seqRef.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class DataSetAnnotations extends
+ uk.ac.vamsas.objects.core.RangeAnnotation implements java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * annotation is associated with a particular dataset sequence
+ */
+ private java.util.Vector _seqRef;
+
+ /**
+ * Field _provenance.
+ */
+ private uk.ac.vamsas.objects.core.Provenance _provenance;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public DataSetAnnotations() {
+ super();
+ this._seqRef = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vSeqRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSeqRef(final java.lang.Object vSeqRef)
+ throws java.lang.IndexOutOfBoundsException {
+ this._seqRef.addElement(vSeqRef);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSeqRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addSeqRef(final int index, final java.lang.Object vSeqRef)
+ throws java.lang.IndexOutOfBoundsException {
+ this._seqRef.add(index, vSeqRef);
+ }
+
+ /**
+ * Method enumerateSeqRef.
+ *
+ * @return an Enumeration over all java.lang.Object elements
+ */
+ public java.util.Enumeration enumerateSeqRef() {
+ return this._seqRef.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof DataSetAnnotations) {
+
+ DataSetAnnotations temp = (DataSetAnnotations) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._seqRef != null) {
+ if (temp._seqRef == null)
+ return false;
+ if (this._seqRef != temp._seqRef) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._seqRef);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._seqRef);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._seqRef);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqRef);
+ }
+ ;
return false;
-
- if (obj instanceof DataSetAnnotations) {
-
- DataSetAnnotations temp = (DataSetAnnotations)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._seqRef != null) {
- if (temp._seqRef == null) return false;
- if (this._seqRef != temp._seqRef) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._seqRef);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._seqRef);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._seqRef); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqRef); };
- return false;
- }
- if (!thcycle) {
- if (!this._seqRef.equals(temp._seqRef)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._seqRef);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqRef);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._seqRef);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqRef);
- }
- }
- } else if (temp._seqRef != null)
- return false;
- if (this._provenance != null) {
- if (temp._provenance == null) return false;
- if (this._provenance != temp._provenance) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };
- return false;
- }
- if (!thcycle) {
- if (!this._provenance.equals(temp._provenance)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- }
- }
- } else if (temp._provenance != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._seqRef.equals(temp._seqRef)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._seqRef);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqRef);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._seqRef);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._seqRef);
+ }
}
+ } else if (temp._seqRef != null)
return false;
- }
-
- /**
- * Returns the value of field 'provenance'.
- *
- * @return the value of field 'Provenance'.
- */
- public uk.ac.vamsas.objects.core.Provenance getProvenance(
- ) {
- return this._provenance;
- }
-
- /**
- * Method getSeqRef.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the java.lang.Object at the given index
- */
- public java.lang.Object getSeqRef(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._seqRef.size()) {
- throw new IndexOutOfBoundsException("getSeqRef: Index value '" + index + "' not in range [0.." + (this._seqRef.size() - 1) + "]");
- }
-
- return _seqRef.get(index);
- }
-
- /**
- * Method getSeqRef.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public java.lang.Object[] getSeqRef(
- ) {
- java.lang.Object[] array = new java.lang.Object[0];
- return (java.lang.Object[]) this._seqRef.toArray(array);
- }
-
- /**
- * Method getSeqRefAsReference.Returns a reference to
- * '_seqRef'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getSeqRefAsReference(
- ) {
- return this._seqRef;
- }
-
- /**
- * Method getSeqRefCount.
- *
- * @return the size of this collection
- */
- public int getSeqRefCount(
- ) {
- return this._seqRef.size();
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_seqRef != null
- && !org.castor.util.CycleBreaker.startingToCycle(_seqRef)) {
- result = 37 * result + _seqRef.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_seqRef);
- }
- if (_provenance != null
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
- result = 37 * result + _provenance.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._provenance != null) {
+ if (temp._provenance == null)
+ return false;
+ if (this._provenance != temp._provenance) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._provenance);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._provenance);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._provenance.equals(temp._provenance)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllSeqRef(
- ) {
- this._seqRef.clear();
+ } else if (temp._provenance != null)
+ return false;
+ return true;
}
-
- /**
- * Method removeSeqRef.
- *
- * @param vSeqRef
- * @return true if the object was removed from the collection.
- */
- public boolean removeSeqRef(
- final java.lang.Object vSeqRef) {
- boolean removed = _seqRef.remove(vSeqRef);
- return removed;
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'provenance'.
+ *
+ * @return the value of field 'Provenance'.
+ */
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {
+ return this._provenance;
+ }
+
+ /**
+ * Method getSeqRef.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the java.lang.Object at the given index
+ */
+ public java.lang.Object getSeqRef(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._seqRef.size()) {
+ throw new IndexOutOfBoundsException("getSeqRef: Index value '" + index
+ + "' not in range [0.." + (this._seqRef.size() - 1) + "]");
}
- /**
- * Method removeSeqRefAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public java.lang.Object removeSeqRefAt(
- final int index) {
- java.lang.Object obj = this._seqRef.remove(index);
- return obj;
+ return _seqRef.get(index);
+ }
+
+ /**
+ * Method getSeqRef.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public java.lang.Object[] getSeqRef() {
+ java.lang.Object[] array = new java.lang.Object[0];
+ return (java.lang.Object[]) this._seqRef.toArray(array);
+ }
+
+ /**
+ * Method getSeqRefAsReference.Returns a reference to '_seqRef'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getSeqRefAsReference() {
+ return this._seqRef;
+ }
+
+ /**
+ * Method getSeqRefCount.
+ *
+ * @return the size of this collection
+ */
+ public int getSeqRefCount() {
+ return this._seqRef.size();
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_seqRef != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_seqRef)) {
+ result = 37 * result + _seqRef.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_seqRef);
}
-
- /**
- * Sets the value of field 'provenance'.
- *
- * @param provenance the value of field 'provenance'.
- */
- public void setProvenance(
- final uk.ac.vamsas.objects.core.Provenance provenance) {
- this._provenance = provenance;
+ if (_provenance != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
+ result = 37 * result + _provenance.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
}
- /**
- *
- *
- * @param index
- * @param vSeqRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setSeqRef(
- final int index,
- final java.lang.Object vSeqRef)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._seqRef.size()) {
- throw new IndexOutOfBoundsException("setSeqRef: Index value '" + index + "' not in range [0.." + (this._seqRef.size() - 1) + "]");
- }
-
- this._seqRef.set(index, vSeqRef);
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
-
- /**
- *
- *
- * @param vSeqRefArray
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setSeqRef(
- final java.lang.Object[] vSeqRefArray) {
- //-- copy array
- _seqRef.clear();
-
- for (int i = 0; i < vSeqRefArray.length; i++) {
- this._seqRef.add(vSeqRefArray[i]);
- }
+ public void removeAllSeqRef() {
+ this._seqRef.clear();
+ }
+
+ /**
+ * Method removeSeqRef.
+ *
+ * @param vSeqRef
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeSeqRef(final java.lang.Object vSeqRef) {
+ boolean removed = _seqRef.remove(vSeqRef);
+ return removed;
+ }
+
+ /**
+ * Method removeSeqRefAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public java.lang.Object removeSeqRefAt(final int index) {
+ java.lang.Object obj = this._seqRef.remove(index);
+ return obj;
+ }
+
+ /**
+ * Sets the value of field 'provenance'.
+ *
+ * @param provenance
+ * the value of field 'provenance'.
+ */
+ public void setProvenance(
+ final uk.ac.vamsas.objects.core.Provenance provenance) {
+ this._provenance = provenance;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vSeqRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setSeqRef(final int index, final java.lang.Object vSeqRef)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._seqRef.size()) {
+ throw new IndexOutOfBoundsException("setSeqRef: Index value '" + index
+ + "' not in range [0.." + (this._seqRef.size() - 1) + "]");
}
- /**
- * Sets the value of '_seqRef' by copying the given Vector. All
- * elements will be checked for type safety.
- *
- * @param vSeqRefList the Vector to copy.
- */
- public void setSeqRef(
- final java.util.Vector vSeqRefList) {
- // copy vector
- this._seqRef.clear();
-
- this._seqRef.addAll(vSeqRefList);
- }
+ this._seqRef.set(index, vSeqRef);
+ }
- /**
- * Sets the value of '_seqRef' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param seqRefVector the Vector to set.
- */
- public void setSeqRefAsReference(
- final java.util.Vector seqRefVector) {
- this._seqRef = seqRefVector;
- }
+ /**
+ *
+ *
+ * @param vSeqRefArray
+ */
+ public void setSeqRef(final java.lang.Object[] vSeqRefArray) {
+ // -- copy array
+ _seqRef.clear();
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType
- */
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.DataSetAnnotations.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ for (int i = 0; i < vSeqRefArray.length; i++) {
+ this._seqRef.add(vSeqRefArray[i]);
}
+ }
+
+ /**
+ * Sets the value of '_seqRef' by copying the given Vector. All elements will
+ * be checked for type safety.
+ *
+ * @param vSeqRefList
+ * the Vector to copy.
+ */
+ public void setSeqRef(final java.util.Vector vSeqRefList) {
+ // copy vector
+ this._seqRef.clear();
+
+ this._seqRef.addAll(vSeqRefList);
+ }
+
+ /**
+ * Sets the value of '_seqRef' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param seqRefVector
+ * the Vector to set.
+ */
+ public void setSeqRefAsReference(final java.util.Vector seqRefVector) {
+ this._seqRef = seqRefVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType
+ */
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.DataSetAnnotations.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
/**
- * Store a list of database references
- * for this sequence record - with optional mapping
- * from database sequence to the given sequence record
+ * Store a list of database references for this sequence record - with optional
+ * mapping from database sequence to the given sequence record
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-29 13:23:12 +0100 (Fri, 29 Jun 2007)
+ * $
*/
-public class DbRef extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * TODO Database Naming
- * Convention: either start using LSID (so
- * change type to URI) or leave this as an
- * uncontrolled/unspecified string ID
- *
- */
- private java.lang.String _source;
-
- /**
- * Version must be specified -
- *
- */
- private java.lang.String _version;
-
- /**
- * TODO: make some specification
- * of the database field from which this
- * accessionId is taken from - should that be a
- * special property of the dbRef object ?
- *
- */
- private java.lang.String _accessionId;
-
- /**
- * Primary Key for vamsas object
- * referencing
- */
- private java.lang.String _id;
-
- /**
- * the local mapType maps from the parent
- * sequence coordinate frame to the reference
- * frame defined by the dbRef element.
- * The mapped mapType is the mapped range defined
- * on the dbRef element's reference frame.
- * Conventionally, the unit attribute defaults to 1, or
- * will be inferred from the local sequence's
- * dictionary type and any dictionary type associated
- * with the database being mapped to.
- * However, it may be used to avoid ambiguity.
- *
- */
- private java.util.Vector _mapList;
-
- /**
- * Field _linkList.
- */
- private java.util.Vector _linkList;
-
- /**
- * Field _propertyList.
- */
- private java.util.Vector _propertyList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public DbRef() {
- super();
- this._mapList = new java.util.Vector();
- this._linkList = new java.util.Vector();
- this._propertyList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vLink
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addLink(
- final uk.ac.vamsas.objects.core.Link vLink)
- throws java.lang.IndexOutOfBoundsException {
- this._linkList.addElement(vLink);
- }
-
- /**
- *
- *
- * @param index
- * @param vLink
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addLink(
- final int index,
- final uk.ac.vamsas.objects.core.Link vLink)
- throws java.lang.IndexOutOfBoundsException {
- this._linkList.add(index, vLink);
- }
-
- /**
- *
- *
- * @param vMap
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addMap(
- final uk.ac.vamsas.objects.core.Map vMap)
- throws java.lang.IndexOutOfBoundsException {
- this._mapList.addElement(vMap);
- }
-
- /**
- *
- *
- * @param index
- * @param vMap
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addMap(
- final int index,
- final uk.ac.vamsas.objects.core.Map vMap)
- throws java.lang.IndexOutOfBoundsException {
- this._mapList.add(index, vMap);
- }
-
- /**
- *
- *
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.addElement(vProperty);
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.add(index, vProperty);
- }
-
- /**
- * Method enumerateLink.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Link elements
- */
- public java.util.Enumeration enumerateLink(
- ) {
- return this._linkList.elements();
- }
-
- /**
- * Method enumerateMap.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Map elements
- */
- public java.util.Enumeration enumerateMap(
- ) {
- return this._mapList.elements();
- }
-
- /**
- * Method enumerateProperty.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Property elements
- */
- public java.util.Enumeration enumerateProperty(
- ) {
- return this._propertyList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class DbRef extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * TODO Database Naming Convention: either start using LSID (so change type to
+ * URI) or leave this as an uncontrolled/unspecified string ID
+ *
+ */
+ private java.lang.String _source;
+
+ /**
+ * Version must be specified -
+ *
+ */
+ private java.lang.String _version;
+
+ /**
+ * TODO: make some specification of the database field from which this
+ * accessionId is taken from - should that be a special property of the dbRef
+ * object ?
+ *
+ */
+ private java.lang.String _accessionId;
+
+ /**
+ * Primary Key for vamsas object referencing
+ */
+ private java.lang.String _id;
+
+ /**
+ * the local mapType maps from the parent sequence coordinate frame to the
+ * reference frame defined by the dbRef element. The mapped mapType is the
+ * mapped range defined on the dbRef element's reference frame.
+ * Conventionally, the unit attribute defaults to 1, or will be inferred from
+ * the local sequence's dictionary type and any dictionary type associated
+ * with the database being mapped to. However, it may be used to avoid
+ * ambiguity.
+ *
+ */
+ private java.util.Vector _mapList;
+
+ /**
+ * Field _linkList.
+ */
+ private java.util.Vector _linkList;
+
+ /**
+ * Field _propertyList.
+ */
+ private java.util.Vector _propertyList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public DbRef() {
+ super();
+ this._mapList = new java.util.Vector();
+ this._linkList = new java.util.Vector();
+ this._propertyList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vLink
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addLink(final uk.ac.vamsas.objects.core.Link vLink)
+ throws java.lang.IndexOutOfBoundsException {
+ this._linkList.addElement(vLink);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vLink
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addLink(final int index,
+ final uk.ac.vamsas.objects.core.Link vLink)
+ throws java.lang.IndexOutOfBoundsException {
+ this._linkList.add(index, vLink);
+ }
+
+ /**
+ *
+ *
+ * @param vMap
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMap(final uk.ac.vamsas.objects.core.Map vMap)
+ throws java.lang.IndexOutOfBoundsException {
+ this._mapList.addElement(vMap);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMap
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addMap(final int index, final uk.ac.vamsas.objects.core.Map vMap)
+ throws java.lang.IndexOutOfBoundsException {
+ this._mapList.add(index, vMap);
+ }
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ * Method enumerateLink.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Link elements
+ */
+ public java.util.Enumeration enumerateLink() {
+ return this._linkList.elements();
+ }
+
+ /**
+ * Method enumerateMap.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Map elements
+ */
+ public java.util.Enumeration enumerateMap() {
+ return this._mapList.elements();
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
+ */
+ public java.util.Enumeration enumerateProperty() {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof DbRef) {
+
+ DbRef temp = (DbRef) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._source != null) {
+ if (temp._source == null)
+ return false;
+ if (this._source != temp._source) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._source);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._source);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
+ }
+ ;
return false;
-
- if (obj instanceof DbRef) {
-
- DbRef temp = (DbRef)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._source != null) {
- if (temp._source == null) return false;
- if (this._source != temp._source) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._source);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._source);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._source); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._source); };
- return false;
- }
- if (!thcycle) {
- if (!this._source.equals(temp._source)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
- }
- }
- } else if (temp._source != null)
- return false;
- if (this._version != null) {
- if (temp._version == null) return false;
- if (this._version != temp._version) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._version);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._version);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._version); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._version); };
- return false;
- }
- if (!thcycle) {
- if (!this._version.equals(temp._version)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
- }
- }
- } else if (temp._version != null)
- return false;
- if (this._accessionId != null) {
- if (temp._accessionId == null) return false;
- if (this._accessionId != temp._accessionId) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._accessionId);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._accessionId);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._accessionId); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._accessionId); };
- return false;
- }
- if (!thcycle) {
- if (!this._accessionId.equals(temp._accessionId)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._accessionId);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._accessionId);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._accessionId);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._accessionId);
- }
- }
- } else if (temp._accessionId != null)
- return false;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._mapList != null) {
- if (temp._mapList == null) return false;
- if (this._mapList != temp._mapList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._mapList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._mapList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList); };
- return false;
- }
- if (!thcycle) {
- if (!this._mapList.equals(temp._mapList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
- }
- }
- } else if (temp._mapList != null)
- return false;
- if (this._linkList != null) {
- if (temp._linkList == null) return false;
- if (this._linkList != temp._linkList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._linkList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._linkList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList); };
- return false;
- }
- if (!thcycle) {
- if (!this._linkList.equals(temp._linkList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
- }
- }
- } else if (temp._linkList != null)
- return false;
- if (this._propertyList != null) {
- if (temp._propertyList == null) return false;
- if (this._propertyList != temp._propertyList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };
- return false;
- }
- if (!thcycle) {
- if (!this._propertyList.equals(temp._propertyList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- }
- }
- } else if (temp._propertyList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._source.equals(temp._source)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._source);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._source);
+ }
}
+ } else if (temp._source != null)
return false;
- }
-
- /**
- * Returns the value of field 'accessionId'. The field
- * 'accessionId' has the following description: TODO: make some
- * specification
- * of the database field from which this
- * accessionId is taken from - should that be a
- * special property of the dbRef object ?
- *
- *
- * @return the value of field 'AccessionId'.
- */
- public java.lang.String getAccessionId(
- ) {
- return this._accessionId;
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getLink.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Link at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Link getLink(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._linkList.size()) {
- throw new IndexOutOfBoundsException("getLink: Index value '" + index + "' not in range [0.." + (this._linkList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Link) _linkList.get(index);
- }
-
- /**
- * Method getLink.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Link[] getLink(
- ) {
- uk.ac.vamsas.objects.core.Link[] array = new uk.ac.vamsas.objects.core.Link[0];
- return (uk.ac.vamsas.objects.core.Link[]) this._linkList.toArray(array);
- }
-
- /**
- * Method getLinkAsReference.Returns a reference to
- * '_linkList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getLinkAsReference(
- ) {
- return this._linkList;
- }
-
- /**
- * Method getLinkCount.
- *
- * @return the size of this collection
- */
- public int getLinkCount(
- ) {
- return this._linkList.size();
- }
-
- /**
- * Method getMap.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Map at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Map getMap(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._mapList.size()) {
- throw new IndexOutOfBoundsException("getMap: Index value '" + index + "' not in range [0.." + (this._mapList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Map) _mapList.get(index);
- }
-
- /**
- * Method getMap.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Map[] getMap(
- ) {
- uk.ac.vamsas.objects.core.Map[] array = new uk.ac.vamsas.objects.core.Map[0];
- return (uk.ac.vamsas.objects.core.Map[]) this._mapList.toArray(array);
- }
-
- /**
- * Method getMapAsReference.Returns a reference to '_mapList'.
- * No type checking is performed on any modifications to the
- * Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getMapAsReference(
- ) {
- return this._mapList;
- }
-
- /**
- * Method getMapCount.
- *
- * @return the size of this collection
- */
- public int getMapCount(
- ) {
- return this._mapList.size();
- }
-
- /**
- * Method getProperty.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Property
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Property getProperty(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
- }
-
- /**
- * Method getProperty.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Property[] getProperty(
- ) {
- uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
- return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
- }
-
- /**
- * Method getPropertyAsReference.Returns a reference to
- * '_propertyList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getPropertyAsReference(
- ) {
- return this._propertyList;
- }
-
- /**
- * Method getPropertyCount.
- *
- * @return the size of this collection
- */
- public int getPropertyCount(
- ) {
- return this._propertyList.size();
- }
-
- /**
- * Returns the value of field 'source'. The field 'source' has
- * the following description: TODO Database Naming
- * Convention: either start using LSID (so
- * change type to URI) or leave this as an
- * uncontrolled/unspecified string ID
- *
- *
- * @return the value of field 'Source'.
- */
- public java.lang.String getSource(
- ) {
- return this._source;
- }
-
- /**
- * Returns the value of field 'version'. The field 'version'
- * has the following description: Version must be specified -
- *
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_source != null
- && !org.castor.util.CycleBreaker.startingToCycle(_source)) {
- result = 37 * result + _source.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_source);
- }
- if (_version != null
- && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
- result = 37 * result + _version.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_version);
- }
- if (_accessionId != null
- && !org.castor.util.CycleBreaker.startingToCycle(_accessionId)) {
- result = 37 * result + _accessionId.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_accessionId);
+ if (this._version != null) {
+ if (temp._version == null)
+ return false;
+ if (this._version != temp._version) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._version);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._version);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._version.equals(temp._version)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ }
}
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
+ } else if (temp._version != null)
+ return false;
+ if (this._accessionId != null) {
+ if (temp._accessionId == null)
+ return false;
+ if (this._accessionId != temp._accessionId) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._accessionId);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._accessionId);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._accessionId);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._accessionId);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._accessionId.equals(temp._accessionId)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._accessionId);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._accessionId);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._accessionId);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._accessionId);
+ }
}
- if (_mapList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_mapList)) {
- result = 37 * result + _mapList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_mapList);
+ } else if (temp._accessionId != null)
+ return false;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
- if (_linkList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_linkList)) {
- result = 37 * result + _linkList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_linkList);
+ } else if (temp._id != null)
+ return false;
+ if (this._mapList != null) {
+ if (temp._mapList == null)
+ return false;
+ if (this._mapList != temp._mapList) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._mapList);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._mapList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._mapList.equals(temp._mapList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._mapList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapList);
+ }
}
- if (_propertyList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
- result = 37 * result + _propertyList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
+ } else if (temp._mapList != null)
+ return false;
+ if (this._linkList != null) {
+ if (temp._linkList == null)
+ return false;
+ if (this._linkList != temp._linkList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._linkList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._linkList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._linkList.equals(temp._linkList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);
+ }
}
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ } else if (temp._linkList != null)
+ return false;
+ if (this._propertyList != null) {
+ if (temp._propertyList == null)
+ return false;
+ if (this._propertyList != temp._propertyList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._propertyList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._propertyList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._propertyList.equals(temp._propertyList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllLink(
- ) {
- this._linkList.clear();
- }
-
- /**
- */
- public void removeAllMap(
- ) {
- this._mapList.clear();
- }
-
- /**
- */
- public void removeAllProperty(
- ) {
- this._propertyList.clear();
- }
-
- /**
- * Method removeLink.
- *
- * @param vLink
- * @return true if the object was removed from the collection.
- */
- public boolean removeLink(
- final uk.ac.vamsas.objects.core.Link vLink) {
- boolean removed = _linkList.remove(vLink);
- return removed;
- }
-
- /**
- * Method removeLinkAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Link removeLinkAt(
- final int index) {
- java.lang.Object obj = this._linkList.remove(index);
- return (uk.ac.vamsas.objects.core.Link) obj;
+ } else if (temp._propertyList != null)
+ return false;
+ return true;
}
-
- /**
- * Method removeMap.
- *
- * @param vMap
- * @return true if the object was removed from the collection.
- */
- public boolean removeMap(
- final uk.ac.vamsas.objects.core.Map vMap) {
- boolean removed = _mapList.remove(vMap);
- return removed;
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'accessionId'. The field 'accessionId' has the
+ * following description: TODO: make some specification of the database field
+ * from which this accessionId is taken from - should that be a special
+ * property of the dbRef object ?
+ *
+ *
+ * @return the value of field 'AccessionId'.
+ */
+ public java.lang.String getAccessionId() {
+ return this._accessionId;
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Method getLink.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Link at the given index
+ */
+ public uk.ac.vamsas.objects.core.Link getLink(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._linkList.size()) {
+ throw new IndexOutOfBoundsException("getLink: Index value '" + index
+ + "' not in range [0.." + (this._linkList.size() - 1) + "]");
}
- /**
- * Method removeMapAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Map removeMapAt(
- final int index) {
- java.lang.Object obj = this._mapList.remove(index);
- return (uk.ac.vamsas.objects.core.Map) obj;
+ return (uk.ac.vamsas.objects.core.Link) _linkList.get(index);
+ }
+
+ /**
+ * Method getLink.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Link[] getLink() {
+ uk.ac.vamsas.objects.core.Link[] array = new uk.ac.vamsas.objects.core.Link[0];
+ return (uk.ac.vamsas.objects.core.Link[]) this._linkList.toArray(array);
+ }
+
+ /**
+ * Method getLinkAsReference.Returns a reference to '_linkList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getLinkAsReference() {
+ return this._linkList;
+ }
+
+ /**
+ * Method getLinkCount.
+ *
+ * @return the size of this collection
+ */
+ public int getLinkCount() {
+ return this._linkList.size();
+ }
+
+ /**
+ * Method getMap.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Map at the given index
+ */
+ public uk.ac.vamsas.objects.core.Map getMap(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._mapList.size()) {
+ throw new IndexOutOfBoundsException("getMap: Index value '" + index
+ + "' not in range [0.." + (this._mapList.size() - 1) + "]");
}
- /**
- * Method removeProperty.
- *
- * @param vProperty
- * @return true if the object was removed from the collection.
- */
- public boolean removeProperty(
- final uk.ac.vamsas.objects.core.Property vProperty) {
- boolean removed = _propertyList.remove(vProperty);
- return removed;
+ return (uk.ac.vamsas.objects.core.Map) _mapList.get(index);
+ }
+
+ /**
+ * Method getMap.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Map[] getMap() {
+ uk.ac.vamsas.objects.core.Map[] array = new uk.ac.vamsas.objects.core.Map[0];
+ return (uk.ac.vamsas.objects.core.Map[]) this._mapList.toArray(array);
+ }
+
+ /**
+ * Method getMapAsReference.Returns a reference to '_mapList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getMapAsReference() {
+ return this._mapList;
+ }
+
+ /**
+ * Method getMapCount.
+ *
+ * @return the size of this collection
+ */
+ public int getMapCount() {
+ return this._mapList.size();
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Property at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("getProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
}
- /**
- * Method removePropertyAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Property removePropertyAt(
- final int index) {
- java.lang.Object obj = this._propertyList.remove(index);
- return (uk.ac.vamsas.objects.core.Property) obj;
+ return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Property[] getProperty() {
+ uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
+ return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getPropertyAsReference() {
+ return this._propertyList;
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount() {
+ return this._propertyList.size();
+ }
+
+ /**
+ * Returns the value of field 'source'. The field 'source' has the following
+ * description: TODO Database Naming Convention: either start using LSID (so
+ * change type to URI) or leave this as an uncontrolled/unspecified string ID
+ *
+ *
+ * @return the value of field 'Source'.
+ */
+ public java.lang.String getSource() {
+ return this._source;
+ }
+
+ /**
+ * Returns the value of field 'version'. The field 'version' has the following
+ * description: Version must be specified -
+ *
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion() {
+ return this._version;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_source != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_source)) {
+ result = 37 * result + _source.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_source);
}
-
- /**
- * Sets the value of field 'accessionId'. The field
- * 'accessionId' has the following description: TODO: make some
- * specification
- * of the database field from which this
- * accessionId is taken from - should that be a
- * special property of the dbRef object ?
- *
- *
- * @param accessionId the value of field 'accessionId'.
- */
- public void setAccessionId(
- final java.lang.String accessionId) {
- this._accessionId = accessionId;
+ if (_version != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
+ result = 37 * result + _version.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_version);
}
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
+ if (_accessionId != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_accessionId)) {
+ result = 37 * result + _accessionId.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_accessionId);
}
-
- /**
- *
- *
- * @param index
- * @param vLink
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setLink(
- final int index,
- final uk.ac.vamsas.objects.core.Link vLink)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._linkList.size()) {
- throw new IndexOutOfBoundsException("setLink: Index value '" + index + "' not in range [0.." + (this._linkList.size() - 1) + "]");
- }
-
- this._linkList.set(index, vLink);
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
}
-
- /**
- *
- *
- * @param vLinkArray
- */
- public void setLink(
- final uk.ac.vamsas.objects.core.Link[] vLinkArray) {
- //-- copy array
- _linkList.clear();
-
- for (int i = 0; i < vLinkArray.length; i++) {
- this._linkList.add(vLinkArray[i]);
- }
+ if (_mapList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_mapList)) {
+ result = 37 * result + _mapList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_mapList);
}
-
- /**
- * Sets the value of '_linkList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vLinkList the Vector to copy.
- */
- public void setLink(
- final java.util.Vector vLinkList) {
- // copy vector
- this._linkList.clear();
-
- this._linkList.addAll(vLinkList);
+ if (_linkList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_linkList)) {
+ result = 37 * result + _linkList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_linkList);
}
-
- /**
- * Sets the value of '_linkList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param linkVector the Vector to set.
- */
- public void setLinkAsReference(
- final java.util.Vector linkVector) {
- this._linkList = linkVector;
+ if (_propertyList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
+ result = 37 * result + _propertyList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
}
- /**
- *
- *
- * @param index
- * @param vMap
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setMap(
- final int index,
- final uk.ac.vamsas.objects.core.Map vMap)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._mapList.size()) {
- throw new IndexOutOfBoundsException("setMap: Index value '" + index + "' not in range [0.." + (this._mapList.size() - 1) + "]");
- }
-
- this._mapList.set(index, vMap);
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
-
- /**
- *
- *
- * @param vMapArray
- */
- public void setMap(
- final uk.ac.vamsas.objects.core.Map[] vMapArray) {
- //-- copy array
- _mapList.clear();
-
- for (int i = 0; i < vMapArray.length; i++) {
- this._mapList.add(vMapArray[i]);
- }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllLink() {
+ this._linkList.clear();
+ }
+
+ /**
+ */
+ public void removeAllMap() {
+ this._mapList.clear();
+ }
+
+ /**
+ */
+ public void removeAllProperty() {
+ this._propertyList.clear();
+ }
+
+ /**
+ * Method removeLink.
+ *
+ * @param vLink
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeLink(final uk.ac.vamsas.objects.core.Link vLink) {
+ boolean removed = _linkList.remove(vLink);
+ return removed;
+ }
+
+ /**
+ * Method removeLinkAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Link removeLinkAt(final int index) {
+ java.lang.Object obj = this._linkList.remove(index);
+ return (uk.ac.vamsas.objects.core.Link) obj;
+ }
+
+ /**
+ * Method removeMap.
+ *
+ * @param vMap
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeMap(final uk.ac.vamsas.objects.core.Map vMap) {
+ boolean removed = _mapList.remove(vMap);
+ return removed;
+ }
+
+ /**
+ * Method removeMapAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Map removeMapAt(final int index) {
+ java.lang.Object obj = this._mapList.remove(index);
+ return (uk.ac.vamsas.objects.core.Map) obj;
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(
+ final uk.ac.vamsas.objects.core.Property vProperty) {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (uk.ac.vamsas.objects.core.Property) obj;
+ }
+
+ /**
+ * Sets the value of field 'accessionId'. The field 'accessionId' has the
+ * following description: TODO: make some specification of the database field
+ * from which this accessionId is taken from - should that be a special
+ * property of the dbRef object ?
+ *
+ *
+ * @param accessionId
+ * the value of field 'accessionId'.
+ */
+ public void setAccessionId(final java.lang.String accessionId) {
+ this._accessionId = accessionId;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vLink
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setLink(final int index,
+ final uk.ac.vamsas.objects.core.Link vLink)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._linkList.size()) {
+ throw new IndexOutOfBoundsException("setLink: Index value '" + index
+ + "' not in range [0.." + (this._linkList.size() - 1) + "]");
}
- /**
- * Sets the value of '_mapList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vMapList the Vector to copy.
- */
- public void setMap(
- final java.util.Vector vMapList) {
- // copy vector
- this._mapList.clear();
-
- this._mapList.addAll(vMapList);
- }
+ this._linkList.set(index, vLink);
+ }
- /**
- * Sets the value of '_mapList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param mapVector the Vector to set.
- */
- public void setMapAsReference(
- final java.util.Vector mapVector) {
- this._mapList = mapVector;
- }
+ /**
+ *
+ *
+ * @param vLinkArray
+ */
+ public void setLink(final uk.ac.vamsas.objects.core.Link[] vLinkArray) {
+ // -- copy array
+ _linkList.clear();
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- this._propertyList.set(index, vProperty);
+ for (int i = 0; i < vLinkArray.length; i++) {
+ this._linkList.add(vLinkArray[i]);
}
-
- /**
- *
- *
- * @param vPropertyArray
- */
- public void setProperty(
- final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
- //-- copy array
- _propertyList.clear();
-
- for (int i = 0; i < vPropertyArray.length; i++) {
- this._propertyList.add(vPropertyArray[i]);
- }
+ }
+
+ /**
+ * Sets the value of '_linkList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vLinkList
+ * the Vector to copy.
+ */
+ public void setLink(final java.util.Vector vLinkList) {
+ // copy vector
+ this._linkList.clear();
+
+ this._linkList.addAll(vLinkList);
+ }
+
+ /**
+ * Sets the value of '_linkList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param linkVector
+ * the Vector to set.
+ */
+ public void setLinkAsReference(final java.util.Vector linkVector) {
+ this._linkList = linkVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vMap
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setMap(final int index, final uk.ac.vamsas.objects.core.Map vMap)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._mapList.size()) {
+ throw new IndexOutOfBoundsException("setMap: Index value '" + index
+ + "' not in range [0.." + (this._mapList.size() - 1) + "]");
}
- /**
- * Sets the value of '_propertyList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vPropertyList the Vector to copy.
- */
- public void setProperty(
- final java.util.Vector vPropertyList) {
- // copy vector
- this._propertyList.clear();
-
- this._propertyList.addAll(vPropertyList);
- }
+ this._mapList.set(index, vMap);
+ }
- /**
- * Sets the value of '_propertyList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param propertyVector the Vector to set.
- */
- public void setPropertyAsReference(
- final java.util.Vector propertyVector) {
- this._propertyList = propertyVector;
- }
+ /**
+ *
+ *
+ * @param vMapArray
+ */
+ public void setMap(final uk.ac.vamsas.objects.core.Map[] vMapArray) {
+ // -- copy array
+ _mapList.clear();
- /**
- * Sets the value of field 'source'. The field 'source' has the
- * following description: TODO Database Naming
- * Convention: either start using LSID (so
- * change type to URI) or leave this as an
- * uncontrolled/unspecified string ID
- *
- *
- * @param source the value of field 'source'.
- */
- public void setSource(
- final java.lang.String source) {
- this._source = source;
+ for (int i = 0; i < vMapArray.length; i++) {
+ this._mapList.add(vMapArray[i]);
}
-
- /**
- * Sets the value of field 'version'. The field 'version' has
- * the following description: Version must be specified -
- *
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
+ }
+
+ /**
+ * Sets the value of '_mapList' by copying the given Vector. All elements will
+ * be checked for type safety.
+ *
+ * @param vMapList
+ * the Vector to copy.
+ */
+ public void setMap(final java.util.Vector vMapList) {
+ // copy vector
+ this._mapList.clear();
+
+ this._mapList.addAll(vMapList);
+ }
+
+ /**
+ * Sets the value of '_mapList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param mapVector
+ * the Vector to set.
+ */
+ public void setMapAsReference(final java.util.Vector mapVector) {
+ this._mapList = mapVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("setProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
}
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.DbRef
- */
- public static uk.ac.vamsas.objects.core.DbRef unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.DbRef) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.DbRef.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(
+ final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++) {
+ this._propertyList.add(vPropertyArray[i]);
}
+ }
+
+ /**
+ * Sets the value of '_propertyList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vPropertyList
+ * the Vector to copy.
+ */
+ public void setProperty(final java.util.Vector vPropertyList) {
+ // copy vector
+ this._propertyList.clear();
+
+ this._propertyList.addAll(vPropertyList);
+ }
+
+ /**
+ * Sets the value of '_propertyList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param propertyVector
+ * the Vector to set.
+ */
+ public void setPropertyAsReference(final java.util.Vector propertyVector) {
+ this._propertyList = propertyVector;
+ }
+
+ /**
+ * Sets the value of field 'source'. The field 'source' has the following
+ * description: TODO Database Naming Convention: either start using LSID (so
+ * change type to URI) or leave this as an uncontrolled/unspecified string ID
+ *
+ *
+ * @param source
+ * the value of field 'source'.
+ */
+ public void setSource(final java.lang.String source) {
+ this._source = source;
+ }
+
+ /**
+ * Sets the value of field 'version'. The field 'version' has the following
+ * description: Version must be specified -
+ *
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version) {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.DbRef
+ */
+ public static uk.ac.vamsas.objects.core.DbRef unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.DbRef) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.DbRef.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class Entry.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class Entry extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Primary Key for vamsas object referencing
- *
- */
- private java.lang.String _id;
-
- /**
- * Who
- */
- private java.lang.String _user;
-
- /**
- * With which application
- */
- private java.lang.String _app;
-
- /**
- * Did what
- */
- private java.lang.String _action;
-
- /**
- * When
- */
- private java.util.Date _date;
-
- /**
- * additional information
- */
- private java.util.Vector _propertyList;
-
- /**
- * parameter for the action
- */
- private java.util.Vector _paramList;
-
- /**
- * bioinformatic objects input to action
- *
- */
- private java.util.Vector _inputList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Entry() {
- super();
- this._propertyList = new java.util.Vector();
- this._paramList = new java.util.Vector();
- this._inputList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vInput
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addInput(
- final uk.ac.vamsas.objects.core.Input vInput)
- throws java.lang.IndexOutOfBoundsException {
- this._inputList.addElement(vInput);
- }
-
- /**
- *
- *
- * @param index
- * @param vInput
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addInput(
- final int index,
- final uk.ac.vamsas.objects.core.Input vInput)
- throws java.lang.IndexOutOfBoundsException {
- this._inputList.add(index, vInput);
- }
-
- /**
- *
- *
- * @param vParam
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addParam(
- final uk.ac.vamsas.objects.core.Param vParam)
- throws java.lang.IndexOutOfBoundsException {
- this._paramList.addElement(vParam);
- }
-
- /**
- *
- *
- * @param index
- * @param vParam
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addParam(
- final int index,
- final uk.ac.vamsas.objects.core.Param vParam)
- throws java.lang.IndexOutOfBoundsException {
- this._paramList.add(index, vParam);
- }
-
- /**
- *
- *
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.addElement(vProperty);
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.add(index, vProperty);
- }
-
- /**
- * Method enumerateInput.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Input elements
- */
- public java.util.Enumeration enumerateInput(
- ) {
- return this._inputList.elements();
- }
-
- /**
- * Method enumerateParam.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Param elements
- */
- public java.util.Enumeration enumerateParam(
- ) {
- return this._paramList.elements();
- }
-
- /**
- * Method enumerateProperty.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Property elements
- */
- public java.util.Enumeration enumerateProperty(
- ) {
- return this._propertyList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class Entry extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Primary Key for vamsas object referencing
+ *
+ */
+ private java.lang.String _id;
+
+ /**
+ * Who
+ */
+ private java.lang.String _user;
+
+ /**
+ * With which application
+ */
+ private java.lang.String _app;
+
+ /**
+ * Did what
+ */
+ private java.lang.String _action;
+
+ /**
+ * When
+ */
+ private java.util.Date _date;
+
+ /**
+ * additional information
+ */
+ private java.util.Vector _propertyList;
+
+ /**
+ * parameter for the action
+ */
+ private java.util.Vector _paramList;
+
+ /**
+ * bioinformatic objects input to action
+ *
+ */
+ private java.util.Vector _inputList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Entry() {
+ super();
+ this._propertyList = new java.util.Vector();
+ this._paramList = new java.util.Vector();
+ this._inputList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vInput
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addInput(final uk.ac.vamsas.objects.core.Input vInput)
+ throws java.lang.IndexOutOfBoundsException {
+ this._inputList.addElement(vInput);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vInput
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addInput(final int index,
+ final uk.ac.vamsas.objects.core.Input vInput)
+ throws java.lang.IndexOutOfBoundsException {
+ this._inputList.add(index, vInput);
+ }
+
+ /**
+ *
+ *
+ * @param vParam
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addParam(final uk.ac.vamsas.objects.core.Param vParam)
+ throws java.lang.IndexOutOfBoundsException {
+ this._paramList.addElement(vParam);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vParam
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addParam(final int index,
+ final uk.ac.vamsas.objects.core.Param vParam)
+ throws java.lang.IndexOutOfBoundsException {
+ this._paramList.add(index, vParam);
+ }
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ * Method enumerateInput.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Input elements
+ */
+ public java.util.Enumeration enumerateInput() {
+ return this._inputList.elements();
+ }
+
+ /**
+ * Method enumerateParam.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Param elements
+ */
+ public java.util.Enumeration enumerateParam() {
+ return this._paramList.elements();
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
+ */
+ public java.util.Enumeration enumerateProperty() {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof Entry) {
+
+ Entry temp = (Entry) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
-
- if (obj instanceof Entry) {
-
- Entry temp = (Entry)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._user != null) {
- if (temp._user == null) return false;
- if (this._user != temp._user) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._user);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._user);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._user); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._user); };
- return false;
- }
- if (!thcycle) {
- if (!this._user.equals(temp._user)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._user);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._user);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._user);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._user);
- }
- }
- } else if (temp._user != null)
- return false;
- if (this._app != null) {
- if (temp._app == null) return false;
- if (this._app != temp._app) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._app);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._app);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._app); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._app); };
- return false;
- }
- if (!thcycle) {
- if (!this._app.equals(temp._app)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._app);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._app);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._app);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._app);
- }
- }
- } else if (temp._app != null)
- return false;
- if (this._action != null) {
- if (temp._action == null) return false;
- if (this._action != temp._action) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._action);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._action);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._action); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._action); };
- return false;
- }
- if (!thcycle) {
- if (!this._action.equals(temp._action)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._action);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._action);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._action);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._action);
- }
- }
- } else if (temp._action != null)
- return false;
- if (this._date != null) {
- if (temp._date == null) return false;
- if (this._date != temp._date) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._date);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._date);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._date); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._date); };
- return false;
- }
- if (!thcycle) {
- if (!this._date.equals(temp._date)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._date);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._date);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._date);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._date);
- }
- }
- } else if (temp._date != null)
- return false;
- if (this._propertyList != null) {
- if (temp._propertyList == null) return false;
- if (this._propertyList != temp._propertyList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };
- return false;
- }
- if (!thcycle) {
- if (!this._propertyList.equals(temp._propertyList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- }
- }
- } else if (temp._propertyList != null)
- return false;
- if (this._paramList != null) {
- if (temp._paramList == null) return false;
- if (this._paramList != temp._paramList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._paramList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._paramList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._paramList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._paramList); };
- return false;
- }
- if (!thcycle) {
- if (!this._paramList.equals(temp._paramList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._paramList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._paramList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._paramList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._paramList);
- }
- }
- } else if (temp._paramList != null)
- return false;
- if (this._inputList != null) {
- if (temp._inputList == null) return false;
- if (this._inputList != temp._inputList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._inputList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._inputList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._inputList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._inputList); };
- return false;
- }
- if (!thcycle) {
- if (!this._inputList.equals(temp._inputList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._inputList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._inputList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._inputList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._inputList);
- }
- }
- } else if (temp._inputList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
+ } else if (temp._id != null)
return false;
- }
-
- /**
- * Returns the value of field 'action'. The field 'action' has
- * the following description: Did what
- *
- * @return the value of field 'Action'.
- */
- public java.lang.String getAction(
- ) {
- return this._action;
- }
-
- /**
- * Returns the value of field 'app'. The field 'app' has the
- * following description: With which application
- *
- * @return the value of field 'App'.
- */
- public java.lang.String getApp(
- ) {
- return this._app;
- }
-
- /**
- * Returns the value of field 'date'. The field 'date' has the
- * following description: When
- *
- * @return the value of field 'Date'.
- */
- public java.util.Date getDate(
- ) {
- return this._date;
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getInput.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Input at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Input getInput(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._inputList.size()) {
- throw new IndexOutOfBoundsException("getInput: Index value '" + index + "' not in range [0.." + (this._inputList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Input) _inputList.get(index);
- }
-
- /**
- * Method getInput.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Input[] getInput(
- ) {
- uk.ac.vamsas.objects.core.Input[] array = new uk.ac.vamsas.objects.core.Input[0];
- return (uk.ac.vamsas.objects.core.Input[]) this._inputList.toArray(array);
- }
-
- /**
- * Method getInputAsReference.Returns a reference to
- * '_inputList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getInputAsReference(
- ) {
- return this._inputList;
- }
-
- /**
- * Method getInputCount.
- *
- * @return the size of this collection
- */
- public int getInputCount(
- ) {
- return this._inputList.size();
- }
-
- /**
- * Method getParam.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Param at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Param getParam(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._paramList.size()) {
- throw new IndexOutOfBoundsException("getParam: Index value '" + index + "' not in range [0.." + (this._paramList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Param) _paramList.get(index);
- }
-
- /**
- * Method getParam.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Param[] getParam(
- ) {
- uk.ac.vamsas.objects.core.Param[] array = new uk.ac.vamsas.objects.core.Param[0];
- return (uk.ac.vamsas.objects.core.Param[]) this._paramList.toArray(array);
- }
-
- /**
- * Method getParamAsReference.Returns a reference to
- * '_paramList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getParamAsReference(
- ) {
- return this._paramList;
- }
-
- /**
- * Method getParamCount.
- *
- * @return the size of this collection
- */
- public int getParamCount(
- ) {
- return this._paramList.size();
- }
-
- /**
- * Method getProperty.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Property
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Property getProperty(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
- }
-
- /**
- * Method getProperty.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Property[] getProperty(
- ) {
- uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
- return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
- }
-
- /**
- * Method getPropertyAsReference.Returns a reference to
- * '_propertyList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getPropertyAsReference(
- ) {
- return this._propertyList;
- }
-
- /**
- * Method getPropertyCount.
- *
- * @return the size of this collection
- */
- public int getPropertyCount(
- ) {
- return this._propertyList.size();
- }
-
- /**
- * Returns the value of field 'user'. The field 'user' has the
- * following description: Who
- *
- * @return the value of field 'User'.
- */
- public java.lang.String getUser(
- ) {
- return this._user;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_user != null
- && !org.castor.util.CycleBreaker.startingToCycle(_user)) {
- result = 37 * result + _user.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_user);
- }
- if (_app != null
- && !org.castor.util.CycleBreaker.startingToCycle(_app)) {
- result = 37 * result + _app.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_app);
+ if (this._user != null) {
+ if (temp._user == null)
+ return false;
+ if (this._user != temp._user) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._user);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._user);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._user);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._user);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._user.equals(temp._user)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._user);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._user);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._user);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._user);
+ }
}
- if (_action != null
- && !org.castor.util.CycleBreaker.startingToCycle(_action)) {
- result = 37 * result + _action.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_action);
+ } else if (temp._user != null)
+ return false;
+ if (this._app != null) {
+ if (temp._app == null)
+ return false;
+ if (this._app != temp._app) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._app);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._app);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._app);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._app);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._app.equals(temp._app)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._app);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._app);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._app);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._app);
+ }
}
- if (_date != null
- && !org.castor.util.CycleBreaker.startingToCycle(_date)) {
- result = 37 * result + _date.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_date);
+ } else if (temp._app != null)
+ return false;
+ if (this._action != null) {
+ if (temp._action == null)
+ return false;
+ if (this._action != temp._action) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._action);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._action);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._action);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._action);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._action.equals(temp._action)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._action);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._action);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._action);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._action);
+ }
}
- if (_propertyList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
- result = 37 * result + _propertyList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
+ } else if (temp._action != null)
+ return false;
+ if (this._date != null) {
+ if (temp._date == null)
+ return false;
+ if (this._date != temp._date) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._date);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._date);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._date);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._date);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._date.equals(temp._date)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._date);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._date);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._date);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._date);
+ }
}
- if (_paramList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_paramList)) {
- result = 37 * result + _paramList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_paramList);
+ } else if (temp._date != null)
+ return false;
+ if (this._propertyList != null) {
+ if (temp._propertyList == null)
+ return false;
+ if (this._propertyList != temp._propertyList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._propertyList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._propertyList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._propertyList.equals(temp._propertyList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
+ }
}
- if (_inputList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_inputList)) {
- result = 37 * result + _inputList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_inputList);
+ } else if (temp._propertyList != null)
+ return false;
+ if (this._paramList != null) {
+ if (temp._paramList == null)
+ return false;
+ if (this._paramList != temp._paramList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._paramList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._paramList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._paramList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._paramList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._paramList.equals(temp._paramList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._paramList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._paramList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._paramList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._paramList);
+ }
}
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ } else if (temp._paramList != null)
+ return false;
+ if (this._inputList != null) {
+ if (temp._inputList == null)
+ return false;
+ if (this._inputList != temp._inputList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._inputList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._inputList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._inputList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._inputList);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._inputList.equals(temp._inputList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._inputList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._inputList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._inputList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._inputList);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllInput(
- ) {
- this._inputList.clear();
- }
-
- /**
- */
- public void removeAllParam(
- ) {
- this._paramList.clear();
- }
-
- /**
- */
- public void removeAllProperty(
- ) {
- this._propertyList.clear();
- }
-
- /**
- * Method removeInput.
- *
- * @param vInput
- * @return true if the object was removed from the collection.
- */
- public boolean removeInput(
- final uk.ac.vamsas.objects.core.Input vInput) {
- boolean removed = _inputList.remove(vInput);
- return removed;
+ } else if (temp._inputList != null)
+ return false;
+ return true;
}
-
- /**
- * Method removeInputAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Input removeInputAt(
- final int index) {
- java.lang.Object obj = this._inputList.remove(index);
- return (uk.ac.vamsas.objects.core.Input) obj;
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'action'. The field 'action' has the following
+ * description: Did what
+ *
+ * @return the value of field 'Action'.
+ */
+ public java.lang.String getAction() {
+ return this._action;
+ }
+
+ /**
+ * Returns the value of field 'app'. The field 'app' has the following
+ * description: With which application
+ *
+ * @return the value of field 'App'.
+ */
+ public java.lang.String getApp() {
+ return this._app;
+ }
+
+ /**
+ * Returns the value of field 'date'. The field 'date' has the following
+ * description: When
+ *
+ * @return the value of field 'Date'.
+ */
+ public java.util.Date getDate() {
+ return this._date;
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Method getInput.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Input at the given index
+ */
+ public uk.ac.vamsas.objects.core.Input getInput(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._inputList.size()) {
+ throw new IndexOutOfBoundsException("getInput: Index value '" + index
+ + "' not in range [0.." + (this._inputList.size() - 1) + "]");
}
- /**
- * Method removeParam.
- *
- * @param vParam
- * @return true if the object was removed from the collection.
- */
- public boolean removeParam(
- final uk.ac.vamsas.objects.core.Param vParam) {
- boolean removed = _paramList.remove(vParam);
- return removed;
+ return (uk.ac.vamsas.objects.core.Input) _inputList.get(index);
+ }
+
+ /**
+ * Method getInput.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Input[] getInput() {
+ uk.ac.vamsas.objects.core.Input[] array = new uk.ac.vamsas.objects.core.Input[0];
+ return (uk.ac.vamsas.objects.core.Input[]) this._inputList.toArray(array);
+ }
+
+ /**
+ * Method getInputAsReference.Returns a reference to '_inputList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getInputAsReference() {
+ return this._inputList;
+ }
+
+ /**
+ * Method getInputCount.
+ *
+ * @return the size of this collection
+ */
+ public int getInputCount() {
+ return this._inputList.size();
+ }
+
+ /**
+ * Method getParam.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Param at the given index
+ */
+ public uk.ac.vamsas.objects.core.Param getParam(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._paramList.size()) {
+ throw new IndexOutOfBoundsException("getParam: Index value '" + index
+ + "' not in range [0.." + (this._paramList.size() - 1) + "]");
}
- /**
- * Method removeParamAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Param removeParamAt(
- final int index) {
- java.lang.Object obj = this._paramList.remove(index);
- return (uk.ac.vamsas.objects.core.Param) obj;
+ return (uk.ac.vamsas.objects.core.Param) _paramList.get(index);
+ }
+
+ /**
+ * Method getParam.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Param[] getParam() {
+ uk.ac.vamsas.objects.core.Param[] array = new uk.ac.vamsas.objects.core.Param[0];
+ return (uk.ac.vamsas.objects.core.Param[]) this._paramList.toArray(array);
+ }
+
+ /**
+ * Method getParamAsReference.Returns a reference to '_paramList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getParamAsReference() {
+ return this._paramList;
+ }
+
+ /**
+ * Method getParamCount.
+ *
+ * @return the size of this collection
+ */
+ public int getParamCount() {
+ return this._paramList.size();
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Property at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("getProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
}
- /**
- * Method removeProperty.
- *
- * @param vProperty
- * @return true if the object was removed from the collection.
- */
- public boolean removeProperty(
- final uk.ac.vamsas.objects.core.Property vProperty) {
- boolean removed = _propertyList.remove(vProperty);
- return removed;
+ return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Property[] getProperty() {
+ uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
+ return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getPropertyAsReference() {
+ return this._propertyList;
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount() {
+ return this._propertyList.size();
+ }
+
+ /**
+ * Returns the value of field 'user'. The field 'user' has the following
+ * description: Who
+ *
+ * @return the value of field 'User'.
+ */
+ public java.lang.String getUser() {
+ return this._user;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
}
-
- /**
- * Method removePropertyAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Property removePropertyAt(
- final int index) {
- java.lang.Object obj = this._propertyList.remove(index);
- return (uk.ac.vamsas.objects.core.Property) obj;
+ if (_user != null && !org.castor.util.CycleBreaker.startingToCycle(_user)) {
+ result = 37 * result + _user.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_user);
}
-
- /**
- * Sets the value of field 'action'. The field 'action' has the
- * following description: Did what
- *
- * @param action the value of field 'action'.
- */
- public void setAction(
- final java.lang.String action) {
- this._action = action;
+ if (_app != null && !org.castor.util.CycleBreaker.startingToCycle(_app)) {
+ result = 37 * result + _app.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_app);
}
-
- /**
- * Sets the value of field 'app'. The field 'app' has the
- * following description: With which application
- *
- * @param app the value of field 'app'.
- */
- public void setApp(
- final java.lang.String app) {
- this._app = app;
+ if (_action != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_action)) {
+ result = 37 * result + _action.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_action);
}
-
- /**
- * Sets the value of field 'date'. The field 'date' has the
- * following description: When
- *
- * @param date the value of field 'date'.
- */
- public void setDate(
- final java.util.Date date) {
- this._date = date;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- *
- *
- * @param index
- * @param vInput
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setInput(
- final int index,
- final uk.ac.vamsas.objects.core.Input vInput)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._inputList.size()) {
- throw new IndexOutOfBoundsException("setInput: Index value '" + index + "' not in range [0.." + (this._inputList.size() - 1) + "]");
- }
-
- this._inputList.set(index, vInput);
+ if (_date != null && !org.castor.util.CycleBreaker.startingToCycle(_date)) {
+ result = 37 * result + _date.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_date);
}
-
- /**
- *
- *
- * @param vInputArray
- */
- public void setInput(
- final uk.ac.vamsas.objects.core.Input[] vInputArray) {
- //-- copy array
- _inputList.clear();
-
- for (int i = 0; i < vInputArray.length; i++) {
- this._inputList.add(vInputArray[i]);
- }
+ if (_propertyList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
+ result = 37 * result + _propertyList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
}
-
- /**
- * Sets the value of '_inputList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vInputList the Vector to copy.
- */
- public void setInput(
- final java.util.Vector vInputList) {
- // copy vector
- this._inputList.clear();
-
- this._inputList.addAll(vInputList);
+ if (_paramList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_paramList)) {
+ result = 37 * result + _paramList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_paramList);
}
-
- /**
- * Sets the value of '_inputList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param inputVector the Vector to set.
- */
- public void setInputAsReference(
- final java.util.Vector inputVector) {
- this._inputList = inputVector;
+ if (_inputList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_inputList)) {
+ result = 37 * result + _inputList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_inputList);
}
- /**
- *
- *
- * @param index
- * @param vParam
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setParam(
- final int index,
- final uk.ac.vamsas.objects.core.Param vParam)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._paramList.size()) {
- throw new IndexOutOfBoundsException("setParam: Index value '" + index + "' not in range [0.." + (this._paramList.size() - 1) + "]");
- }
-
- this._paramList.set(index, vParam);
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
-
- /**
- *
- *
- * @param vParamArray
- */
- public void setParam(
- final uk.ac.vamsas.objects.core.Param[] vParamArray) {
- //-- copy array
- _paramList.clear();
-
- for (int i = 0; i < vParamArray.length; i++) {
- this._paramList.add(vParamArray[i]);
- }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllInput() {
+ this._inputList.clear();
+ }
+
+ /**
+ */
+ public void removeAllParam() {
+ this._paramList.clear();
+ }
+
+ /**
+ */
+ public void removeAllProperty() {
+ this._propertyList.clear();
+ }
+
+ /**
+ * Method removeInput.
+ *
+ * @param vInput
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeInput(final uk.ac.vamsas.objects.core.Input vInput) {
+ boolean removed = _inputList.remove(vInput);
+ return removed;
+ }
+
+ /**
+ * Method removeInputAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Input removeInputAt(final int index) {
+ java.lang.Object obj = this._inputList.remove(index);
+ return (uk.ac.vamsas.objects.core.Input) obj;
+ }
+
+ /**
+ * Method removeParam.
+ *
+ * @param vParam
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeParam(final uk.ac.vamsas.objects.core.Param vParam) {
+ boolean removed = _paramList.remove(vParam);
+ return removed;
+ }
+
+ /**
+ * Method removeParamAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Param removeParamAt(final int index) {
+ java.lang.Object obj = this._paramList.remove(index);
+ return (uk.ac.vamsas.objects.core.Param) obj;
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(
+ final uk.ac.vamsas.objects.core.Property vProperty) {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (uk.ac.vamsas.objects.core.Property) obj;
+ }
+
+ /**
+ * Sets the value of field 'action'. The field 'action' has the following
+ * description: Did what
+ *
+ * @param action
+ * the value of field 'action'.
+ */
+ public void setAction(final java.lang.String action) {
+ this._action = action;
+ }
+
+ /**
+ * Sets the value of field 'app'. The field 'app' has the following
+ * description: With which application
+ *
+ * @param app
+ * the value of field 'app'.
+ */
+ public void setApp(final java.lang.String app) {
+ this._app = app;
+ }
+
+ /**
+ * Sets the value of field 'date'. The field 'date' has the following
+ * description: When
+ *
+ * @param date
+ * the value of field 'date'.
+ */
+ public void setDate(final java.util.Date date) {
+ this._date = date;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vInput
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setInput(final int index,
+ final uk.ac.vamsas.objects.core.Input vInput)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._inputList.size()) {
+ throw new IndexOutOfBoundsException("setInput: Index value '" + index
+ + "' not in range [0.." + (this._inputList.size() - 1) + "]");
}
- /**
- * Sets the value of '_paramList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vParamList the Vector to copy.
- */
- public void setParam(
- final java.util.Vector vParamList) {
- // copy vector
- this._paramList.clear();
-
- this._paramList.addAll(vParamList);
- }
+ this._inputList.set(index, vInput);
+ }
- /**
- * Sets the value of '_paramList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param paramVector the Vector to set.
- */
- public void setParamAsReference(
- final java.util.Vector paramVector) {
- this._paramList = paramVector;
- }
+ /**
+ *
+ *
+ * @param vInputArray
+ */
+ public void setInput(final uk.ac.vamsas.objects.core.Input[] vInputArray) {
+ // -- copy array
+ _inputList.clear();
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- this._propertyList.set(index, vProperty);
+ for (int i = 0; i < vInputArray.length; i++) {
+ this._inputList.add(vInputArray[i]);
}
-
- /**
- *
- *
- * @param vPropertyArray
- */
- public void setProperty(
- final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
- //-- copy array
- _propertyList.clear();
-
- for (int i = 0; i < vPropertyArray.length; i++) {
- this._propertyList.add(vPropertyArray[i]);
- }
+ }
+
+ /**
+ * Sets the value of '_inputList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vInputList
+ * the Vector to copy.
+ */
+ public void setInput(final java.util.Vector vInputList) {
+ // copy vector
+ this._inputList.clear();
+
+ this._inputList.addAll(vInputList);
+ }
+
+ /**
+ * Sets the value of '_inputList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param inputVector
+ * the Vector to set.
+ */
+ public void setInputAsReference(final java.util.Vector inputVector) {
+ this._inputList = inputVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vParam
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setParam(final int index,
+ final uk.ac.vamsas.objects.core.Param vParam)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._paramList.size()) {
+ throw new IndexOutOfBoundsException("setParam: Index value '" + index
+ + "' not in range [0.." + (this._paramList.size() - 1) + "]");
}
- /**
- * Sets the value of '_propertyList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vPropertyList the Vector to copy.
- */
- public void setProperty(
- final java.util.Vector vPropertyList) {
- // copy vector
- this._propertyList.clear();
-
- this._propertyList.addAll(vPropertyList);
- }
+ this._paramList.set(index, vParam);
+ }
- /**
- * Sets the value of '_propertyList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param propertyVector the Vector to set.
- */
- public void setPropertyAsReference(
- final java.util.Vector propertyVector) {
- this._propertyList = propertyVector;
- }
+ /**
+ *
+ *
+ * @param vParamArray
+ */
+ public void setParam(final uk.ac.vamsas.objects.core.Param[] vParamArray) {
+ // -- copy array
+ _paramList.clear();
- /**
- * Sets the value of field 'user'. The field 'user' has the
- * following description: Who
- *
- * @param user the value of field 'user'.
- */
- public void setUser(
- final java.lang.String user) {
- this._user = user;
+ for (int i = 0; i < vParamArray.length; i++) {
+ this._paramList.add(vParamArray[i]);
}
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.Entry
- */
- public static uk.ac.vamsas.objects.core.Entry unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.Entry) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Entry.class, reader);
+ }
+
+ /**
+ * Sets the value of '_paramList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vParamList
+ * the Vector to copy.
+ */
+ public void setParam(final java.util.Vector vParamList) {
+ // copy vector
+ this._paramList.clear();
+
+ this._paramList.addAll(vParamList);
+ }
+
+ /**
+ * Sets the value of '_paramList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param paramVector
+ * the Vector to set.
+ */
+ public void setParamAsReference(final java.util.Vector paramVector) {
+ this._paramList = paramVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("setProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
}
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(
+ final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++) {
+ this._propertyList.add(vPropertyArray[i]);
}
+ }
+
+ /**
+ * Sets the value of '_propertyList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vPropertyList
+ * the Vector to copy.
+ */
+ public void setProperty(final java.util.Vector vPropertyList) {
+ // copy vector
+ this._propertyList.clear();
+
+ this._propertyList.addAll(vPropertyList);
+ }
+
+ /**
+ * Sets the value of '_propertyList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param propertyVector
+ * the Vector to set.
+ */
+ public void setPropertyAsReference(final java.util.Vector propertyVector) {
+ this._propertyList = propertyVector;
+ }
+
+ /**
+ * Sets the value of field 'user'. The field 'user' has the following
+ * description: Who
+ *
+ * @param user
+ * the value of field 'user'.
+ */
+ public void setUser(final java.lang.String user) {
+ this._user = user;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Entry
+ */
+ public static uk.ac.vamsas.objects.core.Entry unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.Entry) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.Entry.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
\r
/**\r
* Discrete symbol - possibly graphically represented\r
- * \r
+ * \r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Glyph extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
+public class Glyph extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * internal content storage\r
+ */\r
+ private java.lang.String _content = "";\r
\r
- /**\r
- * internal content storage\r
- */\r
- private java.lang.String _content = "";\r
+ /**\r
+ * specifies the symbol dictionary for this glyph - eg utf8 (the default),\r
+ * aasecstr_3 or kd_hydrophobicity - the content is not validated so\r
+ * applications must ensure they gracefully deal with invalid entries here\r
+ */\r
+ private java.lang.String _dict = "utf8";\r
\r
- /**\r
- * specifies the symbol dictionary for this\r
- * glyph - eg utf8 (the default), aasecstr_3 or\r
- * kd_hydrophobicity - the content is not validated so\r
- * applications must ensure they gracefully deal with\r
- * invalid entries here \r
- */\r
- private java.lang.String _dict = "utf8";\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public Glyph() {\r
+ super();\r
+ setContent("");\r
+ setDict("utf8");\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public Glyph() {\r
- super();\r
- setContent("");\r
- setDict("utf8");\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (obj instanceof Glyph) {\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ Glyph temp = (Glyph) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._content != null) {\r
+ if (temp._content == null)\r
+ return false;\r
+ if (this._content != temp._content) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Glyph) {\r
- \r
- Glyph temp = (Glyph)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._content != null) {\r
- if (temp._content == null) return false;\r
- if (this._content != temp._content) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._content.equals(temp._content)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- }\r
- }\r
- } else if (temp._content != null)\r
- return false;\r
- if (this._dict != null) {\r
- if (temp._dict == null) return false;\r
- if (this._dict != temp._dict) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dict);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dict);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dict); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dict); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._dict.equals(temp._dict)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dict);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dict);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dict);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dict);\r
- }\r
- }\r
- } else if (temp._dict != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._content.equals(temp._content)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
}\r
+ } else if (temp._content != null)\r
return false;\r
+ if (this._dict != null) {\r
+ if (temp._dict == null)\r
+ return false;\r
+ if (this._dict != temp._dict) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._dict);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._dict);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dict);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dict);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._dict.equals(temp._dict)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dict);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dict);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dict);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dict);\r
+ }\r
+ }\r
+ } else if (temp._dict != null)\r
+ return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'content'. The field 'content'\r
- * has the following description: internal content storage\r
- * \r
- * @return the value of field 'Content'.\r
- */\r
- public java.lang.String getContent(\r
- ) {\r
- return this._content;\r
- }\r
+ /**\r
+ * Returns the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @return the value of field 'Content'.\r
+ */\r
+ public java.lang.String getContent() {\r
+ return this._content;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'dict'. The field 'dict' has the\r
- * following description: specifies the symbol dictionary for\r
- * this\r
- * glyph - eg utf8 (the default), aasecstr_3 or\r
- * kd_hydrophobicity - the content is not validated so\r
- * applications must ensure they gracefully deal with\r
- * invalid entries here \r
- * \r
- * @return the value of field 'Dict'.\r
- */\r
- public java.lang.String getDict(\r
- ) {\r
- return this._dict;\r
- }\r
+ /**\r
+ * Returns the value of field 'dict'. The field 'dict' has the following\r
+ * description: specifies the symbol dictionary for this glyph - eg utf8 (the\r
+ * default), aasecstr_3 or kd_hydrophobicity - the content is not validated so\r
+ * applications must ensure they gracefully deal with invalid entries here\r
+ * \r
+ * @return the value of field 'Dict'.\r
+ */\r
+ public java.lang.String getDict() {\r
+ return this._dict;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_content != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
- result = 37 * result + _content.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
- }\r
- if (_dict != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_dict)) {\r
- result = 37 * result + _dict.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_dict);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ if (_content != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
+ result = 37 * result + _content.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
+ if (_dict != null && !org.castor.util.CycleBreaker.startingToCycle(_dict)) {\r
+ result = 37 * result + _dict.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_dict);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'content'. The field 'content' has\r
- * the following description: internal content storage\r
- * \r
- * @param content the value of field 'content'.\r
- */\r
- public void setContent(\r
- final java.lang.String content) {\r
- this._content = content;\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'dict'. The field 'dict' has the\r
- * following description: specifies the symbol dictionary for\r
- * this\r
- * glyph - eg utf8 (the default), aasecstr_3 or\r
- * kd_hydrophobicity - the content is not validated so\r
- * applications must ensure they gracefully deal with\r
- * invalid entries here \r
- * \r
- * @param dict the value of field 'dict'.\r
- */\r
- public void setDict(\r
- final java.lang.String dict) {\r
- this._dict = dict;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Glyph\r
- */\r
- public static uk.ac.vamsas.objects.core.Glyph unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Glyph) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Glyph.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @param content\r
+ * the value of field 'content'.\r
+ */\r
+ public void setContent(final java.lang.String content) {\r
+ this._content = content;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'dict'. The field 'dict' has the following\r
+ * description: specifies the symbol dictionary for this glyph - eg utf8 (the\r
+ * default), aasecstr_3 or kd_hydrophobicity - the content is not validated so\r
+ * applications must ensure they gracefully deal with invalid entries here\r
+ * \r
+ * @param dict\r
+ * the value of field 'dict'.\r
+ */\r
+ public void setDict(final java.lang.String dict) {\r
+ this._dict = dict;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Glyph\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Glyph unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Glyph) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Glyph.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Input extends uk.ac.vamsas.objects.core.RangeType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _name.\r
- */\r
- private java.lang.String _name;\r
-\r
- /**\r
- * Reference Frame for rangeType specfication\r
- * \r
- */\r
- private java.util.Vector _objRef;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Input() {\r
- super();\r
- this._objRef = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * \r
- * \r
- * @param vObjRef\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addObjRef(\r
- final java.lang.Object vObjRef)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._objRef.addElement(vObjRef);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vObjRef\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addObjRef(\r
- final int index,\r
- final java.lang.Object vObjRef)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._objRef.add(index, vObjRef);\r
- }\r
-\r
- /**\r
- * Method enumerateObjRef.\r
- * \r
- * @return an Enumeration over all java.lang.Object elements\r
- */\r
- public java.util.Enumeration enumerateObjRef(\r
- ) {\r
- return this._objRef.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class Input extends uk.ac.vamsas.objects.core.RangeType implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _name.\r
+ */\r
+ private java.lang.String _name;\r
+\r
+ /**\r
+ * Reference Frame for rangeType specfication\r
+ * \r
+ */\r
+ private java.util.Vector _objRef;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Input() {\r
+ super();\r
+ this._objRef = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vObjRef\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addObjRef(final java.lang.Object vObjRef)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._objRef.addElement(vObjRef);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vObjRef\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addObjRef(final int index, final java.lang.Object vObjRef)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._objRef.add(index, vObjRef);\r
+ }\r
+\r
+ /**\r
+ * Method enumerateObjRef.\r
+ * \r
+ * @return an Enumeration over all java.lang.Object elements\r
+ */\r
+ public java.util.Enumeration enumerateObjRef() {\r
+ return this._objRef.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Input) {\r
+\r
+ Input temp = (Input) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._name != null) {\r
+ if (temp._name == null)\r
+ return false;\r
+ if (this._name != temp._name) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._name);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Input) {\r
- \r
- Input temp = (Input)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._name != null) {\r
- if (temp._name == null) return false;\r
- if (this._name != temp._name) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._name.equals(temp._name)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- }\r
- }\r
- } else if (temp._name != null)\r
- return false;\r
- if (this._objRef != null) {\r
- if (temp._objRef == null) return false;\r
- if (this._objRef != temp._objRef) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._objRef);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._objRef);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._objRef.equals(temp._objRef)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef);\r
- }\r
- }\r
- } else if (temp._objRef != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._name.equals(temp._name)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
}\r
+ } else if (temp._name != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'name'.\r
- * \r
- * @return the value of field 'Name'.\r
- */\r
- public java.lang.String getName(\r
- ) {\r
- return this._name;\r
- }\r
-\r
- /**\r
- * Method getObjRef.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the java.lang.Object at the given index\r
- */\r
- public java.lang.Object getObjRef(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._objRef.size()) {\r
- throw new IndexOutOfBoundsException("getObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]");\r
- }\r
- \r
- return _objRef.get(index);\r
- }\r
-\r
- /**\r
- * Method getObjRef.Returns the contents of the collection in\r
- * an Array. <p>Note: Just in case the collection contents\r
- * are changing in another thread, we pass a 0-length Array of\r
- * the correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public java.lang.Object[] getObjRef(\r
- ) {\r
- java.lang.Object[] array = new java.lang.Object[0];\r
- return (java.lang.Object[]) this._objRef.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getObjRefAsReference.Returns a reference to\r
- * '_objRef'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getObjRefAsReference(\r
- ) {\r
- return this._objRef;\r
- }\r
-\r
- /**\r
- * Method getObjRefCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getObjRefCount(\r
- ) {\r
- return this._objRef.size();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_name != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
- result = 37 * result + _name.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
- }\r
- if (_objRef != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_objRef)) {\r
- result = 37 * result + _objRef.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_objRef);\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ if (this._objRef != null) {\r
+ if (temp._objRef == null)\r
+ return false;\r
+ if (this._objRef != temp._objRef) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._objRef);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._objRef);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._objRef.equals(temp._objRef)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._objRef);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._objRef);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllObjRef(\r
- ) {\r
- this._objRef.clear();\r
+ } else if (temp._objRef != null)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Method removeObjRef.\r
- * \r
- * @param vObjRef\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeObjRef(\r
- final java.lang.Object vObjRef) {\r
- boolean removed = _objRef.remove(vObjRef);\r
- return removed;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'name'.\r
+ * \r
+ * @return the value of field 'Name'.\r
+ */\r
+ public java.lang.String getName() {\r
+ return this._name;\r
+ }\r
+\r
+ /**\r
+ * Method getObjRef.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the java.lang.Object at the given index\r
+ */\r
+ public java.lang.Object getObjRef(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._objRef.size()) {\r
+ throw new IndexOutOfBoundsException("getObjRef: Index value '" + index\r
+ + "' not in range [0.." + (this._objRef.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Method removeObjRefAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public java.lang.Object removeObjRefAt(\r
- final int index) {\r
- java.lang.Object obj = this._objRef.remove(index);\r
- return obj;\r
+ return _objRef.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getObjRef.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public java.lang.Object[] getObjRef() {\r
+ java.lang.Object[] array = new java.lang.Object[0];\r
+ return (java.lang.Object[]) this._objRef.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getObjRefAsReference.Returns a reference to '_objRef'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getObjRefAsReference() {\r
+ return this._objRef;\r
+ }\r
+\r
+ /**\r
+ * Method getObjRefCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getObjRefCount() {\r
+ return this._objRef.size();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_name != null && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
+ result = 37 * result + _name.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
}\r
-\r
- /**\r
- * Sets the value of field 'name'.\r
- * \r
- * @param name the value of field 'name'.\r
- */\r
- public void setName(\r
- final java.lang.String name) {\r
- this._name = name;\r
+ if (_objRef != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_objRef)) {\r
+ result = 37 * result + _objRef.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_objRef);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vObjRef\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setObjRef(\r
- final int index,\r
- final java.lang.Object vObjRef)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._objRef.size()) {\r
- throw new IndexOutOfBoundsException("setObjRef: Index value '" + index + "' not in range [0.." + (this._objRef.size() - 1) + "]");\r
- }\r
- \r
- this._objRef.set(index, vObjRef);\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param vObjRefArray\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
*/\r
- public void setObjRef(\r
- final java.lang.Object[] vObjRefArray) {\r
- //-- copy array\r
- _objRef.clear();\r
- \r
- for (int i = 0; i < vObjRefArray.length; i++) {\r
- this._objRef.add(vObjRefArray[i]);\r
- }\r
+ public void removeAllObjRef() {\r
+ this._objRef.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removeObjRef.\r
+ * \r
+ * @param vObjRef\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeObjRef(final java.lang.Object vObjRef) {\r
+ boolean removed = _objRef.remove(vObjRef);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeObjRefAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public java.lang.Object removeObjRefAt(final int index) {\r
+ java.lang.Object obj = this._objRef.remove(index);\r
+ return obj;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'name'.\r
+ * \r
+ * @param name\r
+ * the value of field 'name'.\r
+ */\r
+ public void setName(final java.lang.String name) {\r
+ this._name = name;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vObjRef\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setObjRef(final int index, final java.lang.Object vObjRef)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._objRef.size()) {\r
+ throw new IndexOutOfBoundsException("setObjRef: Index value '" + index\r
+ + "' not in range [0.." + (this._objRef.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Sets the value of '_objRef' by copying the given Vector. All\r
- * elements will be checked for type safety.\r
- * \r
- * @param vObjRefList the Vector to copy.\r
- */\r
- public void setObjRef(\r
- final java.util.Vector vObjRefList) {\r
- // copy vector\r
- this._objRef.clear();\r
- \r
- this._objRef.addAll(vObjRefList);\r
- }\r
+ this._objRef.set(index, vObjRef);\r
+ }\r
\r
- /**\r
- * Sets the value of '_objRef' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param objRefVector the Vector to set.\r
- */\r
- public void setObjRefAsReference(\r
- final java.util.Vector objRefVector) {\r
- this._objRef = objRefVector;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param vObjRefArray\r
+ */\r
+ public void setObjRef(final java.lang.Object[] vObjRefArray) {\r
+ // -- copy array\r
+ _objRef.clear();\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
- */\r
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Input.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ for (int i = 0; i < vObjRefArray.length; i++) {\r
+ this._objRef.add(vObjRefArray[i]);\r
}\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_objRef' by copying the given Vector. All elements will\r
+ * be checked for type safety.\r
+ * \r
+ * @param vObjRefList\r
+ * the Vector to copy.\r
+ */\r
+ public void setObjRef(final java.util.Vector vObjRefList) {\r
+ // copy vector\r
+ this._objRef.clear();\r
+\r
+ this._objRef.addAll(vObjRefList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_objRef' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param objRefVector\r
+ * the Vector to set.\r
+ */\r
+ public void setObjRefAsReference(final java.util.Vector objRefVector) {\r
+ this._objRef = objRefVector;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Input.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Instance extends uk.ac.vamsas.objects.core.AppData \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _urn.\r
- */\r
- private java.lang.String _urn;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Instance() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class Instance extends uk.ac.vamsas.objects.core.AppData implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _urn.\r
+ */\r
+ private java.lang.String _urn;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Instance() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Instance) {\r
+\r
+ Instance temp = (Instance) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._urn != null) {\r
+ if (temp._urn == null)\r
+ return false;\r
+ if (this._urn != temp._urn) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._urn);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._urn);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._urn);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Instance) {\r
- \r
- Instance temp = (Instance)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._urn != null) {\r
- if (temp._urn == null) return false;\r
- if (this._urn != temp._urn) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._urn);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._urn);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._urn); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._urn.equals(temp._urn)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._urn);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._urn);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn);\r
- }\r
- }\r
- } else if (temp._urn != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._urn.equals(temp._urn)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._urn);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._urn);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._urn);\r
+ }\r
}\r
+ } else if (temp._urn != null)\r
return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'urn'.\r
- * \r
- * @return the value of field 'Urn'.\r
- */\r
- public java.lang.String getUrn(\r
- ) {\r
- return this._urn;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_urn != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_urn)) {\r
- result = 37 * result + _urn.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_urn);\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'urn'.\r
- * \r
- * @param urn the value of field 'urn'.\r
- */\r
- public void setUrn(\r
- final java.lang.String urn) {\r
- this._urn = urn;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
- */\r
- public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Instance.class, reader);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'urn'.\r
+ * \r
+ * @return the value of field 'Urn'.\r
+ */\r
+ public java.lang.String getUrn() {\r
+ return this._urn;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_urn != null && !org.castor.util.CycleBreaker.startingToCycle(_urn)) {\r
+ result = 37 * result + _urn.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_urn);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'urn'.\r
+ * \r
+ * @param urn\r
+ * the value of field 'urn'.\r
+ */\r
+ public void setUrn(final java.lang.String urn) {\r
+ this._urn = urn;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.AppData\r
+ */\r
+ public static uk.ac.vamsas.objects.core.AppData unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Instance.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Link extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
+public class Link extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * internal content storage\r
+ */\r
+ private java.lang.String _content = "";\r
\r
- /**\r
- * internal content storage\r
- */\r
- private java.lang.String _content = "";\r
+ /**\r
+ * The URI\r
+ */\r
+ private java.lang.String _href;\r
\r
- /**\r
- * The URI\r
- */\r
- private java.lang.String _href;\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public Link() {\r
+ super();\r
+ setContent("");\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public Link() {\r
- super();\r
- setContent("");\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (obj instanceof Link) {\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ Link temp = (Link) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._content != null) {\r
+ if (temp._content == null)\r
+ return false;\r
+ if (this._content != temp._content) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Link) {\r
- \r
- Link temp = (Link)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._content != null) {\r
- if (temp._content == null) return false;\r
- if (this._content != temp._content) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._content.equals(temp._content)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- }\r
- }\r
- } else if (temp._content != null)\r
- return false;\r
- if (this._href != null) {\r
- if (temp._href == null) return false;\r
- if (this._href != temp._href) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._href);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._href);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._href); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._href); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._href.equals(temp._href)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._href);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._href);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._href);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._href);\r
- }\r
- }\r
- } else if (temp._href != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._content.equals(temp._content)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
}\r
+ } else if (temp._content != null)\r
return false;\r
+ if (this._href != null) {\r
+ if (temp._href == null)\r
+ return false;\r
+ if (this._href != temp._href) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._href);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._href);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._href);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._href);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._href.equals(temp._href)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._href);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._href);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._href);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._href);\r
+ }\r
+ }\r
+ } else if (temp._href != null)\r
+ return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'content'. The field 'content'\r
- * has the following description: internal content storage\r
- * \r
- * @return the value of field 'Content'.\r
- */\r
- public java.lang.String getContent(\r
- ) {\r
- return this._content;\r
- }\r
+ /**\r
+ * Returns the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @return the value of field 'Content'.\r
+ */\r
+ public java.lang.String getContent() {\r
+ return this._content;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'href'. The field 'href' has the\r
- * following description: The URI\r
- * \r
- * @return the value of field 'Href'.\r
- */\r
- public java.lang.String getHref(\r
- ) {\r
- return this._href;\r
- }\r
+ /**\r
+ * Returns the value of field 'href'. The field 'href' has the following\r
+ * description: The URI\r
+ * \r
+ * @return the value of field 'Href'.\r
+ */\r
+ public java.lang.String getHref() {\r
+ return this._href;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_content != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
- result = 37 * result + _content.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
- }\r
- if (_href != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_href)) {\r
- result = 37 * result + _href.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_href);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ if (_content != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
+ result = 37 * result + _content.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
+ if (_href != null && !org.castor.util.CycleBreaker.startingToCycle(_href)) {\r
+ result = 37 * result + _href.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_href);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'content'. The field 'content' has\r
- * the following description: internal content storage\r
- * \r
- * @param content the value of field 'content'.\r
- */\r
- public void setContent(\r
- final java.lang.String content) {\r
- this._content = content;\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'href'. The field 'href' has the\r
- * following description: The URI\r
- * \r
- * @param href the value of field 'href'.\r
- */\r
- public void setHref(\r
- final java.lang.String href) {\r
- this._href = href;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Link\r
- */\r
- public static uk.ac.vamsas.objects.core.Link unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Link) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Link.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @param content\r
+ * the value of field 'content'.\r
+ */\r
+ public void setContent(final java.lang.String content) {\r
+ this._content = content;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'href'. The field 'href' has the following\r
+ * description: The URI\r
+ * \r
+ * @param href\r
+ * the value of field 'href'.\r
+ */\r
+ public void setHref(final java.lang.String href) {\r
+ this._href = href;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Link\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Link unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Link) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Link.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Local extends MapRangeType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Local() {\r
- super();\r
- }\r
+public class Local extends MapRangeType implements java.io.Serializable {\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Local) {\r
- \r
- return true;\r
- }\r
- return false;\r
- }\r
+ public Local() {\r
+ super();\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- \r
- return result;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ if (obj instanceof Local) {\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
- */\r
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Local.class, reader);\r
+ return true;\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Local.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class LockFile.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class LockFile extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * internal content storage
- */
- private java.lang.String _content = "";
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public LockFile() {
- super();
- setContent("");
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class LockFile extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * internal content storage
+ */
+ private java.lang.String _content = "";
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public LockFile() {
+ super();
+ setContent("");
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof LockFile) {
+
+ LockFile temp = (LockFile) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._content != null) {
+ if (temp._content == null)
+ return false;
+ if (this._content != temp._content) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+ }
+ ;
return false;
-
- if (obj instanceof LockFile) {
-
- LockFile temp = (LockFile)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._content != null) {
- if (temp._content == null) return false;
- if (this._content != temp._content) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };
- return false;
- }
- if (!thcycle) {
- if (!this._content.equals(temp._content)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
- }
- }
- } else if (temp._content != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._content.equals(temp._content)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+ }
}
+ } else if (temp._content != null)
return false;
+ return true;
}
-
- /**
- * Returns the value of field 'content'. The field 'content'
- * has the following description: internal content storage
- *
- * @return the value of field 'Content'.
- */
- public java.lang.String getContent(
- ) {
- return this._content;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_content != null
- && !org.castor.util.CycleBreaker.startingToCycle(_content)) {
- result = 37 * result + _content.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_content);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- * Sets the value of field 'content'. The field 'content' has
- * the following description: internal content storage
- *
- * @param content the value of field 'content'.
- */
- public void setContent(
- final java.lang.String content) {
- this._content = content;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.LockFile
- */
- public static uk.ac.vamsas.objects.core.LockFile unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.LockFile) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.LockFile.class, reader);
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'content'. The field 'content' has the following
+ * description: internal content storage
+ *
+ * @return the value of field 'Content'.
+ */
+ public java.lang.String getContent() {
+ return this._content;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_content != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_content)) {
+ result = 37 * result + _content.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_content);
}
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ * Sets the value of field 'content'. The field 'content' has the following
+ * description: internal content storage
+ *
+ * @param content
+ * the value of field 'content'.
+ */
+ public void setContent(final java.lang.String content) {
+ this._content = content;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.LockFile
+ */
+ public static uk.ac.vamsas.objects.core.LockFile unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.LockFile) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.LockFile.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * the local mapType maps from the parent\r
- * sequence coordinate frame to the reference\r
- * frame defined by the dbRef element.\r
- * The mapped mapType is the mapped range defined\r
- * on the dbRef element's reference frame.\r
- * Conventionally, the unit attribute defaults to 1, or\r
- * will be inferred from the local sequence's\r
- * dictionary type and any dictionary type associated\r
- * with the database being mapped to. \r
- * However, it may be used to avoid ambiguity.\r
- * \r
+ * the local mapType maps from the parent sequence coordinate frame to the\r
+ * reference frame defined by the dbRef element. The mapped mapType is the\r
+ * mapped range defined on the dbRef element's reference frame. Conventionally,\r
+ * the unit attribute defaults to 1, or will be inferred from the local\r
+ * sequence's dictionary type and any dictionary type associated with the\r
+ * database being mapped to. However, it may be used to avoid ambiguity.\r
+ * \r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Map extends uk.ac.vamsas.objects.core.MapType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _id.\r
- */\r
- private java.lang.String _id;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Map() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class Map extends uk.ac.vamsas.objects.core.MapType implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _id.\r
+ */\r
+ private java.lang.String _id;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Map() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Map) {\r
+\r
+ Map temp = (Map) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._id != null) {\r
+ if (temp._id == null)\r
+ return false;\r
+ if (this._id != temp._id) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Map) {\r
- \r
- Map temp = (Map)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._id != null) {\r
- if (temp._id == null) return false;\r
- if (this._id != temp._id) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._id.equals(temp._id)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- }\r
- }\r
- } else if (temp._id != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._id.equals(temp._id)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
}\r
+ } else if (temp._id != null)\r
return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'id'.\r
- * \r
- * @return the value of field 'Id'.\r
- */\r
- public java.lang.String getId(\r
- ) {\r
- return this._id;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_id != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
- result = 37 * result + _id.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'id'.\r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(\r
- final java.lang.String id) {\r
- this._id = id;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
- */\r
- public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Map.class, reader);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'id'.\r
+ * \r
+ * @return the value of field 'Id'.\r
+ */\r
+ public java.lang.String getId() {\r
+ return this._id;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
+ result = 37 * result + _id.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'id'.\r
+ * \r
+ * @param id\r
+ * the value of field 'id'.\r
+ */\r
+ public void setId(final java.lang.String id) {\r
+ this._id = id;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Map.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MapList extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Offset to first position in dataset sequence record that\r
- * start\r
- * position on 'onto' maps to \r
- */\r
- private long _from = 0;\r
-\r
- /**\r
- * keeps track of state for field: _from\r
- */\r
- private boolean _has_from;\r
-\r
- /**\r
- * Offset to last position in dataset sequence record that end\r
- * position on 'onto' maps to \r
- */\r
- private long _to = 0;\r
-\r
- /**\r
- * keeps track of state for field: _to\r
- */\r
- private boolean _has_to;\r
-\r
- /**\r
- * Offset to first position in database entry that first (or\r
- * offset)\r
- * position in sequence maps to \r
- */\r
- private long _start;\r
-\r
- /**\r
- * keeps track of state for field: _start\r
- */\r
- private boolean _has_start;\r
-\r
- /**\r
- * Offset to last position in database entry that last (offset)\r
- * position in sequence maps to \r
- */\r
- private long _end;\r
-\r
- /**\r
- * keeps track of state for field: _end\r
- */\r
- private boolean _has_end;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MapList() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
+public class MapList extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Offset to first position in dataset sequence record that start position on\r
+ * 'onto' maps to\r
+ */\r
+ private long _from = 0;\r
+\r
+ /**\r
+ * keeps track of state for field: _from\r
+ */\r
+ private boolean _has_from;\r
+\r
+ /**\r
+ * Offset to last position in dataset sequence record that end position on\r
+ * 'onto' maps to\r
+ */\r
+ private long _to = 0;\r
+\r
+ /**\r
+ * keeps track of state for field: _to\r
+ */\r
+ private boolean _has_to;\r
+\r
+ /**\r
+ * Offset to first position in database entry that first (or offset) position\r
+ * in sequence maps to\r
+ */\r
+ private long _start;\r
+\r
+ /**\r
+ * keeps track of state for field: _start\r
+ */\r
+ private boolean _has_start;\r
+\r
+ /**\r
+ * Offset to last position in database entry that last (offset) position in\r
+ * sequence maps to\r
+ */\r
+ private long _end;\r
+\r
+ /**\r
+ * keeps track of state for field: _end\r
+ */\r
+ private boolean _has_end;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MapList() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
*/\r
- public void deleteEnd(\r
- ) {\r
- this._has_end= false;\r
- }\r
-\r
- /**\r
- */\r
- public void deleteFrom(\r
- ) {\r
- this._has_from= false;\r
- }\r
+ public void deleteEnd() {\r
+ this._has_end = false;\r
+ }\r
\r
- /**\r
+ /**\r
*/\r
- public void deleteStart(\r
- ) {\r
- this._has_start= false;\r
- }\r
+ public void deleteFrom() {\r
+ this._has_from = false;\r
+ }\r
\r
- /**\r
+ /**\r
*/\r
- public void deleteTo(\r
- ) {\r
- this._has_to= false;\r
- }\r
+ public void deleteStart() {\r
+ this._has_start = false;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
+ /**\r
*/\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof MapList) {\r
- \r
- MapList temp = (MapList)obj;\r
- if (this._from != temp._from)\r
- return false;\r
- if (this._has_from != temp._has_from)\r
- return false;\r
- if (this._to != temp._to)\r
- return false;\r
- if (this._has_to != temp._has_to)\r
- return false;\r
- if (this._start != temp._start)\r
- return false;\r
- if (this._has_start != temp._has_start)\r
- return false;\r
- if (this._end != temp._end)\r
- return false;\r
- if (this._has_end != temp._has_end)\r
- return false;\r
- return true;\r
- }\r
+ public void deleteTo() {\r
+ this._has_to = false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof MapList) {\r
+\r
+ MapList temp = (MapList) obj;\r
+ if (this._from != temp._from)\r
return false;\r
+ if (this._has_from != temp._has_from)\r
+ return false;\r
+ if (this._to != temp._to)\r
+ return false;\r
+ if (this._has_to != temp._has_to)\r
+ return false;\r
+ if (this._start != temp._start)\r
+ return false;\r
+ if (this._has_start != temp._has_start)\r
+ return false;\r
+ if (this._end != temp._end)\r
+ return false;\r
+ if (this._has_end != temp._has_end)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'end'. The field 'end' has the\r
- * following description: Offset to last position in database\r
- * entry that last (offset)\r
- * position in sequence maps to \r
- * \r
- * @return the value of field 'End'.\r
- */\r
- public long getEnd(\r
- ) {\r
- return this._end;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'from'. The field 'from' has the\r
- * following description: Offset to first position in dataset\r
- * sequence record that start\r
- * position on 'onto' maps to \r
- * \r
- * @return the value of field 'From'.\r
- */\r
- public long getFrom(\r
- ) {\r
- return this._from;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'start'. The field 'start' has\r
- * the following description: Offset to first position in\r
- * database entry that first (or offset)\r
- * position in sequence maps to \r
- * \r
- * @return the value of field 'Start'.\r
- */\r
- public long getStart(\r
- ) {\r
- return this._start;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'to'. The field 'to' has the\r
- * following description: Offset to last position in dataset\r
- * sequence record that end\r
- * position on 'onto' maps to \r
- * \r
- * @return the value of field 'To'.\r
- */\r
- public long getTo(\r
- ) {\r
- return this._to;\r
- }\r
-\r
- /**\r
- * Method hasEnd.\r
- * \r
- * @return true if at least one End has been added\r
- */\r
- public boolean hasEnd(\r
- ) {\r
- return this._has_end;\r
- }\r
-\r
- /**\r
- * Method hasFrom.\r
- * \r
- * @return true if at least one From has been added\r
- */\r
- public boolean hasFrom(\r
- ) {\r
- return this._has_from;\r
- }\r
-\r
- /**\r
- * Method hasStart.\r
- * \r
- * @return true if at least one Start has been added\r
- */\r
- public boolean hasStart(\r
- ) {\r
- return this._has_start;\r
- }\r
-\r
- /**\r
- * Method hasTo.\r
- * \r
- * @return true if at least one To has been added\r
- */\r
- public boolean hasTo(\r
- ) {\r
- return this._has_to;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + (int)(_from^(_from>>>32));\r
- result = 37 * result + (int)(_to^(_to>>>32));\r
- result = 37 * result + (int)(_start^(_start>>>32));\r
- result = 37 * result + (int)(_end^(_end>>>32));\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'end'. The field 'end' has the\r
- * following description: Offset to last position in database\r
- * entry that last (offset)\r
- * position in sequence maps to \r
- * \r
- * @param end the value of field 'end'.\r
- */\r
- public void setEnd(\r
- final long end) {\r
- this._end = end;\r
- this._has_end = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'from'. The field 'from' has the\r
- * following description: Offset to first position in dataset\r
- * sequence record that start\r
- * position on 'onto' maps to \r
- * \r
- * @param from the value of field 'from'.\r
- */\r
- public void setFrom(\r
- final long from) {\r
- this._from = from;\r
- this._has_from = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'start'. The field 'start' has the\r
- * following description: Offset to first position in database\r
- * entry that first (or offset)\r
- * position in sequence maps to \r
- * \r
- * @param start the value of field 'start'.\r
- */\r
- public void setStart(\r
- final long start) {\r
- this._start = start;\r
- this._has_start = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'to'. The field 'to' has the\r
- * following description: Offset to last position in dataset\r
- * sequence record that end\r
- * position on 'onto' maps to \r
- * \r
- * @param to the value of field 'to'.\r
- */\r
- public void setTo(\r
- final long to) {\r
- this._to = to;\r
- this._has_to = true;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.MapList\r
- */\r
- public static uk.ac.vamsas.objects.core.MapList unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.MapList) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.MapList.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'end'. The field 'end' has the following\r
+ * description: Offset to last position in database entry that last (offset)\r
+ * position in sequence maps to\r
+ * \r
+ * @return the value of field 'End'.\r
+ */\r
+ public long getEnd() {\r
+ return this._end;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'from'. The field 'from' has the following\r
+ * description: Offset to first position in dataset sequence record that start\r
+ * position on 'onto' maps to\r
+ * \r
+ * @return the value of field 'From'.\r
+ */\r
+ public long getFrom() {\r
+ return this._from;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'start'. The field 'start' has the following\r
+ * description: Offset to first position in database entry that first (or\r
+ * offset) position in sequence maps to\r
+ * \r
+ * @return the value of field 'Start'.\r
+ */\r
+ public long getStart() {\r
+ return this._start;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'to'. The field 'to' has the following\r
+ * description: Offset to last position in dataset sequence record that end\r
+ * position on 'onto' maps to\r
+ * \r
+ * @return the value of field 'To'.\r
+ */\r
+ public long getTo() {\r
+ return this._to;\r
+ }\r
+\r
+ /**\r
+ * Method hasEnd.\r
+ * \r
+ * @return true if at least one End has been added\r
+ */\r
+ public boolean hasEnd() {\r
+ return this._has_end;\r
+ }\r
+\r
+ /**\r
+ * Method hasFrom.\r
+ * \r
+ * @return true if at least one From has been added\r
+ */\r
+ public boolean hasFrom() {\r
+ return this._has_from;\r
+ }\r
+\r
+ /**\r
+ * Method hasStart.\r
+ * \r
+ * @return true if at least one Start has been added\r
+ */\r
+ public boolean hasStart() {\r
+ return this._has_start;\r
+ }\r
+\r
+ /**\r
+ * Method hasTo.\r
+ * \r
+ * @return true if at least one To has been added\r
+ */\r
+ public boolean hasTo() {\r
+ return this._has_to;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ result = 37 * result + (int) (_from ^ (_from >>> 32));\r
+ result = 37 * result + (int) (_to ^ (_to >>> 32));\r
+ result = 37 * result + (int) (_start ^ (_start >>> 32));\r
+ result = 37 * result + (int) (_end ^ (_end >>> 32));\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'end'. The field 'end' has the following\r
+ * description: Offset to last position in database entry that last (offset)\r
+ * position in sequence maps to\r
+ * \r
+ * @param end\r
+ * the value of field 'end'.\r
+ */\r
+ public void setEnd(final long end) {\r
+ this._end = end;\r
+ this._has_end = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'from'. The field 'from' has the following\r
+ * description: Offset to first position in dataset sequence record that start\r
+ * position on 'onto' maps to\r
+ * \r
+ * @param from\r
+ * the value of field 'from'.\r
+ */\r
+ public void setFrom(final long from) {\r
+ this._from = from;\r
+ this._has_from = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'start'. The field 'start' has the following\r
+ * description: Offset to first position in database entry that first (or\r
+ * offset) position in sequence maps to\r
+ * \r
+ * @param start\r
+ * the value of field 'start'.\r
+ */\r
+ public void setStart(final long start) {\r
+ this._start = start;\r
+ this._has_start = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'to'. The field 'to' has the following description:\r
+ * Offset to last position in dataset sequence record that end position on\r
+ * 'onto' maps to\r
+ * \r
+ * @param to\r
+ * the value of field 'to'.\r
+ */\r
+ public void setTo(final long to) {\r
+ this._to = to;\r
+ this._has_to = true;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.MapList\r
+ */\r
+ public static uk.ac.vamsas.objects.core.MapList unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.MapList) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.MapList.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MapRangeType extends uk.ac.vamsas.objects.core.RangeType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * number of dictionary symbol widths involved in each\r
- * mapped position on this sequence (for example, 3 for a dna\r
- * sequence exon\r
- * region that is being mapped to a protein sequence). This is\r
- * optional,\r
- * since the unit can be usually be inferred from the\r
- * dictionary type of\r
- * each sequence involved in the mapping. \r
- */\r
- private long _unit;\r
-\r
- /**\r
- * keeps track of state for field: _unit\r
+public class MapRangeType extends uk.ac.vamsas.objects.core.RangeType implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * number of dictionary symbol widths involved in each mapped position on this\r
+ * sequence (for example, 3 for a dna sequence exon region that is being\r
+ * mapped to a protein sequence). This is optional, since the unit can be\r
+ * usually be inferred from the dictionary type of each sequence involved in\r
+ * the mapping.\r
+ */\r
+ private long _unit;\r
+\r
+ /**\r
+ * keeps track of state for field: _unit\r
+ */\r
+ private boolean _has_unit;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MapRangeType() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
*/\r
- private boolean _has_unit;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MapRangeType() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- */\r
- public void deleteUnit(\r
- ) {\r
- this._has_unit= false;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof MapRangeType) {\r
- \r
- MapRangeType temp = (MapRangeType)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._unit != temp._unit)\r
- return false;\r
- if (this._has_unit != temp._has_unit)\r
- return false;\r
- return true;\r
- }\r
+ public void deleteUnit() {\r
+ this._has_unit = false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof MapRangeType) {\r
+\r
+ MapRangeType temp = (MapRangeType) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._unit != temp._unit)\r
return false;\r
+ if (this._has_unit != temp._has_unit)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'unit'. The field 'unit' has the\r
- * following description: number of dictionary symbol widths\r
- * involved in each\r
- * mapped position on this sequence (for example, 3 for a dna\r
- * sequence exon\r
- * region that is being mapped to a protein sequence). This is\r
- * optional,\r
- * since the unit can be usually be inferred from the\r
- * dictionary type of\r
- * each sequence involved in the mapping. \r
- * \r
- * @return the value of field 'Unit'.\r
- */\r
- public long getUnit(\r
- ) {\r
- return this._unit;\r
- }\r
-\r
- /**\r
- * Method hasUnit.\r
- * \r
- * @return true if at least one Unit has been added\r
- */\r
- public boolean hasUnit(\r
- ) {\r
- return this._has_unit;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + (int)(_unit^(_unit>>>32));\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'unit'. The field 'unit' has the\r
- * following description: number of dictionary symbol widths\r
- * involved in each\r
- * mapped position on this sequence (for example, 3 for a dna\r
- * sequence exon\r
- * region that is being mapped to a protein sequence). This is\r
- * optional,\r
- * since the unit can be usually be inferred from the\r
- * dictionary type of\r
- * each sequence involved in the mapping. \r
- * \r
- * @param unit the value of field 'unit'.\r
- */\r
- public void setUnit(\r
- final long unit) {\r
- this._unit = unit;\r
- this._has_unit = true;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
- */\r
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.MapRangeType.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'unit'. The field 'unit' has the following\r
+ * description: number of dictionary symbol widths involved in each mapped\r
+ * position on this sequence (for example, 3 for a dna sequence exon region\r
+ * that is being mapped to a protein sequence). This is optional, since the\r
+ * unit can be usually be inferred from the dictionary type of each sequence\r
+ * involved in the mapping.\r
+ * \r
+ * @return the value of field 'Unit'.\r
+ */\r
+ public long getUnit() {\r
+ return this._unit;\r
+ }\r
+\r
+ /**\r
+ * Method hasUnit.\r
+ * \r
+ * @return true if at least one Unit has been added\r
+ */\r
+ public boolean hasUnit() {\r
+ return this._has_unit;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ result = 37 * result + (int) (_unit ^ (_unit >>> 32));\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'unit'. The field 'unit' has the following\r
+ * description: number of dictionary symbol widths involved in each mapped\r
+ * position on this sequence (for example, 3 for a dna sequence exon region\r
+ * that is being mapped to a protein sequence). This is optional, since the\r
+ * unit can be usually be inferred from the dictionary type of each sequence\r
+ * involved in the mapping.\r
+ * \r
+ * @param unit\r
+ * the value of field 'unit'.\r
+ */\r
+ public void setUnit(final long unit) {\r
+ this._unit = unit;\r
+ this._has_unit = true;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.MapRangeType.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * Two sets of ranges defined between objects - usually sequences,\r
- * indicating which\r
- * regions on each are mapped. \r
+ * Two sets of ranges defined between objects - usually sequences, indicating\r
+ * which regions on each are mapped.\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MapType extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
+public class MapType extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
+ /**\r
*/\r
- private uk.ac.vamsas.objects.core.Local _local;\r
+ private uk.ac.vamsas.objects.core.Local _local;\r
\r
- /**\r
+ /**\r
*/\r
- private uk.ac.vamsas.objects.core.Mapped _mapped;\r
+ private uk.ac.vamsas.objects.core.Mapped _mapped;\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ public MapType() {\r
+ super();\r
+ }\r
\r
- public MapType() {\r
- super();\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ if (obj instanceof MapType) {\r
+\r
+ MapType temp = (MapType) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._local != null) {\r
+ if (temp._local == null)\r
+ return false;\r
+ if (this._local != temp._local) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._local);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._local);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._local);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._local);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof MapType) {\r
- \r
- MapType temp = (MapType)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._local != null) {\r
- if (temp._local == null) return false;\r
- if (this._local != temp._local) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._local);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._local);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._local); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._local); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._local.equals(temp._local)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._local);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._local);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._local);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._local);\r
- }\r
- }\r
- } else if (temp._local != null)\r
- return false;\r
- if (this._mapped != null) {\r
- if (temp._mapped == null) return false;\r
- if (this._mapped != temp._mapped) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._mapped);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._mapped);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._mapped); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapped); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._mapped.equals(temp._mapped)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._mapped);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapped);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._mapped);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapped);\r
- }\r
- }\r
- } else if (temp._mapped != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._local.equals(temp._local)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._local);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._local);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._local);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._local);\r
+ }\r
}\r
+ } else if (temp._local != null)\r
return false;\r
+ if (this._mapped != null) {\r
+ if (temp._mapped == null)\r
+ return false;\r
+ if (this._mapped != temp._mapped) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._mapped);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._mapped);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._mapped);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapped);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._mapped.equals(temp._mapped)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._mapped);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapped);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._mapped);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._mapped);\r
+ }\r
+ }\r
+ } else if (temp._mapped != null)\r
+ return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'local'.\r
- * \r
- * @return the value of field 'Local'.\r
- */\r
- public uk.ac.vamsas.objects.core.Local getLocal(\r
- ) {\r
- return this._local;\r
- }\r
+ /**\r
+ * Returns the value of field 'local'.\r
+ * \r
+ * @return the value of field 'Local'.\r
+ */\r
+ public uk.ac.vamsas.objects.core.Local getLocal() {\r
+ return this._local;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'mapped'.\r
- * \r
- * @return the value of field 'Mapped'.\r
- */\r
- public uk.ac.vamsas.objects.core.Mapped getMapped(\r
- ) {\r
- return this._mapped;\r
- }\r
+ /**\r
+ * Returns the value of field 'mapped'.\r
+ * \r
+ * @return the value of field 'Mapped'.\r
+ */\r
+ public uk.ac.vamsas.objects.core.Mapped getMapped() {\r
+ return this._mapped;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_local != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_local)) {\r
- result = 37 * result + _local.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_local);\r
- }\r
- if (_mapped != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_mapped)) {\r
- result = 37 * result + _mapped.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_mapped);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ if (_local != null && !org.castor.util.CycleBreaker.startingToCycle(_local)) {\r
+ result = 37 * result + _local.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_local);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
+ if (_mapped != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_mapped)) {\r
+ result = 37 * result + _mapped.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_mapped);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'local'.\r
- * \r
- * @param local the value of field 'local'.\r
- */\r
- public void setLocal(\r
- final uk.ac.vamsas.objects.core.Local local) {\r
- this._local = local;\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'mapped'.\r
- * \r
- * @param mapped the value of field 'mapped'.\r
- */\r
- public void setMapped(\r
- final uk.ac.vamsas.objects.core.Mapped mapped) {\r
- this._mapped = mapped;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
- */\r
- public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.MapType.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'local'.\r
+ * \r
+ * @param local\r
+ * the value of field 'local'.\r
+ */\r
+ public void setLocal(final uk.ac.vamsas.objects.core.Local local) {\r
+ this._local = local;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'mapped'.\r
+ * \r
+ * @param mapped\r
+ * the value of field 'mapped'.\r
+ */\r
+ public void setMapped(final uk.ac.vamsas.objects.core.Mapped mapped) {\r
+ this._mapped = mapped;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.MapType.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Mapped extends MapRangeType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Mapped() {\r
- super();\r
- }\r
+public class Mapped extends MapRangeType implements java.io.Serializable {\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Mapped) {\r
- \r
- return true;\r
- }\r
- return false;\r
- }\r
+ public Mapped() {\r
+ super();\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- \r
- return result;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ if (obj instanceof Mapped) {\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
- */\r
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Mapped.class, reader);\r
+ return true;\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Mapped.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Mapping extends uk.ac.vamsas.objects.core.MapList \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * object to which the mapping is being mapped\r
- * \r
- */\r
- private java.lang.Object _onto;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Mapping() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Mapping) {\r
- \r
- Mapping temp = (Mapping)obj;\r
- if (this._onto != null) {\r
- if (temp._onto == null) return false;\r
- else if (!(this._onto.equals(temp._onto))) \r
- return false;\r
- }\r
- else if (temp._onto != null)\r
- return false;\r
- return true;\r
- }\r
+public class Mapping extends uk.ac.vamsas.objects.core.MapList implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * object to which the mapping is being mapped\r
+ * \r
+ */\r
+ private java.lang.Object _onto;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Mapping() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Mapping) {\r
+\r
+ Mapping temp = (Mapping) obj;\r
+ if (this._onto != null) {\r
+ if (temp._onto == null)\r
+ return false;\r
+ else if (!(this._onto.equals(temp._onto)))\r
+ return false;\r
+ } else if (temp._onto != null)\r
return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'onto'. The field 'onto' has the\r
- * following description: object to which the mapping is being\r
- * mapped\r
- * \r
- * \r
- * @return the value of field 'Onto'.\r
- */\r
- public java.lang.Object getOnto(\r
- ) {\r
- return this._onto;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_onto != null) {\r
- result = 37 * result + _onto.hashCode();\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'onto'. The field 'onto' has the\r
- * following description: object to which the mapping is being\r
- * mapped\r
- * \r
- * \r
- * @param onto the value of field 'onto'.\r
- */\r
- public void setOnto(\r
- final java.lang.Object onto) {\r
- this._onto = onto;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.MapList\r
- */\r
- public static uk.ac.vamsas.objects.core.MapList unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.MapList) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Mapping.class, reader);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'onto'. The field 'onto' has the following\r
+ * description: object to which the mapping is being mapped\r
+ * \r
+ * \r
+ * @return the value of field 'Onto'.\r
+ */\r
+ public java.lang.Object getOnto() {\r
+ return this._onto;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_onto != null) {\r
+ result = 37 * result + _onto.hashCode();\r
}\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'onto'. The field 'onto' has the following\r
+ * description: object to which the mapping is being mapped\r
+ * \r
+ * \r
+ * @param onto\r
+ * the value of field 'onto'.\r
+ */\r
+ public void setOnto(final java.lang.Object onto) {\r
+ this._onto = onto;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.MapList\r
+ */\r
+ public static uk.ac.vamsas.objects.core.MapList unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.MapList) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Mapping.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class Newick.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class Newick extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
+public class Newick extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ /**
+ * internal content storage
+ */
+ private java.lang.String _content = "";
- /**
- * internal content storage
- */
- private java.lang.String _content = "";
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
- /**
- * Field _title.
- */
- private java.lang.String _title;
+ /**
+ * Primary Key for vamsas object referencing
+ *
+ */
+ private java.lang.String _id;
- /**
- * Primary Key for vamsas object referencing
- *
- */
- private java.lang.String _id;
+ /**
+ * Field _modifiable.
+ */
+ private java.lang.String _modifiable;
- /**
- * Field _modifiable.
- */
- private java.lang.String _modifiable;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+ public Newick() {
+ super();
+ setContent("");
+ }
- //----------------/
- //- Constructors -/
- //----------------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- public Newick() {
- super();
- setContent("");
- }
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+ if (obj instanceof Newick) {
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+ Newick temp = (Newick) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._content != null) {
+ if (temp._content == null)
+ return false;
+ if (this._content != temp._content) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._content.equals(temp._content)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
+ }
+ }
+ } else if (temp._content != null)
+ return false;
+ if (this._title != null) {
+ if (temp._title == null)
+ return false;
+ if (this._title != temp._title) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._title);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._title);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
+ }
+ ;
return false;
-
- if (obj instanceof Newick) {
-
- Newick temp = (Newick)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._content != null) {
- if (temp._content == null) return false;
- if (this._content != temp._content) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };
- return false;
- }
- if (!thcycle) {
- if (!this._content.equals(temp._content)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);
- }
- }
- } else if (temp._content != null)
- return false;
- if (this._title != null) {
- if (temp._title == null) return false;
- if (this._title != temp._title) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._title);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._title);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._title); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._title); };
- return false;
- }
- if (!thcycle) {
- if (!this._title.equals(temp._title)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
- }
- }
- } else if (temp._title != null)
- return false;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._modifiable != null) {
- if (temp._modifiable == null) return false;
- if (this._modifiable != temp._modifiable) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };
- return false;
- }
- if (!thcycle) {
- if (!this._modifiable.equals(temp._modifiable)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- }
- }
- } else if (temp._modifiable != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._title.equals(temp._title)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
+ }
}
+ } else if (temp._title != null)
return false;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ }
+ } else if (temp._id != null)
+ return false;
+ if (this._modifiable != null) {
+ if (temp._modifiable == null)
+ return false;
+ if (this._modifiable != temp._modifiable) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._modifiable);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._modifiable);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._modifiable.equals(temp._modifiable)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
+ }
+ } else if (temp._modifiable != null)
+ return false;
+ return true;
}
+ return false;
+ }
- /**
- * Returns the value of field 'content'. The field 'content'
- * has the following description: internal content storage
- *
- * @return the value of field 'Content'.
- */
- public java.lang.String getContent(
- ) {
- return this._content;
- }
+ /**
+ * Returns the value of field 'content'. The field 'content' has the following
+ * description: internal content storage
+ *
+ * @return the value of field 'Content'.
+ */
+ public java.lang.String getContent() {
+ return this._content;
+ }
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
- /**
- * Returns the value of field 'modifiable'.
- *
- * @return the value of field 'Modifiable'.
- */
- public java.lang.String getModifiable(
- ) {
- return this._modifiable;
- }
+ /**
+ * Returns the value of field 'modifiable'.
+ *
+ * @return the value of field 'Modifiable'.
+ */
+ public java.lang.String getModifiable() {
+ return this._modifiable;
+ }
- /**
- * Returns the value of field 'title'.
- *
- * @return the value of field 'Title'.
- */
- public java.lang.String getTitle(
- ) {
- return this._title;
- }
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle() {
+ return this._title;
+ }
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_content != null
- && !org.castor.util.CycleBreaker.startingToCycle(_content)) {
- result = 37 * result + _content.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_content);
- }
- if (_title != null
- && !org.castor.util.CycleBreaker.startingToCycle(_title)) {
- result = 37 * result + _title.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_title);
- }
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_modifiable != null
- && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
- result = 37 * result + _modifiable.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
- }
-
- return result;
- }
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ long tmp;
+ if (_content != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_content)) {
+ result = 37 * result + _content.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_content);
}
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
+ if (_title != null && !org.castor.util.CycleBreaker.startingToCycle(_title)) {
+ result = 37 * result + _title.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_title);
}
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
}
-
- /**
- * Sets the value of field 'content'. The field 'content' has
- * the following description: internal content storage
- *
- * @param content the value of field 'content'.
- */
- public void setContent(
- final java.lang.String content) {
- this._content = content;
+ if (_modifiable != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
+ result = 37 * result + _modifiable.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
}
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
+ return result;
+ }
- /**
- * Sets the value of field 'modifiable'.
- *
- * @param modifiable the value of field 'modifiable'.
- */
- public void setModifiable(
- final java.lang.String modifiable) {
- this._modifiable = modifiable;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
+ return true;
+ }
- /**
- * Sets the value of field 'title'.
- *
- * @param title the value of field 'title'.
- */
- public void setTitle(
- final java.lang.String title) {
- this._title = title;
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.Newick
- */
- public static uk.ac.vamsas.objects.core.Newick unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.Newick) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Newick.class, reader);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ * Sets the value of field 'content'. The field 'content' has the following
+ * description: internal content storage
+ *
+ * @param content
+ * the value of field 'content'.
+ */
+ public void setContent(final java.lang.String content) {
+ this._content = content;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'modifiable'.
+ *
+ * @param modifiable
+ * the value of field 'modifiable'.
+ */
+ public void setModifiable(final java.lang.String modifiable) {
+ this._modifiable = modifiable;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title) {
+ this._title = title;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Newick
+ */
+ public static uk.ac.vamsas.objects.core.Newick unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.Newick) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.Newick.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class NodeType extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Primary Key for vamsas object referencing \r
- */\r
- private java.lang.String _id;\r
-\r
- /**\r
- * Field _modifiable.\r
- */\r
- private java.lang.String _modifiable;\r
-\r
- /**\r
- * Short name for this node\r
- */\r
- private java.lang.String _name;\r
-\r
- /**\r
- * Descriptive text for this node\r
- */\r
- private java.lang.String _description;\r
-\r
- /**\r
- * Direct associations between this node and any vamsas\r
- * objects\r
- */\r
- private java.util.Vector _vrefList;\r
-\r
- /**\r
- * Field _propertyList.\r
- */\r
- private java.util.Vector _propertyList;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public NodeType() {\r
- super();\r
- this._vrefList = new java.util.Vector();\r
- this._propertyList = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * \r
- * \r
- * @param vProperty\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addProperty(\r
- final uk.ac.vamsas.objects.core.Property vProperty)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._propertyList.addElement(vProperty);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vProperty\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addProperty(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Property vProperty)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._propertyList.add(index, vProperty);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vVref\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addVref(\r
- final uk.ac.vamsas.objects.core.Vref vVref)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._vrefList.addElement(vVref);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vVref\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addVref(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Vref vVref)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._vrefList.add(index, vVref);\r
- }\r
-\r
- /**\r
- * Method enumerateProperty.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Property elements\r
- */\r
- public java.util.Enumeration enumerateProperty(\r
- ) {\r
- return this._propertyList.elements();\r
- }\r
-\r
- /**\r
- * Method enumerateVref.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Vref elements\r
- */\r
- public java.util.Enumeration enumerateVref(\r
- ) {\r
- return this._vrefList.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class NodeType extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Primary Key for vamsas object referencing\r
+ */\r
+ private java.lang.String _id;\r
+\r
+ /**\r
+ * Field _modifiable.\r
+ */\r
+ private java.lang.String _modifiable;\r
+\r
+ /**\r
+ * Short name for this node\r
+ */\r
+ private java.lang.String _name;\r
+\r
+ /**\r
+ * Descriptive text for this node\r
+ */\r
+ private java.lang.String _description;\r
+\r
+ /**\r
+ * Direct associations between this node and any vamsas objects\r
+ */\r
+ private java.util.Vector _vrefList;\r
+\r
+ /**\r
+ * Field _propertyList.\r
+ */\r
+ private java.util.Vector _propertyList;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public NodeType() {\r
+ super();\r
+ this._vrefList = new java.util.Vector();\r
+ this._propertyList = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vProperty\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._propertyList.addElement(vProperty);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vProperty\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addProperty(final int index,\r
+ final uk.ac.vamsas.objects.core.Property vProperty)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._propertyList.add(index, vProperty);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vVref\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addVref(final uk.ac.vamsas.objects.core.Vref vVref)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._vrefList.addElement(vVref);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vVref\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addVref(final int index,\r
+ final uk.ac.vamsas.objects.core.Vref vVref)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._vrefList.add(index, vVref);\r
+ }\r
+\r
+ /**\r
+ * Method enumerateProperty.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements\r
+ */\r
+ public java.util.Enumeration enumerateProperty() {\r
+ return this._propertyList.elements();\r
+ }\r
+\r
+ /**\r
+ * Method enumerateVref.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Vref elements\r
+ */\r
+ public java.util.Enumeration enumerateVref() {\r
+ return this._vrefList.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof NodeType) {\r
+\r
+ NodeType temp = (NodeType) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._id != null) {\r
+ if (temp._id == null)\r
+ return false;\r
+ if (this._id != temp._id) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof NodeType) {\r
- \r
- NodeType temp = (NodeType)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._id != null) {\r
- if (temp._id == null) return false;\r
- if (this._id != temp._id) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._id.equals(temp._id)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- }\r
- }\r
- } else if (temp._id != null)\r
- return false;\r
- if (this._modifiable != null) {\r
- if (temp._modifiable == null) return false;\r
- if (this._modifiable != temp._modifiable) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._modifiable.equals(temp._modifiable)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
- }\r
- }\r
- } else if (temp._modifiable != null)\r
- return false;\r
- if (this._name != null) {\r
- if (temp._name == null) return false;\r
- if (this._name != temp._name) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._name.equals(temp._name)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- }\r
- }\r
- } else if (temp._name != null)\r
- return false;\r
- if (this._description != null) {\r
- if (temp._description == null) return false;\r
- if (this._description != temp._description) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._description);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._description);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._description); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._description); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._description.equals(temp._description)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);\r
- }\r
- }\r
- } else if (temp._description != null)\r
- return false;\r
- if (this._vrefList != null) {\r
- if (temp._vrefList == null) return false;\r
- if (this._vrefList != temp._vrefList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._vrefList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._vrefList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._vrefList.equals(temp._vrefList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList);\r
- }\r
- }\r
- } else if (temp._vrefList != null)\r
- return false;\r
- if (this._propertyList != null) {\r
- if (temp._propertyList == null) return false;\r
- if (this._propertyList != temp._propertyList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._propertyList.equals(temp._propertyList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);\r
- }\r
- }\r
- } else if (temp._propertyList != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._id.equals(temp._id)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
}\r
+ } else if (temp._id != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'description'. The field\r
- * 'description' has the following description: Descriptive\r
- * text for this node\r
- * \r
- * @return the value of field 'Description'.\r
- */\r
- public java.lang.String getDescription(\r
- ) {\r
- return this._description;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing \r
- * \r
- * @return the value of field 'Id'.\r
- */\r
- public java.lang.String getId(\r
- ) {\r
- return this._id;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'modifiable'.\r
- * \r
- * @return the value of field 'Modifiable'.\r
- */\r
- public java.lang.String getModifiable(\r
- ) {\r
- return this._modifiable;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'name'. The field 'name' has the\r
- * following description: Short name for this node\r
- * \r
- * @return the value of field 'Name'.\r
- */\r
- public java.lang.String getName(\r
- ) {\r
- return this._name;\r
- }\r
-\r
- /**\r
- * Method getProperty.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the uk.ac.vamsas.objects.core.Property\r
- * at the given index\r
- */\r
- public uk.ac.vamsas.objects.core.Property getProperty(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._propertyList.size()) {\r
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);\r
- }\r
-\r
- /**\r
- * Method getProperty.Returns the contents of the collection in\r
- * an Array. <p>Note: Just in case the collection contents\r
- * are changing in another thread, we pass a 0-length Array of\r
- * the correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.Property[] getProperty(\r
- ) {\r
- uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];\r
- return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getPropertyAsReference.Returns a reference to\r
- * '_propertyList'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getPropertyAsReference(\r
- ) {\r
- return this._propertyList;\r
- }\r
-\r
- /**\r
- * Method getPropertyCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getPropertyCount(\r
- ) {\r
- return this._propertyList.size();\r
- }\r
-\r
- /**\r
- * Method getVref.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the uk.ac.vamsas.objects.core.Vref at\r
- * the given index\r
- */\r
- public uk.ac.vamsas.objects.core.Vref getVref(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._vrefList.size()) {\r
- throw new IndexOutOfBoundsException("getVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.Vref) _vrefList.get(index);\r
- }\r
-\r
- /**\r
- * Method getVref.Returns the contents of the collection in an\r
- * Array. <p>Note: Just in case the collection contents are\r
- * changing in another thread, we pass a 0-length Array of the\r
- * correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.Vref[] getVref(\r
- ) {\r
- uk.ac.vamsas.objects.core.Vref[] array = new uk.ac.vamsas.objects.core.Vref[0];\r
- return (uk.ac.vamsas.objects.core.Vref[]) this._vrefList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getVrefAsReference.Returns a reference to\r
- * '_vrefList'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getVrefAsReference(\r
- ) {\r
- return this._vrefList;\r
- }\r
-\r
- /**\r
- * Method getVrefCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getVrefCount(\r
- ) {\r
- return this._vrefList.size();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_id != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
- result = 37 * result + _id.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
- }\r
- if (_modifiable != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {\r
- result = 37 * result + _modifiable.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);\r
- }\r
- if (_name != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
- result = 37 * result + _name.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
- }\r
- if (_description != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_description)) {\r
- result = 37 * result + _description.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_description);\r
- }\r
- if (_vrefList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_vrefList)) {\r
- result = 37 * result + _vrefList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_vrefList);\r
- }\r
- if (_propertyList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {\r
- result = 37 * result + _propertyList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ if (this._modifiable != null) {\r
+ if (temp._modifiable == null)\r
+ return false;\r
+ if (this._modifiable != temp._modifiable) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._modifiable);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._modifiable);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._modifiable.equals(temp._modifiable)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllProperty(\r
- ) {\r
- this._propertyList.clear();\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllVref(\r
- ) {\r
- this._vrefList.clear();\r
- }\r
-\r
- /**\r
- * Method removeProperty.\r
- * \r
- * @param vProperty\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeProperty(\r
- final uk.ac.vamsas.objects.core.Property vProperty) {\r
- boolean removed = _propertyList.remove(vProperty);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removePropertyAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.Property removePropertyAt(\r
- final int index) {\r
- java.lang.Object obj = this._propertyList.remove(index);\r
- return (uk.ac.vamsas.objects.core.Property) obj;\r
- }\r
-\r
- /**\r
- * Method removeVref.\r
- * \r
- * @param vVref\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeVref(\r
- final uk.ac.vamsas.objects.core.Vref vVref) {\r
- boolean removed = _vrefList.remove(vVref);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removeVrefAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.Vref removeVrefAt(\r
- final int index) {\r
- java.lang.Object obj = this._vrefList.remove(index);\r
- return (uk.ac.vamsas.objects.core.Vref) obj;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'description'. The field\r
- * 'description' has the following description: Descriptive\r
- * text for this node\r
- * \r
- * @param description the value of field 'description'.\r
- */\r
- public void setDescription(\r
- final java.lang.String description) {\r
- this._description = description;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing \r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(\r
- final java.lang.String id) {\r
- this._id = id;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'modifiable'.\r
- * \r
- * @param modifiable the value of field 'modifiable'.\r
- */\r
- public void setModifiable(\r
- final java.lang.String modifiable) {\r
- this._modifiable = modifiable;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'name'. The field 'name' has the\r
- * following description: Short name for this node\r
- * \r
- * @param name the value of field 'name'.\r
- */\r
- public void setName(\r
- final java.lang.String name) {\r
- this._name = name;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vProperty\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setProperty(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Property vProperty)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._propertyList.size()) {\r
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
+ } else if (temp._modifiable != null)\r
+ return false;\r
+ if (this._name != null) {\r
+ if (temp._name == null)\r
+ return false;\r
+ if (this._name != temp._name) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._name);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._name.equals(temp._name)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
}\r
- \r
- this._propertyList.set(index, vProperty);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vPropertyArray\r
- */\r
- public void setProperty(\r
- final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {\r
- //-- copy array\r
- _propertyList.clear();\r
- \r
- for (int i = 0; i < vPropertyArray.length; i++) {\r
- this._propertyList.add(vPropertyArray[i]);\r
+ } else if (temp._name != null)\r
+ return false;\r
+ if (this._description != null) {\r
+ if (temp._description == null)\r
+ return false;\r
+ if (this._description != temp._description) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._description);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._description);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._description);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._description);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._description.equals(temp._description)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._description);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._description);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._description);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * Sets the value of '_propertyList' by copying the given\r
- * Vector. All elements will be checked for type safety.\r
- * \r
- * @param vPropertyList the Vector to copy.\r
- */\r
- public void setProperty(\r
- final java.util.Vector vPropertyList) {\r
- // copy vector\r
- this._propertyList.clear();\r
- \r
- this._propertyList.addAll(vPropertyList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_propertyList' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param propertyVector the Vector to set.\r
- */\r
- public void setPropertyAsReference(\r
- final java.util.Vector propertyVector) {\r
- this._propertyList = propertyVector;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vVref\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setVref(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Vref vVref)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._vrefList.size()) {\r
- throw new IndexOutOfBoundsException("setVref: Index value '" + index + "' not in range [0.." + (this._vrefList.size() - 1) + "]");\r
+ } else if (temp._description != null)\r
+ return false;\r
+ if (this._vrefList != null) {\r
+ if (temp._vrefList == null)\r
+ return false;\r
+ if (this._vrefList != temp._vrefList) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._vrefList);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._vrefList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._vrefList.equals(temp._vrefList)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._vrefList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._vrefList);\r
+ }\r
}\r
- \r
- this._vrefList.set(index, vVref);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vVrefArray\r
- */\r
- public void setVref(\r
- final uk.ac.vamsas.objects.core.Vref[] vVrefArray) {\r
- //-- copy array\r
- _vrefList.clear();\r
- \r
- for (int i = 0; i < vVrefArray.length; i++) {\r
- this._vrefList.add(vVrefArray[i]);\r
+ } else if (temp._vrefList != null)\r
+ return false;\r
+ if (this._propertyList != null) {\r
+ if (temp._propertyList == null)\r
+ return false;\r
+ if (this._propertyList != temp._propertyList) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._propertyList);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._propertyList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._propertyList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._propertyList);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._propertyList.equals(temp._propertyList)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._propertyList);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._propertyList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * Sets the value of '_vrefList' by copying the given Vector.\r
- * All elements will be checked for type safety.\r
- * \r
- * @param vVrefList the Vector to copy.\r
- */\r
- public void setVref(\r
- final java.util.Vector vVrefList) {\r
- // copy vector\r
- this._vrefList.clear();\r
- \r
- this._vrefList.addAll(vVrefList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_vrefList' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param vrefVector the Vector to set.\r
- */\r
- public void setVrefAsReference(\r
- final java.util.Vector vrefVector) {\r
- this._vrefList = vrefVector;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType\r
- */\r
- public static uk.ac.vamsas.objects.core.NodeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.NodeType.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ } else if (temp._propertyList != null)\r
+ return false;\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'description'. The field 'description' has the\r
+ * following description: Descriptive text for this node\r
+ * \r
+ * @return the value of field 'Description'.\r
+ */\r
+ public java.lang.String getDescription() {\r
+ return this._description;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'id'. The field 'id' has the following\r
+ * description: Primary Key for vamsas object referencing\r
+ * \r
+ * @return the value of field 'Id'.\r
+ */\r
+ public java.lang.String getId() {\r
+ return this._id;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'modifiable'.\r
+ * \r
+ * @return the value of field 'Modifiable'.\r
+ */\r
+ public java.lang.String getModifiable() {\r
+ return this._modifiable;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'name'. The field 'name' has the following\r
+ * description: Short name for this node\r
+ * \r
+ * @return the value of field 'Name'.\r
+ */\r
+ public java.lang.String getName() {\r
+ return this._name;\r
+ }\r
+\r
+ /**\r
+ * Method getProperty.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Property at the given\r
+ * index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Property getProperty(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._propertyList.size()) {\r
+ throw new IndexOutOfBoundsException("getProperty: Index value '" + index\r
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getProperty.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Property[] getProperty() {\r
+ uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];\r
+ return (uk.ac.vamsas.objects.core.Property[]) this._propertyList\r
+ .toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getPropertyAsReference.Returns a reference to '_propertyList'. No\r
+ * type checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getPropertyAsReference() {\r
+ return this._propertyList;\r
+ }\r
+\r
+ /**\r
+ * Method getPropertyCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getPropertyCount() {\r
+ return this._propertyList.size();\r
+ }\r
+\r
+ /**\r
+ * Method getVref.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Vref at the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Vref getVref(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._vrefList.size()) {\r
+ throw new IndexOutOfBoundsException("getVref: Index value '" + index\r
+ + "' not in range [0.." + (this._vrefList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Vref) _vrefList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getVref.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Vref[] getVref() {\r
+ uk.ac.vamsas.objects.core.Vref[] array = new uk.ac.vamsas.objects.core.Vref[0];\r
+ return (uk.ac.vamsas.objects.core.Vref[]) this._vrefList.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getVrefAsReference.Returns a reference to '_vrefList'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getVrefAsReference() {\r
+ return this._vrefList;\r
+ }\r
+\r
+ /**\r
+ * Method getVrefCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getVrefCount() {\r
+ return this._vrefList.size();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
+ result = 37 * result + _id.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
+ }\r
+ if (_modifiable != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {\r
+ result = 37 * result + _modifiable.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);\r
+ }\r
+ if (_name != null && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
+ result = 37 * result + _name.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
+ }\r
+ if (_description != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_description)) {\r
+ result = 37 * result + _description.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_description);\r
+ }\r
+ if (_vrefList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_vrefList)) {\r
+ result = 37 * result + _vrefList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_vrefList);\r
+ }\r
+ if (_propertyList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {\r
+ result = 37 * result + _propertyList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllProperty() {\r
+ this._propertyList.clear();\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllVref() {\r
+ this._vrefList.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removeProperty.\r
+ * \r
+ * @param vProperty\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeProperty(\r
+ final uk.ac.vamsas.objects.core.Property vProperty) {\r
+ boolean removed = _propertyList.remove(vProperty);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removePropertyAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {\r
+ java.lang.Object obj = this._propertyList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Property) obj;\r
+ }\r
+\r
+ /**\r
+ * Method removeVref.\r
+ * \r
+ * @param vVref\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeVref(final uk.ac.vamsas.objects.core.Vref vVref) {\r
+ boolean removed = _vrefList.remove(vVref);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeVrefAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Vref removeVrefAt(final int index) {\r
+ java.lang.Object obj = this._vrefList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Vref) obj;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'description'. The field 'description' has the\r
+ * following description: Descriptive text for this node\r
+ * \r
+ * @param description\r
+ * the value of field 'description'.\r
+ */\r
+ public void setDescription(final java.lang.String description) {\r
+ this._description = description;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'id'. The field 'id' has the following description:\r
+ * Primary Key for vamsas object referencing\r
+ * \r
+ * @param id\r
+ * the value of field 'id'.\r
+ */\r
+ public void setId(final java.lang.String id) {\r
+ this._id = id;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'modifiable'.\r
+ * \r
+ * @param modifiable\r
+ * the value of field 'modifiable'.\r
+ */\r
+ public void setModifiable(final java.lang.String modifiable) {\r
+ this._modifiable = modifiable;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'name'. The field 'name' has the following\r
+ * description: Short name for this node\r
+ * \r
+ * @param name\r
+ * the value of field 'name'.\r
+ */\r
+ public void setName(final java.lang.String name) {\r
+ this._name = name;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vProperty\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setProperty(final int index,\r
+ final uk.ac.vamsas.objects.core.Property vProperty)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._propertyList.size()) {\r
+ throw new IndexOutOfBoundsException("setProperty: Index value '" + index\r
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
+ }\r
+\r
+ this._propertyList.set(index, vProperty);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vPropertyArray\r
+ */\r
+ public void setProperty(\r
+ final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {\r
+ // -- copy array\r
+ _propertyList.clear();\r
+\r
+ for (int i = 0; i < vPropertyArray.length; i++) {\r
+ this._propertyList.add(vPropertyArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_propertyList' by copying the given Vector. All elements\r
+ * will be checked for type safety.\r
+ * \r
+ * @param vPropertyList\r
+ * the Vector to copy.\r
+ */\r
+ public void setProperty(final java.util.Vector vPropertyList) {\r
+ // copy vector\r
+ this._propertyList.clear();\r
+\r
+ this._propertyList.addAll(vPropertyList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_propertyList' by setting it to the given Vector. No\r
+ * type checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param propertyVector\r
+ * the Vector to set.\r
+ */\r
+ public void setPropertyAsReference(final java.util.Vector propertyVector) {\r
+ this._propertyList = propertyVector;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vVref\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setVref(final int index,\r
+ final uk.ac.vamsas.objects.core.Vref vVref)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._vrefList.size()) {\r
+ throw new IndexOutOfBoundsException("setVref: Index value '" + index\r
+ + "' not in range [0.." + (this._vrefList.size() - 1) + "]");\r
+ }\r
+\r
+ this._vrefList.set(index, vVref);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vVrefArray\r
+ */\r
+ public void setVref(final uk.ac.vamsas.objects.core.Vref[] vVrefArray) {\r
+ // -- copy array\r
+ _vrefList.clear();\r
+\r
+ for (int i = 0; i < vVrefArray.length; i++) {\r
+ this._vrefList.add(vVrefArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_vrefList' by copying the given Vector. All elements\r
+ * will be checked for type safety.\r
+ * \r
+ * @param vVrefList\r
+ * the Vector to copy.\r
+ */\r
+ public void setVref(final java.util.Vector vVrefList) {\r
+ // copy vector\r
+ this._vrefList.clear();\r
+\r
+ this._vrefList.addAll(vVrefList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_vrefList' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param vrefVector\r
+ * the Vector to set.\r
+ */\r
+ public void setVrefAsReference(final java.util.Vector vrefVector) {\r
+ this._vrefList = vrefVector;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.NodeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.NodeType.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Param extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
+public class Param extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * internal content storage\r
+ */\r
+ private java.lang.String _content = "";\r
\r
- /**\r
- * internal content storage\r
- */\r
- private java.lang.String _content = "";\r
+ /**\r
+ * Field _name.\r
+ */\r
+ private java.lang.String _name;\r
\r
- /**\r
- * Field _name.\r
- */\r
- private java.lang.String _name;\r
+ /**\r
+ * The type specifies how the property will be parsed. Empty property strings\r
+ * are allowed, and can be used to prototype the input to a document. TODO:\r
+ * specify allowed types\r
+ */\r
+ private java.lang.String _type;\r
\r
- /**\r
- * The type specifies how the property will be parsed.\r
- * Empty property strings are allowed, and can be used to\r
- * prototype the\r
- * input to a document. TODO: specify allowed types \r
- */\r
- private java.lang.String _type;\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public Param() {\r
+ super();\r
+ setContent("");\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public Param() {\r
- super();\r
- setContent("");\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (obj instanceof Param) {\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ Param temp = (Param) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._content != null) {\r
+ if (temp._content == null)\r
+ return false;\r
+ if (this._content != temp._content) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._content.equals(temp._content)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
+ }\r
+ } else if (temp._content != null)\r
+ return false;\r
+ if (this._name != null) {\r
+ if (temp._name == null)\r
+ return false;\r
+ if (this._name != temp._name) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._name);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._name.equals(temp._name)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
+ }\r
+ } else if (temp._name != null)\r
+ return false;\r
+ if (this._type != null) {\r
+ if (temp._type == null)\r
+ return false;\r
+ if (this._type != temp._type) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._type);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Param) {\r
- \r
- Param temp = (Param)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._content != null) {\r
- if (temp._content == null) return false;\r
- if (this._content != temp._content) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._content.equals(temp._content)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- }\r
- }\r
- } else if (temp._content != null)\r
- return false;\r
- if (this._name != null) {\r
- if (temp._name == null) return false;\r
- if (this._name != temp._name) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._name.equals(temp._name)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- }\r
- }\r
- } else if (temp._name != null)\r
- return false;\r
- if (this._type != null) {\r
- if (temp._type == null) return false;\r
- if (this._type != temp._type) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._type);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._type); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._type.equals(temp._type)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- }\r
- }\r
- } else if (temp._type != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._type.equals(temp._type)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
}\r
+ } else if (temp._type != null)\r
return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'content'. The field 'content'\r
- * has the following description: internal content storage\r
- * \r
- * @return the value of field 'Content'.\r
- */\r
- public java.lang.String getContent(\r
- ) {\r
- return this._content;\r
- }\r
+ /**\r
+ * Returns the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @return the value of field 'Content'.\r
+ */\r
+ public java.lang.String getContent() {\r
+ return this._content;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'name'.\r
- * \r
- * @return the value of field 'Name'.\r
- */\r
- public java.lang.String getName(\r
- ) {\r
- return this._name;\r
- }\r
+ /**\r
+ * Returns the value of field 'name'.\r
+ * \r
+ * @return the value of field 'Name'.\r
+ */\r
+ public java.lang.String getName() {\r
+ return this._name;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'type'. The field 'type' has the\r
- * following description: The type specifies how the property\r
- * will be parsed.\r
- * Empty property strings are allowed, and can be used to\r
- * prototype the\r
- * input to a document. TODO: specify allowed types \r
- * \r
- * @return the value of field 'Type'.\r
- */\r
- public java.lang.String getType(\r
- ) {\r
- return this._type;\r
- }\r
+ /**\r
+ * Returns the value of field 'type'. The field 'type' has the following\r
+ * description: The type specifies how the property will be parsed. Empty\r
+ * property strings are allowed, and can be used to prototype the input to a\r
+ * document. TODO: specify allowed types\r
+ * \r
+ * @return the value of field 'Type'.\r
+ */\r
+ public java.lang.String getType() {\r
+ return this._type;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_content != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
- result = 37 * result + _content.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
- }\r
- if (_name != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
- result = 37 * result + _name.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
- }\r
- if (_type != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
- result = 37 * result + _type.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ if (_content != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
+ result = 37 * result + _content.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
+ if (_name != null && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
+ result = 37 * result + _name.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
+ if (_type != null && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
+ result = 37 * result + _type.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
}\r
\r
- /**\r
- * Sets the value of field 'content'. The field 'content' has\r
- * the following description: internal content storage\r
- * \r
- * @param content the value of field 'content'.\r
- */\r
- public void setContent(\r
- final java.lang.String content) {\r
- this._content = content;\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'name'.\r
- * \r
- * @param name the value of field 'name'.\r
- */\r
- public void setName(\r
- final java.lang.String name) {\r
- this._name = name;\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'type'. The field 'type' has the\r
- * following description: The type specifies how the property\r
- * will be parsed.\r
- * Empty property strings are allowed, and can be used to\r
- * prototype the\r
- * input to a document. TODO: specify allowed types \r
- * \r
- * @param type the value of field 'type'.\r
- */\r
- public void setType(\r
- final java.lang.String type) {\r
- this._type = type;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Param\r
- */\r
- public static uk.ac.vamsas.objects.core.Param unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Param) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Param.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @param content\r
+ * the value of field 'content'.\r
+ */\r
+ public void setContent(final java.lang.String content) {\r
+ this._content = content;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'name'.\r
+ * \r
+ * @param name\r
+ * the value of field 'name'.\r
+ */\r
+ public void setName(final java.lang.String name) {\r
+ this._name = name;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'type'. The field 'type' has the following\r
+ * description: The type specifies how the property will be parsed. Empty\r
+ * property strings are allowed, and can be used to prototype the input to a\r
+ * document. TODO: specify allowed types\r
+ * \r
+ * @param type\r
+ * the value of field 'type'.\r
+ */\r
+ public void setType(final java.lang.String type) {\r
+ this._type = type;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Param\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Param unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Param) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Param.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
\r
/**\r
* a position within the associated object's coordinate system\r
- * \r
+ * \r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Pos extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _i.\r
- */\r
- private int _i;\r
-\r
- /**\r
- * keeps track of state for field: _i\r
- */\r
- private boolean _has_i;\r
+public class Pos extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ /**\r
+ * Field _i.\r
+ */\r
+ private int _i;\r
\r
- public Pos() {\r
- super();\r
- }\r
+ /**\r
+ * keeps track of state for field: _i\r
+ */\r
+ private boolean _has_i;\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public Pos() {\r
+ super();\r
+ }\r
\r
- /**\r
- */\r
- public void deleteI(\r
- ) {\r
- this._has_i= false;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
+ /**\r
*/\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Pos) {\r
- \r
- Pos temp = (Pos)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._i != temp._i)\r
- return false;\r
- if (this._has_i != temp._has_i)\r
- return false;\r
- return true;\r
- }\r
+ public void deleteI() {\r
+ this._has_i = false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Pos) {\r
+\r
+ Pos temp = (Pos) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._i != temp._i)\r
return false;\r
+ if (this._has_i != temp._has_i)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'i'.\r
- * \r
- * @return the value of field 'I'.\r
- */\r
- public int getI(\r
- ) {\r
- return this._i;\r
- }\r
-\r
- /**\r
- * Method hasI.\r
- * \r
- * @return true if at least one I has been added\r
- */\r
- public boolean hasI(\r
- ) {\r
- return this._has_i;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + _i;\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'i'.\r
- * \r
- * @param i the value of field 'i'.\r
- */\r
- public void setI(\r
- final int i) {\r
- this._i = i;\r
- this._has_i = true;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Pos\r
- */\r
- public static uk.ac.vamsas.objects.core.Pos unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Pos) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Pos.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'i'.\r
+ * \r
+ * @return the value of field 'I'.\r
+ */\r
+ public int getI() {\r
+ return this._i;\r
+ }\r
+\r
+ /**\r
+ * Method hasI.\r
+ * \r
+ * @return true if at least one I has been added\r
+ */\r
+ public boolean hasI() {\r
+ return this._has_i;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ result = 37 * result + _i;\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'i'.\r
+ * \r
+ * @param i\r
+ * the value of field 'i'.\r
+ */\r
+ public void setI(final int i) {\r
+ this._i = i;\r
+ this._has_i = true;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Pos\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Pos unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Pos) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Pos.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Property extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
+public class Property extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * internal content storage\r
+ */\r
+ private java.lang.String _content = "";\r
\r
- /**\r
- * internal content storage\r
- */\r
- private java.lang.String _content = "";\r
+ /**\r
+ * Field _name.\r
+ */\r
+ private java.lang.String _name;\r
\r
- /**\r
- * Field _name.\r
- */\r
- private java.lang.String _name;\r
+ /**\r
+ * The type specifies how the property will be parsed. Empty property strings\r
+ * are allowed, and can be used to prototype the input to a document. TODO:\r
+ * specify allowed types\r
+ */\r
+ private java.lang.String _type;\r
\r
- /**\r
- * The type specifies how the property will be parsed.\r
- * Empty property strings are allowed, and can be used to\r
- * prototype the\r
- * input to a document. TODO: specify allowed types \r
- */\r
- private java.lang.String _type;\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public Property() {\r
+ super();\r
+ setContent("");\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public Property() {\r
- super();\r
- setContent("");\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (obj instanceof Property) {\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ Property temp = (Property) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._content != null) {\r
+ if (temp._content == null)\r
+ return false;\r
+ if (this._content != temp._content) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._content.equals(temp._content)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
+ }\r
+ } else if (temp._content != null)\r
+ return false;\r
+ if (this._name != null) {\r
+ if (temp._name == null)\r
+ return false;\r
+ if (this._name != temp._name) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._name);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._name.equals(temp._name)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
+ }\r
+ } else if (temp._name != null)\r
+ return false;\r
+ if (this._type != null) {\r
+ if (temp._type == null)\r
+ return false;\r
+ if (this._type != temp._type) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._type);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Property) {\r
- \r
- Property temp = (Property)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._content != null) {\r
- if (temp._content == null) return false;\r
- if (this._content != temp._content) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._content.equals(temp._content)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- }\r
- }\r
- } else if (temp._content != null)\r
- return false;\r
- if (this._name != null) {\r
- if (temp._name == null) return false;\r
- if (this._name != temp._name) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._name.equals(temp._name)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- }\r
- }\r
- } else if (temp._name != null)\r
- return false;\r
- if (this._type != null) {\r
- if (temp._type == null) return false;\r
- if (this._type != temp._type) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._type);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._type); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._type.equals(temp._type)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- }\r
- }\r
- } else if (temp._type != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._type.equals(temp._type)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
}\r
+ } else if (temp._type != null)\r
return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'content'. The field 'content'\r
- * has the following description: internal content storage\r
- * \r
- * @return the value of field 'Content'.\r
- */\r
- public java.lang.String getContent(\r
- ) {\r
- return this._content;\r
- }\r
+ /**\r
+ * Returns the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @return the value of field 'Content'.\r
+ */\r
+ public java.lang.String getContent() {\r
+ return this._content;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'name'.\r
- * \r
- * @return the value of field 'Name'.\r
- */\r
- public java.lang.String getName(\r
- ) {\r
- return this._name;\r
- }\r
+ /**\r
+ * Returns the value of field 'name'.\r
+ * \r
+ * @return the value of field 'Name'.\r
+ */\r
+ public java.lang.String getName() {\r
+ return this._name;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'type'. The field 'type' has the\r
- * following description: The type specifies how the property\r
- * will be parsed.\r
- * Empty property strings are allowed, and can be used to\r
- * prototype the\r
- * input to a document. TODO: specify allowed types \r
- * \r
- * @return the value of field 'Type'.\r
- */\r
- public java.lang.String getType(\r
- ) {\r
- return this._type;\r
- }\r
+ /**\r
+ * Returns the value of field 'type'. The field 'type' has the following\r
+ * description: The type specifies how the property will be parsed. Empty\r
+ * property strings are allowed, and can be used to prototype the input to a\r
+ * document. TODO: specify allowed types\r
+ * \r
+ * @return the value of field 'Type'.\r
+ */\r
+ public java.lang.String getType() {\r
+ return this._type;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_content != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
- result = 37 * result + _content.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
- }\r
- if (_name != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
- result = 37 * result + _name.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
- }\r
- if (_type != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
- result = 37 * result + _type.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ if (_content != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
+ result = 37 * result + _content.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
+ if (_name != null && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
+ result = 37 * result + _name.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
+ if (_type != null && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
+ result = 37 * result + _type.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
}\r
\r
- /**\r
- * Sets the value of field 'content'. The field 'content' has\r
- * the following description: internal content storage\r
- * \r
- * @param content the value of field 'content'.\r
- */\r
- public void setContent(\r
- final java.lang.String content) {\r
- this._content = content;\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'name'.\r
- * \r
- * @param name the value of field 'name'.\r
- */\r
- public void setName(\r
- final java.lang.String name) {\r
- this._name = name;\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'type'. The field 'type' has the\r
- * following description: The type specifies how the property\r
- * will be parsed.\r
- * Empty property strings are allowed, and can be used to\r
- * prototype the\r
- * input to a document. TODO: specify allowed types \r
- * \r
- * @param type the value of field 'type'.\r
- */\r
- public void setType(\r
- final java.lang.String type) {\r
- this._type = type;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Property\r
- */\r
- public static uk.ac.vamsas.objects.core.Property unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Property) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Property.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @param content\r
+ * the value of field 'content'.\r
+ */\r
+ public void setContent(final java.lang.String content) {\r
+ this._content = content;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'name'.\r
+ * \r
+ * @param name\r
+ * the value of field 'name'.\r
+ */\r
+ public void setName(final java.lang.String name) {\r
+ this._name = name;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'type'. The field 'type' has the following\r
+ * description: The type specifies how the property will be parsed. Empty\r
+ * property strings are allowed, and can be used to prototype the input to a\r
+ * document. TODO: specify allowed types\r
+ * \r
+ * @param type\r
+ * the value of field 'type'.\r
+ */\r
+ public void setType(final java.lang.String type) {\r
+ this._type = type;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Property\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Property unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Property) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Property.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class Provenance.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class Provenance extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _entryList.
- */
- private java.util.Vector _entryList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Provenance() {
- super();
- this._entryList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vEntry
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addEntry(
- final uk.ac.vamsas.objects.core.Entry vEntry)
- throws java.lang.IndexOutOfBoundsException {
- this._entryList.addElement(vEntry);
- }
-
- /**
- *
- *
- * @param index
- * @param vEntry
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addEntry(
- final int index,
- final uk.ac.vamsas.objects.core.Entry vEntry)
- throws java.lang.IndexOutOfBoundsException {
- this._entryList.add(index, vEntry);
- }
-
- /**
- * Method enumerateEntry.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Entry elements
- */
- public java.util.Enumeration enumerateEntry(
- ) {
- return this._entryList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class Provenance extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _entryList.
+ */
+ private java.util.Vector _entryList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Provenance() {
+ super();
+ this._entryList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vEntry
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addEntry(final uk.ac.vamsas.objects.core.Entry vEntry)
+ throws java.lang.IndexOutOfBoundsException {
+ this._entryList.addElement(vEntry);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vEntry
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addEntry(final int index,
+ final uk.ac.vamsas.objects.core.Entry vEntry)
+ throws java.lang.IndexOutOfBoundsException {
+ this._entryList.add(index, vEntry);
+ }
+
+ /**
+ * Method enumerateEntry.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Entry elements
+ */
+ public java.util.Enumeration enumerateEntry() {
+ return this._entryList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof Provenance) {
+
+ Provenance temp = (Provenance) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._entryList != null) {
+ if (temp._entryList == null)
+ return false;
+ if (this._entryList != temp._entryList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._entryList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._entryList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._entryList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._entryList);
+ }
+ ;
return false;
-
- if (obj instanceof Provenance) {
-
- Provenance temp = (Provenance)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._entryList != null) {
- if (temp._entryList == null) return false;
- if (this._entryList != temp._entryList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._entryList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._entryList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._entryList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._entryList); };
- return false;
- }
- if (!thcycle) {
- if (!this._entryList.equals(temp._entryList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._entryList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._entryList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._entryList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._entryList);
- }
- }
- } else if (temp._entryList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._entryList.equals(temp._entryList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._entryList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._entryList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._entryList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._entryList);
+ }
}
+ } else if (temp._entryList != null)
return false;
+ return true;
}
-
- /**
- * Method getEntry.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Entry at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Entry getEntry(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._entryList.size()) {
- throw new IndexOutOfBoundsException("getEntry: Index value '" + index + "' not in range [0.." + (this._entryList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Entry) _entryList.get(index);
- }
-
- /**
- * Method getEntry.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Entry[] getEntry(
- ) {
- uk.ac.vamsas.objects.core.Entry[] array = new uk.ac.vamsas.objects.core.Entry[0];
- return (uk.ac.vamsas.objects.core.Entry[]) this._entryList.toArray(array);
- }
-
- /**
- * Method getEntryAsReference.Returns a reference to
- * '_entryList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getEntryAsReference(
- ) {
- return this._entryList;
- }
-
- /**
- * Method getEntryCount.
- *
- * @return the size of this collection
- */
- public int getEntryCount(
- ) {
- return this._entryList.size();
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_entryList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_entryList)) {
- result = 37 * result + _entryList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_entryList);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllEntry(
- ) {
- this._entryList.clear();
- }
-
- /**
- * Method removeEntry.
- *
- * @param vEntry
- * @return true if the object was removed from the collection.
- */
- public boolean removeEntry(
- final uk.ac.vamsas.objects.core.Entry vEntry) {
- boolean removed = _entryList.remove(vEntry);
- return removed;
+ return false;
+ }
+
+ /**
+ * Method getEntry.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Entry at the given index
+ */
+ public uk.ac.vamsas.objects.core.Entry getEntry(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._entryList.size()) {
+ throw new IndexOutOfBoundsException("getEntry: Index value '" + index
+ + "' not in range [0.." + (this._entryList.size() - 1) + "]");
}
- /**
- * Method removeEntryAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Entry removeEntryAt(
- final int index) {
- java.lang.Object obj = this._entryList.remove(index);
- return (uk.ac.vamsas.objects.core.Entry) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vEntry
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setEntry(
- final int index,
- final uk.ac.vamsas.objects.core.Entry vEntry)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._entryList.size()) {
- throw new IndexOutOfBoundsException("setEntry: Index value '" + index + "' not in range [0.." + (this._entryList.size() - 1) + "]");
- }
-
- this._entryList.set(index, vEntry);
+ return (uk.ac.vamsas.objects.core.Entry) _entryList.get(index);
+ }
+
+ /**
+ * Method getEntry.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Entry[] getEntry() {
+ uk.ac.vamsas.objects.core.Entry[] array = new uk.ac.vamsas.objects.core.Entry[0];
+ return (uk.ac.vamsas.objects.core.Entry[]) this._entryList.toArray(array);
+ }
+
+ /**
+ * Method getEntryAsReference.Returns a reference to '_entryList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getEntryAsReference() {
+ return this._entryList;
+ }
+
+ /**
+ * Method getEntryCount.
+ *
+ * @return the size of this collection
+ */
+ public int getEntryCount() {
+ return this._entryList.size();
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_entryList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_entryList)) {
+ result = 37 * result + _entryList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_entryList);
}
- /**
- *
- *
- * @param vEntryArray
- */
- public void setEntry(
- final uk.ac.vamsas.objects.core.Entry[] vEntryArray) {
- //-- copy array
- _entryList.clear();
-
- for (int i = 0; i < vEntryArray.length; i++) {
- this._entryList.add(vEntryArray[i]);
- }
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
-
- /**
- * Sets the value of '_entryList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vEntryList the Vector to copy.
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setEntry(
- final java.util.Vector vEntryList) {
- // copy vector
- this._entryList.clear();
-
- this._entryList.addAll(vEntryList);
+ public void removeAllEntry() {
+ this._entryList.clear();
+ }
+
+ /**
+ * Method removeEntry.
+ *
+ * @param vEntry
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeEntry(final uk.ac.vamsas.objects.core.Entry vEntry) {
+ boolean removed = _entryList.remove(vEntry);
+ return removed;
+ }
+
+ /**
+ * Method removeEntryAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Entry removeEntryAt(final int index) {
+ java.lang.Object obj = this._entryList.remove(index);
+ return (uk.ac.vamsas.objects.core.Entry) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vEntry
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setEntry(final int index,
+ final uk.ac.vamsas.objects.core.Entry vEntry)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._entryList.size()) {
+ throw new IndexOutOfBoundsException("setEntry: Index value '" + index
+ + "' not in range [0.." + (this._entryList.size() - 1) + "]");
}
- /**
- * Sets the value of '_entryList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param entryVector the Vector to set.
- */
- public void setEntryAsReference(
- final java.util.Vector entryVector) {
- this._entryList = entryVector;
- }
+ this._entryList.set(index, vEntry);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.Provenance
- */
- public static uk.ac.vamsas.objects.core.Provenance unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.Provenance) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Provenance.class, reader);
- }
+ /**
+ *
+ *
+ * @param vEntryArray
+ */
+ public void setEntry(final uk.ac.vamsas.objects.core.Entry[] vEntryArray) {
+ // -- copy array
+ _entryList.clear();
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ for (int i = 0; i < vEntryArray.length; i++) {
+ this._entryList.add(vEntryArray[i]);
}
+ }
+
+ /**
+ * Sets the value of '_entryList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vEntryList
+ * the Vector to copy.
+ */
+ public void setEntry(final java.util.Vector vEntryList) {
+ // copy vector
+ this._entryList.clear();
+
+ this._entryList.addAll(vEntryList);
+ }
+
+ /**
+ * Sets the value of '_entryList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param entryVector
+ * the Vector to set.
+ */
+ public void setEntryAsReference(final java.util.Vector entryVector) {
+ this._entryList = entryVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Provenance
+ */
+ public static uk.ac.vamsas.objects.core.Provenance unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.Provenance) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.Provenance.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Range extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _seqAStart.\r
- */\r
- private int _seqAStart;\r
-\r
- /**\r
- * keeps track of state for field: _seqAStart\r
- */\r
- private boolean _has_seqAStart;\r
-\r
- /**\r
- * Field _seqAEnd.\r
- */\r
- private int _seqAEnd;\r
-\r
- /**\r
- * keeps track of state for field: _seqAEnd\r
- */\r
- private boolean _has_seqAEnd;\r
-\r
- /**\r
- * Field _seqBStart.\r
- */\r
- private int _seqBStart;\r
-\r
- /**\r
- * keeps track of state for field: _seqBStart\r
- */\r
- private boolean _has_seqBStart;\r
-\r
- /**\r
- * Field _seqBEnd.\r
- */\r
- private int _seqBEnd;\r
-\r
- /**\r
- * keeps track of state for field: _seqBEnd\r
- */\r
- private boolean _has_seqBEnd;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Range() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
+public class Range extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _seqAStart.\r
+ */\r
+ private int _seqAStart;\r
+\r
+ /**\r
+ * keeps track of state for field: _seqAStart\r
+ */\r
+ private boolean _has_seqAStart;\r
+\r
+ /**\r
+ * Field _seqAEnd.\r
+ */\r
+ private int _seqAEnd;\r
+\r
+ /**\r
+ * keeps track of state for field: _seqAEnd\r
+ */\r
+ private boolean _has_seqAEnd;\r
+\r
+ /**\r
+ * Field _seqBStart.\r
+ */\r
+ private int _seqBStart;\r
+\r
+ /**\r
+ * keeps track of state for field: _seqBStart\r
+ */\r
+ private boolean _has_seqBStart;\r
+\r
+ /**\r
+ * Field _seqBEnd.\r
+ */\r
+ private int _seqBEnd;\r
+\r
+ /**\r
+ * keeps track of state for field: _seqBEnd\r
+ */\r
+ private boolean _has_seqBEnd;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Range() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
*/\r
- public void deleteSeqAEnd(\r
- ) {\r
- this._has_seqAEnd= false;\r
- }\r
-\r
- /**\r
- */\r
- public void deleteSeqAStart(\r
- ) {\r
- this._has_seqAStart= false;\r
- }\r
+ public void deleteSeqAEnd() {\r
+ this._has_seqAEnd = false;\r
+ }\r
\r
- /**\r
+ /**\r
*/\r
- public void deleteSeqBEnd(\r
- ) {\r
- this._has_seqBEnd= false;\r
- }\r
+ public void deleteSeqAStart() {\r
+ this._has_seqAStart = false;\r
+ }\r
\r
- /**\r
+ /**\r
*/\r
- public void deleteSeqBStart(\r
- ) {\r
- this._has_seqBStart= false;\r
- }\r
+ public void deleteSeqBEnd() {\r
+ this._has_seqBEnd = false;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
+ /**\r
*/\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Range) {\r
- \r
- Range temp = (Range)obj;\r
- if (this._seqAStart != temp._seqAStart)\r
- return false;\r
- if (this._has_seqAStart != temp._has_seqAStart)\r
- return false;\r
- if (this._seqAEnd != temp._seqAEnd)\r
- return false;\r
- if (this._has_seqAEnd != temp._has_seqAEnd)\r
- return false;\r
- if (this._seqBStart != temp._seqBStart)\r
- return false;\r
- if (this._has_seqBStart != temp._has_seqBStart)\r
- return false;\r
- if (this._seqBEnd != temp._seqBEnd)\r
- return false;\r
- if (this._has_seqBEnd != temp._has_seqBEnd)\r
- return false;\r
- return true;\r
- }\r
+ public void deleteSeqBStart() {\r
+ this._has_seqBStart = false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Range) {\r
+\r
+ Range temp = (Range) obj;\r
+ if (this._seqAStart != temp._seqAStart)\r
return false;\r
+ if (this._has_seqAStart != temp._has_seqAStart)\r
+ return false;\r
+ if (this._seqAEnd != temp._seqAEnd)\r
+ return false;\r
+ if (this._has_seqAEnd != temp._has_seqAEnd)\r
+ return false;\r
+ if (this._seqBStart != temp._seqBStart)\r
+ return false;\r
+ if (this._has_seqBStart != temp._has_seqBStart)\r
+ return false;\r
+ if (this._seqBEnd != temp._seqBEnd)\r
+ return false;\r
+ if (this._has_seqBEnd != temp._has_seqBEnd)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'seqAEnd'.\r
- * \r
- * @return the value of field 'SeqAEnd'.\r
- */\r
- public int getSeqAEnd(\r
- ) {\r
- return this._seqAEnd;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'seqAStart'.\r
- * \r
- * @return the value of field 'SeqAStart'.\r
- */\r
- public int getSeqAStart(\r
- ) {\r
- return this._seqAStart;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'seqBEnd'.\r
- * \r
- * @return the value of field 'SeqBEnd'.\r
- */\r
- public int getSeqBEnd(\r
- ) {\r
- return this._seqBEnd;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'seqBStart'.\r
- * \r
- * @return the value of field 'SeqBStart'.\r
- */\r
- public int getSeqBStart(\r
- ) {\r
- return this._seqBStart;\r
- }\r
-\r
- /**\r
- * Method hasSeqAEnd.\r
- * \r
- * @return true if at least one SeqAEnd has been added\r
- */\r
- public boolean hasSeqAEnd(\r
- ) {\r
- return this._has_seqAEnd;\r
- }\r
-\r
- /**\r
- * Method hasSeqAStart.\r
- * \r
- * @return true if at least one SeqAStart has been added\r
- */\r
- public boolean hasSeqAStart(\r
- ) {\r
- return this._has_seqAStart;\r
- }\r
-\r
- /**\r
- * Method hasSeqBEnd.\r
- * \r
- * @return true if at least one SeqBEnd has been added\r
- */\r
- public boolean hasSeqBEnd(\r
- ) {\r
- return this._has_seqBEnd;\r
- }\r
-\r
- /**\r
- * Method hasSeqBStart.\r
- * \r
- * @return true if at least one SeqBStart has been added\r
- */\r
- public boolean hasSeqBStart(\r
- ) {\r
- return this._has_seqBStart;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + _seqAStart;\r
- result = 37 * result + _seqAEnd;\r
- result = 37 * result + _seqBStart;\r
- result = 37 * result + _seqBEnd;\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'seqAEnd'.\r
- * \r
- * @param seqAEnd the value of field 'seqAEnd'.\r
- */\r
- public void setSeqAEnd(\r
- final int seqAEnd) {\r
- this._seqAEnd = seqAEnd;\r
- this._has_seqAEnd = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'seqAStart'.\r
- * \r
- * @param seqAStart the value of field 'seqAStart'.\r
- */\r
- public void setSeqAStart(\r
- final int seqAStart) {\r
- this._seqAStart = seqAStart;\r
- this._has_seqAStart = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'seqBEnd'.\r
- * \r
- * @param seqBEnd the value of field 'seqBEnd'.\r
- */\r
- public void setSeqBEnd(\r
- final int seqBEnd) {\r
- this._seqBEnd = seqBEnd;\r
- this._has_seqBEnd = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'seqBStart'.\r
- * \r
- * @param seqBStart the value of field 'seqBStart'.\r
- */\r
- public void setSeqBStart(\r
- final int seqBStart) {\r
- this._seqBStart = seqBStart;\r
- this._has_seqBStart = true;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Range\r
- */\r
- public static uk.ac.vamsas.objects.core.Range unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Range) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Range.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'seqAEnd'.\r
+ * \r
+ * @return the value of field 'SeqAEnd'.\r
+ */\r
+ public int getSeqAEnd() {\r
+ return this._seqAEnd;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'seqAStart'.\r
+ * \r
+ * @return the value of field 'SeqAStart'.\r
+ */\r
+ public int getSeqAStart() {\r
+ return this._seqAStart;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'seqBEnd'.\r
+ * \r
+ * @return the value of field 'SeqBEnd'.\r
+ */\r
+ public int getSeqBEnd() {\r
+ return this._seqBEnd;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'seqBStart'.\r
+ * \r
+ * @return the value of field 'SeqBStart'.\r
+ */\r
+ public int getSeqBStart() {\r
+ return this._seqBStart;\r
+ }\r
+\r
+ /**\r
+ * Method hasSeqAEnd.\r
+ * \r
+ * @return true if at least one SeqAEnd has been added\r
+ */\r
+ public boolean hasSeqAEnd() {\r
+ return this._has_seqAEnd;\r
+ }\r
+\r
+ /**\r
+ * Method hasSeqAStart.\r
+ * \r
+ * @return true if at least one SeqAStart has been added\r
+ */\r
+ public boolean hasSeqAStart() {\r
+ return this._has_seqAStart;\r
+ }\r
+\r
+ /**\r
+ * Method hasSeqBEnd.\r
+ * \r
+ * @return true if at least one SeqBEnd has been added\r
+ */\r
+ public boolean hasSeqBEnd() {\r
+ return this._has_seqBEnd;\r
+ }\r
+\r
+ /**\r
+ * Method hasSeqBStart.\r
+ * \r
+ * @return true if at least one SeqBStart has been added\r
+ */\r
+ public boolean hasSeqBStart() {\r
+ return this._has_seqBStart;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ result = 37 * result + _seqAStart;\r
+ result = 37 * result + _seqAEnd;\r
+ result = 37 * result + _seqBStart;\r
+ result = 37 * result + _seqBEnd;\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'seqAEnd'.\r
+ * \r
+ * @param seqAEnd\r
+ * the value of field 'seqAEnd'.\r
+ */\r
+ public void setSeqAEnd(final int seqAEnd) {\r
+ this._seqAEnd = seqAEnd;\r
+ this._has_seqAEnd = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'seqAStart'.\r
+ * \r
+ * @param seqAStart\r
+ * the value of field 'seqAStart'.\r
+ */\r
+ public void setSeqAStart(final int seqAStart) {\r
+ this._seqAStart = seqAStart;\r
+ this._has_seqAStart = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'seqBEnd'.\r
+ * \r
+ * @param seqBEnd\r
+ * the value of field 'seqBEnd'.\r
+ */\r
+ public void setSeqBEnd(final int seqBEnd) {\r
+ this._seqBEnd = seqBEnd;\r
+ this._has_seqBEnd = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'seqBStart'.\r
+ * \r
+ * @param seqBStart\r
+ * the value of field 'seqBStart'.\r
+ */\r
+ public void setSeqBStart(final int seqBStart) {\r
+ this._seqBStart = seqBStart;\r
+ this._has_seqBStart = true;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Range\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Range unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Range) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Range.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * Annotation for a rangeSpec - values can be attached for the\r
- * whole\r
- * specification, and to each position within the spec. following\r
- * the orientation\r
- * specified by the ordered set of rangeSpec (pos, seg) elements. \r
+ * Annotation for a rangeSpec - values can be attached for the whole\r
+ * specification, and to each position within the spec. following the\r
+ * orientation specified by the ordered set of rangeSpec (pos, seg) elements.\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class RangeAnnotation extends uk.ac.vamsas.objects.core.RangeType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Primary Key for vamsas object referencing\r
- * \r
- */\r
- private java.lang.String _id;\r
-\r
- /**\r
- * Field _modifiable.\r
- */\r
- private java.lang.String _modifiable;\r
-\r
- /**\r
- * Annotation with the same non-empty group name are grouped\r
- * together \r
- */\r
- private java.lang.String _group = "";\r
-\r
- /**\r
- * A Das Feature has both a type and a Type ID. We go the\r
- * route of requiring the type string to be taken from a\r
- * controlled\r
- * vocabulary if an application expects others to make sense\r
- * of it. The\r
- * type may qualified - so uniprot:CHAIN is a valid type name,\r
- * and\r
- * considered distinct from someotherDB:CHAIN \r
- */\r
- private java.lang.String _type;\r
-\r
- /**\r
- * Short, meaningful name for the annotation - if this\r
- * is absent, then the type string should be used in its\r
- * place.\r
- * \r
- */\r
- private java.lang.String _label;\r
-\r
- /**\r
- * Human readable description of the annotation\r
- * \r
- */\r
- private java.lang.String _description;\r
-\r
- /**\r
- * TODO: specify this - we have considered taking the GO\r
- * evidence codes as a model for assessing a measure of\r
- * quality to an\r
- * annotation. \r
- */\r
- private java.lang.String _status;\r
-\r
- /**\r
- * Annotation Element position maps to ordered positions\r
- * defined by the sequence of rangeType pos positions or\r
- * concatenated\r
- * seg start/end segments. \r
- */\r
- private java.util.Vector _annotationElementList;\r
-\r
- /**\r
- * Ordered set of optionally named float values for the\r
- * whole annotation \r
- */\r
- private java.util.Vector _scoreList;\r
-\r
- /**\r
- * Field _linkList.\r
- */\r
- private java.util.Vector _linkList;\r
-\r
- /**\r
- * Note:These are mutable so an application should check\r
- * them each time. \r
- */\r
- private java.util.Vector _propertyList;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public RangeAnnotation() {\r
- super();\r
- setGroup("");\r
- this._annotationElementList = new java.util.Vector();\r
- this._scoreList = new java.util.Vector();\r
- this._linkList = new java.util.Vector();\r
- this._propertyList = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * \r
- * \r
- * @param vAnnotationElement\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addAnnotationElement(\r
- final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._annotationElementList.addElement(vAnnotationElement);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vAnnotationElement\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addAnnotationElement(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._annotationElementList.add(index, vAnnotationElement);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vLink\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addLink(\r
- final uk.ac.vamsas.objects.core.Link vLink)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._linkList.addElement(vLink);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vLink\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addLink(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Link vLink)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._linkList.add(index, vLink);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vProperty\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addProperty(\r
- final uk.ac.vamsas.objects.core.Property vProperty)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._propertyList.addElement(vProperty);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vProperty\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addProperty(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Property vProperty)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._propertyList.add(index, vProperty);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vScore\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addScore(\r
- final uk.ac.vamsas.objects.core.Score vScore)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._scoreList.addElement(vScore);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vScore\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addScore(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Score vScore)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._scoreList.add(index, vScore);\r
- }\r
-\r
- /**\r
- * Method enumerateAnnotationElement.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.AnnotationElement elements\r
- */\r
- public java.util.Enumeration enumerateAnnotationElement(\r
- ) {\r
- return this._annotationElementList.elements();\r
- }\r
-\r
- /**\r
- * Method enumerateLink.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Link elements\r
- */\r
- public java.util.Enumeration enumerateLink(\r
- ) {\r
- return this._linkList.elements();\r
- }\r
-\r
- /**\r
- * Method enumerateProperty.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Property elements\r
- */\r
- public java.util.Enumeration enumerateProperty(\r
- ) {\r
- return this._propertyList.elements();\r
- }\r
-\r
- /**\r
- * Method enumerateScore.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Score elements\r
- */\r
- public java.util.Enumeration enumerateScore(\r
- ) {\r
- return this._scoreList.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class RangeAnnotation extends uk.ac.vamsas.objects.core.RangeType\r
+ implements java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Primary Key for vamsas object referencing\r
+ * \r
+ */\r
+ private java.lang.String _id;\r
+\r
+ /**\r
+ * Field _modifiable.\r
+ */\r
+ private java.lang.String _modifiable;\r
+\r
+ /**\r
+ * Annotation with the same non-empty group name are grouped together\r
+ */\r
+ private java.lang.String _group = "";\r
+\r
+ /**\r
+ * A Das Feature has both a type and a Type ID. We go the route of requiring\r
+ * the type string to be taken from a controlled vocabulary if an application\r
+ * expects others to make sense of it. The type may qualified - so\r
+ * uniprot:CHAIN is a valid type name, and considered distinct from\r
+ * someotherDB:CHAIN\r
+ */\r
+ private java.lang.String _type;\r
+\r
+ /**\r
+ * Short, meaningful name for the annotation - if this is absent, then the\r
+ * type string should be used in its place.\r
+ * \r
+ */\r
+ private java.lang.String _label;\r
+\r
+ /**\r
+ * Human readable description of the annotation\r
+ * \r
+ */\r
+ private java.lang.String _description;\r
+\r
+ /**\r
+ * TODO: specify this - we have considered taking the GO evidence codes as a\r
+ * model for assessing a measure of quality to an annotation.\r
+ */\r
+ private java.lang.String _status;\r
+\r
+ /**\r
+ * Annotation Element position maps to ordered positions defined by the\r
+ * sequence of rangeType pos positions or concatenated seg start/end segments.\r
+ */\r
+ private java.util.Vector _annotationElementList;\r
+\r
+ /**\r
+ * Ordered set of optionally named float values for the whole annotation\r
+ */\r
+ private java.util.Vector _scoreList;\r
+\r
+ /**\r
+ * Field _linkList.\r
+ */\r
+ private java.util.Vector _linkList;\r
+\r
+ /**\r
+ * Note:These are mutable so an application should check them each time.\r
+ */\r
+ private java.util.Vector _propertyList;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public RangeAnnotation() {\r
+ super();\r
+ setGroup("");\r
+ this._annotationElementList = new java.util.Vector();\r
+ this._scoreList = new java.util.Vector();\r
+ this._linkList = new java.util.Vector();\r
+ this._propertyList = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vAnnotationElement\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addAnnotationElement(\r
+ final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._annotationElementList.addElement(vAnnotationElement);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vAnnotationElement\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addAnnotationElement(final int index,\r
+ final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._annotationElementList.add(index, vAnnotationElement);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vLink\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addLink(final uk.ac.vamsas.objects.core.Link vLink)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._linkList.addElement(vLink);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vLink\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addLink(final int index,\r
+ final uk.ac.vamsas.objects.core.Link vLink)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._linkList.add(index, vLink);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vProperty\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._propertyList.addElement(vProperty);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vProperty\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addProperty(final int index,\r
+ final uk.ac.vamsas.objects.core.Property vProperty)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._propertyList.add(index, vProperty);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vScore\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addScore(final uk.ac.vamsas.objects.core.Score vScore)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._scoreList.addElement(vScore);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vScore\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addScore(final int index,\r
+ final uk.ac.vamsas.objects.core.Score vScore)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._scoreList.add(index, vScore);\r
+ }\r
+\r
+ /**\r
+ * Method enumerateAnnotationElement.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.AnnotationElement\r
+ * elements\r
+ */\r
+ public java.util.Enumeration enumerateAnnotationElement() {\r
+ return this._annotationElementList.elements();\r
+ }\r
+\r
+ /**\r
+ * Method enumerateLink.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Link elements\r
+ */\r
+ public java.util.Enumeration enumerateLink() {\r
+ return this._linkList.elements();\r
+ }\r
+\r
+ /**\r
+ * Method enumerateProperty.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements\r
+ */\r
+ public java.util.Enumeration enumerateProperty() {\r
+ return this._propertyList.elements();\r
+ }\r
+\r
+ /**\r
+ * Method enumerateScore.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Score elements\r
+ */\r
+ public java.util.Enumeration enumerateScore() {\r
+ return this._scoreList.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof RangeAnnotation) {\r
+\r
+ RangeAnnotation temp = (RangeAnnotation) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._id != null) {\r
+ if (temp._id == null)\r
+ return false;\r
+ if (this._id != temp._id) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof RangeAnnotation) {\r
- \r
- RangeAnnotation temp = (RangeAnnotation)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._id != null) {\r
- if (temp._id == null) return false;\r
- if (this._id != temp._id) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._id.equals(temp._id)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- }\r
- }\r
- } else if (temp._id != null)\r
- return false;\r
- if (this._modifiable != null) {\r
- if (temp._modifiable == null) return false;\r
- if (this._modifiable != temp._modifiable) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._modifiable.equals(temp._modifiable)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
- }\r
- }\r
- } else if (temp._modifiable != null)\r
- return false;\r
- if (this._group != null) {\r
- if (temp._group == null) return false;\r
- if (this._group != temp._group) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._group);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._group);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._group); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._group); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._group.equals(temp._group)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._group);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._group);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);\r
- }\r
- }\r
- } else if (temp._group != null)\r
- return false;\r
- if (this._type != null) {\r
- if (temp._type == null) return false;\r
- if (this._type != temp._type) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._type);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._type); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._type); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._type.equals(temp._type)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
- }\r
- }\r
- } else if (temp._type != null)\r
- return false;\r
- if (this._label != null) {\r
- if (temp._label == null) return false;\r
- if (this._label != temp._label) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._label);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._label);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._label); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._label); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._label.equals(temp._label)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._label);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._label);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);\r
- }\r
- }\r
- } else if (temp._label != null)\r
- return false;\r
- if (this._description != null) {\r
- if (temp._description == null) return false;\r
- if (this._description != temp._description) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._description);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._description);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._description); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._description); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._description.equals(temp._description)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);\r
- }\r
- }\r
- } else if (temp._description != null)\r
- return false;\r
- if (this._status != null) {\r
- if (temp._status == null) return false;\r
- if (this._status != temp._status) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._status);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._status);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._status); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._status); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._status.equals(temp._status)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._status);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._status);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);\r
- }\r
- }\r
- } else if (temp._status != null)\r
- return false;\r
- if (this._annotationElementList != null) {\r
- if (temp._annotationElementList == null) return false;\r
- if (this._annotationElementList != temp._annotationElementList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._annotationElementList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._annotationElementList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._annotationElementList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._annotationElementList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._annotationElementList.equals(temp._annotationElementList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._annotationElementList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._annotationElementList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._annotationElementList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._annotationElementList);\r
- }\r
- }\r
- } else if (temp._annotationElementList != null)\r
- return false;\r
- if (this._scoreList != null) {\r
- if (temp._scoreList == null) return false;\r
- if (this._scoreList != temp._scoreList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._scoreList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._scoreList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._scoreList.equals(temp._scoreList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);\r
- }\r
- }\r
- } else if (temp._scoreList != null)\r
- return false;\r
- if (this._linkList != null) {\r
- if (temp._linkList == null) return false;\r
- if (this._linkList != temp._linkList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._linkList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._linkList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._linkList.equals(temp._linkList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);\r
- }\r
- }\r
- } else if (temp._linkList != null)\r
- return false;\r
- if (this._propertyList != null) {\r
- if (temp._propertyList == null) return false;\r
- if (this._propertyList != temp._propertyList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._propertyList.equals(temp._propertyList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);\r
- }\r
- }\r
- } else if (temp._propertyList != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._id.equals(temp._id)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
}\r
+ } else if (temp._id != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Method getAnnotationElement.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the\r
- * uk.ac.vamsas.objects.core.AnnotationElement at the given inde\r
- */\r
- public uk.ac.vamsas.objects.core.AnnotationElement getAnnotationElement(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._annotationElementList.size()) {\r
- throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.AnnotationElement) _annotationElementList.get(index);\r
- }\r
-\r
- /**\r
- * Method getAnnotationElement.Returns the contents of the\r
- * collection in an Array. <p>Note: Just in case the\r
- * collection contents are changing in another thread, we pass\r
- * a 0-length Array of the correct type into the API call. \r
- * This way we <i>know</i> that the Array returned is of\r
- * exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.AnnotationElement[] getAnnotationElement(\r
- ) {\r
- uk.ac.vamsas.objects.core.AnnotationElement[] array = new uk.ac.vamsas.objects.core.AnnotationElement[0];\r
- return (uk.ac.vamsas.objects.core.AnnotationElement[]) this._annotationElementList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getAnnotationElementAsReference.Returns a reference\r
- * to '_annotationElementList'. No type checking is performed\r
- * on any modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getAnnotationElementAsReference(\r
- ) {\r
- return this._annotationElementList;\r
- }\r
-\r
- /**\r
- * Method getAnnotationElementCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getAnnotationElementCount(\r
- ) {\r
- return this._annotationElementList.size();\r
- }\r
-\r
- /**\r
- * Returns the value of field 'description'. The field\r
- * 'description' has the following description: Human readable\r
- * description of the annotation\r
- * \r
- * \r
- * @return the value of field 'Description'.\r
- */\r
- public java.lang.String getDescription(\r
- ) {\r
- return this._description;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'group'. The field 'group' has\r
- * the following description: Annotation with the same\r
- * non-empty group name are grouped\r
- * together \r
- * \r
- * @return the value of field 'Group'.\r
- */\r
- public java.lang.String getGroup(\r
- ) {\r
- return this._group;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing\r
- * \r
- * \r
- * @return the value of field 'Id'.\r
- */\r
- public java.lang.String getId(\r
- ) {\r
- return this._id;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'label'. The field 'label' has\r
- * the following description: Short, meaningful name for the\r
- * annotation - if this\r
- * is absent, then the type string should be used in its\r
- * place.\r
- * \r
- * \r
- * @return the value of field 'Label'.\r
- */\r
- public java.lang.String getLabel(\r
- ) {\r
- return this._label;\r
- }\r
-\r
- /**\r
- * Method getLink.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the uk.ac.vamsas.objects.core.Link at\r
- * the given index\r
- */\r
- public uk.ac.vamsas.objects.core.Link getLink(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._linkList.size()) {\r
- throw new IndexOutOfBoundsException("getLink: Index value '" + index + "' not in range [0.." + (this._linkList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.Link) _linkList.get(index);\r
- }\r
-\r
- /**\r
- * Method getLink.Returns the contents of the collection in an\r
- * Array. <p>Note: Just in case the collection contents are\r
- * changing in another thread, we pass a 0-length Array of the\r
- * correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.Link[] getLink(\r
- ) {\r
- uk.ac.vamsas.objects.core.Link[] array = new uk.ac.vamsas.objects.core.Link[0];\r
- return (uk.ac.vamsas.objects.core.Link[]) this._linkList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getLinkAsReference.Returns a reference to\r
- * '_linkList'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getLinkAsReference(\r
- ) {\r
- return this._linkList;\r
- }\r
-\r
- /**\r
- * Method getLinkCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getLinkCount(\r
- ) {\r
- return this._linkList.size();\r
- }\r
-\r
- /**\r
- * Returns the value of field 'modifiable'.\r
- * \r
- * @return the value of field 'Modifiable'.\r
- */\r
- public java.lang.String getModifiable(\r
- ) {\r
- return this._modifiable;\r
- }\r
-\r
- /**\r
- * Method getProperty.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the uk.ac.vamsas.objects.core.Property\r
- * at the given index\r
- */\r
- public uk.ac.vamsas.objects.core.Property getProperty(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._propertyList.size()) {\r
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);\r
- }\r
-\r
- /**\r
- * Method getProperty.Returns the contents of the collection in\r
- * an Array. <p>Note: Just in case the collection contents\r
- * are changing in another thread, we pass a 0-length Array of\r
- * the correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.Property[] getProperty(\r
- ) {\r
- uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];\r
- return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getPropertyAsReference.Returns a reference to\r
- * '_propertyList'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getPropertyAsReference(\r
- ) {\r
- return this._propertyList;\r
- }\r
-\r
- /**\r
- * Method getPropertyCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getPropertyCount(\r
- ) {\r
- return this._propertyList.size();\r
- }\r
-\r
- /**\r
- * Method getScore.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the uk.ac.vamsas.objects.core.Score at\r
- * the given index\r
- */\r
- public uk.ac.vamsas.objects.core.Score getScore(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._scoreList.size()) {\r
- throw new IndexOutOfBoundsException("getScore: Index value '" + index + "' not in range [0.." + (this._scoreList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.Score) _scoreList.get(index);\r
- }\r
-\r
- /**\r
- * Method getScore.Returns the contents of the collection in an\r
- * Array. <p>Note: Just in case the collection contents are\r
- * changing in another thread, we pass a 0-length Array of the\r
- * correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.Score[] getScore(\r
- ) {\r
- uk.ac.vamsas.objects.core.Score[] array = new uk.ac.vamsas.objects.core.Score[0];\r
- return (uk.ac.vamsas.objects.core.Score[]) this._scoreList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getScoreAsReference.Returns a reference to\r
- * '_scoreList'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getScoreAsReference(\r
- ) {\r
- return this._scoreList;\r
- }\r
-\r
- /**\r
- * Method getScoreCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getScoreCount(\r
- ) {\r
- return this._scoreList.size();\r
- }\r
-\r
- /**\r
- * Returns the value of field 'status'. The field 'status' has\r
- * the following description: TODO: specify this - we have\r
- * considered taking the GO\r
- * evidence codes as a model for assessing a measure of\r
- * quality to an\r
- * annotation. \r
- * \r
- * @return the value of field 'Status'.\r
- */\r
- public java.lang.String getStatus(\r
- ) {\r
- return this._status;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'type'. The field 'type' has the\r
- * following description: A Das Feature has both a type and a\r
- * Type ID. We go the\r
- * route of requiring the type string to be taken from a\r
- * controlled\r
- * vocabulary if an application expects others to make sense\r
- * of it. The\r
- * type may qualified - so uniprot:CHAIN is a valid type name,\r
- * and\r
- * considered distinct from someotherDB:CHAIN \r
- * \r
- * @return the value of field 'Type'.\r
- */\r
- public java.lang.String getType(\r
- ) {\r
- return this._type;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_id != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
- result = 37 * result + _id.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
- }\r
- if (_modifiable != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {\r
- result = 37 * result + _modifiable.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);\r
- }\r
- if (_group != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_group)) {\r
- result = 37 * result + _group.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_group);\r
- }\r
- if (_type != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
- result = 37 * result + _type.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
- }\r
- if (_label != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_label)) {\r
- result = 37 * result + _label.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_label);\r
- }\r
- if (_description != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_description)) {\r
- result = 37 * result + _description.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_description);\r
- }\r
- if (_status != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_status)) {\r
- result = 37 * result + _status.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_status);\r
- }\r
- if (_annotationElementList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_annotationElementList)) {\r
- result = 37 * result + _annotationElementList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_annotationElementList);\r
- }\r
- if (_scoreList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_scoreList)) {\r
- result = 37 * result + _scoreList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_scoreList);\r
- }\r
- if (_linkList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_linkList)) {\r
- result = 37 * result + _linkList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_linkList);\r
- }\r
- if (_propertyList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {\r
- result = 37 * result + _propertyList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);\r
+ if (this._modifiable != null) {\r
+ if (temp._modifiable == null)\r
+ return false;\r
+ if (this._modifiable != temp._modifiable) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._modifiable);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._modifiable);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._modifiable.equals(temp._modifiable)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);\r
+ }\r
}\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ } else if (temp._modifiable != null)\r
+ return false;\r
+ if (this._group != null) {\r
+ if (temp._group == null)\r
+ return false;\r
+ if (this._group != temp._group) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._group);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._group);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._group);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._group.equals(temp._group)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._group);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._group);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._group);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllAnnotationElement(\r
- ) {\r
- this._annotationElementList.clear();\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllLink(\r
- ) {\r
- this._linkList.clear();\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllProperty(\r
- ) {\r
- this._propertyList.clear();\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllScore(\r
- ) {\r
- this._scoreList.clear();\r
- }\r
-\r
- /**\r
- * Method removeAnnotationElement.\r
- * \r
- * @param vAnnotationElement\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeAnnotationElement(\r
- final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement) {\r
- boolean removed = _annotationElementList.remove(vAnnotationElement);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removeAnnotationElementAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.AnnotationElement removeAnnotationElementAt(\r
- final int index) {\r
- java.lang.Object obj = this._annotationElementList.remove(index);\r
- return (uk.ac.vamsas.objects.core.AnnotationElement) obj;\r
- }\r
-\r
- /**\r
- * Method removeLink.\r
- * \r
- * @param vLink\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeLink(\r
- final uk.ac.vamsas.objects.core.Link vLink) {\r
- boolean removed = _linkList.remove(vLink);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removeLinkAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.Link removeLinkAt(\r
- final int index) {\r
- java.lang.Object obj = this._linkList.remove(index);\r
- return (uk.ac.vamsas.objects.core.Link) obj;\r
- }\r
-\r
- /**\r
- * Method removeProperty.\r
- * \r
- * @param vProperty\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeProperty(\r
- final uk.ac.vamsas.objects.core.Property vProperty) {\r
- boolean removed = _propertyList.remove(vProperty);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removePropertyAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.Property removePropertyAt(\r
- final int index) {\r
- java.lang.Object obj = this._propertyList.remove(index);\r
- return (uk.ac.vamsas.objects.core.Property) obj;\r
- }\r
-\r
- /**\r
- * Method removeScore.\r
- * \r
- * @param vScore\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeScore(\r
- final uk.ac.vamsas.objects.core.Score vScore) {\r
- boolean removed = _scoreList.remove(vScore);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removeScoreAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.Score removeScoreAt(\r
- final int index) {\r
- java.lang.Object obj = this._scoreList.remove(index);\r
- return (uk.ac.vamsas.objects.core.Score) obj;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vAnnotationElement\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setAnnotationElement(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._annotationElementList.size()) {\r
- throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");\r
+ } else if (temp._group != null)\r
+ return false;\r
+ if (this._type != null) {\r
+ if (temp._type == null)\r
+ return false;\r
+ if (this._type != temp._type) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._type);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._type);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._type.equals(temp._type)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._type);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._type);\r
+ }\r
}\r
- \r
- this._annotationElementList.set(index, vAnnotationElement);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vAnnotationElementArray\r
- */\r
- public void setAnnotationElement(\r
- final uk.ac.vamsas.objects.core.AnnotationElement[] vAnnotationElementArray) {\r
- //-- copy array\r
- _annotationElementList.clear();\r
- \r
- for (int i = 0; i < vAnnotationElementArray.length; i++) {\r
- this._annotationElementList.add(vAnnotationElementArray[i]);\r
+ } else if (temp._type != null)\r
+ return false;\r
+ if (this._label != null) {\r
+ if (temp._label == null)\r
+ return false;\r
+ if (this._label != temp._label) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._label);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._label);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._label);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._label.equals(temp._label)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._label);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._label);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._label);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * Sets the value of '_annotationElementList' by copying the\r
- * given Vector. All elements will be checked for type safety.\r
- * \r
- * @param vAnnotationElementList the Vector to copy.\r
- */\r
- public void setAnnotationElement(\r
- final java.util.Vector vAnnotationElementList) {\r
- // copy vector\r
- this._annotationElementList.clear();\r
- \r
- this._annotationElementList.addAll(vAnnotationElementList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_annotationElementList' by setting it to\r
- * the given Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param annotationElementVector the Vector to set.\r
- */\r
- public void setAnnotationElementAsReference(\r
- final java.util.Vector annotationElementVector) {\r
- this._annotationElementList = annotationElementVector;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'description'. The field\r
- * 'description' has the following description: Human readable\r
- * description of the annotation\r
- * \r
- * \r
- * @param description the value of field 'description'.\r
- */\r
- public void setDescription(\r
- final java.lang.String description) {\r
- this._description = description;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'group'. The field 'group' has the\r
- * following description: Annotation with the same non-empty\r
- * group name are grouped\r
- * together \r
- * \r
- * @param group the value of field 'group'.\r
- */\r
- public void setGroup(\r
- final java.lang.String group) {\r
- this._group = group;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing\r
- * \r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(\r
- final java.lang.String id) {\r
- this._id = id;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'label'. The field 'label' has the\r
- * following description: Short, meaningful name for the\r
- * annotation - if this\r
- * is absent, then the type string should be used in its\r
- * place.\r
- * \r
- * \r
- * @param label the value of field 'label'.\r
- */\r
- public void setLabel(\r
- final java.lang.String label) {\r
- this._label = label;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vLink\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setLink(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Link vLink)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._linkList.size()) {\r
- throw new IndexOutOfBoundsException("setLink: Index value '" + index + "' not in range [0.." + (this._linkList.size() - 1) + "]");\r
+ } else if (temp._label != null)\r
+ return false;\r
+ if (this._description != null) {\r
+ if (temp._description == null)\r
+ return false;\r
+ if (this._description != temp._description) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._description);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._description);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._description);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._description);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._description.equals(temp._description)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._description);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._description);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._description);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);\r
+ }\r
}\r
- \r
- this._linkList.set(index, vLink);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vLinkArray\r
- */\r
- public void setLink(\r
- final uk.ac.vamsas.objects.core.Link[] vLinkArray) {\r
- //-- copy array\r
- _linkList.clear();\r
- \r
- for (int i = 0; i < vLinkArray.length; i++) {\r
- this._linkList.add(vLinkArray[i]);\r
+ } else if (temp._description != null)\r
+ return false;\r
+ if (this._status != null) {\r
+ if (temp._status == null)\r
+ return false;\r
+ if (this._status != temp._status) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._status);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._status);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._status);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._status.equals(temp._status)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._status);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._status);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._status);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * Sets the value of '_linkList' by copying the given Vector.\r
- * All elements will be checked for type safety.\r
- * \r
- * @param vLinkList the Vector to copy.\r
- */\r
- public void setLink(\r
- final java.util.Vector vLinkList) {\r
- // copy vector\r
- this._linkList.clear();\r
- \r
- this._linkList.addAll(vLinkList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_linkList' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param linkVector the Vector to set.\r
- */\r
- public void setLinkAsReference(\r
- final java.util.Vector linkVector) {\r
- this._linkList = linkVector;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'modifiable'.\r
- * \r
- * @param modifiable the value of field 'modifiable'.\r
- */\r
- public void setModifiable(\r
- final java.lang.String modifiable) {\r
- this._modifiable = modifiable;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vProperty\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setProperty(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Property vProperty)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._propertyList.size()) {\r
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
+ } else if (temp._status != null)\r
+ return false;\r
+ if (this._annotationElementList != null) {\r
+ if (temp._annotationElementList == null)\r
+ return false;\r
+ if (this._annotationElementList != temp._annotationElementList) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._annotationElementList);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._annotationElementList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._annotationElementList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._annotationElementList);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._annotationElementList\r
+ .equals(temp._annotationElementList)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._annotationElementList);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._annotationElementList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._annotationElementList);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._annotationElementList);\r
+ }\r
}\r
- \r
- this._propertyList.set(index, vProperty);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vPropertyArray\r
- */\r
- public void setProperty(\r
- final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {\r
- //-- copy array\r
- _propertyList.clear();\r
- \r
- for (int i = 0; i < vPropertyArray.length; i++) {\r
- this._propertyList.add(vPropertyArray[i]);\r
+ } else if (temp._annotationElementList != null)\r
+ return false;\r
+ if (this._scoreList != null) {\r
+ if (temp._scoreList == null)\r
+ return false;\r
+ if (this._scoreList != temp._scoreList) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._scoreList);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._scoreList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._scoreList.equals(temp._scoreList)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._scoreList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._scoreList);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * Sets the value of '_propertyList' by copying the given\r
- * Vector. All elements will be checked for type safety.\r
- * \r
- * @param vPropertyList the Vector to copy.\r
- */\r
- public void setProperty(\r
- final java.util.Vector vPropertyList) {\r
- // copy vector\r
- this._propertyList.clear();\r
- \r
- this._propertyList.addAll(vPropertyList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_propertyList' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param propertyVector the Vector to set.\r
- */\r
- public void setPropertyAsReference(\r
- final java.util.Vector propertyVector) {\r
- this._propertyList = propertyVector;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vScore\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setScore(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Score vScore)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._scoreList.size()) {\r
- throw new IndexOutOfBoundsException("setScore: Index value '" + index + "' not in range [0.." + (this._scoreList.size() - 1) + "]");\r
+ } else if (temp._scoreList != null)\r
+ return false;\r
+ if (this._linkList != null) {\r
+ if (temp._linkList == null)\r
+ return false;\r
+ if (this._linkList != temp._linkList) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._linkList);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._linkList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._linkList.equals(temp._linkList)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._linkList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._linkList);\r
+ }\r
}\r
- \r
- this._scoreList.set(index, vScore);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vScoreArray\r
- */\r
- public void setScore(\r
- final uk.ac.vamsas.objects.core.Score[] vScoreArray) {\r
- //-- copy array\r
- _scoreList.clear();\r
- \r
- for (int i = 0; i < vScoreArray.length; i++) {\r
- this._scoreList.add(vScoreArray[i]);\r
+ } else if (temp._linkList != null)\r
+ return false;\r
+ if (this._propertyList != null) {\r
+ if (temp._propertyList == null)\r
+ return false;\r
+ if (this._propertyList != temp._propertyList) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._propertyList);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._propertyList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._propertyList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._propertyList);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._propertyList.equals(temp._propertyList)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._propertyList);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._propertyList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * Sets the value of '_scoreList' by copying the given Vector.\r
- * All elements will be checked for type safety.\r
- * \r
- * @param vScoreList the Vector to copy.\r
- */\r
- public void setScore(\r
- final java.util.Vector vScoreList) {\r
- // copy vector\r
- this._scoreList.clear();\r
- \r
- this._scoreList.addAll(vScoreList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_scoreList' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param scoreVector the Vector to set.\r
- */\r
- public void setScoreAsReference(\r
- final java.util.Vector scoreVector) {\r
- this._scoreList = scoreVector;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'status'. The field 'status' has the\r
- * following description: TODO: specify this - we have\r
- * considered taking the GO\r
- * evidence codes as a model for assessing a measure of\r
- * quality to an\r
- * annotation. \r
- * \r
- * @param status the value of field 'status'.\r
- */\r
- public void setStatus(\r
- final java.lang.String status) {\r
- this._status = status;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'type'. The field 'type' has the\r
- * following description: A Das Feature has both a type and a\r
- * Type ID. We go the\r
- * route of requiring the type string to be taken from a\r
- * controlled\r
- * vocabulary if an application expects others to make sense\r
- * of it. The\r
- * type may qualified - so uniprot:CHAIN is a valid type name,\r
- * and\r
- * considered distinct from someotherDB:CHAIN \r
- * \r
- * @param type the value of field 'type'.\r
- */\r
- public void setType(\r
- final java.lang.String type) {\r
- this._type = type;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
- */\r
- public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.RangeAnnotation.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ } else if (temp._propertyList != null)\r
+ return false;\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Method getAnnotationElement.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.AnnotationElement at the\r
+ * given inde\r
+ */\r
+ public uk.ac.vamsas.objects.core.AnnotationElement getAnnotationElement(\r
+ final int index) throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._annotationElementList.size()) {\r
+ throw new IndexOutOfBoundsException("getAnnotationElement: Index value '"\r
+ + index + "' not in range [0.."\r
+ + (this._annotationElementList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.AnnotationElement) _annotationElementList\r
+ .get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getAnnotationElement.Returns the contents of the collection in an\r
+ * Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.AnnotationElement[] getAnnotationElement() {\r
+ uk.ac.vamsas.objects.core.AnnotationElement[] array = new uk.ac.vamsas.objects.core.AnnotationElement[0];\r
+ return (uk.ac.vamsas.objects.core.AnnotationElement[]) this._annotationElementList\r
+ .toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getAnnotationElementAsReference.Returns a reference to\r
+ * '_annotationElementList'. No type checking is performed on any\r
+ * modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getAnnotationElementAsReference() {\r
+ return this._annotationElementList;\r
+ }\r
+\r
+ /**\r
+ * Method getAnnotationElementCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getAnnotationElementCount() {\r
+ return this._annotationElementList.size();\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'description'. The field 'description' has the\r
+ * following description: Human readable description of the annotation\r
+ * \r
+ * \r
+ * @return the value of field 'Description'.\r
+ */\r
+ public java.lang.String getDescription() {\r
+ return this._description;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'group'. The field 'group' has the following\r
+ * description: Annotation with the same non-empty group name are grouped\r
+ * together\r
+ * \r
+ * @return the value of field 'Group'.\r
+ */\r
+ public java.lang.String getGroup() {\r
+ return this._group;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'id'. The field 'id' has the following\r
+ * description: Primary Key for vamsas object referencing\r
+ * \r
+ * \r
+ * @return the value of field 'Id'.\r
+ */\r
+ public java.lang.String getId() {\r
+ return this._id;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'label'. The field 'label' has the following\r
+ * description: Short, meaningful name for the annotation - if this is absent,\r
+ * then the type string should be used in its place.\r
+ * \r
+ * \r
+ * @return the value of field 'Label'.\r
+ */\r
+ public java.lang.String getLabel() {\r
+ return this._label;\r
+ }\r
+\r
+ /**\r
+ * Method getLink.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Link at the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Link getLink(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._linkList.size()) {\r
+ throw new IndexOutOfBoundsException("getLink: Index value '" + index\r
+ + "' not in range [0.." + (this._linkList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Link) _linkList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getLink.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Link[] getLink() {\r
+ uk.ac.vamsas.objects.core.Link[] array = new uk.ac.vamsas.objects.core.Link[0];\r
+ return (uk.ac.vamsas.objects.core.Link[]) this._linkList.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getLinkAsReference.Returns a reference to '_linkList'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getLinkAsReference() {\r
+ return this._linkList;\r
+ }\r
+\r
+ /**\r
+ * Method getLinkCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getLinkCount() {\r
+ return this._linkList.size();\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'modifiable'.\r
+ * \r
+ * @return the value of field 'Modifiable'.\r
+ */\r
+ public java.lang.String getModifiable() {\r
+ return this._modifiable;\r
+ }\r
+\r
+ /**\r
+ * Method getProperty.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Property at the given\r
+ * index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Property getProperty(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._propertyList.size()) {\r
+ throw new IndexOutOfBoundsException("getProperty: Index value '" + index\r
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getProperty.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Property[] getProperty() {\r
+ uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];\r
+ return (uk.ac.vamsas.objects.core.Property[]) this._propertyList\r
+ .toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getPropertyAsReference.Returns a reference to '_propertyList'. No\r
+ * type checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getPropertyAsReference() {\r
+ return this._propertyList;\r
+ }\r
+\r
+ /**\r
+ * Method getPropertyCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getPropertyCount() {\r
+ return this._propertyList.size();\r
+ }\r
+\r
+ /**\r
+ * Method getScore.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Score at the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Score getScore(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._scoreList.size()) {\r
+ throw new IndexOutOfBoundsException("getScore: Index value '" + index\r
+ + "' not in range [0.." + (this._scoreList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Score) _scoreList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getScore.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Score[] getScore() {\r
+ uk.ac.vamsas.objects.core.Score[] array = new uk.ac.vamsas.objects.core.Score[0];\r
+ return (uk.ac.vamsas.objects.core.Score[]) this._scoreList.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getScoreAsReference.Returns a reference to '_scoreList'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getScoreAsReference() {\r
+ return this._scoreList;\r
+ }\r
+\r
+ /**\r
+ * Method getScoreCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getScoreCount() {\r
+ return this._scoreList.size();\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'status'. The field 'status' has the following\r
+ * description: TODO: specify this - we have considered taking the GO evidence\r
+ * codes as a model for assessing a measure of quality to an annotation.\r
+ * \r
+ * @return the value of field 'Status'.\r
+ */\r
+ public java.lang.String getStatus() {\r
+ return this._status;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'type'. The field 'type' has the following\r
+ * description: A Das Feature has both a type and a Type ID. We go the route\r
+ * of requiring the type string to be taken from a controlled vocabulary if an\r
+ * application expects others to make sense of it. The type may qualified - so\r
+ * uniprot:CHAIN is a valid type name, and considered distinct from\r
+ * someotherDB:CHAIN\r
+ * \r
+ * @return the value of field 'Type'.\r
+ */\r
+ public java.lang.String getType() {\r
+ return this._type;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
+ result = 37 * result + _id.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
+ }\r
+ if (_modifiable != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {\r
+ result = 37 * result + _modifiable.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);\r
+ }\r
+ if (_group != null && !org.castor.util.CycleBreaker.startingToCycle(_group)) {\r
+ result = 37 * result + _group.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_group);\r
+ }\r
+ if (_type != null && !org.castor.util.CycleBreaker.startingToCycle(_type)) {\r
+ result = 37 * result + _type.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_type);\r
+ }\r
+ if (_label != null && !org.castor.util.CycleBreaker.startingToCycle(_label)) {\r
+ result = 37 * result + _label.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_label);\r
+ }\r
+ if (_description != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_description)) {\r
+ result = 37 * result + _description.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_description);\r
+ }\r
+ if (_status != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_status)) {\r
+ result = 37 * result + _status.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_status);\r
+ }\r
+ if (_annotationElementList != null\r
+ && !org.castor.util.CycleBreaker\r
+ .startingToCycle(_annotationElementList)) {\r
+ result = 37 * result + _annotationElementList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_annotationElementList);\r
+ }\r
+ if (_scoreList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_scoreList)) {\r
+ result = 37 * result + _scoreList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_scoreList);\r
+ }\r
+ if (_linkList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_linkList)) {\r
+ result = 37 * result + _linkList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_linkList);\r
+ }\r
+ if (_propertyList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {\r
+ result = 37 * result + _propertyList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllAnnotationElement() {\r
+ this._annotationElementList.clear();\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllLink() {\r
+ this._linkList.clear();\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllProperty() {\r
+ this._propertyList.clear();\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllScore() {\r
+ this._scoreList.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removeAnnotationElement.\r
+ * \r
+ * @param vAnnotationElement\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeAnnotationElement(\r
+ final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement) {\r
+ boolean removed = _annotationElementList.remove(vAnnotationElement);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeAnnotationElementAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.AnnotationElement removeAnnotationElementAt(\r
+ final int index) {\r
+ java.lang.Object obj = this._annotationElementList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.AnnotationElement) obj;\r
+ }\r
+\r
+ /**\r
+ * Method removeLink.\r
+ * \r
+ * @param vLink\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeLink(final uk.ac.vamsas.objects.core.Link vLink) {\r
+ boolean removed = _linkList.remove(vLink);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeLinkAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Link removeLinkAt(final int index) {\r
+ java.lang.Object obj = this._linkList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Link) obj;\r
+ }\r
+\r
+ /**\r
+ * Method removeProperty.\r
+ * \r
+ * @param vProperty\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeProperty(\r
+ final uk.ac.vamsas.objects.core.Property vProperty) {\r
+ boolean removed = _propertyList.remove(vProperty);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removePropertyAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {\r
+ java.lang.Object obj = this._propertyList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Property) obj;\r
+ }\r
+\r
+ /**\r
+ * Method removeScore.\r
+ * \r
+ * @param vScore\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeScore(final uk.ac.vamsas.objects.core.Score vScore) {\r
+ boolean removed = _scoreList.remove(vScore);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeScoreAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Score removeScoreAt(final int index) {\r
+ java.lang.Object obj = this._scoreList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Score) obj;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vAnnotationElement\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setAnnotationElement(final int index,\r
+ final uk.ac.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._annotationElementList.size()) {\r
+ throw new IndexOutOfBoundsException("setAnnotationElement: Index value '"\r
+ + index + "' not in range [0.."\r
+ + (this._annotationElementList.size() - 1) + "]");\r
+ }\r
+\r
+ this._annotationElementList.set(index, vAnnotationElement);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vAnnotationElementArray\r
+ */\r
+ public void setAnnotationElement(\r
+ final uk.ac.vamsas.objects.core.AnnotationElement[] vAnnotationElementArray) {\r
+ // -- copy array\r
+ _annotationElementList.clear();\r
+\r
+ for (int i = 0; i < vAnnotationElementArray.length; i++) {\r
+ this._annotationElementList.add(vAnnotationElementArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_annotationElementList' by copying the given Vector. All\r
+ * elements will be checked for type safety.\r
+ * \r
+ * @param vAnnotationElementList\r
+ * the Vector to copy.\r
+ */\r
+ public void setAnnotationElement(final java.util.Vector vAnnotationElementList) {\r
+ // copy vector\r
+ this._annotationElementList.clear();\r
+\r
+ this._annotationElementList.addAll(vAnnotationElementList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_annotationElementList' by setting it to the given\r
+ * Vector. No type checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param annotationElementVector\r
+ * the Vector to set.\r
+ */\r
+ public void setAnnotationElementAsReference(\r
+ final java.util.Vector annotationElementVector) {\r
+ this._annotationElementList = annotationElementVector;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'description'. The field 'description' has the\r
+ * following description: Human readable description of the annotation\r
+ * \r
+ * \r
+ * @param description\r
+ * the value of field 'description'.\r
+ */\r
+ public void setDescription(final java.lang.String description) {\r
+ this._description = description;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'group'. The field 'group' has the following\r
+ * description: Annotation with the same non-empty group name are grouped\r
+ * together\r
+ * \r
+ * @param group\r
+ * the value of field 'group'.\r
+ */\r
+ public void setGroup(final java.lang.String group) {\r
+ this._group = group;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'id'. The field 'id' has the following description:\r
+ * Primary Key for vamsas object referencing\r
+ * \r
+ * \r
+ * @param id\r
+ * the value of field 'id'.\r
+ */\r
+ public void setId(final java.lang.String id) {\r
+ this._id = id;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'label'. The field 'label' has the following\r
+ * description: Short, meaningful name for the annotation - if this is absent,\r
+ * then the type string should be used in its place.\r
+ * \r
+ * \r
+ * @param label\r
+ * the value of field 'label'.\r
+ */\r
+ public void setLabel(final java.lang.String label) {\r
+ this._label = label;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vLink\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setLink(final int index,\r
+ final uk.ac.vamsas.objects.core.Link vLink)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._linkList.size()) {\r
+ throw new IndexOutOfBoundsException("setLink: Index value '" + index\r
+ + "' not in range [0.." + (this._linkList.size() - 1) + "]");\r
+ }\r
+\r
+ this._linkList.set(index, vLink);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vLinkArray\r
+ */\r
+ public void setLink(final uk.ac.vamsas.objects.core.Link[] vLinkArray) {\r
+ // -- copy array\r
+ _linkList.clear();\r
+\r
+ for (int i = 0; i < vLinkArray.length; i++) {\r
+ this._linkList.add(vLinkArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_linkList' by copying the given Vector. All elements\r
+ * will be checked for type safety.\r
+ * \r
+ * @param vLinkList\r
+ * the Vector to copy.\r
+ */\r
+ public void setLink(final java.util.Vector vLinkList) {\r
+ // copy vector\r
+ this._linkList.clear();\r
+\r
+ this._linkList.addAll(vLinkList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_linkList' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param linkVector\r
+ * the Vector to set.\r
+ */\r
+ public void setLinkAsReference(final java.util.Vector linkVector) {\r
+ this._linkList = linkVector;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'modifiable'.\r
+ * \r
+ * @param modifiable\r
+ * the value of field 'modifiable'.\r
+ */\r
+ public void setModifiable(final java.lang.String modifiable) {\r
+ this._modifiable = modifiable;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vProperty\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setProperty(final int index,\r
+ final uk.ac.vamsas.objects.core.Property vProperty)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._propertyList.size()) {\r
+ throw new IndexOutOfBoundsException("setProperty: Index value '" + index\r
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");\r
+ }\r
+\r
+ this._propertyList.set(index, vProperty);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vPropertyArray\r
+ */\r
+ public void setProperty(\r
+ final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {\r
+ // -- copy array\r
+ _propertyList.clear();\r
+\r
+ for (int i = 0; i < vPropertyArray.length; i++) {\r
+ this._propertyList.add(vPropertyArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_propertyList' by copying the given Vector. All elements\r
+ * will be checked for type safety.\r
+ * \r
+ * @param vPropertyList\r
+ * the Vector to copy.\r
+ */\r
+ public void setProperty(final java.util.Vector vPropertyList) {\r
+ // copy vector\r
+ this._propertyList.clear();\r
+\r
+ this._propertyList.addAll(vPropertyList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_propertyList' by setting it to the given Vector. No\r
+ * type checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param propertyVector\r
+ * the Vector to set.\r
+ */\r
+ public void setPropertyAsReference(final java.util.Vector propertyVector) {\r
+ this._propertyList = propertyVector;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vScore\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setScore(final int index,\r
+ final uk.ac.vamsas.objects.core.Score vScore)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._scoreList.size()) {\r
+ throw new IndexOutOfBoundsException("setScore: Index value '" + index\r
+ + "' not in range [0.." + (this._scoreList.size() - 1) + "]");\r
+ }\r
+\r
+ this._scoreList.set(index, vScore);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vScoreArray\r
+ */\r
+ public void setScore(final uk.ac.vamsas.objects.core.Score[] vScoreArray) {\r
+ // -- copy array\r
+ _scoreList.clear();\r
+\r
+ for (int i = 0; i < vScoreArray.length; i++) {\r
+ this._scoreList.add(vScoreArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_scoreList' by copying the given Vector. All elements\r
+ * will be checked for type safety.\r
+ * \r
+ * @param vScoreList\r
+ * the Vector to copy.\r
+ */\r
+ public void setScore(final java.util.Vector vScoreList) {\r
+ // copy vector\r
+ this._scoreList.clear();\r
+\r
+ this._scoreList.addAll(vScoreList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_scoreList' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param scoreVector\r
+ * the Vector to set.\r
+ */\r
+ public void setScoreAsReference(final java.util.Vector scoreVector) {\r
+ this._scoreList = scoreVector;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'status'. The field 'status' has the following\r
+ * description: TODO: specify this - we have considered taking the GO evidence\r
+ * codes as a model for assessing a measure of quality to an annotation.\r
+ * \r
+ * @param status\r
+ * the value of field 'status'.\r
+ */\r
+ public void setStatus(final java.lang.String status) {\r
+ this._status = status;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'type'. The field 'type' has the following\r
+ * description: A Das Feature has both a type and a Type ID. We go the route\r
+ * of requiring the type string to be taken from a controlled vocabulary if an\r
+ * application expects others to make sense of it. The type may qualified - so\r
+ * uniprot:CHAIN is a valid type name, and considered distinct from\r
+ * someotherDB:CHAIN\r
+ * \r
+ * @param type\r
+ * the value of field 'type'.\r
+ */\r
+ public void setType(final java.lang.String type) {\r
+ this._type = type;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.RangeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.RangeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.RangeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.RangeAnnotation.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
/**\r
- * Specify an ordered set of positions and/or regions on the\r
- * principle\r
- * dimension of some associated vamsas object Keeping to jaxb-1.0\r
- * specification for the moment - this choice should\r
- * become a substitution group when we use jaxb-2.0 capable\r
- * bindings\r
- * \r
+ * Specify an ordered set of positions and/or regions on the principle dimension\r
+ * of some associated vamsas object Keeping to jaxb-1.0 specification for the\r
+ * moment - this choice should become a substitution group when we use jaxb-2.0\r
+ * capable bindings\r
+ * \r
* \r
* @version $Revision$ $Date$\r
*/\r
-public abstract class RangeType extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Internal choice value storage\r
- */\r
- private java.lang.Object _choiceValue;\r
-\r
- /**\r
- * a position within the associated object's coordinate system\r
- * \r
- */\r
- private java.util.Vector _posList;\r
-\r
- /**\r
- * a region from start to end, with flag for inclusivity of\r
- * terminii \r
- */\r
- private java.util.Vector _segList;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public RangeType() {\r
- super();\r
- this._posList = new java.util.Vector();\r
- this._segList = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * \r
- * \r
- * @param vPos\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addPos(\r
- final uk.ac.vamsas.objects.core.Pos vPos)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._posList.addElement(vPos);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vPos\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addPos(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Pos vPos)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._posList.add(index, vPos);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vSeg\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addSeg(\r
- final uk.ac.vamsas.objects.core.Seg vSeg)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._segList.addElement(vSeg);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vSeg\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addSeg(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Seg vSeg)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._segList.add(index, vSeg);\r
- }\r
-\r
- /**\r
- * Method enumeratePos.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Pos elements\r
- */\r
- public java.util.Enumeration enumeratePos(\r
- ) {\r
- return this._posList.elements();\r
- }\r
-\r
- /**\r
- * Method enumerateSeg.\r
- * \r
- * @return an Enumeration over all\r
- * uk.ac.vamsas.objects.core.Seg elements\r
- */\r
- public java.util.Enumeration enumerateSeg(\r
- ) {\r
- return this._segList.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public abstract class RangeType extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Internal choice value storage\r
+ */\r
+ private java.lang.Object _choiceValue;\r
+\r
+ /**\r
+ * a position within the associated object's coordinate system\r
+ * \r
+ */\r
+ private java.util.Vector _posList;\r
+\r
+ /**\r
+ * a region from start to end, with flag for inclusivity of terminii\r
+ */\r
+ private java.util.Vector _segList;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public RangeType() {\r
+ super();\r
+ this._posList = new java.util.Vector();\r
+ this._segList = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addPos(final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._posList.addElement(vPos);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addPos(final int index, final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._posList.add(index, vPos);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addSeg(final uk.ac.vamsas.objects.core.Seg vSeg)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._segList.addElement(vSeg);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addSeg(final int index, final uk.ac.vamsas.objects.core.Seg vSeg)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._segList.add(index, vSeg);\r
+ }\r
+\r
+ /**\r
+ * Method enumeratePos.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Pos elements\r
+ */\r
+ public java.util.Enumeration enumeratePos() {\r
+ return this._posList.elements();\r
+ }\r
+\r
+ /**\r
+ * Method enumerateSeg.\r
+ * \r
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Seg elements\r
+ */\r
+ public java.util.Enumeration enumerateSeg() {\r
+ return this._segList.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof RangeType) {\r
+\r
+ RangeType temp = (RangeType) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._choiceValue != null) {\r
+ if (temp._choiceValue == null)\r
+ return false;\r
+ if (this._choiceValue != temp._choiceValue) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._choiceValue);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._choiceValue);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._choiceValue);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._choiceValue);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof RangeType) {\r
- \r
- RangeType temp = (RangeType)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._choiceValue != null) {\r
- if (temp._choiceValue == null) return false;\r
- if (this._choiceValue != temp._choiceValue) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._choiceValue);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._choiceValue);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._choiceValue.equals(temp._choiceValue)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
- }\r
- }\r
- } else if (temp._choiceValue != null)\r
- return false;\r
- if (this._posList != null) {\r
- if (temp._posList == null) return false;\r
- if (this._posList != temp._posList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._posList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._posList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._posList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._posList.equals(temp._posList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
- }\r
- }\r
- } else if (temp._posList != null)\r
- return false;\r
- if (this._segList != null) {\r
- if (temp._segList == null) return false;\r
- if (this._segList != temp._segList) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._segList);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._segList);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._segList); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._segList.equals(temp._segList)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
- }\r
- }\r
- } else if (temp._segList != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._choiceValue.equals(temp._choiceValue)) {\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(this._choiceValue);\r
+ org.castor.util.CycleBreaker\r
+ .releaseCycleHandle(temp._choiceValue);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._choiceValue);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._choiceValue);\r
+ }\r
}\r
+ } else if (temp._choiceValue != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'choiceValue'. The field\r
- * 'choiceValue' has the following description: Internal choice\r
- * value storage\r
- * \r
- * @return the value of field 'ChoiceValue'.\r
- */\r
- public java.lang.Object getChoiceValue(\r
- ) {\r
- return this._choiceValue;\r
- }\r
-\r
- /**\r
- * Method getPos.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the uk.ac.vamsas.objects.core.Pos at\r
- * the given index\r
- */\r
- public uk.ac.vamsas.objects.core.Pos getPos(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._posList.size()) {\r
- throw new IndexOutOfBoundsException("getPos: Index value '" + index + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.Pos) _posList.get(index);\r
- }\r
-\r
- /**\r
- * Method getPos.Returns the contents of the collection in an\r
- * Array. <p>Note: Just in case the collection contents are\r
- * changing in another thread, we pass a 0-length Array of the\r
- * correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.Pos[] getPos(\r
- ) {\r
- uk.ac.vamsas.objects.core.Pos[] array = new uk.ac.vamsas.objects.core.Pos[0];\r
- return (uk.ac.vamsas.objects.core.Pos[]) this._posList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getPosAsReference.Returns a reference to '_posList'.\r
- * No type checking is performed on any modifications to the\r
- * Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getPosAsReference(\r
- ) {\r
- return this._posList;\r
- }\r
-\r
- /**\r
- * Method getPosCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getPosCount(\r
- ) {\r
- return this._posList.size();\r
- }\r
-\r
- /**\r
- * Method getSeg.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the uk.ac.vamsas.objects.core.Seg at\r
- * the given index\r
- */\r
- public uk.ac.vamsas.objects.core.Seg getSeg(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._segList.size()) {\r
- throw new IndexOutOfBoundsException("getSeg: Index value '" + index + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
- }\r
- \r
- return (uk.ac.vamsas.objects.core.Seg) _segList.get(index);\r
- }\r
-\r
- /**\r
- * Method getSeg.Returns the contents of the collection in an\r
- * Array. <p>Note: Just in case the collection contents are\r
- * changing in another thread, we pass a 0-length Array of the\r
- * correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public uk.ac.vamsas.objects.core.Seg[] getSeg(\r
- ) {\r
- uk.ac.vamsas.objects.core.Seg[] array = new uk.ac.vamsas.objects.core.Seg[0];\r
- return (uk.ac.vamsas.objects.core.Seg[]) this._segList.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getSegAsReference.Returns a reference to '_segList'.\r
- * No type checking is performed on any modifications to the\r
- * Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getSegAsReference(\r
- ) {\r
- return this._segList;\r
- }\r
-\r
- /**\r
- * Method getSegCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getSegCount(\r
- ) {\r
- return this._segList.size();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_choiceValue != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_choiceValue)) {\r
- result = 37 * result + _choiceValue.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_choiceValue);\r
- }\r
- if (_posList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_posList)) {\r
- result = 37 * result + _posList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_posList);\r
- }\r
- if (_segList != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_segList)) {\r
- result = 37 * result + _segList.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_segList);\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ if (this._posList != null) {\r
+ if (temp._posList == null)\r
+ return false;\r
+ if (this._posList != temp._posList) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._posList);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._posList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._posList.equals(temp._posList)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._posList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._posList);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllPos(\r
- ) {\r
- this._posList.clear();\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllSeg(\r
- ) {\r
- this._segList.clear();\r
- }\r
-\r
- /**\r
- * Method removePos.\r
- * \r
- * @param vPos\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removePos(\r
- final uk.ac.vamsas.objects.core.Pos vPos) {\r
- boolean removed = _posList.remove(vPos);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removePosAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.Pos removePosAt(\r
- final int index) {\r
- java.lang.Object obj = this._posList.remove(index);\r
- return (uk.ac.vamsas.objects.core.Pos) obj;\r
- }\r
-\r
- /**\r
- * Method removeSeg.\r
- * \r
- * @param vSeg\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeSeg(\r
- final uk.ac.vamsas.objects.core.Seg vSeg) {\r
- boolean removed = _segList.remove(vSeg);\r
- return removed;\r
- }\r
-\r
- /**\r
- * Method removeSegAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public uk.ac.vamsas.objects.core.Seg removeSegAt(\r
- final int index) {\r
- java.lang.Object obj = this._segList.remove(index);\r
- return (uk.ac.vamsas.objects.core.Seg) obj;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vPos\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setPos(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Pos vPos)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._posList.size()) {\r
- throw new IndexOutOfBoundsException("setPos: Index value '" + index + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
- }\r
- \r
- this._posList.set(index, vPos);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vPosArray\r
- */\r
- public void setPos(\r
- final uk.ac.vamsas.objects.core.Pos[] vPosArray) {\r
- //-- copy array\r
- _posList.clear();\r
- \r
- for (int i = 0; i < vPosArray.length; i++) {\r
- this._posList.add(vPosArray[i]);\r
- }\r
- }\r
-\r
- /**\r
- * Sets the value of '_posList' by copying the given Vector.\r
- * All elements will be checked for type safety.\r
- * \r
- * @param vPosList the Vector to copy.\r
- */\r
- public void setPos(\r
- final java.util.Vector vPosList) {\r
- // copy vector\r
- this._posList.clear();\r
- \r
- this._posList.addAll(vPosList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_posList' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param posVector the Vector to set.\r
- */\r
- public void setPosAsReference(\r
- final java.util.Vector posVector) {\r
- this._posList = posVector;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vSeg\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setSeg(\r
- final int index,\r
- final uk.ac.vamsas.objects.core.Seg vSeg)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._segList.size()) {\r
- throw new IndexOutOfBoundsException("setSeg: Index value '" + index + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
- }\r
- \r
- this._segList.set(index, vSeg);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param vSegArray\r
- */\r
- public void setSeg(\r
- final uk.ac.vamsas.objects.core.Seg[] vSegArray) {\r
- //-- copy array\r
- _segList.clear();\r
- \r
- for (int i = 0; i < vSegArray.length; i++) {\r
- this._segList.add(vSegArray[i]);\r
+ } else if (temp._posList != null)\r
+ return false;\r
+ if (this._segList != null) {\r
+ if (temp._segList == null)\r
+ return false;\r
+ if (this._segList != temp._segList) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._segList);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._segList);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._segList.equals(temp._segList)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._segList);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._segList);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * Sets the value of '_segList' by copying the given Vector.\r
- * All elements will be checked for type safety.\r
- * \r
- * @param vSegList the Vector to copy.\r
- */\r
- public void setSeg(\r
- final java.util.Vector vSegList) {\r
- // copy vector\r
- this._segList.clear();\r
- \r
- this._segList.addAll(vSegList);\r
- }\r
-\r
- /**\r
- * Sets the value of '_segList' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param segVector the Vector to set.\r
- */\r
- public void setSegAsReference(\r
- final java.util.Vector segVector) {\r
- this._segList = segVector;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ } else if (temp._segList != null)\r
+ return false;\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'choiceValue'. The field 'choiceValue' has the\r
+ * following description: Internal choice value storage\r
+ * \r
+ * @return the value of field 'ChoiceValue'.\r
+ */\r
+ public java.lang.Object getChoiceValue() {\r
+ return this._choiceValue;\r
+ }\r
+\r
+ /**\r
+ * Method getPos.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Pos at the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Pos getPos(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._posList.size()) {\r
+ throw new IndexOutOfBoundsException("getPos: Index value '" + index\r
+ + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Pos) _posList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getPos.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Pos[] getPos() {\r
+ uk.ac.vamsas.objects.core.Pos[] array = new uk.ac.vamsas.objects.core.Pos[0];\r
+ return (uk.ac.vamsas.objects.core.Pos[]) this._posList.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getPosAsReference.Returns a reference to '_posList'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getPosAsReference() {\r
+ return this._posList;\r
+ }\r
+\r
+ /**\r
+ * Method getPosCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getPosCount() {\r
+ return this._posList.size();\r
+ }\r
+\r
+ /**\r
+ * Method getSeg.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the uk.ac.vamsas.objects.core.Seg at the given index\r
+ */\r
+ public uk.ac.vamsas.objects.core.Seg getSeg(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._segList.size()) {\r
+ throw new IndexOutOfBoundsException("getSeg: Index value '" + index\r
+ + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
+ }\r
+\r
+ return (uk.ac.vamsas.objects.core.Seg) _segList.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getSeg.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public uk.ac.vamsas.objects.core.Seg[] getSeg() {\r
+ uk.ac.vamsas.objects.core.Seg[] array = new uk.ac.vamsas.objects.core.Seg[0];\r
+ return (uk.ac.vamsas.objects.core.Seg[]) this._segList.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getSegAsReference.Returns a reference to '_segList'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getSegAsReference() {\r
+ return this._segList;\r
+ }\r
+\r
+ /**\r
+ * Method getSegCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getSegCount() {\r
+ return this._segList.size();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_choiceValue != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_choiceValue)) {\r
+ result = 37 * result + _choiceValue.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_choiceValue);\r
+ }\r
+ if (_posList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_posList)) {\r
+ result = 37 * result + _posList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_posList);\r
+ }\r
+ if (_segList != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_segList)) {\r
+ result = 37 * result + _segList.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_segList);\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllPos() {\r
+ this._posList.clear();\r
+ }\r
+\r
+ /**\r
+ */\r
+ public void removeAllSeg() {\r
+ this._segList.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removePos.\r
+ * \r
+ * @param vPos\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removePos(final uk.ac.vamsas.objects.core.Pos vPos) {\r
+ boolean removed = _posList.remove(vPos);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removePosAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Pos removePosAt(final int index) {\r
+ java.lang.Object obj = this._posList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Pos) obj;\r
+ }\r
+\r
+ /**\r
+ * Method removeSeg.\r
+ * \r
+ * @param vSeg\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeSeg(final uk.ac.vamsas.objects.core.Seg vSeg) {\r
+ boolean removed = _segList.remove(vSeg);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeSegAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public uk.ac.vamsas.objects.core.Seg removeSegAt(final int index) {\r
+ java.lang.Object obj = this._segList.remove(index);\r
+ return (uk.ac.vamsas.objects.core.Seg) obj;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vPos\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setPos(final int index, final uk.ac.vamsas.objects.core.Pos vPos)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._posList.size()) {\r
+ throw new IndexOutOfBoundsException("setPos: Index value '" + index\r
+ + "' not in range [0.." + (this._posList.size() - 1) + "]");\r
+ }\r
+\r
+ this._posList.set(index, vPos);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vPosArray\r
+ */\r
+ public void setPos(final uk.ac.vamsas.objects.core.Pos[] vPosArray) {\r
+ // -- copy array\r
+ _posList.clear();\r
+\r
+ for (int i = 0; i < vPosArray.length; i++) {\r
+ this._posList.add(vPosArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_posList' by copying the given Vector. All elements will\r
+ * be checked for type safety.\r
+ * \r
+ * @param vPosList\r
+ * the Vector to copy.\r
+ */\r
+ public void setPos(final java.util.Vector vPosList) {\r
+ // copy vector\r
+ this._posList.clear();\r
+\r
+ this._posList.addAll(vPosList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_posList' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param posVector\r
+ * the Vector to set.\r
+ */\r
+ public void setPosAsReference(final java.util.Vector posVector) {\r
+ this._posList = posVector;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vSeg\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setSeg(final int index, final uk.ac.vamsas.objects.core.Seg vSeg)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._segList.size()) {\r
+ throw new IndexOutOfBoundsException("setSeg: Index value '" + index\r
+ + "' not in range [0.." + (this._segList.size() - 1) + "]");\r
+ }\r
+\r
+ this._segList.set(index, vSeg);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vSegArray\r
+ */\r
+ public void setSeg(final uk.ac.vamsas.objects.core.Seg[] vSegArray) {\r
+ // -- copy array\r
+ _segList.clear();\r
+\r
+ for (int i = 0; i < vSegArray.length; i++) {\r
+ this._segList.add(vSegArray[i]);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_segList' by copying the given Vector. All elements will\r
+ * be checked for type safety.\r
+ * \r
+ * @param vSegList\r
+ * the Vector to copy.\r
+ */\r
+ public void setSeg(final java.util.Vector vSegList) {\r
+ // copy vector\r
+ this._segList.clear();\r
+\r
+ this._segList.addAll(vSegList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_segList' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param segVector\r
+ * the Vector to set.\r
+ */\r
+ public void setSegAsReference(final java.util.Vector segVector) {\r
+ this._segList = segVector;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * base type for citing arbitrary links between vamsas objects\r
- * Optional human readable description of the relationship\r
- * \r
+ * base type for citing arbitrary links between vamsas objects Optional human\r
+ * readable description of the relationship\r
+ * \r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class ReferenceType extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * internal content storage\r
- */\r
- private java.lang.String _content = "";\r
-\r
- /**\r
- * Primary Key for vamsas object referencing\r
- * \r
- */\r
- private java.lang.String _id;\r
-\r
- /**\r
- * List of one or more vamsas object\r
- * references\r
- */\r
- private java.util.Vector _refs;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public ReferenceType() {\r
- super();\r
- setContent("");\r
- this._refs = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * \r
- * \r
- * @param vRefs\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addRefs(\r
- final java.lang.Object vRefs)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._refs.addElement(vRefs);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vRefs\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addRefs(\r
- final int index,\r
- final java.lang.Object vRefs)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._refs.add(index, vRefs);\r
- }\r
-\r
- /**\r
- * Method enumerateRefs.\r
- * \r
- * @return an Enumeration over all java.lang.Object elements\r
- */\r
- public java.util.Enumeration enumerateRefs(\r
- ) {\r
- return this._refs.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class ReferenceType extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * internal content storage\r
+ */\r
+ private java.lang.String _content = "";\r
+\r
+ /**\r
+ * Primary Key for vamsas object referencing\r
+ * \r
+ */\r
+ private java.lang.String _id;\r
+\r
+ /**\r
+ * List of one or more vamsas object references\r
+ */\r
+ private java.util.Vector _refs;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public ReferenceType() {\r
+ super();\r
+ setContent("");\r
+ this._refs = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vRefs\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addRefs(final java.lang.Object vRefs)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._refs.addElement(vRefs);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vRefs\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addRefs(final int index, final java.lang.Object vRefs)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._refs.add(index, vRefs);\r
+ }\r
+\r
+ /**\r
+ * Method enumerateRefs.\r
+ * \r
+ * @return an Enumeration over all java.lang.Object elements\r
+ */\r
+ public java.util.Enumeration enumerateRefs() {\r
+ return this._refs.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof ReferenceType) {\r
+\r
+ ReferenceType temp = (ReferenceType) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._content != null) {\r
+ if (temp._content == null)\r
+ return false;\r
+ if (this._content != temp._content) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._content);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof ReferenceType) {\r
- \r
- ReferenceType temp = (ReferenceType)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._content != null) {\r
- if (temp._content == null) return false;\r
- if (this._content != temp._content) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._content);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._content);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._content); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._content); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._content.equals(temp._content)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
- }\r
- }\r
- } else if (temp._content != null)\r
- return false;\r
- if (this._id != null) {\r
- if (temp._id == null) return false;\r
- if (this._id != temp._id) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._id.equals(temp._id)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- }\r
- }\r
- } else if (temp._id != null)\r
- return false;\r
- if (this._refs != null) {\r
- if (temp._refs == null) return false;\r
- if (this._refs != temp._refs) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._refs);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._refs);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._refs); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._refs.equals(temp._refs)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._refs);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._refs);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs);\r
- }\r
- }\r
- } else if (temp._refs != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._content.equals(temp._content)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._content);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._content);\r
+ }\r
}\r
+ } else if (temp._content != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'content'. The field 'content'\r
- * has the following description: internal content storage\r
- * \r
- * @return the value of field 'Content'.\r
- */\r
- public java.lang.String getContent(\r
- ) {\r
- return this._content;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing\r
- * \r
- * \r
- * @return the value of field 'Id'.\r
- */\r
- public java.lang.String getId(\r
- ) {\r
- return this._id;\r
- }\r
-\r
- /**\r
- * Method getRefs.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the java.lang.Object at the given index\r
- */\r
- public java.lang.Object getRefs(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._refs.size()) {\r
- throw new IndexOutOfBoundsException("getRefs: Index value '" + index + "' not in range [0.." + (this._refs.size() - 1) + "]");\r
- }\r
- \r
- return _refs.get(index);\r
- }\r
-\r
- /**\r
- * Method getRefs.Returns the contents of the collection in an\r
- * Array. <p>Note: Just in case the collection contents are\r
- * changing in another thread, we pass a 0-length Array of the\r
- * correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public java.lang.Object[] getRefs(\r
- ) {\r
- java.lang.Object[] array = new java.lang.Object[0];\r
- return (java.lang.Object[]) this._refs.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getRefsAsReference.Returns a reference to '_refs'. No\r
- * type checking is performed on any modifications to the\r
- * Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getRefsAsReference(\r
- ) {\r
- return this._refs;\r
- }\r
-\r
- /**\r
- * Method getRefsCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getRefsCount(\r
- ) {\r
- return this._refs.size();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_content != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
- result = 37 * result + _content.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
- }\r
- if (_id != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
- result = 37 * result + _id.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
- }\r
- if (_refs != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_refs)) {\r
- result = 37 * result + _refs.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_refs);\r
+ if (this._id != null) {\r
+ if (temp._id == null)\r
+ return false;\r
+ if (this._id != temp._id) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._id.equals(temp._id)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
}\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ } else if (temp._id != null)\r
+ return false;\r
+ if (this._refs != null) {\r
+ if (temp._refs == null)\r
+ return false;\r
+ if (this._refs != temp._refs) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._refs);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._refs);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._refs);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._refs.equals(temp._refs)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._refs);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._refs);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._refs);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllRefs(\r
- ) {\r
- this._refs.clear();\r
+ } else if (temp._refs != null)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Method removeRefs.\r
- * \r
- * @param vRefs\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeRefs(\r
- final java.lang.Object vRefs) {\r
- boolean removed = _refs.remove(vRefs);\r
- return removed;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @return the value of field 'Content'.\r
+ */\r
+ public java.lang.String getContent() {\r
+ return this._content;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'id'. The field 'id' has the following\r
+ * description: Primary Key for vamsas object referencing\r
+ * \r
+ * \r
+ * @return the value of field 'Id'.\r
+ */\r
+ public java.lang.String getId() {\r
+ return this._id;\r
+ }\r
+\r
+ /**\r
+ * Method getRefs.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the java.lang.Object at the given index\r
+ */\r
+ public java.lang.Object getRefs(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._refs.size()) {\r
+ throw new IndexOutOfBoundsException("getRefs: Index value '" + index\r
+ + "' not in range [0.." + (this._refs.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Method removeRefsAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public java.lang.Object removeRefsAt(\r
- final int index) {\r
- java.lang.Object obj = this._refs.remove(index);\r
- return obj;\r
+ return _refs.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getRefs.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public java.lang.Object[] getRefs() {\r
+ java.lang.Object[] array = new java.lang.Object[0];\r
+ return (java.lang.Object[]) this._refs.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getRefsAsReference.Returns a reference to '_refs'. No type checking\r
+ * is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getRefsAsReference() {\r
+ return this._refs;\r
+ }\r
+\r
+ /**\r
+ * Method getRefsCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getRefsCount() {\r
+ return this._refs.size();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_content != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_content)) {\r
+ result = 37 * result + _content.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_content);\r
}\r
-\r
- /**\r
- * Sets the value of field 'content'. The field 'content' has\r
- * the following description: internal content storage\r
- * \r
- * @param content the value of field 'content'.\r
- */\r
- public void setContent(\r
- final java.lang.String content) {\r
- this._content = content;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'id'. The field 'id' has the\r
- * following description: Primary Key for vamsas object\r
- * referencing\r
- * \r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(\r
- final java.lang.String id) {\r
- this._id = id;\r
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
+ result = 37 * result + _id.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vRefs\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setRefs(\r
- final int index,\r
- final java.lang.Object vRefs)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._refs.size()) {\r
- throw new IndexOutOfBoundsException("setRefs: Index value '" + index + "' not in range [0.." + (this._refs.size() - 1) + "]");\r
- }\r
- \r
- this._refs.set(index, vRefs);\r
+ if (_refs != null && !org.castor.util.CycleBreaker.startingToCycle(_refs)) {\r
+ result = 37 * result + _refs.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_refs);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param vRefsArray\r
- */\r
- public void setRefs(\r
- final java.lang.Object[] vRefsArray) {\r
- //-- copy array\r
- _refs.clear();\r
- \r
- for (int i = 0; i < vRefsArray.length; i++) {\r
- this._refs.add(vRefsArray[i]);\r
- }\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
-\r
- /**\r
- * Sets the value of '_refs' by copying the given Vector. All\r
- * elements will be checked for type safety.\r
- * \r
- * @param vRefsList the Vector to copy.\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
*/\r
- public void setRefs(\r
- final java.util.Vector vRefsList) {\r
- // copy vector\r
- this._refs.clear();\r
- \r
- this._refs.addAll(vRefsList);\r
+ public void removeAllRefs() {\r
+ this._refs.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removeRefs.\r
+ * \r
+ * @param vRefs\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeRefs(final java.lang.Object vRefs) {\r
+ boolean removed = _refs.remove(vRefs);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeRefsAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public java.lang.Object removeRefsAt(final int index) {\r
+ java.lang.Object obj = this._refs.remove(index);\r
+ return obj;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @param content\r
+ * the value of field 'content'.\r
+ */\r
+ public void setContent(final java.lang.String content) {\r
+ this._content = content;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'id'. The field 'id' has the following description:\r
+ * Primary Key for vamsas object referencing\r
+ * \r
+ * \r
+ * @param id\r
+ * the value of field 'id'.\r
+ */\r
+ public void setId(final java.lang.String id) {\r
+ this._id = id;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vRefs\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setRefs(final int index, final java.lang.Object vRefs)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._refs.size()) {\r
+ throw new IndexOutOfBoundsException("setRefs: Index value '" + index\r
+ + "' not in range [0.." + (this._refs.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Sets the value of '_refs' by setting it to the given Vector.\r
- * No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param refsVector the Vector to set.\r
- */\r
- public void setRefsAsReference(\r
- final java.util.Vector refsVector) {\r
- this._refs = refsVector;\r
- }\r
+ this._refs.set(index, vRefs);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled\r
- * uk.ac.vamsas.objects.core.ReferenceType\r
- */\r
- public static uk.ac.vamsas.objects.core.ReferenceType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.ReferenceType.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param vRefsArray\r
+ */\r
+ public void setRefs(final java.lang.Object[] vRefsArray) {\r
+ // -- copy array\r
+ _refs.clear();\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ for (int i = 0; i < vRefsArray.length; i++) {\r
+ this._refs.add(vRefsArray[i]);\r
}\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_refs' by copying the given Vector. All elements will be\r
+ * checked for type safety.\r
+ * \r
+ * @param vRefsList\r
+ * the Vector to copy.\r
+ */\r
+ public void setRefs(final java.util.Vector vRefsList) {\r
+ // copy vector\r
+ this._refs.clear();\r
+\r
+ this._refs.addAll(vRefsList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_refs' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param refsVector\r
+ * the Vector to set.\r
+ */\r
+ public void setRefsAsReference(final java.util.Vector refsVector) {\r
+ this._refs = refsVector;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.ReferenceType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.ReferenceType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.ReferenceType.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * Ordered set of optionally named float values for the\r
- * whole annotation \r
+ * Ordered set of optionally named float values for the whole annotation\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Score extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
+public class Score extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * internal content storage\r
+ */\r
+ private float _content;\r
\r
- /**\r
- * internal content storage\r
- */\r
- private float _content;\r
+ /**\r
+ * keeps track of state for field: _content\r
+ */\r
+ private boolean _has_content;\r
\r
- /**\r
- * keeps track of state for field: _content\r
- */\r
- private boolean _has_content;\r
+ /**\r
+ * Field _name.\r
+ */\r
+ private java.lang.String _name = "score";\r
\r
- /**\r
- * Field _name.\r
- */\r
- private java.lang.String _name = "score";\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public Score() {\r
+ super();\r
+ setName("score");\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public Score() {\r
- super();\r
- setName("score");\r
- }\r
+ /**\r
+ */\r
+ public void deleteContent() {\r
+ this._has_content = false;\r
+ }\r
\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- */\r
- public void deleteContent(\r
- ) {\r
- this._has_content= false;\r
- }\r
+ if (obj instanceof Score) {\r
\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ Score temp = (Score) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._content != temp._content)\r
+ return false;\r
+ if (this._has_content != temp._has_content)\r
+ return false;\r
+ if (this._name != null) {\r
+ if (temp._name == null)\r
+ return false;\r
+ if (this._name != temp._name) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._name);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Score) {\r
- \r
- Score temp = (Score)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._content != temp._content)\r
- return false;\r
- if (this._has_content != temp._has_content)\r
- return false;\r
- if (this._name != null) {\r
- if (temp._name == null) return false;\r
- if (this._name != temp._name) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._name.equals(temp._name)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
- }\r
- }\r
- } else if (temp._name != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._name.equals(temp._name)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);\r
+ }\r
}\r
+ } else if (temp._name != null)\r
return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'content'. The field 'content'\r
- * has the following description: internal content storage\r
- * \r
- * @return the value of field 'Content'.\r
- */\r
- public float getContent(\r
- ) {\r
- return this._content;\r
- }\r
+ /**\r
+ * Returns the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @return the value of field 'Content'.\r
+ */\r
+ public float getContent() {\r
+ return this._content;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'name'.\r
- * \r
- * @return the value of field 'Name'.\r
- */\r
- public java.lang.String getName(\r
- ) {\r
- return this._name;\r
- }\r
+ /**\r
+ * Returns the value of field 'name'.\r
+ * \r
+ * @return the value of field 'Name'.\r
+ */\r
+ public java.lang.String getName() {\r
+ return this._name;\r
+ }\r
\r
- /**\r
- * Method hasContent.\r
- * \r
- * @return true if at least one Content has been added\r
- */\r
- public boolean hasContent(\r
- ) {\r
- return this._has_content;\r
- }\r
+ /**\r
+ * Method hasContent.\r
+ * \r
+ * @return true if at least one Content has been added\r
+ */\r
+ public boolean hasContent() {\r
+ return this._has_content;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + java.lang.Float.floatToIntBits(_content);\r
- if (_name != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
- result = 37 * result + _name.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ result = 37 * result + java.lang.Float.floatToIntBits(_content);\r
+ if (_name != null && !org.castor.util.CycleBreaker.startingToCycle(_name)) {\r
+ result = 37 * result + _name.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_name);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'content'. The field 'content' has\r
- * the following description: internal content storage\r
- * \r
- * @param content the value of field 'content'.\r
- */\r
- public void setContent(\r
- final float content) {\r
- this._content = content;\r
- this._has_content = true;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Sets the value of field 'name'.\r
- * \r
- * @param name the value of field 'name'.\r
- */\r
- public void setName(\r
- final java.lang.String name) {\r
- this._name = name;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Score\r
- */\r
- public static uk.ac.vamsas.objects.core.Score unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Score) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Score.class, reader);\r
- }\r
+ /**\r
+ * Sets the value of field 'content'. The field 'content' has the following\r
+ * description: internal content storage\r
+ * \r
+ * @param content\r
+ * the value of field 'content'.\r
+ */\r
+ public void setContent(final float content) {\r
+ this._content = content;\r
+ this._has_content = true;\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'name'.\r
+ * \r
+ * @param name\r
+ * the value of field 'name'.\r
+ */\r
+ public void setName(final java.lang.String name) {\r
+ this._name = name;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Score\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Score unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Score) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Score.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * a region from start to end, with flag for inclusivity of\r
- * terminii \r
+ * a region from start to end, with flag for inclusivity of terminii\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Seg extends uk.ac.vamsas.client.Vobject \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _start.\r
- */\r
- private int _start;\r
-\r
- /**\r
- * keeps track of state for field: _start\r
- */\r
- private boolean _has_start;\r
-\r
- /**\r
- * Field _end.\r
- */\r
- private int _end;\r
-\r
- /**\r
- * keeps track of state for field: _end\r
- */\r
- private boolean _has_end;\r
-\r
- /**\r
- * when false, a consecutive range like 'start=1, end=2'\r
- * means the region lying after position 1 and before position\r
- * 2\r
- * \r
- */\r
- private boolean _inclusive;\r
-\r
- /**\r
- * keeps track of state for field: _inclusive\r
- */\r
- private boolean _has_inclusive;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Seg() {\r
- super();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
+public class Seg extends uk.ac.vamsas.client.Vobject implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _start.\r
+ */\r
+ private int _start;\r
+\r
+ /**\r
+ * keeps track of state for field: _start\r
+ */\r
+ private boolean _has_start;\r
+\r
+ /**\r
+ * Field _end.\r
+ */\r
+ private int _end;\r
+\r
+ /**\r
+ * keeps track of state for field: _end\r
+ */\r
+ private boolean _has_end;\r
+\r
+ /**\r
+ * when false, a consecutive range like 'start=1, end=2' means the region\r
+ * lying after position 1 and before position 2\r
+ * \r
+ */\r
+ private boolean _inclusive;\r
+\r
+ /**\r
+ * keeps track of state for field: _inclusive\r
+ */\r
+ private boolean _has_inclusive;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Seg() {\r
+ super();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
*/\r
- public void deleteEnd(\r
- ) {\r
- this._has_end= false;\r
- }\r
+ public void deleteEnd() {\r
+ this._has_end = false;\r
+ }\r
\r
- /**\r
+ /**\r
*/\r
- public void deleteInclusive(\r
- ) {\r
- this._has_inclusive= false;\r
- }\r
+ public void deleteInclusive() {\r
+ this._has_inclusive = false;\r
+ }\r
\r
- /**\r
+ /**\r
*/\r
- public void deleteStart(\r
- ) {\r
- this._has_start= false;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Seg) {\r
- \r
- Seg temp = (Seg)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._start != temp._start)\r
- return false;\r
- if (this._has_start != temp._has_start)\r
- return false;\r
- if (this._end != temp._end)\r
- return false;\r
- if (this._has_end != temp._has_end)\r
- return false;\r
- if (this._inclusive != temp._inclusive)\r
- return false;\r
- if (this._has_inclusive != temp._has_inclusive)\r
- return false;\r
- return true;\r
- }\r
+ public void deleteStart() {\r
+ this._has_start = false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Seg) {\r
+\r
+ Seg temp = (Seg) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._start != temp._start)\r
return false;\r
+ if (this._has_start != temp._has_start)\r
+ return false;\r
+ if (this._end != temp._end)\r
+ return false;\r
+ if (this._has_end != temp._has_end)\r
+ return false;\r
+ if (this._inclusive != temp._inclusive)\r
+ return false;\r
+ if (this._has_inclusive != temp._has_inclusive)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Returns the value of field 'end'.\r
- * \r
- * @return the value of field 'End'.\r
- */\r
- public int getEnd(\r
- ) {\r
- return this._end;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'inclusive'. The field\r
- * 'inclusive' has the following description: when false, a\r
- * consecutive range like 'start=1, end=2'\r
- * means the region lying after position 1 and before position\r
- * 2\r
- * \r
- * \r
- * @return the value of field 'Inclusive'.\r
- */\r
- public boolean getInclusive(\r
- ) {\r
- return this._inclusive;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'start'.\r
- * \r
- * @return the value of field 'Start'.\r
- */\r
- public int getStart(\r
- ) {\r
- return this._start;\r
- }\r
-\r
- /**\r
- * Method hasEnd.\r
- * \r
- * @return true if at least one End has been added\r
- */\r
- public boolean hasEnd(\r
- ) {\r
- return this._has_end;\r
- }\r
-\r
- /**\r
- * Method hasInclusive.\r
- * \r
- * @return true if at least one Inclusive has been added\r
- */\r
- public boolean hasInclusive(\r
- ) {\r
- return this._has_inclusive;\r
- }\r
-\r
- /**\r
- * Method hasStart.\r
- * \r
- * @return true if at least one Start has been added\r
- */\r
- public boolean hasStart(\r
- ) {\r
- return this._has_start;\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- result = 37 * result + _start;\r
- result = 37 * result + _end;\r
- result = 37 * result + (_inclusive?0:1);\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'inclusive'. The field\r
- * 'inclusive' has the following description: when false, a\r
- * consecutive range like 'start=1, end=2'\r
- * means the region lying after position 1 and before position\r
- * 2\r
- * \r
- * \r
- * @return the value of field 'Inclusive'.\r
- */\r
- public boolean isInclusive(\r
- ) {\r
- return this._inclusive;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- * Sets the value of field 'end'.\r
- * \r
- * @param end the value of field 'end'.\r
- */\r
- public void setEnd(\r
- final int end) {\r
- this._end = end;\r
- this._has_end = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'inclusive'. The field 'inclusive'\r
- * has the following description: when false, a consecutive\r
- * range like 'start=1, end=2'\r
- * means the region lying after position 1 and before position\r
- * 2\r
- * \r
- * \r
- * @param inclusive the value of field 'inclusive'.\r
- */\r
- public void setInclusive(\r
- final boolean inclusive) {\r
- this._inclusive = inclusive;\r
- this._has_inclusive = true;\r
- }\r
-\r
- /**\r
- * Sets the value of field 'start'.\r
- * \r
- * @param start the value of field 'start'.\r
- */\r
- public void setStart(\r
- final int start) {\r
- this._start = start;\r
- this._has_start = true;\r
- }\r
-\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.Seg\r
- */\r
- public static uk.ac.vamsas.objects.core.Seg unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.Seg) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Seg.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'end'.\r
+ * \r
+ * @return the value of field 'End'.\r
+ */\r
+ public int getEnd() {\r
+ return this._end;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'inclusive'. The field 'inclusive' has the\r
+ * following description: when false, a consecutive range like 'start=1,\r
+ * end=2' means the region lying after position 1 and before position 2\r
+ * \r
+ * \r
+ * @return the value of field 'Inclusive'.\r
+ */\r
+ public boolean getInclusive() {\r
+ return this._inclusive;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'start'.\r
+ * \r
+ * @return the value of field 'Start'.\r
+ */\r
+ public int getStart() {\r
+ return this._start;\r
+ }\r
+\r
+ /**\r
+ * Method hasEnd.\r
+ * \r
+ * @return true if at least one End has been added\r
+ */\r
+ public boolean hasEnd() {\r
+ return this._has_end;\r
+ }\r
+\r
+ /**\r
+ * Method hasInclusive.\r
+ * \r
+ * @return true if at least one Inclusive has been added\r
+ */\r
+ public boolean hasInclusive() {\r
+ return this._has_inclusive;\r
+ }\r
+\r
+ /**\r
+ * Method hasStart.\r
+ * \r
+ * @return true if at least one Start has been added\r
+ */\r
+ public boolean hasStart() {\r
+ return this._has_start;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ result = 37 * result + _start;\r
+ result = 37 * result + _end;\r
+ result = 37 * result + (_inclusive ? 0 : 1);\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'inclusive'. The field 'inclusive' has the\r
+ * following description: when false, a consecutive range like 'start=1,\r
+ * end=2' means the region lying after position 1 and before position 2\r
+ * \r
+ * \r
+ * @return the value of field 'Inclusive'.\r
+ */\r
+ public boolean isInclusive() {\r
+ return this._inclusive;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'end'.\r
+ * \r
+ * @param end\r
+ * the value of field 'end'.\r
+ */\r
+ public void setEnd(final int end) {\r
+ this._end = end;\r
+ this._has_end = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'inclusive'. The field 'inclusive' has the\r
+ * following description: when false, a consecutive range like 'start=1,\r
+ * end=2' means the region lying after position 1 and before position 2\r
+ * \r
+ * \r
+ * @param inclusive\r
+ * the value of field 'inclusive'.\r
+ */\r
+ public void setInclusive(final boolean inclusive) {\r
+ this._inclusive = inclusive;\r
+ this._has_inclusive = true;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'start'.\r
+ * \r
+ * @param start\r
+ * the value of field 'start'.\r
+ */\r
+ public void setStart(final int start) {\r
+ this._start = start;\r
+ this._has_start = true;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Seg\r
+ */\r
+ public static uk.ac.vamsas.objects.core.Seg unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.Seg) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Seg.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class Sequence.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class Sequence extends uk.ac.vamsas.objects.core.SequenceType
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Primary Key for vamsas object referencing
- *
- */
- private java.lang.String _id;
-
- /**
- * symbol class for sequence
- *
- */
- private java.lang.String _dictionary;
-
- /**
- * Store a list of database references
- * for this sequence record - with optional mapping
- * from database sequence to the given sequence record
- */
- private java.util.Vector _dbRefList;
-
- /**
- * explicitly named cross reference to
- * other objects in the document.
- */
- private java.util.Vector _vxrefList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Sequence() {
- super();
- this._dbRefList = new java.util.Vector();
- this._vxrefList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vDbRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDbRef(
- final uk.ac.vamsas.objects.core.DbRef vDbRef)
- throws java.lang.IndexOutOfBoundsException {
- this._dbRefList.addElement(vDbRef);
- }
-
- /**
- *
- *
- * @param index
- * @param vDbRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDbRef(
- final int index,
- final uk.ac.vamsas.objects.core.DbRef vDbRef)
- throws java.lang.IndexOutOfBoundsException {
- this._dbRefList.add(index, vDbRef);
- }
-
- /**
- *
- *
- * @param vVxref
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addVxref(
- final uk.ac.vamsas.objects.core.Vxref vVxref)
- throws java.lang.IndexOutOfBoundsException {
- this._vxrefList.addElement(vVxref);
- }
-
- /**
- *
- *
- * @param index
- * @param vVxref
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addVxref(
- final int index,
- final uk.ac.vamsas.objects.core.Vxref vVxref)
- throws java.lang.IndexOutOfBoundsException {
- this._vxrefList.add(index, vVxref);
- }
-
- /**
- * Method enumerateDbRef.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.DbRef elements
- */
- public java.util.Enumeration enumerateDbRef(
- ) {
- return this._dbRefList.elements();
- }
-
- /**
- * Method enumerateVxref.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Vxref elements
- */
- public java.util.Enumeration enumerateVxref(
- ) {
- return this._vxrefList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class Sequence extends uk.ac.vamsas.objects.core.SequenceType implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Primary Key for vamsas object referencing
+ *
+ */
+ private java.lang.String _id;
+
+ /**
+ * symbol class for sequence
+ *
+ */
+ private java.lang.String _dictionary;
+
+ /**
+ * Store a list of database references for this sequence record - with
+ * optional mapping from database sequence to the given sequence record
+ */
+ private java.util.Vector _dbRefList;
+
+ /**
+ * explicitly named cross reference to other objects in the document.
+ */
+ private java.util.Vector _vxrefList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Sequence() {
+ super();
+ this._dbRefList = new java.util.Vector();
+ this._vxrefList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vDbRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDbRef(final uk.ac.vamsas.objects.core.DbRef vDbRef)
+ throws java.lang.IndexOutOfBoundsException {
+ this._dbRefList.addElement(vDbRef);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDbRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDbRef(final int index,
+ final uk.ac.vamsas.objects.core.DbRef vDbRef)
+ throws java.lang.IndexOutOfBoundsException {
+ this._dbRefList.add(index, vDbRef);
+ }
+
+ /**
+ *
+ *
+ * @param vVxref
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addVxref(final uk.ac.vamsas.objects.core.Vxref vVxref)
+ throws java.lang.IndexOutOfBoundsException {
+ this._vxrefList.addElement(vVxref);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vVxref
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addVxref(final int index,
+ final uk.ac.vamsas.objects.core.Vxref vVxref)
+ throws java.lang.IndexOutOfBoundsException {
+ this._vxrefList.add(index, vVxref);
+ }
+
+ /**
+ * Method enumerateDbRef.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.DbRef elements
+ */
+ public java.util.Enumeration enumerateDbRef() {
+ return this._dbRefList.elements();
+ }
+
+ /**
+ * Method enumerateVxref.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Vxref elements
+ */
+ public java.util.Enumeration enumerateVxref() {
+ return this._vxrefList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof Sequence) {
+
+ Sequence temp = (Sequence) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
-
- if (obj instanceof Sequence) {
-
- Sequence temp = (Sequence)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._dictionary != null) {
- if (temp._dictionary == null) return false;
- if (this._dictionary != temp._dictionary) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dictionary);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dictionary);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dictionary); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dictionary); };
- return false;
- }
- if (!thcycle) {
- if (!this._dictionary.equals(temp._dictionary)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dictionary);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dictionary);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dictionary);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dictionary);
- }
- }
- } else if (temp._dictionary != null)
- return false;
- if (this._dbRefList != null) {
- if (temp._dbRefList == null) return false;
- if (this._dbRefList != temp._dbRefList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dbRefList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dbRefList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dbRefList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dbRefList); };
- return false;
- }
- if (!thcycle) {
- if (!this._dbRefList.equals(temp._dbRefList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dbRefList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dbRefList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dbRefList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dbRefList);
- }
- }
- } else if (temp._dbRefList != null)
- return false;
- if (this._vxrefList != null) {
- if (temp._vxrefList == null) return false;
- if (this._vxrefList != temp._vxrefList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._vxrefList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._vxrefList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._vxrefList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._vxrefList); };
- return false;
- }
- if (!thcycle) {
- if (!this._vxrefList.equals(temp._vxrefList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._vxrefList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._vxrefList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._vxrefList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._vxrefList);
- }
- }
- } else if (temp._vxrefList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
+ } else if (temp._id != null)
return false;
- }
-
- /**
- * Method getDbRef.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.DbRef at
- * the given index
- */
- public uk.ac.vamsas.objects.core.DbRef getDbRef(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._dbRefList.size()) {
- throw new IndexOutOfBoundsException("getDbRef: Index value '" + index + "' not in range [0.." + (this._dbRefList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.DbRef) _dbRefList.get(index);
- }
-
- /**
- * Method getDbRef.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.DbRef[] getDbRef(
- ) {
- uk.ac.vamsas.objects.core.DbRef[] array = new uk.ac.vamsas.objects.core.DbRef[0];
- return (uk.ac.vamsas.objects.core.DbRef[]) this._dbRefList.toArray(array);
- }
-
- /**
- * Method getDbRefAsReference.Returns a reference to
- * '_dbRefList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getDbRefAsReference(
- ) {
- return this._dbRefList;
- }
-
- /**
- * Method getDbRefCount.
- *
- * @return the size of this collection
- */
- public int getDbRefCount(
- ) {
- return this._dbRefList.size();
- }
-
- /**
- * Returns the value of field 'dictionary'. The field
- * 'dictionary' has the following description: symbol class for
- * sequence
- *
- *
- * @return the value of field 'Dictionary'.
- */
- public java.lang.String getDictionary(
- ) {
- return this._dictionary;
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getVxref.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Vxref at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Vxref getVxref(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._vxrefList.size()) {
- throw new IndexOutOfBoundsException("getVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Vxref) _vxrefList.get(index);
- }
-
- /**
- * Method getVxref.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Vxref[] getVxref(
- ) {
- uk.ac.vamsas.objects.core.Vxref[] array = new uk.ac.vamsas.objects.core.Vxref[0];
- return (uk.ac.vamsas.objects.core.Vxref[]) this._vxrefList.toArray(array);
- }
-
- /**
- * Method getVxrefAsReference.Returns a reference to
- * '_vxrefList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getVxrefAsReference(
- ) {
- return this._vxrefList;
- }
-
- /**
- * Method getVxrefCount.
- *
- * @return the size of this collection
- */
- public int getVxrefCount(
- ) {
- return this._vxrefList.size();
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_dictionary != null
- && !org.castor.util.CycleBreaker.startingToCycle(_dictionary)) {
- result = 37 * result + _dictionary.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_dictionary);
- }
- if (_dbRefList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_dbRefList)) {
- result = 37 * result + _dbRefList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_dbRefList);
- }
- if (_vxrefList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_vxrefList)) {
- result = 37 * result + _vxrefList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_vxrefList);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._dictionary != null) {
+ if (temp._dictionary == null)
+ return false;
+ if (this._dictionary != temp._dictionary) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._dictionary);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._dictionary);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dictionary);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dictionary);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._dictionary.equals(temp._dictionary)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dictionary);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dictionary);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dictionary);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dictionary);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllDbRef(
- ) {
- this._dbRefList.clear();
- }
-
- /**
- */
- public void removeAllVxref(
- ) {
- this._vxrefList.clear();
- }
-
- /**
- * Method removeDbRef.
- *
- * @param vDbRef
- * @return true if the object was removed from the collection.
- */
- public boolean removeDbRef(
- final uk.ac.vamsas.objects.core.DbRef vDbRef) {
- boolean removed = _dbRefList.remove(vDbRef);
- return removed;
- }
-
- /**
- * Method removeDbRefAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.DbRef removeDbRefAt(
- final int index) {
- java.lang.Object obj = this._dbRefList.remove(index);
- return (uk.ac.vamsas.objects.core.DbRef) obj;
- }
-
- /**
- * Method removeVxref.
- *
- * @param vVxref
- * @return true if the object was removed from the collection.
- */
- public boolean removeVxref(
- final uk.ac.vamsas.objects.core.Vxref vVxref) {
- boolean removed = _vxrefList.remove(vVxref);
- return removed;
- }
-
- /**
- * Method removeVxrefAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Vxref removeVxrefAt(
- final int index) {
- java.lang.Object obj = this._vxrefList.remove(index);
- return (uk.ac.vamsas.objects.core.Vxref) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vDbRef
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setDbRef(
- final int index,
- final uk.ac.vamsas.objects.core.DbRef vDbRef)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._dbRefList.size()) {
- throw new IndexOutOfBoundsException("setDbRef: Index value '" + index + "' not in range [0.." + (this._dbRefList.size() - 1) + "]");
- }
-
- this._dbRefList.set(index, vDbRef);
- }
-
- /**
- *
- *
- * @param vDbRefArray
- */
- public void setDbRef(
- final uk.ac.vamsas.objects.core.DbRef[] vDbRefArray) {
- //-- copy array
- _dbRefList.clear();
-
- for (int i = 0; i < vDbRefArray.length; i++) {
- this._dbRefList.add(vDbRefArray[i]);
- }
- }
-
- /**
- * Sets the value of '_dbRefList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vDbRefList the Vector to copy.
- */
- public void setDbRef(
- final java.util.Vector vDbRefList) {
- // copy vector
- this._dbRefList.clear();
-
- this._dbRefList.addAll(vDbRefList);
- }
-
- /**
- * Sets the value of '_dbRefList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param dbRefVector the Vector to set.
- */
- public void setDbRefAsReference(
- final java.util.Vector dbRefVector) {
- this._dbRefList = dbRefVector;
- }
-
- /**
- * Sets the value of field 'dictionary'. The field 'dictionary'
- * has the following description: symbol class for sequence
- *
- *
- * @param dictionary the value of field 'dictionary'.
- */
- public void setDictionary(
- final java.lang.String dictionary) {
- this._dictionary = dictionary;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- *
- *
- * @param index
- * @param vVxref
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setVxref(
- final int index,
- final uk.ac.vamsas.objects.core.Vxref vVxref)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._vxrefList.size()) {
- throw new IndexOutOfBoundsException("setVxref: Index value '" + index + "' not in range [0.." + (this._vxrefList.size() - 1) + "]");
+ } else if (temp._dictionary != null)
+ return false;
+ if (this._dbRefList != null) {
+ if (temp._dbRefList == null)
+ return false;
+ if (this._dbRefList != temp._dbRefList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._dbRefList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._dbRefList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dbRefList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dbRefList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._dbRefList.equals(temp._dbRefList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dbRefList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dbRefList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dbRefList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dbRefList);
+ }
}
-
- this._vxrefList.set(index, vVxref);
- }
-
- /**
- *
- *
- * @param vVxrefArray
- */
- public void setVxref(
- final uk.ac.vamsas.objects.core.Vxref[] vVxrefArray) {
- //-- copy array
- _vxrefList.clear();
-
- for (int i = 0; i < vVxrefArray.length; i++) {
- this._vxrefList.add(vVxrefArray[i]);
+ } else if (temp._dbRefList != null)
+ return false;
+ if (this._vxrefList != null) {
+ if (temp._vxrefList == null)
+ return false;
+ if (this._vxrefList != temp._vxrefList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._vxrefList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._vxrefList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._vxrefList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._vxrefList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._vxrefList.equals(temp._vxrefList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._vxrefList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._vxrefList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._vxrefList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._vxrefList);
+ }
}
- }
-
- /**
- * Sets the value of '_vxrefList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vVxrefList the Vector to copy.
- */
- public void setVxref(
- final java.util.Vector vVxrefList) {
- // copy vector
- this._vxrefList.clear();
-
- this._vxrefList.addAll(vVxrefList);
- }
-
- /**
- * Sets the value of '_vxrefList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param vxrefVector the Vector to set.
- */
- public void setVxrefAsReference(
- final java.util.Vector vxrefVector) {
- this._vxrefList = vxrefVector;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
- */
- public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Sequence.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ } else if (temp._vxrefList != null)
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method getDbRef.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.DbRef at the given index
+ */
+ public uk.ac.vamsas.objects.core.DbRef getDbRef(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._dbRefList.size()) {
+ throw new IndexOutOfBoundsException("getDbRef: Index value '" + index
+ + "' not in range [0.." + (this._dbRefList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.DbRef) _dbRefList.get(index);
+ }
+
+ /**
+ * Method getDbRef.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.DbRef[] getDbRef() {
+ uk.ac.vamsas.objects.core.DbRef[] array = new uk.ac.vamsas.objects.core.DbRef[0];
+ return (uk.ac.vamsas.objects.core.DbRef[]) this._dbRefList.toArray(array);
+ }
+
+ /**
+ * Method getDbRefAsReference.Returns a reference to '_dbRefList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getDbRefAsReference() {
+ return this._dbRefList;
+ }
+
+ /**
+ * Method getDbRefCount.
+ *
+ * @return the size of this collection
+ */
+ public int getDbRefCount() {
+ return this._dbRefList.size();
+ }
+
+ /**
+ * Returns the value of field 'dictionary'. The field 'dictionary' has the
+ * following description: symbol class for sequence
+ *
+ *
+ * @return the value of field 'Dictionary'.
+ */
+ public java.lang.String getDictionary() {
+ return this._dictionary;
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Method getVxref.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Vxref at the given index
+ */
+ public uk.ac.vamsas.objects.core.Vxref getVxref(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._vxrefList.size()) {
+ throw new IndexOutOfBoundsException("getVxref: Index value '" + index
+ + "' not in range [0.." + (this._vxrefList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Vxref) _vxrefList.get(index);
+ }
+
+ /**
+ * Method getVxref.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Vxref[] getVxref() {
+ uk.ac.vamsas.objects.core.Vxref[] array = new uk.ac.vamsas.objects.core.Vxref[0];
+ return (uk.ac.vamsas.objects.core.Vxref[]) this._vxrefList.toArray(array);
+ }
+
+ /**
+ * Method getVxrefAsReference.Returns a reference to '_vxrefList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getVxrefAsReference() {
+ return this._vxrefList;
+ }
+
+ /**
+ * Method getVxrefCount.
+ *
+ * @return the size of this collection
+ */
+ public int getVxrefCount() {
+ return this._vxrefList.size();
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
+ }
+ if (_dictionary != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_dictionary)) {
+ result = 37 * result + _dictionary.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_dictionary);
+ }
+ if (_dbRefList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_dbRefList)) {
+ result = 37 * result + _dbRefList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_dbRefList);
+ }
+ if (_vxrefList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_vxrefList)) {
+ result = 37 * result + _vxrefList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_vxrefList);
+ }
+
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllDbRef() {
+ this._dbRefList.clear();
+ }
+
+ /**
+ */
+ public void removeAllVxref() {
+ this._vxrefList.clear();
+ }
+
+ /**
+ * Method removeDbRef.
+ *
+ * @param vDbRef
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeDbRef(final uk.ac.vamsas.objects.core.DbRef vDbRef) {
+ boolean removed = _dbRefList.remove(vDbRef);
+ return removed;
+ }
+
+ /**
+ * Method removeDbRefAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.DbRef removeDbRefAt(final int index) {
+ java.lang.Object obj = this._dbRefList.remove(index);
+ return (uk.ac.vamsas.objects.core.DbRef) obj;
+ }
+
+ /**
+ * Method removeVxref.
+ *
+ * @param vVxref
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeVxref(final uk.ac.vamsas.objects.core.Vxref vVxref) {
+ boolean removed = _vxrefList.remove(vVxref);
+ return removed;
+ }
+
+ /**
+ * Method removeVxrefAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Vxref removeVxrefAt(final int index) {
+ java.lang.Object obj = this._vxrefList.remove(index);
+ return (uk.ac.vamsas.objects.core.Vxref) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDbRef
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setDbRef(final int index,
+ final uk.ac.vamsas.objects.core.DbRef vDbRef)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._dbRefList.size()) {
+ throw new IndexOutOfBoundsException("setDbRef: Index value '" + index
+ + "' not in range [0.." + (this._dbRefList.size() - 1) + "]");
+ }
+
+ this._dbRefList.set(index, vDbRef);
+ }
+
+ /**
+ *
+ *
+ * @param vDbRefArray
+ */
+ public void setDbRef(final uk.ac.vamsas.objects.core.DbRef[] vDbRefArray) {
+ // -- copy array
+ _dbRefList.clear();
+
+ for (int i = 0; i < vDbRefArray.length; i++) {
+ this._dbRefList.add(vDbRefArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_dbRefList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vDbRefList
+ * the Vector to copy.
+ */
+ public void setDbRef(final java.util.Vector vDbRefList) {
+ // copy vector
+ this._dbRefList.clear();
+
+ this._dbRefList.addAll(vDbRefList);
+ }
+
+ /**
+ * Sets the value of '_dbRefList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param dbRefVector
+ * the Vector to set.
+ */
+ public void setDbRefAsReference(final java.util.Vector dbRefVector) {
+ this._dbRefList = dbRefVector;
+ }
+
+ /**
+ * Sets the value of field 'dictionary'. The field 'dictionary' has the
+ * following description: symbol class for sequence
+ *
+ *
+ * @param dictionary
+ * the value of field 'dictionary'.
+ */
+ public void setDictionary(final java.lang.String dictionary) {
+ this._dictionary = dictionary;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vVxref
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setVxref(final int index,
+ final uk.ac.vamsas.objects.core.Vxref vVxref)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._vxrefList.size()) {
+ throw new IndexOutOfBoundsException("setVxref: Index value '" + index
+ + "' not in range [0.." + (this._vxrefList.size() - 1) + "]");
+ }
+
+ this._vxrefList.set(index, vVxref);
+ }
+
+ /**
+ *
+ *
+ * @param vVxrefArray
+ */
+ public void setVxref(final uk.ac.vamsas.objects.core.Vxref[] vVxrefArray) {
+ // -- copy array
+ _vxrefList.clear();
+
+ for (int i = 0; i < vVxrefArray.length; i++) {
+ this._vxrefList.add(vVxrefArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_vxrefList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vVxrefList
+ * the Vector to copy.
+ */
+ public void setVxref(final java.util.Vector vVxrefList) {
+ // copy vector
+ this._vxrefList.clear();
+
+ this._vxrefList.addAll(vVxrefList);
+ }
+
+ /**
+ * Sets the value of '_vxrefList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param vxrefVector
+ * the Vector to set.
+ */
+ public void setVxrefAsReference(final java.util.Vector vxrefVector) {
+ this._vxrefList = vxrefVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
+ */
+ public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.Sequence.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class SequenceMapping extends uk.ac.vamsas.objects.core.MapType \r
-implements java.io.Serializable\r
-{\r
+public class SequenceMapping extends uk.ac.vamsas.objects.core.MapType\r
+ implements java.io.Serializable {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ /**\r
+ * Object on which the local range is defined.\r
+ */\r
+ private java.lang.Object _loc;\r
\r
- /**\r
- * Object on which the local\r
- * range is defined. \r
- */\r
- private java.lang.Object _loc;\r
+ /**\r
+ * Object on which the mapped range is defined.\r
+ */\r
+ private java.lang.Object _map;\r
\r
- /**\r
- * Object on which the mapped\r
- * range is defined. \r
- */\r
- private java.lang.Object _map;\r
+ /**\r
+ * Field _id.\r
+ */\r
+ private java.lang.String _id;\r
\r
- /**\r
- * Field _id.\r
- */\r
- private java.lang.String _id;\r
+ /**\r
+ * Field _provenance.\r
+ */\r
+ private uk.ac.vamsas.objects.core.Provenance _provenance;\r
\r
- /**\r
- * Field _provenance.\r
- */\r
- private uk.ac.vamsas.objects.core.Provenance _provenance;\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
+ public SequenceMapping() {\r
+ super();\r
+ }\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- public SequenceMapping() {\r
- super();\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
+ if (obj instanceof SequenceMapping) {\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+ SequenceMapping temp = (SequenceMapping) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._loc != null) {\r
+ if (temp._loc == null)\r
+ return false;\r
+ if (this._loc != temp._loc) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._loc);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._loc);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._loc);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._loc.equals(temp._loc)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._loc);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._loc);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc);\r
+ }\r
+ }\r
+ } else if (temp._loc != null)\r
+ return false;\r
+ if (this._map != null) {\r
+ if (temp._map == null)\r
+ return false;\r
+ if (this._map != temp._map) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._map);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._map);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._map);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._map);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof SequenceMapping) {\r
- \r
- SequenceMapping temp = (SequenceMapping)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._loc != null) {\r
- if (temp._loc == null) return false;\r
- if (this._loc != temp._loc) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._loc);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._loc);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._loc); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._loc.equals(temp._loc)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._loc);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._loc);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc);\r
- }\r
- }\r
- } else if (temp._loc != null)\r
- return false;\r
- if (this._map != null) {\r
- if (temp._map == null) return false;\r
- if (this._map != temp._map) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._map);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._map);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._map); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._map); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._map.equals(temp._map)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._map);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._map);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._map);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._map);\r
- }\r
- }\r
- } else if (temp._map != null)\r
- return false;\r
- if (this._id != null) {\r
- if (temp._id == null) return false;\r
- if (this._id != temp._id) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._id.equals(temp._id)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
- }\r
- }\r
- } else if (temp._id != null)\r
- return false;\r
- if (this._provenance != null) {\r
- if (temp._provenance == null) return false;\r
- if (this._provenance != temp._provenance) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._provenance.equals(temp._provenance)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
- }\r
- }\r
- } else if (temp._provenance != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._map.equals(temp._map)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._map);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._map);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._map);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._map);\r
+ }\r
}\r
+ } else if (temp._map != null)\r
return false;\r
+ if (this._id != null) {\r
+ if (temp._id == null)\r
+ return false;\r
+ if (this._id != temp._id) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._id.equals(temp._id)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
+ }\r
+ }\r
+ } else if (temp._id != null)\r
+ return false;\r
+ if (this._provenance != null) {\r
+ if (temp._provenance == null)\r
+ return false;\r
+ if (this._provenance != temp._provenance) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._provenance);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._provenance);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ }\r
+ ;\r
+ return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._provenance.equals(temp._provenance)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
+ }\r
+ }\r
+ } else if (temp._provenance != null)\r
+ return false;\r
+ return true;\r
}\r
+ return false;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'id'.\r
- * \r
- * @return the value of field 'Id'.\r
- */\r
- public java.lang.String getId(\r
- ) {\r
- return this._id;\r
- }\r
+ /**\r
+ * Returns the value of field 'id'.\r
+ * \r
+ * @return the value of field 'Id'.\r
+ */\r
+ public java.lang.String getId() {\r
+ return this._id;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'loc'. The field 'loc' has the\r
- * following description: Object on which the local\r
- * range is defined. \r
- * \r
- * @return the value of field 'Loc'.\r
- */\r
- public java.lang.Object getLoc(\r
- ) {\r
- return this._loc;\r
- }\r
+ /**\r
+ * Returns the value of field 'loc'. The field 'loc' has the following\r
+ * description: Object on which the local range is defined.\r
+ * \r
+ * @return the value of field 'Loc'.\r
+ */\r
+ public java.lang.Object getLoc() {\r
+ return this._loc;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'map'. The field 'map' has the\r
- * following description: Object on which the mapped\r
- * range is defined. \r
- * \r
- * @return the value of field 'Map'.\r
- */\r
- public java.lang.Object getMap(\r
- ) {\r
- return this._map;\r
- }\r
+ /**\r
+ * Returns the value of field 'map'. The field 'map' has the following\r
+ * description: Object on which the mapped range is defined.\r
+ * \r
+ * @return the value of field 'Map'.\r
+ */\r
+ public java.lang.Object getMap() {\r
+ return this._map;\r
+ }\r
\r
- /**\r
- * Returns the value of field 'provenance'.\r
- * \r
- * @return the value of field 'Provenance'.\r
- */\r
- public uk.ac.vamsas.objects.core.Provenance getProvenance(\r
- ) {\r
- return this._provenance;\r
- }\r
+ /**\r
+ * Returns the value of field 'provenance'.\r
+ * \r
+ * @return the value of field 'Provenance'.\r
+ */\r
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {\r
+ return this._provenance;\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_loc != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_loc)) {\r
- result = 37 * result + _loc.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_loc);\r
- }\r
- if (_map != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_map)) {\r
- result = 37 * result + _map.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_map);\r
- }\r
- if (_id != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
- result = 37 * result + _id.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
- }\r
- if (_provenance != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {\r
- result = 37 * result + _provenance.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);\r
- }\r
- \r
- return result;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
+ long tmp;\r
+ if (_loc != null && !org.castor.util.CycleBreaker.startingToCycle(_loc)) {\r
+ result = 37 * result + _loc.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_loc);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
+ if (_map != null && !org.castor.util.CycleBreaker.startingToCycle(_map)) {\r
+ result = 37 * result + _map.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_map);\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
+ result = 37 * result + _id.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
}\r
-\r
- /**\r
- * Sets the value of field 'id'.\r
- * \r
- * @param id the value of field 'id'.\r
- */\r
- public void setId(\r
- final java.lang.String id) {\r
- this._id = id;\r
+ if (_provenance != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {\r
+ result = 37 * result + _provenance.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);\r
}\r
\r
- /**\r
- * Sets the value of field 'loc'. The field 'loc' has the\r
- * following description: Object on which the local\r
- * range is defined. \r
- * \r
- * @param loc the value of field 'loc'.\r
- */\r
- public void setLoc(\r
- final java.lang.Object loc) {\r
- this._loc = loc;\r
- }\r
+ return result;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'map'. The field 'map' has the\r
- * following description: Object on which the mapped\r
- * range is defined. \r
- * \r
- * @param map the value of field 'map'.\r
- */\r
- public void setMap(\r
- final java.lang.Object map) {\r
- this._map = map;\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
\r
- /**\r
- * Sets the value of field 'provenance'.\r
- * \r
- * @param provenance the value of field 'provenance'.\r
- */\r
- public void setProvenance(\r
- final uk.ac.vamsas.objects.core.Provenance provenance) {\r
- this._provenance = provenance;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
- */\r
- public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceMapping.class, reader);\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
- }\r
+ /**\r
+ * Sets the value of field 'id'.\r
+ * \r
+ * @param id\r
+ * the value of field 'id'.\r
+ */\r
+ public void setId(final java.lang.String id) {\r
+ this._id = id;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'loc'. The field 'loc' has the following\r
+ * description: Object on which the local range is defined.\r
+ * \r
+ * @param loc\r
+ * the value of field 'loc'.\r
+ */\r
+ public void setLoc(final java.lang.Object loc) {\r
+ this._loc = loc;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'map'. The field 'map' has the following\r
+ * description: Object on which the mapped range is defined.\r
+ * \r
+ * @param map\r
+ * the value of field 'map'.\r
+ */\r
+ public void setMap(final java.lang.Object map) {\r
+ this._map = map;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'provenance'.\r
+ * \r
+ * @param provenance\r
+ * the value of field 'provenance'.\r
+ */\r
+ public void setProvenance(\r
+ final uk.ac.vamsas.objects.core.Provenance provenance) {\r
+ this._provenance = provenance;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.SequenceMapping.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class SequenceType.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class SequenceType extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _start.
- */
- private long _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private long _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _sequence.
- */
- private java.lang.String _sequence;
-
- /**
- * Field _name.
- */
- private java.lang.String _name;
-
- /**
- * Field _description.
- */
- private java.lang.String _description;
-
- /**
- * additional typed properties
- */
- private java.util.Vector _propertyList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public SequenceType() {
- super();
- this._propertyList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.addElement(vProperty);
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.add(index, vProperty);
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- * Method enumerateProperty.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Property elements
- */
- public java.util.Enumeration enumerateProperty(
- ) {
- return this._propertyList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class SequenceType extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _start.
+ */
+ private long _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private long _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _sequence.
+ */
+ private java.lang.String _sequence;
+
+ /**
+ * Field _name.
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _description.
+ */
+ private java.lang.String _description;
+
+ /**
+ * additional typed properties
+ */
+ private java.util.Vector _propertyList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public SequenceType() {
+ super();
+ this._propertyList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ */
+ public void deleteEnd() {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteStart() {
+ this._has_start = false;
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
+ */
+ public java.util.Enumeration enumerateProperty() {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof SequenceType) {
+
+ SequenceType temp = (SequenceType) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._start != temp._start)
+ return false;
+ if (this._has_start != temp._has_start)
+ return false;
+ if (this._end != temp._end)
+ return false;
+ if (this._has_end != temp._has_end)
+ return false;
+ if (this._sequence != null) {
+ if (temp._sequence == null)
+ return false;
+ if (this._sequence != temp._sequence) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._sequence);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._sequence);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence);
+ }
+ ;
return false;
-
- if (obj instanceof SequenceType) {
-
- SequenceType temp = (SequenceType)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._start != temp._start)
- return false;
- if (this._has_start != temp._has_start)
- return false;
- if (this._end != temp._end)
- return false;
- if (this._has_end != temp._has_end)
- return false;
- if (this._sequence != null) {
- if (temp._sequence == null) return false;
- if (this._sequence != temp._sequence) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._sequence);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._sequence);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence); };
- return false;
- }
- if (!thcycle) {
- if (!this._sequence.equals(temp._sequence)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence);
- }
- }
- } else if (temp._sequence != null)
- return false;
- if (this._name != null) {
- if (temp._name == null) return false;
- if (this._name != temp._name) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._name);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._name);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._name); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._name); };
- return false;
- }
- if (!thcycle) {
- if (!this._name.equals(temp._name)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
- }
- }
- } else if (temp._name != null)
- return false;
- if (this._description != null) {
- if (temp._description == null) return false;
- if (this._description != temp._description) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._description);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._description);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._description); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._description); };
- return false;
- }
- if (!thcycle) {
- if (!this._description.equals(temp._description)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
- }
- }
- } else if (temp._description != null)
- return false;
- if (this._propertyList != null) {
- if (temp._propertyList == null) return false;
- if (this._propertyList != temp._propertyList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };
- return false;
- }
- if (!thcycle) {
- if (!this._propertyList.equals(temp._propertyList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- }
- }
- } else if (temp._propertyList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._sequence.equals(temp._sequence)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._sequence);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._sequence);
+ }
}
+ } else if (temp._sequence != null)
return false;
- }
-
- /**
- * Returns the value of field 'description'.
- *
- * @return the value of field 'Description'.
- */
- public java.lang.String getDescription(
- ) {
- return this._description;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public long getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Returns the value of field 'name'.
- *
- * @return the value of field 'Name'.
- */
- public java.lang.String getName(
- ) {
- return this._name;
- }
-
- /**
- * Method getProperty.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Property
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Property getProperty(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
- }
-
- /**
- * Method getProperty.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Property[] getProperty(
- ) {
- uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
- return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
- }
-
- /**
- * Method getPropertyAsReference.Returns a reference to
- * '_propertyList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getPropertyAsReference(
- ) {
- return this._propertyList;
- }
-
- /**
- * Method getPropertyCount.
- *
- * @return the size of this collection
- */
- public int getPropertyCount(
- ) {
- return this._propertyList.size();
- }
-
- /**
- * Returns the value of field 'sequence'.
- *
- * @return the value of field 'Sequence'.
- */
- public java.lang.String getSequence(
- ) {
- return this._sequence;
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public long getStart(
- ) {
- return this._start;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- result = 37 * result + (int)(_start^(_start>>>32));
- result = 37 * result + (int)(_end^(_end>>>32));
- if (_sequence != null
- && !org.castor.util.CycleBreaker.startingToCycle(_sequence)) {
- result = 37 * result + _sequence.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_sequence);
- }
- if (_name != null
- && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
- result = 37 * result + _name.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_name);
- }
- if (_description != null
- && !org.castor.util.CycleBreaker.startingToCycle(_description)) {
- result = 37 * result + _description.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_description);
- }
- if (_propertyList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
- result = 37 * result + _propertyList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._name != null) {
+ if (temp._name == null)
+ return false;
+ if (this._name != temp._name) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._name);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._name);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._name.equals(temp._name)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._name);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._name);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllProperty(
- ) {
- this._propertyList.clear();
- }
-
- /**
- * Method removeProperty.
- *
- * @param vProperty
- * @return true if the object was removed from the collection.
- */
- public boolean removeProperty(
- final uk.ac.vamsas.objects.core.Property vProperty) {
- boolean removed = _propertyList.remove(vProperty);
- return removed;
- }
-
- /**
- * Method removePropertyAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Property removePropertyAt(
- final int index) {
- java.lang.Object obj = this._propertyList.remove(index);
- return (uk.ac.vamsas.objects.core.Property) obj;
- }
-
- /**
- * Sets the value of field 'description'.
- *
- * @param description the value of field 'description'.
- */
- public void setDescription(
- final java.lang.String description) {
- this._description = description;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final long end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- * Sets the value of field 'name'.
- *
- * @param name the value of field 'name'.
- */
- public void setName(
- final java.lang.String name) {
- this._name = name;
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
+ } else if (temp._name != null)
+ return false;
+ if (this._description != null) {
+ if (temp._description == null)
+ return false;
+ if (this._description != temp._description) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._description);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._description);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._description);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._description);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._description.equals(temp._description)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._description);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._description);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._description);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._description);
+ }
}
-
- this._propertyList.set(index, vProperty);
- }
-
- /**
- *
- *
- * @param vPropertyArray
- */
- public void setProperty(
- final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
- //-- copy array
- _propertyList.clear();
-
- for (int i = 0; i < vPropertyArray.length; i++) {
- this._propertyList.add(vPropertyArray[i]);
+ } else if (temp._description != null)
+ return false;
+ if (this._propertyList != null) {
+ if (temp._propertyList == null)
+ return false;
+ if (this._propertyList != temp._propertyList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._propertyList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._propertyList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._propertyList.equals(temp._propertyList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
+ }
}
- }
-
- /**
- * Sets the value of '_propertyList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vPropertyList the Vector to copy.
- */
- public void setProperty(
- final java.util.Vector vPropertyList) {
- // copy vector
- this._propertyList.clear();
-
- this._propertyList.addAll(vPropertyList);
- }
-
- /**
- * Sets the value of '_propertyList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param propertyVector the Vector to set.
- */
- public void setPropertyAsReference(
- final java.util.Vector propertyVector) {
- this._propertyList = propertyVector;
- }
-
- /**
- * Sets the value of field 'sequence'.
- *
- * @param sequence the value of field 'sequence'.
- */
- public void setSequence(
- final java.lang.String sequence) {
- this._sequence = sequence;
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final long start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
- */
- public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceType.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ } else if (temp._propertyList != null)
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription() {
+ return this._description;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public long getEnd() {
+ return this._end;
+ }
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName() {
+ return this._name;
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Property at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("getProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Property[] getProperty() {
+ uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
+ return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getPropertyAsReference() {
+ return this._propertyList;
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount() {
+ return this._propertyList.size();
+ }
+
+ /**
+ * Returns the value of field 'sequence'.
+ *
+ * @return the value of field 'Sequence'.
+ */
+ public java.lang.String getSequence() {
+ return this._sequence;
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public long getStart() {
+ return this._start;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd() {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart() {
+ return this._has_start;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ result = 37 * result + (int) (_start ^ (_start >>> 32));
+ result = 37 * result + (int) (_end ^ (_end >>> 32));
+ if (_sequence != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_sequence)) {
+ result = 37 * result + _sequence.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_sequence);
+ }
+ if (_name != null && !org.castor.util.CycleBreaker.startingToCycle(_name)) {
+ result = 37 * result + _name.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_name);
+ }
+ if (_description != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_description)) {
+ result = 37 * result + _description.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_description);
+ }
+ if (_propertyList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
+ result = 37 * result + _propertyList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
+ }
+
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllProperty() {
+ this._propertyList.clear();
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(
+ final uk.ac.vamsas.objects.core.Property vProperty) {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (uk.ac.vamsas.objects.core.Property) obj;
+ }
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description
+ * the value of field 'description'.
+ */
+ public void setDescription(final java.lang.String description) {
+ this._description = description;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final long end) {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name
+ * the value of field 'name'.
+ */
+ public void setName(final java.lang.String name) {
+ this._name = name;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("setProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
+ }
+
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(
+ final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++) {
+ this._propertyList.add(vPropertyArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_propertyList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vPropertyList
+ * the Vector to copy.
+ */
+ public void setProperty(final java.util.Vector vPropertyList) {
+ // copy vector
+ this._propertyList.clear();
+
+ this._propertyList.addAll(vPropertyList);
+ }
+
+ /**
+ * Sets the value of '_propertyList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param propertyVector
+ * the Vector to set.
+ */
+ public void setPropertyAsReference(final java.util.Vector propertyVector) {
+ this._propertyList = propertyVector;
+ }
+
+ /**
+ * Sets the value of field 'sequence'.
+ *
+ * @param sequence
+ * the value of field 'sequence'.
+ */
+ public void setSequence(final java.lang.String sequence) {
+ this._sequence = sequence;
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final long start) {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.SequenceTyp
+ */
+ public static uk.ac.vamsas.objects.core.SequenceType unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.SequenceType.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class Tree.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class Tree extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Primary Key for vamsas object referencing
- */
- private java.lang.String _id;
-
- /**
- * Field _modifiable.
- */
- private java.lang.String _modifiable;
-
- /**
- * Field _title.
- */
- private java.lang.String _title;
-
- /**
- * Field _newickList.
- */
- private java.util.Vector _newickList;
-
- /**
- * node identity and mapping data between tree
- * representations and vamsas document objects
- */
- private java.util.Vector _treenodeList;
-
- /**
- * Field _propertyList.
- */
- private java.util.Vector _propertyList;
-
- /**
- * Field _provenance.
- */
- private uk.ac.vamsas.objects.core.Provenance _provenance;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public Tree() {
- super();
- this._newickList = new java.util.Vector();
- this._treenodeList = new java.util.Vector();
- this._propertyList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vNewick
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addNewick(
- final uk.ac.vamsas.objects.core.Newick vNewick)
- throws java.lang.IndexOutOfBoundsException {
- this._newickList.addElement(vNewick);
- }
-
- /**
- *
- *
- * @param index
- * @param vNewick
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addNewick(
- final int index,
- final uk.ac.vamsas.objects.core.Newick vNewick)
- throws java.lang.IndexOutOfBoundsException {
- this._newickList.add(index, vNewick);
- }
-
- /**
- *
- *
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.addElement(vProperty);
- }
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- this._propertyList.add(index, vProperty);
- }
-
- /**
- *
- *
- * @param vTreenode
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTreenode(
- final uk.ac.vamsas.objects.core.Treenode vTreenode)
- throws java.lang.IndexOutOfBoundsException {
- this._treenodeList.addElement(vTreenode);
- }
-
- /**
- *
- *
- * @param index
- * @param vTreenode
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTreenode(
- final int index,
- final uk.ac.vamsas.objects.core.Treenode vTreenode)
- throws java.lang.IndexOutOfBoundsException {
- this._treenodeList.add(index, vTreenode);
- }
-
- /**
- * Method enumerateNewick.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Newick elements
- */
- public java.util.Enumeration enumerateNewick(
- ) {
- return this._newickList.elements();
- }
-
- /**
- * Method enumerateProperty.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Property elements
- */
- public java.util.Enumeration enumerateProperty(
- ) {
- return this._propertyList.elements();
- }
-
- /**
- * Method enumerateTreenode.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Treenode elements
- */
- public java.util.Enumeration enumerateTreenode(
- ) {
- return this._treenodeList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class Tree extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Primary Key for vamsas object referencing
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _modifiable.
+ */
+ private java.lang.String _modifiable;
+
+ /**
+ * Field _title.
+ */
+ private java.lang.String _title;
+
+ /**
+ * Field _newickList.
+ */
+ private java.util.Vector _newickList;
+
+ /**
+ * node identity and mapping data between tree representations and vamsas
+ * document objects
+ */
+ private java.util.Vector _treenodeList;
+
+ /**
+ * Field _propertyList.
+ */
+ private java.util.Vector _propertyList;
+
+ /**
+ * Field _provenance.
+ */
+ private uk.ac.vamsas.objects.core.Provenance _provenance;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public Tree() {
+ super();
+ this._newickList = new java.util.Vector();
+ this._treenodeList = new java.util.Vector();
+ this._propertyList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vNewick
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addNewick(final uk.ac.vamsas.objects.core.Newick vNewick)
+ throws java.lang.IndexOutOfBoundsException {
+ this._newickList.addElement(vNewick);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vNewick
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addNewick(final int index,
+ final uk.ac.vamsas.objects.core.Newick vNewick)
+ throws java.lang.IndexOutOfBoundsException {
+ this._newickList.add(index, vNewick);
+ }
+
+ /**
+ *
+ *
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.addElement(vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ this._propertyList.add(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vTreenode
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTreenode(final uk.ac.vamsas.objects.core.Treenode vTreenode)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treenodeList.addElement(vTreenode);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTreenode
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTreenode(final int index,
+ final uk.ac.vamsas.objects.core.Treenode vTreenode)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treenodeList.add(index, vTreenode);
+ }
+
+ /**
+ * Method enumerateNewick.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Newick elements
+ */
+ public java.util.Enumeration enumerateNewick() {
+ return this._newickList.elements();
+ }
+
+ /**
+ * Method enumerateProperty.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Property elements
+ */
+ public java.util.Enumeration enumerateProperty() {
+ return this._propertyList.elements();
+ }
+
+ /**
+ * Method enumerateTreenode.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Treenode elements
+ */
+ public java.util.Enumeration enumerateTreenode() {
+ return this._treenodeList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof Tree) {
+
+ Tree temp = (Tree) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
-
- if (obj instanceof Tree) {
-
- Tree temp = (Tree)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._modifiable != null) {
- if (temp._modifiable == null) return false;
- if (this._modifiable != temp._modifiable) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };
- return false;
- }
- if (!thcycle) {
- if (!this._modifiable.equals(temp._modifiable)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- }
- }
- } else if (temp._modifiable != null)
- return false;
- if (this._title != null) {
- if (temp._title == null) return false;
- if (this._title != temp._title) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._title);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._title);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._title); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._title); };
- return false;
- }
- if (!thcycle) {
- if (!this._title.equals(temp._title)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
- }
- }
- } else if (temp._title != null)
- return false;
- if (this._newickList != null) {
- if (temp._newickList == null) return false;
- if (this._newickList != temp._newickList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._newickList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._newickList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList); };
- return false;
- }
- if (!thcycle) {
- if (!this._newickList.equals(temp._newickList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
- }
- }
- } else if (temp._newickList != null)
- return false;
- if (this._treenodeList != null) {
- if (temp._treenodeList == null) return false;
- if (this._treenodeList != temp._treenodeList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._treenodeList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._treenodeList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._treenodeList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._treenodeList); };
- return false;
- }
- if (!thcycle) {
- if (!this._treenodeList.equals(temp._treenodeList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treenodeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treenodeList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treenodeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treenodeList);
- }
- }
- } else if (temp._treenodeList != null)
- return false;
- if (this._propertyList != null) {
- if (temp._propertyList == null) return false;
- if (this._propertyList != temp._propertyList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._propertyList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._propertyList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList); };
- return false;
- }
- if (!thcycle) {
- if (!this._propertyList.equals(temp._propertyList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
- }
- }
- } else if (temp._propertyList != null)
- return false;
- if (this._provenance != null) {
- if (temp._provenance == null) return false;
- if (this._provenance != temp._provenance) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };
- return false;
- }
- if (!thcycle) {
- if (!this._provenance.equals(temp._provenance)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- }
- }
- } else if (temp._provenance != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
+ } else if (temp._id != null)
return false;
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'modifiable'.
- *
- * @return the value of field 'Modifiable'.
- */
- public java.lang.String getModifiable(
- ) {
- return this._modifiable;
- }
-
- /**
- * Method getNewick.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Newick at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Newick getNewick(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._newickList.size()) {
- throw new IndexOutOfBoundsException("getNewick: Index value '" + index + "' not in range [0.." + (this._newickList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Newick) _newickList.get(index);
- }
-
- /**
- * Method getNewick.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Newick[] getNewick(
- ) {
- uk.ac.vamsas.objects.core.Newick[] array = new uk.ac.vamsas.objects.core.Newick[0];
- return (uk.ac.vamsas.objects.core.Newick[]) this._newickList.toArray(array);
- }
-
- /**
- * Method getNewickAsReference.Returns a reference to
- * '_newickList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getNewickAsReference(
- ) {
- return this._newickList;
- }
-
- /**
- * Method getNewickCount.
- *
- * @return the size of this collection
- */
- public int getNewickCount(
- ) {
- return this._newickList.size();
- }
-
- /**
- * Method getProperty.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Property
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Property getProperty(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("getProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
- }
-
- /**
- * Method getProperty.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Property[] getProperty(
- ) {
- uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
- return (uk.ac.vamsas.objects.core.Property[]) this._propertyList.toArray(array);
- }
-
- /**
- * Method getPropertyAsReference.Returns a reference to
- * '_propertyList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getPropertyAsReference(
- ) {
- return this._propertyList;
- }
-
- /**
- * Method getPropertyCount.
- *
- * @return the size of this collection
- */
- public int getPropertyCount(
- ) {
- return this._propertyList.size();
- }
-
- /**
- * Returns the value of field 'provenance'.
- *
- * @return the value of field 'Provenance'.
- */
- public uk.ac.vamsas.objects.core.Provenance getProvenance(
- ) {
- return this._provenance;
- }
-
- /**
- * Returns the value of field 'title'.
- *
- * @return the value of field 'Title'.
- */
- public java.lang.String getTitle(
- ) {
- return this._title;
- }
-
- /**
- * Method getTreenode.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Treenode
- * at the given index
- */
- public uk.ac.vamsas.objects.core.Treenode getTreenode(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treenodeList.size()) {
- throw new IndexOutOfBoundsException("getTreenode: Index value '" + index + "' not in range [0.." + (this._treenodeList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Treenode) _treenodeList.get(index);
- }
-
- /**
- * Method getTreenode.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Treenode[] getTreenode(
- ) {
- uk.ac.vamsas.objects.core.Treenode[] array = new uk.ac.vamsas.objects.core.Treenode[0];
- return (uk.ac.vamsas.objects.core.Treenode[]) this._treenodeList.toArray(array);
- }
-
- /**
- * Method getTreenodeAsReference.Returns a reference to
- * '_treenodeList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getTreenodeAsReference(
- ) {
- return this._treenodeList;
- }
-
- /**
- * Method getTreenodeCount.
- *
- * @return the size of this collection
- */
- public int getTreenodeCount(
- ) {
- return this._treenodeList.size();
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_modifiable != null
- && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
- result = 37 * result + _modifiable.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
- }
- if (_title != null
- && !org.castor.util.CycleBreaker.startingToCycle(_title)) {
- result = 37 * result + _title.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_title);
+ if (this._modifiable != null) {
+ if (temp._modifiable == null)
+ return false;
+ if (this._modifiable != temp._modifiable) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._modifiable);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._modifiable);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._modifiable.equals(temp._modifiable)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
}
- if (_newickList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_newickList)) {
- result = 37 * result + _newickList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_newickList);
+ } else if (temp._modifiable != null)
+ return false;
+ if (this._title != null) {
+ if (temp._title == null)
+ return false;
+ if (this._title != temp._title) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._title);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._title);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._title.equals(temp._title)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._title);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._title);
+ }
}
- if (_treenodeList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_treenodeList)) {
- result = 37 * result + _treenodeList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_treenodeList);
+ } else if (temp._title != null)
+ return false;
+ if (this._newickList != null) {
+ if (temp._newickList == null)
+ return false;
+ if (this._newickList != temp._newickList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._newickList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._newickList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._newickList.equals(temp._newickList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._newickList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._newickList);
+ }
}
- if (_propertyList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
- result = 37 * result + _propertyList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
+ } else if (temp._newickList != null)
+ return false;
+ if (this._treenodeList != null) {
+ if (temp._treenodeList == null)
+ return false;
+ if (this._treenodeList != temp._treenodeList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._treenodeList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._treenodeList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._treenodeList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._treenodeList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._treenodeList.equals(temp._treenodeList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._treenodeList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._treenodeList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treenodeList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treenodeList);
+ }
}
- if (_provenance != null
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
- result = 37 * result + _provenance.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
+ } else if (temp._treenodeList != null)
+ return false;
+ if (this._propertyList != null) {
+ if (temp._propertyList == null)
+ return false;
+ if (this._propertyList != temp._propertyList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._propertyList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._propertyList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._propertyList.equals(temp._propertyList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._propertyList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._propertyList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._propertyList);
+ }
}
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ } else if (temp._propertyList != null)
+ return false;
+ if (this._provenance != null) {
+ if (temp._provenance == null)
+ return false;
+ if (this._provenance != temp._provenance) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._provenance);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._provenance);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._provenance.equals(temp._provenance)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllNewick(
- ) {
- this._newickList.clear();
- }
-
- /**
- */
- public void removeAllProperty(
- ) {
- this._propertyList.clear();
- }
-
- /**
- */
- public void removeAllTreenode(
- ) {
- this._treenodeList.clear();
- }
-
- /**
- * Method removeNewick.
- *
- * @param vNewick
- * @return true if the object was removed from the collection.
- */
- public boolean removeNewick(
- final uk.ac.vamsas.objects.core.Newick vNewick) {
- boolean removed = _newickList.remove(vNewick);
- return removed;
- }
-
- /**
- * Method removeNewickAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Newick removeNewickAt(
- final int index) {
- java.lang.Object obj = this._newickList.remove(index);
- return (uk.ac.vamsas.objects.core.Newick) obj;
- }
-
- /**
- * Method removeProperty.
- *
- * @param vProperty
- * @return true if the object was removed from the collection.
- */
- public boolean removeProperty(
- final uk.ac.vamsas.objects.core.Property vProperty) {
- boolean removed = _propertyList.remove(vProperty);
- return removed;
- }
-
- /**
- * Method removePropertyAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Property removePropertyAt(
- final int index) {
- java.lang.Object obj = this._propertyList.remove(index);
- return (uk.ac.vamsas.objects.core.Property) obj;
- }
-
- /**
- * Method removeTreenode.
- *
- * @param vTreenode
- * @return true if the object was removed from the collection.
- */
- public boolean removeTreenode(
- final uk.ac.vamsas.objects.core.Treenode vTreenode) {
- boolean removed = _treenodeList.remove(vTreenode);
- return removed;
+ } else if (temp._provenance != null)
+ return false;
+ return true;
}
-
- /**
- * Method removeTreenodeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Treenode removeTreenodeAt(
- final int index) {
- java.lang.Object obj = this._treenodeList.remove(index);
- return (uk.ac.vamsas.objects.core.Treenode) obj;
+ return false;
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'modifiable'.
+ *
+ * @return the value of field 'Modifiable'.
+ */
+ public java.lang.String getModifiable() {
+ return this._modifiable;
+ }
+
+ /**
+ * Method getNewick.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Newick at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Newick getNewick(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._newickList.size()) {
+ throw new IndexOutOfBoundsException("getNewick: Index value '" + index
+ + "' not in range [0.." + (this._newickList.size() - 1) + "]");
}
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
+ return (uk.ac.vamsas.objects.core.Newick) _newickList.get(index);
+ }
+
+ /**
+ * Method getNewick.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Newick[] getNewick() {
+ uk.ac.vamsas.objects.core.Newick[] array = new uk.ac.vamsas.objects.core.Newick[0];
+ return (uk.ac.vamsas.objects.core.Newick[]) this._newickList.toArray(array);
+ }
+
+ /**
+ * Method getNewickAsReference.Returns a reference to '_newickList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getNewickAsReference() {
+ return this._newickList;
+ }
+
+ /**
+ * Method getNewickCount.
+ *
+ * @return the size of this collection
+ */
+ public int getNewickCount() {
+ return this._newickList.size();
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Property at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Property getProperty(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("getProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
}
- /**
- * Sets the value of field 'modifiable'.
- *
- * @param modifiable the value of field 'modifiable'.
- */
- public void setModifiable(
- final java.lang.String modifiable) {
- this._modifiable = modifiable;
+ return (uk.ac.vamsas.objects.core.Property) _propertyList.get(index);
+ }
+
+ /**
+ * Method getProperty.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Property[] getProperty() {
+ uk.ac.vamsas.objects.core.Property[] array = new uk.ac.vamsas.objects.core.Property[0];
+ return (uk.ac.vamsas.objects.core.Property[]) this._propertyList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPropertyAsReference.Returns a reference to '_propertyList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getPropertyAsReference() {
+ return this._propertyList;
+ }
+
+ /**
+ * Method getPropertyCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPropertyCount() {
+ return this._propertyList.size();
+ }
+
+ /**
+ * Returns the value of field 'provenance'.
+ *
+ * @return the value of field 'Provenance'.
+ */
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {
+ return this._provenance;
+ }
+
+ /**
+ * Returns the value of field 'title'.
+ *
+ * @return the value of field 'Title'.
+ */
+ public java.lang.String getTitle() {
+ return this._title;
+ }
+
+ /**
+ * Method getTreenode.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Treenode at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Treenode getTreenode(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treenodeList.size()) {
+ throw new IndexOutOfBoundsException("getTreenode: Index value '" + index
+ + "' not in range [0.." + (this._treenodeList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vNewick
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setNewick(
- final int index,
- final uk.ac.vamsas.objects.core.Newick vNewick)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._newickList.size()) {
- throw new IndexOutOfBoundsException("setNewick: Index value '" + index + "' not in range [0.." + (this._newickList.size() - 1) + "]");
- }
-
- this._newickList.set(index, vNewick);
+ return (uk.ac.vamsas.objects.core.Treenode) _treenodeList.get(index);
+ }
+
+ /**
+ * Method getTreenode.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Treenode[] getTreenode() {
+ uk.ac.vamsas.objects.core.Treenode[] array = new uk.ac.vamsas.objects.core.Treenode[0];
+ return (uk.ac.vamsas.objects.core.Treenode[]) this._treenodeList
+ .toArray(array);
+ }
+
+ /**
+ * Method getTreenodeAsReference.Returns a reference to '_treenodeList'. No
+ * type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getTreenodeAsReference() {
+ return this._treenodeList;
+ }
+
+ /**
+ * Method getTreenodeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreenodeCount() {
+ return this._treenodeList.size();
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
}
-
- /**
- *
- *
- * @param vNewickArray
- */
- public void setNewick(
- final uk.ac.vamsas.objects.core.Newick[] vNewickArray) {
- //-- copy array
- _newickList.clear();
-
- for (int i = 0; i < vNewickArray.length; i++) {
- this._newickList.add(vNewickArray[i]);
- }
+ if (_modifiable != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
+ result = 37 * result + _modifiable.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
}
-
- /**
- * Sets the value of '_newickList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vNewickList the Vector to copy.
- */
- public void setNewick(
- final java.util.Vector vNewickList) {
- // copy vector
- this._newickList.clear();
-
- this._newickList.addAll(vNewickList);
+ if (_title != null && !org.castor.util.CycleBreaker.startingToCycle(_title)) {
+ result = 37 * result + _title.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_title);
}
-
- /**
- * Sets the value of '_newickList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param newickVector the Vector to set.
- */
- public void setNewickAsReference(
- final java.util.Vector newickVector) {
- this._newickList = newickVector;
+ if (_newickList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_newickList)) {
+ result = 37 * result + _newickList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_newickList);
}
-
- /**
- *
- *
- * @param index
- * @param vProperty
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setProperty(
- final int index,
- final uk.ac.vamsas.objects.core.Property vProperty)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._propertyList.size()) {
- throw new IndexOutOfBoundsException("setProperty: Index value '" + index + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
- }
-
- this._propertyList.set(index, vProperty);
+ if (_treenodeList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_treenodeList)) {
+ result = 37 * result + _treenodeList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_treenodeList);
}
-
- /**
- *
- *
- * @param vPropertyArray
- */
- public void setProperty(
- final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
- //-- copy array
- _propertyList.clear();
-
- for (int i = 0; i < vPropertyArray.length; i++) {
- this._propertyList.add(vPropertyArray[i]);
- }
+ if (_propertyList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_propertyList)) {
+ result = 37 * result + _propertyList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_propertyList);
}
-
- /**
- * Sets the value of '_propertyList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vPropertyList the Vector to copy.
- */
- public void setProperty(
- final java.util.Vector vPropertyList) {
- // copy vector
- this._propertyList.clear();
-
- this._propertyList.addAll(vPropertyList);
+ if (_provenance != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
+ result = 37 * result + _provenance.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
}
- /**
- * Sets the value of '_propertyList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param propertyVector the Vector to set.
- */
- public void setPropertyAsReference(
- final java.util.Vector propertyVector) {
- this._propertyList = propertyVector;
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
-
- /**
- * Sets the value of field 'provenance'.
- *
- * @param provenance the value of field 'provenance'.
- */
- public void setProvenance(
- final uk.ac.vamsas.objects.core.Provenance provenance) {
- this._provenance = provenance;
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllNewick() {
+ this._newickList.clear();
+ }
+
+ /**
+ */
+ public void removeAllProperty() {
+ this._propertyList.clear();
+ }
+
+ /**
+ */
+ public void removeAllTreenode() {
+ this._treenodeList.clear();
+ }
+
+ /**
+ * Method removeNewick.
+ *
+ * @param vNewick
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeNewick(final uk.ac.vamsas.objects.core.Newick vNewick) {
+ boolean removed = _newickList.remove(vNewick);
+ return removed;
+ }
+
+ /**
+ * Method removeNewickAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Newick removeNewickAt(final int index) {
+ java.lang.Object obj = this._newickList.remove(index);
+ return (uk.ac.vamsas.objects.core.Newick) obj;
+ }
+
+ /**
+ * Method removeProperty.
+ *
+ * @param vProperty
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeProperty(
+ final uk.ac.vamsas.objects.core.Property vProperty) {
+ boolean removed = _propertyList.remove(vProperty);
+ return removed;
+ }
+
+ /**
+ * Method removePropertyAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Property removePropertyAt(final int index) {
+ java.lang.Object obj = this._propertyList.remove(index);
+ return (uk.ac.vamsas.objects.core.Property) obj;
+ }
+
+ /**
+ * Method removeTreenode.
+ *
+ * @param vTreenode
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTreenode(
+ final uk.ac.vamsas.objects.core.Treenode vTreenode) {
+ boolean removed = _treenodeList.remove(vTreenode);
+ return removed;
+ }
+
+ /**
+ * Method removeTreenodeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Treenode removeTreenodeAt(final int index) {
+ java.lang.Object obj = this._treenodeList.remove(index);
+ return (uk.ac.vamsas.objects.core.Treenode) obj;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'modifiable'.
+ *
+ * @param modifiable
+ * the value of field 'modifiable'.
+ */
+ public void setModifiable(final java.lang.String modifiable) {
+ this._modifiable = modifiable;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vNewick
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setNewick(final int index,
+ final uk.ac.vamsas.objects.core.Newick vNewick)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._newickList.size()) {
+ throw new IndexOutOfBoundsException("setNewick: Index value '" + index
+ + "' not in range [0.." + (this._newickList.size() - 1) + "]");
}
- /**
- * Sets the value of field 'title'.
- *
- * @param title the value of field 'title'.
- */
- public void setTitle(
- final java.lang.String title) {
- this._title = title;
- }
+ this._newickList.set(index, vNewick);
+ }
- /**
- *
- *
- * @param index
- * @param vTreenode
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setTreenode(
- final int index,
- final uk.ac.vamsas.objects.core.Treenode vTreenode)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treenodeList.size()) {
- throw new IndexOutOfBoundsException("setTreenode: Index value '" + index + "' not in range [0.." + (this._treenodeList.size() - 1) + "]");
- }
-
- this._treenodeList.set(index, vTreenode);
- }
+ /**
+ *
+ *
+ * @param vNewickArray
+ */
+ public void setNewick(final uk.ac.vamsas.objects.core.Newick[] vNewickArray) {
+ // -- copy array
+ _newickList.clear();
- /**
- *
- *
- * @param vTreenodeArray
- */
- public void setTreenode(
- final uk.ac.vamsas.objects.core.Treenode[] vTreenodeArray) {
- //-- copy array
- _treenodeList.clear();
-
- for (int i = 0; i < vTreenodeArray.length; i++) {
- this._treenodeList.add(vTreenodeArray[i]);
- }
+ for (int i = 0; i < vNewickArray.length; i++) {
+ this._newickList.add(vNewickArray[i]);
}
-
- /**
- * Sets the value of '_treenodeList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vTreenodeList the Vector to copy.
- */
- public void setTreenode(
- final java.util.Vector vTreenodeList) {
- // copy vector
- this._treenodeList.clear();
-
- this._treenodeList.addAll(vTreenodeList);
+ }
+
+ /**
+ * Sets the value of '_newickList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vNewickList
+ * the Vector to copy.
+ */
+ public void setNewick(final java.util.Vector vNewickList) {
+ // copy vector
+ this._newickList.clear();
+
+ this._newickList.addAll(vNewickList);
+ }
+
+ /**
+ * Sets the value of '_newickList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param newickVector
+ * the Vector to set.
+ */
+ public void setNewickAsReference(final java.util.Vector newickVector) {
+ this._newickList = newickVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vProperty
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setProperty(final int index,
+ final uk.ac.vamsas.objects.core.Property vProperty)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._propertyList.size()) {
+ throw new IndexOutOfBoundsException("setProperty: Index value '" + index
+ + "' not in range [0.." + (this._propertyList.size() - 1) + "]");
}
- /**
- * Sets the value of '_treenodeList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param treenodeVector the Vector to set.
- */
- public void setTreenodeAsReference(
- final java.util.Vector treenodeVector) {
- this._treenodeList = treenodeVector;
+ this._propertyList.set(index, vProperty);
+ }
+
+ /**
+ *
+ *
+ * @param vPropertyArray
+ */
+ public void setProperty(
+ final uk.ac.vamsas.objects.core.Property[] vPropertyArray) {
+ // -- copy array
+ _propertyList.clear();
+
+ for (int i = 0; i < vPropertyArray.length; i++) {
+ this._propertyList.add(vPropertyArray[i]);
}
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.Tree
- */
- public static uk.ac.vamsas.objects.core.Tree unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.Tree) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Tree.class, reader);
+ }
+
+ /**
+ * Sets the value of '_propertyList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vPropertyList
+ * the Vector to copy.
+ */
+ public void setProperty(final java.util.Vector vPropertyList) {
+ // copy vector
+ this._propertyList.clear();
+
+ this._propertyList.addAll(vPropertyList);
+ }
+
+ /**
+ * Sets the value of '_propertyList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param propertyVector
+ * the Vector to set.
+ */
+ public void setPropertyAsReference(final java.util.Vector propertyVector) {
+ this._propertyList = propertyVector;
+ }
+
+ /**
+ * Sets the value of field 'provenance'.
+ *
+ * @param provenance
+ * the value of field 'provenance'.
+ */
+ public void setProvenance(
+ final uk.ac.vamsas.objects.core.Provenance provenance) {
+ this._provenance = provenance;
+ }
+
+ /**
+ * Sets the value of field 'title'.
+ *
+ * @param title
+ * the value of field 'title'.
+ */
+ public void setTitle(final java.lang.String title) {
+ this._title = title;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTreenode
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTreenode(final int index,
+ final uk.ac.vamsas.objects.core.Treenode vTreenode)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treenodeList.size()) {
+ throw new IndexOutOfBoundsException("setTreenode: Index value '" + index
+ + "' not in range [0.." + (this._treenodeList.size() - 1) + "]");
}
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ this._treenodeList.set(index, vTreenode);
+ }
+
+ /**
+ *
+ *
+ * @param vTreenodeArray
+ */
+ public void setTreenode(
+ final uk.ac.vamsas.objects.core.Treenode[] vTreenodeArray) {
+ // -- copy array
+ _treenodeList.clear();
+
+ for (int i = 0; i < vTreenodeArray.length; i++) {
+ this._treenodeList.add(vTreenodeArray[i]);
}
+ }
+
+ /**
+ * Sets the value of '_treenodeList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vTreenodeList
+ * the Vector to copy.
+ */
+ public void setTreenode(final java.util.Vector vTreenodeList) {
+ // copy vector
+ this._treenodeList.clear();
+
+ this._treenodeList.addAll(vTreenodeList);
+ }
+
+ /**
+ * Sets the value of '_treenodeList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param treenodeVector
+ * the Vector to set.
+ */
+ public void setTreenodeAsReference(final java.util.Vector treenodeVector) {
+ this._treenodeList = treenodeVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.Tree
+ */
+ public static uk.ac.vamsas.objects.core.Tree unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.Tree) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.Tree.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * node identity and mapping data between tree\r
- * representations and vamsas document objects \r
+ * node identity and mapping data between tree representations and vamsas\r
+ * document objects\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Treenode extends uk.ac.vamsas.objects.core.NodeType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * reference to one or more trees containing\r
- * the node being described. \r
- */\r
- private java.util.Vector _treeId;\r
-\r
- /**\r
- * String uniquely identifying a particular\r
- * node in the referenced tree according to the format of\r
- * the tree representation that is referenced.\r
- * \r
- */\r
- private java.lang.String _nodespec;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Treenode() {\r
- super();\r
- this._treeId = new java.util.Vector();\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * \r
- * \r
- * @param vTreeId\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addTreeId(\r
- final java.lang.Object vTreeId)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._treeId.addElement(vTreeId);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vTreeId\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void addTreeId(\r
- final int index,\r
- final java.lang.Object vTreeId)\r
- throws java.lang.IndexOutOfBoundsException {\r
- this._treeId.add(index, vTreeId);\r
- }\r
-\r
- /**\r
- * Method enumerateTreeId.\r
- * \r
- * @return an Enumeration over all java.lang.Object elements\r
- */\r
- public java.util.Enumeration enumerateTreeId(\r
- ) {\r
- return this._treeId.elements();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
+public class Treenode extends uk.ac.vamsas.objects.core.NodeType implements\r
+ java.io.Serializable {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * reference to one or more trees containing the node being described.\r
+ */\r
+ private java.util.Vector _treeId;\r
+\r
+ /**\r
+ * String uniquely identifying a particular node in the referenced tree\r
+ * according to the format of the tree representation that is referenced.\r
+ * \r
+ */\r
+ private java.lang.String _nodespec;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public Treenode() {\r
+ super();\r
+ this._treeId = new java.util.Vector();\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param vTreeId\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addTreeId(final java.lang.Object vTreeId)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._treeId.addElement(vTreeId);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vTreeId\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void addTreeId(final int index, final java.lang.Object vTreeId)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ this._treeId.add(index, vTreeId);\r
+ }\r
+\r
+ /**\r
+ * Method enumerateTreeId.\r
+ * \r
+ * @return an Enumeration over all java.lang.Object elements\r
+ */\r
+ public java.util.Enumeration enumerateTreeId() {\r
+ return this._treeId.elements();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
+\r
+ if (super.equals(obj) == false)\r
+ return false;\r
+\r
+ if (obj instanceof Treenode) {\r
+\r
+ Treenode temp = (Treenode) obj;\r
+ boolean thcycle;\r
+ boolean tmcycle;\r
+ if (this._treeId != null) {\r
+ if (temp._treeId == null)\r
+ return false;\r
+ if (this._treeId != temp._treeId) {\r
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._treeId);\r
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._treeId);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeId);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeId);\r
+ }\r
+ ;\r
return false;\r
- \r
- if (obj instanceof Treenode) {\r
- \r
- Treenode temp = (Treenode)obj;\r
- boolean thcycle;\r
- boolean tmcycle;\r
- if (this._treeId != null) {\r
- if (temp._treeId == null) return false;\r
- if (this._treeId != temp._treeId) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._treeId);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._treeId);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._treeId); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeId); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._treeId.equals(temp._treeId)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeId);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeId);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeId);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeId);\r
- }\r
- }\r
- } else if (temp._treeId != null)\r
- return false;\r
- if (this._nodespec != null) {\r
- if (temp._nodespec == null) return false;\r
- if (this._nodespec != temp._nodespec) {\r
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._nodespec);\r
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._nodespec);\r
- if (thcycle!=tmcycle) {\r
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._nodespec); };\r
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._nodespec); };\r
- return false;\r
- }\r
- if (!thcycle) {\r
- if (!this._nodespec.equals(temp._nodespec)) {\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._nodespec);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._nodespec);\r
- return false;\r
- }\r
- org.castor.util.CycleBreaker.releaseCycleHandle(this._nodespec);\r
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._nodespec);\r
- }\r
- }\r
- } else if (temp._nodespec != null)\r
- return false;\r
- return true;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._treeId.equals(temp._treeId)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeId);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeId);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeId);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeId);\r
+ }\r
}\r
+ } else if (temp._treeId != null)\r
return false;\r
- }\r
-\r
- /**\r
- * Returns the value of field 'nodespec'. The field 'nodespec'\r
- * has the following description: String uniquely identifying a\r
- * particular\r
- * node in the referenced tree according to the format of\r
- * the tree representation that is referenced.\r
- * \r
- * \r
- * @return the value of field 'Nodespec'.\r
- */\r
- public java.lang.String getNodespec(\r
- ) {\r
- return this._nodespec;\r
- }\r
-\r
- /**\r
- * Method getTreeId.\r
- * \r
- * @param index\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- * @return the value of the java.lang.Object at the given index\r
- */\r
- public java.lang.Object getTreeId(\r
- final int index)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._treeId.size()) {\r
- throw new IndexOutOfBoundsException("getTreeId: Index value '" + index + "' not in range [0.." + (this._treeId.size() - 1) + "]");\r
- }\r
- \r
- return _treeId.get(index);\r
- }\r
-\r
- /**\r
- * Method getTreeId.Returns the contents of the collection in\r
- * an Array. <p>Note: Just in case the collection contents\r
- * are changing in another thread, we pass a 0-length Array of\r
- * the correct type into the API call. This way we <i>know</i>\r
- * that the Array returned is of exactly the correct length.\r
- * \r
- * @return this collection as an Array\r
- */\r
- public java.lang.Object[] getTreeId(\r
- ) {\r
- java.lang.Object[] array = new java.lang.Object[0];\r
- return (java.lang.Object[]) this._treeId.toArray(array);\r
- }\r
-\r
- /**\r
- * Method getTreeIdAsReference.Returns a reference to\r
- * '_treeId'. No type checking is performed on any\r
- * modifications to the Vector.\r
- * \r
- * @return a reference to the Vector backing this class\r
- */\r
- public java.util.Vector getTreeIdAsReference(\r
- ) {\r
- return this._treeId;\r
- }\r
-\r
- /**\r
- * Method getTreeIdCount.\r
- * \r
- * @return the size of this collection\r
- */\r
- public int getTreeIdCount(\r
- ) {\r
- return this._treeId.size();\r
- }\r
-\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- if (_treeId != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_treeId)) {\r
- result = 37 * result + _treeId.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_treeId);\r
- }\r
- if (_nodespec != null\r
- && !org.castor.util.CycleBreaker.startingToCycle(_nodespec)) {\r
- result = 37 * result + _nodespec.hashCode();\r
- org.castor.util.CycleBreaker.releaseCycleHandle(_nodespec);\r
- }\r
- \r
- return result;\r
- }\r
-\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ if (this._nodespec != null) {\r
+ if (temp._nodespec == null)\r
+ return false;\r
+ if (this._nodespec != temp._nodespec) {\r
+ thcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(this._nodespec);\r
+ tmcycle = org.castor.util.CycleBreaker\r
+ .startingToCycle(temp._nodespec);\r
+ if (thcycle != tmcycle) {\r
+ if (!thcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._nodespec);\r
+ }\r
+ ;\r
+ if (!tmcycle) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._nodespec);\r
+ }\r
+ ;\r
return false;\r
+ }\r
+ if (!thcycle) {\r
+ if (!this._nodespec.equals(temp._nodespec)) {\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._nodespec);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._nodespec);\r
+ return false;\r
+ }\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._nodespec);\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._nodespec);\r
+ }\r
}\r
- return true;\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
-\r
- /**\r
- */\r
- public void removeAllTreeId(\r
- ) {\r
- this._treeId.clear();\r
+ } else if (temp._nodespec != null)\r
+ return false;\r
+ return true;\r
}\r
-\r
- /**\r
- * Method removeTreeId.\r
- * \r
- * @param vTreeId\r
- * @return true if the object was removed from the collection.\r
- */\r
- public boolean removeTreeId(\r
- final java.lang.Object vTreeId) {\r
- boolean removed = _treeId.remove(vTreeId);\r
- return removed;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Returns the value of field 'nodespec'. The field 'nodespec' has the\r
+ * following description: String uniquely identifying a particular node in the\r
+ * referenced tree according to the format of the tree representation that is\r
+ * referenced.\r
+ * \r
+ * \r
+ * @return the value of field 'Nodespec'.\r
+ */\r
+ public java.lang.String getNodespec() {\r
+ return this._nodespec;\r
+ }\r
+\r
+ /**\r
+ * Method getTreeId.\r
+ * \r
+ * @param index\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ * @return the value of the java.lang.Object at the given index\r
+ */\r
+ public java.lang.Object getTreeId(final int index)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._treeId.size()) {\r
+ throw new IndexOutOfBoundsException("getTreeId: Index value '" + index\r
+ + "' not in range [0.." + (this._treeId.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Method removeTreeIdAt.\r
- * \r
- * @param index\r
- * @return the element removed from the collection\r
- */\r
- public java.lang.Object removeTreeIdAt(\r
- final int index) {\r
- java.lang.Object obj = this._treeId.remove(index);\r
- return obj;\r
+ return _treeId.get(index);\r
+ }\r
+\r
+ /**\r
+ * Method getTreeId.Returns the contents of the collection in an Array.\r
+ * <p>\r
+ * Note: Just in case the collection contents are changing in another thread,\r
+ * we pass a 0-length Array of the correct type into the API call. This way we\r
+ * <i>know</i> that the Array returned is of exactly the correct length.\r
+ * \r
+ * @return this collection as an Array\r
+ */\r
+ public java.lang.Object[] getTreeId() {\r
+ java.lang.Object[] array = new java.lang.Object[0];\r
+ return (java.lang.Object[]) this._treeId.toArray(array);\r
+ }\r
+\r
+ /**\r
+ * Method getTreeIdAsReference.Returns a reference to '_treeId'. No type\r
+ * checking is performed on any modifications to the Vector.\r
+ * \r
+ * @return a reference to the Vector backing this class\r
+ */\r
+ public java.util.Vector getTreeIdAsReference() {\r
+ return this._treeId;\r
+ }\r
+\r
+ /**\r
+ * Method getTreeIdCount.\r
+ * \r
+ * @return the size of this collection\r
+ */\r
+ public int getTreeIdCount() {\r
+ return this._treeId.size();\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+ if (_treeId != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_treeId)) {\r
+ result = 37 * result + _treeId.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_treeId);\r
}\r
-\r
- /**\r
- * Sets the value of field 'nodespec'. The field 'nodespec' has\r
- * the following description: String uniquely identifying a\r
- * particular\r
- * node in the referenced tree according to the format of\r
- * the tree representation that is referenced.\r
- * \r
- * \r
- * @param nodespec the value of field 'nodespec'.\r
- */\r
- public void setNodespec(\r
- final java.lang.String nodespec) {\r
- this._nodespec = nodespec;\r
+ if (_nodespec != null\r
+ && !org.castor.util.CycleBreaker.startingToCycle(_nodespec)) {\r
+ result = 37 * result + _nodespec.hashCode();\r
+ org.castor.util.CycleBreaker.releaseCycleHandle(_nodespec);\r
}\r
\r
- /**\r
- * \r
- * \r
- * @param index\r
- * @param vTreeId\r
- * @throws java.lang.IndexOutOfBoundsException if the index\r
- * given is outside the bounds of the collection\r
- */\r
- public void setTreeId(\r
- final int index,\r
- final java.lang.Object vTreeId)\r
- throws java.lang.IndexOutOfBoundsException {\r
- // check bounds for index\r
- if (index < 0 || index >= this._treeId.size()) {\r
- throw new IndexOutOfBoundsException("setTreeId: Index value '" + index + "' not in range [0.." + (this._treeId.size() - 1) + "]");\r
- }\r
- \r
- this._treeId.set(index, vTreeId);\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @param vTreeIdArray\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
*/\r
- public void setTreeId(\r
- final java.lang.Object[] vTreeIdArray) {\r
- //-- copy array\r
- _treeId.clear();\r
- \r
- for (int i = 0; i < vTreeIdArray.length; i++) {\r
- this._treeId.add(vTreeIdArray[i]);\r
- }\r
+ public void removeAllTreeId() {\r
+ this._treeId.clear();\r
+ }\r
+\r
+ /**\r
+ * Method removeTreeId.\r
+ * \r
+ * @param vTreeId\r
+ * @return true if the object was removed from the collection.\r
+ */\r
+ public boolean removeTreeId(final java.lang.Object vTreeId) {\r
+ boolean removed = _treeId.remove(vTreeId);\r
+ return removed;\r
+ }\r
+\r
+ /**\r
+ * Method removeTreeIdAt.\r
+ * \r
+ * @param index\r
+ * @return the element removed from the collection\r
+ */\r
+ public java.lang.Object removeTreeIdAt(final int index) {\r
+ java.lang.Object obj = this._treeId.remove(index);\r
+ return obj;\r
+ }\r
+\r
+ /**\r
+ * Sets the value of field 'nodespec'. The field 'nodespec' has the following\r
+ * description: String uniquely identifying a particular node in the\r
+ * referenced tree according to the format of the tree representation that is\r
+ * referenced.\r
+ * \r
+ * \r
+ * @param nodespec\r
+ * the value of field 'nodespec'.\r
+ */\r
+ public void setNodespec(final java.lang.String nodespec) {\r
+ this._nodespec = nodespec;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param index\r
+ * @param vTreeId\r
+ * @throws java.lang.IndexOutOfBoundsException\r
+ * if the index given is outside the bounds of the collection\r
+ */\r
+ public void setTreeId(final int index, final java.lang.Object vTreeId)\r
+ throws java.lang.IndexOutOfBoundsException {\r
+ // check bounds for index\r
+ if (index < 0 || index >= this._treeId.size()) {\r
+ throw new IndexOutOfBoundsException("setTreeId: Index value '" + index\r
+ + "' not in range [0.." + (this._treeId.size() - 1) + "]");\r
}\r
\r
- /**\r
- * Sets the value of '_treeId' by copying the given Vector. All\r
- * elements will be checked for type safety.\r
- * \r
- * @param vTreeIdList the Vector to copy.\r
- */\r
- public void setTreeId(\r
- final java.util.Vector vTreeIdList) {\r
- // copy vector\r
- this._treeId.clear();\r
- \r
- this._treeId.addAll(vTreeIdList);\r
- }\r
+ this._treeId.set(index, vTreeId);\r
+ }\r
\r
- /**\r
- * Sets the value of '_treeId' by setting it to the given\r
- * Vector. No type checking is performed.\r
- * @deprecated\r
- * \r
- * @param treeIdVector the Vector to set.\r
- */\r
- public void setTreeIdAsReference(\r
- final java.util.Vector treeIdVector) {\r
- this._treeId = treeIdVector;\r
- }\r
+ /**\r
+ * \r
+ * \r
+ * @param vTreeIdArray\r
+ */\r
+ public void setTreeId(final java.lang.Object[] vTreeIdArray) {\r
+ // -- copy array\r
+ _treeId.clear();\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType\r
- */\r
- public static uk.ac.vamsas.objects.core.NodeType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Treenode.class, reader);\r
- }\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ for (int i = 0; i < vTreeIdArray.length; i++) {\r
+ this._treeId.add(vTreeIdArray[i]);\r
}\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_treeId' by copying the given Vector. All elements will\r
+ * be checked for type safety.\r
+ * \r
+ * @param vTreeIdList\r
+ * the Vector to copy.\r
+ */\r
+ public void setTreeId(final java.util.Vector vTreeIdList) {\r
+ // copy vector\r
+ this._treeId.clear();\r
+\r
+ this._treeId.addAll(vTreeIdList);\r
+ }\r
+\r
+ /**\r
+ * Sets the value of '_treeId' by setting it to the given Vector. No type\r
+ * checking is performed.\r
+ * \r
+ * @deprecated\r
+ * \r
+ * @param treeIdVector\r
+ * the Vector to set.\r
+ */\r
+ public void setTreeIdAsReference(final java.util.Vector treeIdVector) {\r
+ this._treeId = treeIdVector;\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.NodeType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.NodeType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.NodeType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Treenode.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class User.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class User extends uk.ac.vamsas.objects.core.AppData
-implements java.io.Serializable
-{
+public class User extends uk.ac.vamsas.objects.core.AppData implements
+ java.io.Serializable {
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
+ /**
+ * Field _fullname.
+ */
+ private java.lang.String _fullname;
- /**
- * Field _fullname.
- */
- private java.lang.String _fullname;
+ /**
+ * Field _organization.
+ */
+ private java.lang.String _organization;
- /**
- * Field _organization.
- */
- private java.lang.String _organization;
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+ public User() {
+ super();
+ }
- //----------------/
- //- Constructors -/
- //----------------/
+ // -----------/
+ // - Methods -/
+ // -----------/
- public User() {
- super();
- }
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (super.equals(obj) == false)
+ return false;
- //-----------/
- //- Methods -/
- //-----------/
+ if (obj instanceof User) {
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+ User temp = (User) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._fullname != null) {
+ if (temp._fullname == null)
+ return false;
+ if (this._fullname != temp._fullname) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._fullname);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._fullname);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname);
+ }
+ ;
return false;
-
- if (obj instanceof User) {
-
- User temp = (User)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._fullname != null) {
- if (temp._fullname == null) return false;
- if (this._fullname != temp._fullname) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._fullname);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._fullname);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname); };
- return false;
- }
- if (!thcycle) {
- if (!this._fullname.equals(temp._fullname)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname);
- }
- }
- } else if (temp._fullname != null)
- return false;
- if (this._organization != null) {
- if (temp._organization == null) return false;
- if (this._organization != temp._organization) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._organization);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._organization);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._organization); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._organization); };
- return false;
- }
- if (!thcycle) {
- if (!this._organization.equals(temp._organization)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._organization);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._organization);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._organization);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._organization);
- }
- }
- } else if (temp._organization != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._fullname.equals(temp._fullname)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._fullname);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._fullname);
+ }
}
+ } else if (temp._fullname != null)
return false;
+ if (this._organization != null) {
+ if (temp._organization == null)
+ return false;
+ if (this._organization != temp._organization) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._organization);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._organization);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._organization);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._organization);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._organization.equals(temp._organization)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._organization);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._organization);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._organization);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._organization);
+ }
+ }
+ } else if (temp._organization != null)
+ return false;
+ return true;
}
+ return false;
+ }
- /**
- * Returns the value of field 'fullname'.
- *
- * @return the value of field 'Fullname'.
- */
- public java.lang.String getFullname(
- ) {
- return this._fullname;
- }
+ /**
+ * Returns the value of field 'fullname'.
+ *
+ * @return the value of field 'Fullname'.
+ */
+ public java.lang.String getFullname() {
+ return this._fullname;
+ }
- /**
- * Returns the value of field 'organization'.
- *
- * @return the value of field 'Organization'.
- */
- public java.lang.String getOrganization(
- ) {
- return this._organization;
- }
+ /**
+ * Returns the value of field 'organization'.
+ *
+ * @return the value of field 'Organization'.
+ */
+ public java.lang.String getOrganization() {
+ return this._organization;
+ }
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_fullname != null
- && !org.castor.util.CycleBreaker.startingToCycle(_fullname)) {
- result = 37 * result + _fullname.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_fullname);
- }
- if (_organization != null
- && !org.castor.util.CycleBreaker.startingToCycle(_organization)) {
- result = 37 * result + _organization.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_organization);
- }
-
- return result;
- }
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
+ long tmp;
+ if (_fullname != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_fullname)) {
+ result = 37 * result + _fullname.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_fullname);
}
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
+ if (_organization != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_organization)) {
+ result = 37 * result + _organization.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_organization);
}
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
+ return result;
+ }
- /**
- * Sets the value of field 'fullname'.
- *
- * @param fullname the value of field 'fullname'.
- */
- public void setFullname(
- final java.lang.String fullname) {
- this._fullname = fullname;
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
+ return true;
+ }
- /**
- * Sets the value of field 'organization'.
- *
- * @param organization the value of field 'organization'.
- */
- public void setOrganization(
- final java.lang.String organization) {
- this._organization = organization;
- }
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.AppData
- */
- public static uk.ac.vamsas.objects.core.AppData unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.User.class, reader);
- }
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ /**
+ * Sets the value of field 'fullname'.
+ *
+ * @param fullname
+ * the value of field 'fullname'.
+ */
+ public void setFullname(final java.lang.String fullname) {
+ this._fullname = fullname;
+ }
+
+ /**
+ * Sets the value of field 'organization'.
+ *
+ * @param organization
+ * the value of field 'organization'.
+ */
+ public void setOrganization(final java.lang.String organization) {
+ this._organization = organization;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.AppData
+ */
+ public static uk.ac.vamsas.objects.core.AppData unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.User.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* contains unassociated trees and a number of analysis sets
- *
*
- * @version $Revision$ $Date$
+ *
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class VAMSAS extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Primary Key for vamsas object referencing
- */
- private java.lang.String _id;
-
- /**
- * Field _modifiable.
- */
- private java.lang.String _modifiable;
-
- /**
- * Field _treeList.
- */
- private java.util.Vector _treeList;
-
- /**
- * Field _dataSetList.
- */
- private java.util.Vector _dataSetList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VAMSAS() {
- super();
- this._treeList = new java.util.Vector();
- this._dataSetList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vDataSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDataSet(
- final uk.ac.vamsas.objects.core.DataSet vDataSet)
- throws java.lang.IndexOutOfBoundsException {
- this._dataSetList.addElement(vDataSet);
- }
-
- /**
- *
- *
- * @param index
- * @param vDataSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addDataSet(
- final int index,
- final uk.ac.vamsas.objects.core.DataSet vDataSet)
- throws java.lang.IndexOutOfBoundsException {
- this._dataSetList.add(index, vDataSet);
- }
-
- /**
- *
- *
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.addElement(vTree);
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addTree(
- final int index,
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- this._treeList.add(index, vTree);
- }
-
- /**
- * Method enumerateDataSet.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.DataSet elements
- */
- public java.util.Enumeration enumerateDataSet(
- ) {
- return this._dataSetList.elements();
- }
-
- /**
- * Method enumerateTree.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Tree elements
- */
- public java.util.Enumeration enumerateTree(
- ) {
- return this._treeList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class VAMSAS extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Primary Key for vamsas object referencing
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _modifiable.
+ */
+ private java.lang.String _modifiable;
+
+ /**
+ * Field _treeList.
+ */
+ private java.util.Vector _treeList;
+
+ /**
+ * Field _dataSetList.
+ */
+ private java.util.Vector _dataSetList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public VAMSAS() {
+ super();
+ this._treeList = new java.util.Vector();
+ this._dataSetList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vDataSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDataSet(final uk.ac.vamsas.objects.core.DataSet vDataSet)
+ throws java.lang.IndexOutOfBoundsException {
+ this._dataSetList.addElement(vDataSet);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDataSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addDataSet(final int index,
+ final uk.ac.vamsas.objects.core.DataSet vDataSet)
+ throws java.lang.IndexOutOfBoundsException {
+ this._dataSetList.add(index, vDataSet);
+ }
+
+ /**
+ *
+ *
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treeList.addElement(vTree);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addTree(final int index,
+ final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ this._treeList.add(index, vTree);
+ }
+
+ /**
+ * Method enumerateDataSet.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.DataSet elements
+ */
+ public java.util.Enumeration enumerateDataSet() {
+ return this._dataSetList.elements();
+ }
+
+ /**
+ * Method enumerateTree.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Tree elements
+ */
+ public java.util.Enumeration enumerateTree() {
+ return this._treeList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof VAMSAS) {
+
+ VAMSAS temp = (VAMSAS) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._id != null) {
+ if (temp._id == null)
+ return false;
+ if (this._id != temp._id) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._id);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._id);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
+ ;
return false;
-
- if (obj instanceof VAMSAS) {
-
- VAMSAS temp = (VAMSAS)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._id != null) {
- if (temp._id == null) return false;
- if (this._id != temp._id) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };
- return false;
- }
- if (!thcycle) {
- if (!this._id.equals(temp._id)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
- }
- }
- } else if (temp._id != null)
- return false;
- if (this._modifiable != null) {
- if (temp._modifiable == null) return false;
- if (this._modifiable != temp._modifiable) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._modifiable);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._modifiable);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable); };
- return false;
- }
- if (!thcycle) {
- if (!this._modifiable.equals(temp._modifiable)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
- }
- }
- } else if (temp._modifiable != null)
- return false;
- if (this._treeList != null) {
- if (temp._treeList == null) return false;
- if (this._treeList != temp._treeList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._treeList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._treeList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList); };
- return false;
- }
- if (!thcycle) {
- if (!this._treeList.equals(temp._treeList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
- }
- }
- } else if (temp._treeList != null)
- return false;
- if (this._dataSetList != null) {
- if (temp._dataSetList == null) return false;
- if (this._dataSetList != temp._dataSetList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._dataSetList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._dataSetList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetList); };
- return false;
- }
- if (!thcycle) {
- if (!this._dataSetList.equals(temp._dataSetList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetList);
- }
- }
- } else if (temp._dataSetList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._id.equals(temp._id)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._id);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);
+ }
}
+ } else if (temp._id != null)
return false;
- }
-
- /**
- * Method getDataSet.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.DataSet
- * at the given index
- */
- public uk.ac.vamsas.objects.core.DataSet getDataSet(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._dataSetList.size()) {
- throw new IndexOutOfBoundsException("getDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.DataSet) _dataSetList.get(index);
- }
-
- /**
- * Method getDataSet.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.DataSet[] getDataSet(
- ) {
- uk.ac.vamsas.objects.core.DataSet[] array = new uk.ac.vamsas.objects.core.DataSet[0];
- return (uk.ac.vamsas.objects.core.DataSet[]) this._dataSetList.toArray(array);
- }
-
- /**
- * Method getDataSetAsReference.Returns a reference to
- * '_dataSetList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getDataSetAsReference(
- ) {
- return this._dataSetList;
- }
-
- /**
- * Method getDataSetCount.
- *
- * @return the size of this collection
- */
- public int getDataSetCount(
- ) {
- return this._dataSetList.size();
- }
-
- /**
- * Returns the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Returns the value of field 'modifiable'.
- *
- * @return the value of field 'Modifiable'.
- */
- public java.lang.String getModifiable(
- ) {
- return this._modifiable;
- }
-
- /**
- * Method getTree.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.Tree at
- * the given index
- */
- public uk.ac.vamsas.objects.core.Tree getTree(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("getTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
- }
-
- /**
- * Method getTree.Returns the contents of the collection in an
- * Array. <p>Note: Just in case the collection contents are
- * changing in another thread, we pass a 0-length Array of the
- * correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Tree[] getTree(
- ) {
- uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
- return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
- }
-
- /**
- * Method getTreeAsReference.Returns a reference to
- * '_treeList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getTreeAsReference(
- ) {
- return this._treeList;
- }
-
- /**
- * Method getTreeCount.
- *
- * @return the size of this collection
- */
- public int getTreeCount(
- ) {
- return this._treeList.size();
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_id != null
- && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
- result = 37 * result + _id.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_id);
- }
- if (_modifiable != null
- && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
- result = 37 * result + _modifiable.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
- }
- if (_treeList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
- result = 37 * result + _treeList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
- }
- if (_dataSetList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_dataSetList)) {
- result = 37 * result + _dataSetList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_dataSetList);
- }
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ if (this._modifiable != null) {
+ if (temp._modifiable == null)
+ return false;
+ if (this._modifiable != temp._modifiable) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._modifiable);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._modifiable);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._modifiable.equals(temp._modifiable)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._modifiable);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._modifiable);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllDataSet(
- ) {
- this._dataSetList.clear();
- }
-
- /**
- */
- public void removeAllTree(
- ) {
- this._treeList.clear();
- }
-
- /**
- * Method removeDataSet.
- *
- * @param vDataSet
- * @return true if the object was removed from the collection.
- */
- public boolean removeDataSet(
- final uk.ac.vamsas.objects.core.DataSet vDataSet) {
- boolean removed = _dataSetList.remove(vDataSet);
- return removed;
- }
-
- /**
- * Method removeDataSetAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.DataSet removeDataSetAt(
- final int index) {
- java.lang.Object obj = this._dataSetList.remove(index);
- return (uk.ac.vamsas.objects.core.DataSet) obj;
- }
-
- /**
- * Method removeTree.
- *
- * @param vTree
- * @return true if the object was removed from the collection.
- */
- public boolean removeTree(
- final uk.ac.vamsas.objects.core.Tree vTree) {
- boolean removed = _treeList.remove(vTree);
- return removed;
- }
-
- /**
- * Method removeTreeAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Tree removeTreeAt(
- final int index) {
- java.lang.Object obj = this._treeList.remove(index);
- return (uk.ac.vamsas.objects.core.Tree) obj;
- }
-
- /**
- *
- *
- * @param index
- * @param vDataSet
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setDataSet(
- final int index,
- final uk.ac.vamsas.objects.core.DataSet vDataSet)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._dataSetList.size()) {
- throw new IndexOutOfBoundsException("setDataSet: Index value '" + index + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
- }
-
- this._dataSetList.set(index, vDataSet);
- }
-
- /**
- *
- *
- * @param vDataSetArray
- */
- public void setDataSet(
- final uk.ac.vamsas.objects.core.DataSet[] vDataSetArray) {
- //-- copy array
- _dataSetList.clear();
-
- for (int i = 0; i < vDataSetArray.length; i++) {
- this._dataSetList.add(vDataSetArray[i]);
- }
- }
-
- /**
- * Sets the value of '_dataSetList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vDataSetList the Vector to copy.
- */
- public void setDataSet(
- final java.util.Vector vDataSetList) {
- // copy vector
- this._dataSetList.clear();
-
- this._dataSetList.addAll(vDataSetList);
- }
-
- /**
- * Sets the value of '_dataSetList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param dataSetVector the Vector to set.
- */
- public void setDataSetAsReference(
- final java.util.Vector dataSetVector) {
- this._dataSetList = dataSetVector;
- }
-
- /**
- * Sets the value of field 'id'. The field 'id' has the
- * following description: Primary Key for vamsas object
- * referencing
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- * Sets the value of field 'modifiable'.
- *
- * @param modifiable the value of field 'modifiable'.
- */
- public void setModifiable(
- final java.lang.String modifiable) {
- this._modifiable = modifiable;
- }
-
- /**
- *
- *
- * @param index
- * @param vTree
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setTree(
- final int index,
- final uk.ac.vamsas.objects.core.Tree vTree)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._treeList.size()) {
- throw new IndexOutOfBoundsException("setTree: Index value '" + index + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ } else if (temp._modifiable != null)
+ return false;
+ if (this._treeList != null) {
+ if (temp._treeList == null)
+ return false;
+ if (this._treeList != temp._treeList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._treeList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._treeList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._treeList.equals(temp._treeList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._treeList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._treeList);
+ }
}
-
- this._treeList.set(index, vTree);
- }
-
- /**
- *
- *
- * @param vTreeArray
- */
- public void setTree(
- final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
- //-- copy array
- _treeList.clear();
-
- for (int i = 0; i < vTreeArray.length; i++) {
- this._treeList.add(vTreeArray[i]);
+ } else if (temp._treeList != null)
+ return false;
+ if (this._dataSetList != null) {
+ if (temp._dataSetList == null)
+ return false;
+ if (this._dataSetList != temp._dataSetList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._dataSetList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._dataSetList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._dataSetList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._dataSetList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._dataSetList.equals(temp._dataSetList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._dataSetList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._dataSetList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._dataSetList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._dataSetList);
+ }
}
- }
-
- /**
- * Sets the value of '_treeList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vTreeList the Vector to copy.
- */
- public void setTree(
- final java.util.Vector vTreeList) {
- // copy vector
- this._treeList.clear();
-
- this._treeList.addAll(vTreeList);
- }
-
- /**
- * Sets the value of '_treeList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param treeVector the Vector to set.
- */
- public void setTreeAsReference(
- final java.util.Vector treeVector) {
- this._treeList = treeVector;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled uk.ac.vamsas.objects.core.VAMSAS
- */
- public static uk.ac.vamsas.objects.core.VAMSAS unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.VAMSAS) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VAMSAS.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+ } else if (temp._dataSetList != null)
+ return false;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method getDataSet.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.DataSet at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.DataSet getDataSet(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._dataSetList.size()) {
+ throw new IndexOutOfBoundsException("getDataSet: Index value '" + index
+ + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.DataSet) _dataSetList.get(index);
+ }
+
+ /**
+ * Method getDataSet.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.DataSet[] getDataSet() {
+ uk.ac.vamsas.objects.core.DataSet[] array = new uk.ac.vamsas.objects.core.DataSet[0];
+ return (uk.ac.vamsas.objects.core.DataSet[]) this._dataSetList
+ .toArray(array);
+ }
+
+ /**
+ * Method getDataSetAsReference.Returns a reference to '_dataSetList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getDataSetAsReference() {
+ return this._dataSetList;
+ }
+
+ /**
+ * Method getDataSetCount.
+ *
+ * @return the size of this collection
+ */
+ public int getDataSetCount() {
+ return this._dataSetList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'. The field 'id' has the following
+ * description: Primary Key for vamsas object referencing
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId() {
+ return this._id;
+ }
+
+ /**
+ * Returns the value of field 'modifiable'.
+ *
+ * @return the value of field 'Modifiable'.
+ */
+ public java.lang.String getModifiable() {
+ return this._modifiable;
+ }
+
+ /**
+ * Method getTree.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Tree at the given index
+ */
+ public uk.ac.vamsas.objects.core.Tree getTree(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size()) {
+ throw new IndexOutOfBoundsException("getTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ return (uk.ac.vamsas.objects.core.Tree) _treeList.get(index);
+ }
+
+ /**
+ * Method getTree.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Tree[] getTree() {
+ uk.ac.vamsas.objects.core.Tree[] array = new uk.ac.vamsas.objects.core.Tree[0];
+ return (uk.ac.vamsas.objects.core.Tree[]) this._treeList.toArray(array);
+ }
+
+ /**
+ * Method getTreeAsReference.Returns a reference to '_treeList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getTreeAsReference() {
+ return this._treeList;
+ }
+
+ /**
+ * Method getTreeCount.
+ *
+ * @return the size of this collection
+ */
+ public int getTreeCount() {
+ return this._treeList.size();
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_id != null && !org.castor.util.CycleBreaker.startingToCycle(_id)) {
+ result = 37 * result + _id.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_id);
+ }
+ if (_modifiable != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_modifiable)) {
+ result = 37 * result + _modifiable.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_modifiable);
+ }
+ if (_treeList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_treeList)) {
+ result = 37 * result + _treeList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_treeList);
+ }
+ if (_dataSetList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_dataSetList)) {
+ result = 37 * result + _dataSetList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_dataSetList);
+ }
+
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllDataSet() {
+ this._dataSetList.clear();
+ }
+
+ /**
+ */
+ public void removeAllTree() {
+ this._treeList.clear();
+ }
+
+ /**
+ * Method removeDataSet.
+ *
+ * @param vDataSet
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeDataSet(final uk.ac.vamsas.objects.core.DataSet vDataSet) {
+ boolean removed = _dataSetList.remove(vDataSet);
+ return removed;
+ }
+
+ /**
+ * Method removeDataSetAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.DataSet removeDataSetAt(final int index) {
+ java.lang.Object obj = this._dataSetList.remove(index);
+ return (uk.ac.vamsas.objects.core.DataSet) obj;
+ }
+
+ /**
+ * Method removeTree.
+ *
+ * @param vTree
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeTree(final uk.ac.vamsas.objects.core.Tree vTree) {
+ boolean removed = _treeList.remove(vTree);
+ return removed;
+ }
+
+ /**
+ * Method removeTreeAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Tree removeTreeAt(final int index) {
+ java.lang.Object obj = this._treeList.remove(index);
+ return (uk.ac.vamsas.objects.core.Tree) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vDataSet
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setDataSet(final int index,
+ final uk.ac.vamsas.objects.core.DataSet vDataSet)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._dataSetList.size()) {
+ throw new IndexOutOfBoundsException("setDataSet: Index value '" + index
+ + "' not in range [0.." + (this._dataSetList.size() - 1) + "]");
+ }
+
+ this._dataSetList.set(index, vDataSet);
+ }
+
+ /**
+ *
+ *
+ * @param vDataSetArray
+ */
+ public void setDataSet(final uk.ac.vamsas.objects.core.DataSet[] vDataSetArray) {
+ // -- copy array
+ _dataSetList.clear();
+
+ for (int i = 0; i < vDataSetArray.length; i++) {
+ this._dataSetList.add(vDataSetArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_dataSetList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vDataSetList
+ * the Vector to copy.
+ */
+ public void setDataSet(final java.util.Vector vDataSetList) {
+ // copy vector
+ this._dataSetList.clear();
+
+ this._dataSetList.addAll(vDataSetList);
+ }
+
+ /**
+ * Sets the value of '_dataSetList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param dataSetVector
+ * the Vector to set.
+ */
+ public void setDataSetAsReference(final java.util.Vector dataSetVector) {
+ this._dataSetList = dataSetVector;
+ }
+
+ /**
+ * Sets the value of field 'id'. The field 'id' has the following description:
+ * Primary Key for vamsas object referencing
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id) {
+ this._id = id;
+ }
+
+ /**
+ * Sets the value of field 'modifiable'.
+ *
+ * @param modifiable
+ * the value of field 'modifiable'.
+ */
+ public void setModifiable(final java.lang.String modifiable) {
+ this._modifiable = modifiable;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vTree
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setTree(final int index,
+ final uk.ac.vamsas.objects.core.Tree vTree)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._treeList.size()) {
+ throw new IndexOutOfBoundsException("setTree: Index value '" + index
+ + "' not in range [0.." + (this._treeList.size() - 1) + "]");
+ }
+
+ this._treeList.set(index, vTree);
+ }
+
+ /**
+ *
+ *
+ * @param vTreeArray
+ */
+ public void setTree(final uk.ac.vamsas.objects.core.Tree[] vTreeArray) {
+ // -- copy array
+ _treeList.clear();
+
+ for (int i = 0; i < vTreeArray.length; i++) {
+ this._treeList.add(vTreeArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of '_treeList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vTreeList
+ * the Vector to copy.
+ */
+ public void setTree(final java.util.Vector vTreeList) {
+ // copy vector
+ this._treeList.clear();
+
+ this._treeList.addAll(vTreeList);
+ }
+
+ /**
+ * Sets the value of '_treeList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param treeVector
+ * the Vector to set.
+ */
+ public void setTreeAsReference(final java.util.Vector treeVector) {
+ this._treeList = treeVector;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.VAMSAS
+ */
+ public static uk.ac.vamsas.objects.core.VAMSAS unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.VAMSAS) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.VAMSAS.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*
- * This class was automatically generated with
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
- * Schema.
- * $Id$
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
*/
-
package uk.ac.vamsas.objects.core;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
/**
* Class VamsasDocument.
*
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2007-06-28 14:51:44 +0100 (Thu, 28 Jun 2007)
+ * $
*/
-public class VamsasDocument extends uk.ac.vamsas.client.Vobject
-implements java.io.Serializable
-{
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Vamsas Document Version Number
- */
- private java.lang.String _version;
-
- /**
- * Field _lockFile.
- */
- private uk.ac.vamsas.objects.core.LockFile _lockFile;
-
- /**
- * Field _provenance.
- */
- private uk.ac.vamsas.objects.core.Provenance _provenance;
-
- /**
- * contains unassociated trees and a number of analysis sets
- *
- */
- private java.util.Vector _VAMSASList;
-
- /**
- * Field _applicationDataList.
- */
- private java.util.Vector _applicationDataList;
-
- /**
- * Field _attachmentList.
- */
- private java.util.Vector _attachmentList;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public VamsasDocument() {
- super();
- this._VAMSASList = new java.util.Vector();
- this._applicationDataList = new java.util.Vector();
- this._attachmentList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vApplicationData
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addApplicationData(
- final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
- throws java.lang.IndexOutOfBoundsException {
- this._applicationDataList.addElement(vApplicationData);
- }
-
- /**
- *
- *
- * @param index
- * @param vApplicationData
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addApplicationData(
- final int index,
- final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
- throws java.lang.IndexOutOfBoundsException {
- this._applicationDataList.add(index, vApplicationData);
- }
-
- /**
- *
- *
- * @param vAttachment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAttachment(
- final uk.ac.vamsas.objects.core.Attachment vAttachment)
- throws java.lang.IndexOutOfBoundsException {
- this._attachmentList.addElement(vAttachment);
- }
-
- /**
- *
- *
- * @param index
- * @param vAttachment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addAttachment(
- final int index,
- final uk.ac.vamsas.objects.core.Attachment vAttachment)
- throws java.lang.IndexOutOfBoundsException {
- this._attachmentList.add(index, vAttachment);
- }
-
- /**
- *
- *
- * @param vVAMSAS
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addVAMSAS(
- final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
- throws java.lang.IndexOutOfBoundsException {
- this._VAMSASList.addElement(vVAMSAS);
- }
-
- /**
- *
- *
- * @param index
- * @param vVAMSAS
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addVAMSAS(
- final int index,
- final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
- throws java.lang.IndexOutOfBoundsException {
- this._VAMSASList.add(index, vVAMSAS);
- }
-
- /**
- * Method enumerateApplicationData.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.ApplicationData elements
- */
- public java.util.Enumeration enumerateApplicationData(
- ) {
- return this._applicationDataList.elements();
- }
-
- /**
- * Method enumerateAttachment.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.Attachment elements
- */
- public java.util.Enumeration enumerateAttachment(
- ) {
- return this._attachmentList.elements();
- }
-
- /**
- * Method enumerateVAMSAS.
- *
- * @return an Enumeration over all
- * uk.ac.vamsas.objects.core.VAMSAS elements
- */
- public java.util.Enumeration enumerateVAMSAS(
- ) {
- return this._VAMSASList.elements();
- }
-
- /**
- * Overrides the java.lang.Object.equals method.
- *
- * @param obj
- * @return true if the objects are equal.
- */
- public boolean equals(
- final java.lang.Object obj) {
- if ( this == obj )
- return true;
-
- if (super.equals(obj)==false)
+public class VamsasDocument extends uk.ac.vamsas.client.Vobject implements
+ java.io.Serializable {
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Vamsas Document Version Number
+ */
+ private java.lang.String _version;
+
+ /**
+ * Field _lockFile.
+ */
+ private uk.ac.vamsas.objects.core.LockFile _lockFile;
+
+ /**
+ * Field _provenance.
+ */
+ private uk.ac.vamsas.objects.core.Provenance _provenance;
+
+ /**
+ * contains unassociated trees and a number of analysis sets
+ *
+ */
+ private java.util.Vector _VAMSASList;
+
+ /**
+ * Field _applicationDataList.
+ */
+ private java.util.Vector _applicationDataList;
+
+ /**
+ * Field _attachmentList.
+ */
+ private java.util.Vector _attachmentList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public VamsasDocument() {
+ super();
+ this._VAMSASList = new java.util.Vector();
+ this._applicationDataList = new java.util.Vector();
+ this._attachmentList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vApplicationData
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addApplicationData(
+ final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
+ throws java.lang.IndexOutOfBoundsException {
+ this._applicationDataList.addElement(vApplicationData);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vApplicationData
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addApplicationData(final int index,
+ final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
+ throws java.lang.IndexOutOfBoundsException {
+ this._applicationDataList.add(index, vApplicationData);
+ }
+
+ /**
+ *
+ *
+ * @param vAttachment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAttachment(
+ final uk.ac.vamsas.objects.core.Attachment vAttachment)
+ throws java.lang.IndexOutOfBoundsException {
+ this._attachmentList.addElement(vAttachment);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAttachment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addAttachment(final int index,
+ final uk.ac.vamsas.objects.core.Attachment vAttachment)
+ throws java.lang.IndexOutOfBoundsException {
+ this._attachmentList.add(index, vAttachment);
+ }
+
+ /**
+ *
+ *
+ * @param vVAMSAS
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
+ throws java.lang.IndexOutOfBoundsException {
+ this._VAMSASList.addElement(vVAMSAS);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vVAMSAS
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addVAMSAS(final int index,
+ final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
+ throws java.lang.IndexOutOfBoundsException {
+ this._VAMSASList.add(index, vVAMSAS);
+ }
+
+ /**
+ * Method enumerateApplicationData.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.ApplicationData
+ * elements
+ */
+ public java.util.Enumeration enumerateApplicationData() {
+ return this._applicationDataList.elements();
+ }
+
+ /**
+ * Method enumerateAttachment.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.Attachment
+ * elements
+ */
+ public java.util.Enumeration enumerateAttachment() {
+ return this._attachmentList.elements();
+ }
+
+ /**
+ * Method enumerateVAMSAS.
+ *
+ * @return an Enumeration over all uk.ac.vamsas.objects.core.VAMSAS elements
+ */
+ public java.util.Enumeration enumerateVAMSAS() {
+ return this._VAMSASList.elements();
+ }
+
+ /**
+ * Overrides the java.lang.Object.equals method.
+ *
+ * @param obj
+ * @return true if the objects are equal.
+ */
+ public boolean equals(final java.lang.Object obj) {
+ if (this == obj)
+ return true;
+
+ if (super.equals(obj) == false)
+ return false;
+
+ if (obj instanceof VamsasDocument) {
+
+ VamsasDocument temp = (VamsasDocument) obj;
+ boolean thcycle;
+ boolean tmcycle;
+ if (this._version != null) {
+ if (temp._version == null)
+ return false;
+ if (this._version != temp._version) {
+ thcycle = org.castor.util.CycleBreaker.startingToCycle(this._version);
+ tmcycle = org.castor.util.CycleBreaker.startingToCycle(temp._version);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ }
+ ;
return false;
-
- if (obj instanceof VamsasDocument) {
-
- VamsasDocument temp = (VamsasDocument)obj;
- boolean thcycle;
- boolean tmcycle;
- if (this._version != null) {
- if (temp._version == null) return false;
- if (this._version != temp._version) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._version);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._version);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._version); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._version); };
- return false;
- }
- if (!thcycle) {
- if (!this._version.equals(temp._version)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
- }
- }
- } else if (temp._version != null)
- return false;
- if (this._lockFile != null) {
- if (temp._lockFile == null) return false;
- if (this._lockFile != temp._lockFile) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._lockFile);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._lockFile);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile); };
- return false;
- }
- if (!thcycle) {
- if (!this._lockFile.equals(temp._lockFile)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
- }
- }
- } else if (temp._lockFile != null)
- return false;
- if (this._provenance != null) {
- if (temp._provenance == null) return false;
- if (this._provenance != temp._provenance) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };
- return false;
- }
- if (!thcycle) {
- if (!this._provenance.equals(temp._provenance)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
- }
- }
- } else if (temp._provenance != null)
- return false;
- if (this._VAMSASList != null) {
- if (temp._VAMSASList == null) return false;
- if (this._VAMSASList != temp._VAMSASList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._VAMSASList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._VAMSASList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList); };
- return false;
- }
- if (!thcycle) {
- if (!this._VAMSASList.equals(temp._VAMSASList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
- }
- }
- } else if (temp._VAMSASList != null)
- return false;
- if (this._applicationDataList != null) {
- if (temp._applicationDataList == null) return false;
- if (this._applicationDataList != temp._applicationDataList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._applicationDataList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._applicationDataList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._applicationDataList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._applicationDataList); };
- return false;
- }
- if (!thcycle) {
- if (!this._applicationDataList.equals(temp._applicationDataList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._applicationDataList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._applicationDataList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._applicationDataList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._applicationDataList);
- }
- }
- } else if (temp._applicationDataList != null)
- return false;
- if (this._attachmentList != null) {
- if (temp._attachmentList == null) return false;
- if (this._attachmentList != temp._attachmentList) {
- thcycle=org.castor.util.CycleBreaker.startingToCycle(this._attachmentList);
- tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._attachmentList);
- if (thcycle!=tmcycle) {
- if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._attachmentList); };
- if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._attachmentList); };
- return false;
- }
- if (!thcycle) {
- if (!this._attachmentList.equals(temp._attachmentList)) {
- org.castor.util.CycleBreaker.releaseCycleHandle(this._attachmentList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._attachmentList);
- return false;
- }
- org.castor.util.CycleBreaker.releaseCycleHandle(this._attachmentList);
- org.castor.util.CycleBreaker.releaseCycleHandle(temp._attachmentList);
- }
- }
- } else if (temp._attachmentList != null)
- return false;
- return true;
+ }
+ if (!thcycle) {
+ if (!this._version.equals(temp._version)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._version);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._version);
+ }
}
+ } else if (temp._version != null)
return false;
- }
-
- /**
- * Method getApplicationData.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * uk.ac.vamsas.objects.core.ApplicationData at the given index
- */
- public uk.ac.vamsas.objects.core.ApplicationData getApplicationData(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._applicationDataList.size()) {
- throw new IndexOutOfBoundsException("getApplicationData: Index value '" + index + "' not in range [0.." + (this._applicationDataList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.ApplicationData) _applicationDataList.get(index);
- }
-
- /**
- * Method getApplicationData.Returns the contents of the
- * collection in an Array. <p>Note: Just in case the
- * collection contents are changing in another thread, we pass
- * a 0-length Array of the correct type into the API call.
- * This way we <i>know</i> that the Array returned is of
- * exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.ApplicationData[] getApplicationData(
- ) {
- uk.ac.vamsas.objects.core.ApplicationData[] array = new uk.ac.vamsas.objects.core.ApplicationData[0];
- return (uk.ac.vamsas.objects.core.ApplicationData[]) this._applicationDataList.toArray(array);
- }
-
- /**
- * Method getApplicationDataAsReference.Returns a reference to
- * '_applicationDataList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getApplicationDataAsReference(
- ) {
- return this._applicationDataList;
- }
-
- /**
- * Method getApplicationDataCount.
- *
- * @return the size of this collection
- */
- public int getApplicationDataCount(
- ) {
- return this._applicationDataList.size();
- }
-
- /**
- * Method getAttachment.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * uk.ac.vamsas.objects.core.Attachment at the given index
- */
- public uk.ac.vamsas.objects.core.Attachment getAttachment(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._attachmentList.size()) {
- throw new IndexOutOfBoundsException("getAttachment: Index value '" + index + "' not in range [0.." + (this._attachmentList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.Attachment) _attachmentList.get(index);
- }
-
- /**
- * Method getAttachment.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.Attachment[] getAttachment(
- ) {
- uk.ac.vamsas.objects.core.Attachment[] array = new uk.ac.vamsas.objects.core.Attachment[0];
- return (uk.ac.vamsas.objects.core.Attachment[]) this._attachmentList.toArray(array);
- }
-
- /**
- * Method getAttachmentAsReference.Returns a reference to
- * '_attachmentList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getAttachmentAsReference(
- ) {
- return this._attachmentList;
- }
-
- /**
- * Method getAttachmentCount.
- *
- * @return the size of this collection
- */
- public int getAttachmentCount(
- ) {
- return this._attachmentList.size();
- }
-
- /**
- * Returns the value of field 'lockFile'.
- *
- * @return the value of field 'LockFile'.
- */
- public uk.ac.vamsas.objects.core.LockFile getLockFile(
- ) {
- return this._lockFile;
- }
-
- /**
- * Returns the value of field 'provenance'.
- *
- * @return the value of field 'Provenance'.
- */
- public uk.ac.vamsas.objects.core.Provenance getProvenance(
- ) {
- return this._provenance;
- }
-
- /**
- * Method getVAMSAS.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the uk.ac.vamsas.objects.core.VAMSAS at
- * the given index
- */
- public uk.ac.vamsas.objects.core.VAMSAS getVAMSAS(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._VAMSASList.size()) {
- throw new IndexOutOfBoundsException("getVAMSAS: Index value '" + index + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
- }
-
- return (uk.ac.vamsas.objects.core.VAMSAS) _VAMSASList.get(index);
- }
-
- /**
- * Method getVAMSAS.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public uk.ac.vamsas.objects.core.VAMSAS[] getVAMSAS(
- ) {
- uk.ac.vamsas.objects.core.VAMSAS[] array = new uk.ac.vamsas.objects.core.VAMSAS[0];
- return (uk.ac.vamsas.objects.core.VAMSAS[]) this._VAMSASList.toArray(array);
- }
-
- /**
- * Method getVAMSASAsReference.Returns a reference to
- * '_VAMSASList'. No type checking is performed on any
- * modifications to the Vector.
- *
- * @return a reference to the Vector backing this class
- */
- public java.util.Vector getVAMSASAsReference(
- ) {
- return this._VAMSASList;
- }
-
- /**
- * Method getVAMSASCount.
- *
- * @return the size of this collection
- */
- public int getVAMSASCount(
- ) {
- return this._VAMSASList.size();
- }
-
- /**
- * Returns the value of field 'version'. The field 'version'
- * has the following description: Vamsas Document Version
- * Number
- *
- * @return the value of field 'Version'.
- */
- public java.lang.String getVersion(
- ) {
- return this._version;
- }
-
- /**
- * Overrides the java.lang.Object.hashCode method.
- * <p>
- * The following steps came from <b>Effective Java Programming
- * Language Guide</b> by Joshua Bloch, Chapter 3
- *
- * @return a hash code value for the object.
- */
- public int hashCode(
- ) {
- int result = super.hashCode();
-
- long tmp;
- if (_version != null
- && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
- result = 37 * result + _version.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_version);
- }
- if (_lockFile != null
- && !org.castor.util.CycleBreaker.startingToCycle(_lockFile)) {
- result = 37 * result + _lockFile.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_lockFile);
- }
- if (_provenance != null
- && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
- result = 37 * result + _provenance.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
+ if (this._lockFile != null) {
+ if (temp._lockFile == null)
+ return false;
+ if (this._lockFile != temp._lockFile) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._lockFile);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._lockFile);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._lockFile.equals(temp._lockFile)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._lockFile);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._lockFile);
+ }
}
- if (_VAMSASList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_VAMSASList)) {
- result = 37 * result + _VAMSASList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_VAMSASList);
+ } else if (temp._lockFile != null)
+ return false;
+ if (this._provenance != null) {
+ if (temp._provenance == null)
+ return false;
+ if (this._provenance != temp._provenance) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._provenance);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._provenance);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._provenance.equals(temp._provenance)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);
+ }
}
- if (_applicationDataList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_applicationDataList)) {
- result = 37 * result + _applicationDataList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_applicationDataList);
+ } else if (temp._provenance != null)
+ return false;
+ if (this._VAMSASList != null) {
+ if (temp._VAMSASList == null)
+ return false;
+ if (this._VAMSASList != temp._VAMSASList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._VAMSASList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._VAMSASList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._VAMSASList.equals(temp._VAMSASList)) {
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
+ return false;
+ }
+ org.castor.util.CycleBreaker.releaseCycleHandle(this._VAMSASList);
+ org.castor.util.CycleBreaker.releaseCycleHandle(temp._VAMSASList);
+ }
}
- if (_attachmentList != null
- && !org.castor.util.CycleBreaker.startingToCycle(_attachmentList)) {
- result = 37 * result + _attachmentList.hashCode();
- org.castor.util.CycleBreaker.releaseCycleHandle(_attachmentList);
+ } else if (temp._VAMSASList != null)
+ return false;
+ if (this._applicationDataList != null) {
+ if (temp._applicationDataList == null)
+ return false;
+ if (this._applicationDataList != temp._applicationDataList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._applicationDataList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._applicationDataList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._applicationDataList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._applicationDataList);
+ }
+ ;
+ return false;
+ }
+ if (!thcycle) {
+ if (!this._applicationDataList.equals(temp._applicationDataList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._applicationDataList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._applicationDataList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._applicationDataList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._applicationDataList);
+ }
}
-
- return result;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
+ } else if (temp._applicationDataList != null)
+ return false;
+ if (this._attachmentList != null) {
+ if (temp._attachmentList == null)
+ return false;
+ if (this._attachmentList != temp._attachmentList) {
+ thcycle = org.castor.util.CycleBreaker
+ .startingToCycle(this._attachmentList);
+ tmcycle = org.castor.util.CycleBreaker
+ .startingToCycle(temp._attachmentList);
+ if (thcycle != tmcycle) {
+ if (!thcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._attachmentList);
+ }
+ ;
+ if (!tmcycle) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._attachmentList);
+ }
+ ;
return false;
+ }
+ if (!thcycle) {
+ if (!this._attachmentList.equals(temp._attachmentList)) {
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._attachmentList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._attachmentList);
+ return false;
+ }
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(this._attachmentList);
+ org.castor.util.CycleBreaker
+ .releaseCycleHandle(temp._attachmentList);
+ }
}
- return true;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllApplicationData(
- ) {
- this._applicationDataList.clear();
- }
-
- /**
- */
- public void removeAllAttachment(
- ) {
- this._attachmentList.clear();
- }
-
- /**
- */
- public void removeAllVAMSAS(
- ) {
- this._VAMSASList.clear();
- }
-
- /**
- * Method removeApplicationData.
- *
- * @param vApplicationData
- * @return true if the object was removed from the collection.
- */
- public boolean removeApplicationData(
- final uk.ac.vamsas.objects.core.ApplicationData vApplicationData) {
- boolean removed = _applicationDataList.remove(vApplicationData);
- return removed;
- }
-
- /**
- * Method removeApplicationDataAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.ApplicationData removeApplicationDataAt(
- final int index) {
- java.lang.Object obj = this._applicationDataList.remove(index);
- return (uk.ac.vamsas.objects.core.ApplicationData) obj;
- }
-
- /**
- * Method removeAttachment.
- *
- * @param vAttachment
- * @return true if the object was removed from the collection.
- */
- public boolean removeAttachment(
- final uk.ac.vamsas.objects.core.Attachment vAttachment) {
- boolean removed = _attachmentList.remove(vAttachment);
- return removed;
+ } else if (temp._attachmentList != null)
+ return false;
+ return true;
}
-
- /**
- * Method removeAttachmentAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.Attachment removeAttachmentAt(
- final int index) {
- java.lang.Object obj = this._attachmentList.remove(index);
- return (uk.ac.vamsas.objects.core.Attachment) obj;
+ return false;
+ }
+
+ /**
+ * Method getApplicationData.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.ApplicationData at the
+ * given index
+ */
+ public uk.ac.vamsas.objects.core.ApplicationData getApplicationData(
+ final int index) throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._applicationDataList.size()) {
+ throw new IndexOutOfBoundsException("getApplicationData: Index value '"
+ + index + "' not in range [0.."
+ + (this._applicationDataList.size() - 1) + "]");
}
- /**
- * Method removeVAMSAS.
- *
- * @param vVAMSAS
- * @return true if the object was removed from the collection.
- */
- public boolean removeVAMSAS(
- final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS) {
- boolean removed = _VAMSASList.remove(vVAMSAS);
- return removed;
+ return (uk.ac.vamsas.objects.core.ApplicationData) _applicationDataList
+ .get(index);
+ }
+
+ /**
+ * Method getApplicationData.Returns the contents of the collection in an
+ * Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.ApplicationData[] getApplicationData() {
+ uk.ac.vamsas.objects.core.ApplicationData[] array = new uk.ac.vamsas.objects.core.ApplicationData[0];
+ return (uk.ac.vamsas.objects.core.ApplicationData[]) this._applicationDataList
+ .toArray(array);
+ }
+
+ /**
+ * Method getApplicationDataAsReference.Returns a reference to
+ * '_applicationDataList'. No type checking is performed on any modifications
+ * to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getApplicationDataAsReference() {
+ return this._applicationDataList;
+ }
+
+ /**
+ * Method getApplicationDataCount.
+ *
+ * @return the size of this collection
+ */
+ public int getApplicationDataCount() {
+ return this._applicationDataList.size();
+ }
+
+ /**
+ * Method getAttachment.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.Attachment at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.Attachment getAttachment(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._attachmentList.size()) {
+ throw new IndexOutOfBoundsException("getAttachment: Index value '"
+ + index + "' not in range [0.." + (this._attachmentList.size() - 1)
+ + "]");
}
- /**
- * Method removeVAMSASAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public uk.ac.vamsas.objects.core.VAMSAS removeVAMSASAt(
- final int index) {
- java.lang.Object obj = this._VAMSASList.remove(index);
- return (uk.ac.vamsas.objects.core.VAMSAS) obj;
+ return (uk.ac.vamsas.objects.core.Attachment) _attachmentList.get(index);
+ }
+
+ /**
+ * Method getAttachment.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.Attachment[] getAttachment() {
+ uk.ac.vamsas.objects.core.Attachment[] array = new uk.ac.vamsas.objects.core.Attachment[0];
+ return (uk.ac.vamsas.objects.core.Attachment[]) this._attachmentList
+ .toArray(array);
+ }
+
+ /**
+ * Method getAttachmentAsReference.Returns a reference to '_attachmentList'.
+ * No type checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getAttachmentAsReference() {
+ return this._attachmentList;
+ }
+
+ /**
+ * Method getAttachmentCount.
+ *
+ * @return the size of this collection
+ */
+ public int getAttachmentCount() {
+ return this._attachmentList.size();
+ }
+
+ /**
+ * Returns the value of field 'lockFile'.
+ *
+ * @return the value of field 'LockFile'.
+ */
+ public uk.ac.vamsas.objects.core.LockFile getLockFile() {
+ return this._lockFile;
+ }
+
+ /**
+ * Returns the value of field 'provenance'.
+ *
+ * @return the value of field 'Provenance'.
+ */
+ public uk.ac.vamsas.objects.core.Provenance getProvenance() {
+ return this._provenance;
+ }
+
+ /**
+ * Method getVAMSAS.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the uk.ac.vamsas.objects.core.VAMSAS at the given
+ * index
+ */
+ public uk.ac.vamsas.objects.core.VAMSAS getVAMSAS(final int index)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._VAMSASList.size()) {
+ throw new IndexOutOfBoundsException("getVAMSAS: Index value '" + index
+ + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vApplicationData
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setApplicationData(
- final int index,
- final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._applicationDataList.size()) {
- throw new IndexOutOfBoundsException("setApplicationData: Index value '" + index + "' not in range [0.." + (this._applicationDataList.size() - 1) + "]");
- }
-
- this._applicationDataList.set(index, vApplicationData);
+ return (uk.ac.vamsas.objects.core.VAMSAS) _VAMSASList.get(index);
+ }
+
+ /**
+ * Method getVAMSAS.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public uk.ac.vamsas.objects.core.VAMSAS[] getVAMSAS() {
+ uk.ac.vamsas.objects.core.VAMSAS[] array = new uk.ac.vamsas.objects.core.VAMSAS[0];
+ return (uk.ac.vamsas.objects.core.VAMSAS[]) this._VAMSASList.toArray(array);
+ }
+
+ /**
+ * Method getVAMSASAsReference.Returns a reference to '_VAMSASList'. No type
+ * checking is performed on any modifications to the Vector.
+ *
+ * @return a reference to the Vector backing this class
+ */
+ public java.util.Vector getVAMSASAsReference() {
+ return this._VAMSASList;
+ }
+
+ /**
+ * Method getVAMSASCount.
+ *
+ * @return the size of this collection
+ */
+ public int getVAMSASCount() {
+ return this._VAMSASList.size();
+ }
+
+ /**
+ * Returns the value of field 'version'. The field 'version' has the following
+ * description: Vamsas Document Version Number
+ *
+ * @return the value of field 'Version'.
+ */
+ public java.lang.String getVersion() {
+ return this._version;
+ }
+
+ /**
+ * Overrides the java.lang.Object.hashCode method.
+ * <p>
+ * The following steps came from <b>Effective Java Programming Language
+ * Guide</b> by Joshua Bloch, Chapter 3
+ *
+ * @return a hash code value for the object.
+ */
+ public int hashCode() {
+ int result = super.hashCode();
+
+ long tmp;
+ if (_version != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_version)) {
+ result = 37 * result + _version.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_version);
}
-
- /**
- *
- *
- * @param vApplicationDataArray
- */
- public void setApplicationData(
- final uk.ac.vamsas.objects.core.ApplicationData[] vApplicationDataArray) {
- //-- copy array
- _applicationDataList.clear();
-
- for (int i = 0; i < vApplicationDataArray.length; i++) {
- this._applicationDataList.add(vApplicationDataArray[i]);
- }
+ if (_lockFile != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_lockFile)) {
+ result = 37 * result + _lockFile.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_lockFile);
}
-
- /**
- * Sets the value of '_applicationDataList' by copying the
- * given Vector. All elements will be checked for type safety.
- *
- * @param vApplicationDataList the Vector to copy.
- */
- public void setApplicationData(
- final java.util.Vector vApplicationDataList) {
- // copy vector
- this._applicationDataList.clear();
-
- this._applicationDataList.addAll(vApplicationDataList);
+ if (_provenance != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {
+ result = 37 * result + _provenance.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);
}
-
- /**
- * Sets the value of '_applicationDataList' by setting it to
- * the given Vector. No type checking is performed.
- * @deprecated
- *
- * @param applicationDataVector the Vector to set.
- */
- public void setApplicationDataAsReference(
- final java.util.Vector applicationDataVector) {
- this._applicationDataList = applicationDataVector;
+ if (_VAMSASList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_VAMSASList)) {
+ result = 37 * result + _VAMSASList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_VAMSASList);
}
-
- /**
- *
- *
- * @param index
- * @param vAttachment
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setAttachment(
- final int index,
- final uk.ac.vamsas.objects.core.Attachment vAttachment)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._attachmentList.size()) {
- throw new IndexOutOfBoundsException("setAttachment: Index value '" + index + "' not in range [0.." + (this._attachmentList.size() - 1) + "]");
- }
-
- this._attachmentList.set(index, vAttachment);
+ if (_applicationDataList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_applicationDataList)) {
+ result = 37 * result + _applicationDataList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_applicationDataList);
}
-
- /**
- *
- *
- * @param vAttachmentArray
- */
- public void setAttachment(
- final uk.ac.vamsas.objects.core.Attachment[] vAttachmentArray) {
- //-- copy array
- _attachmentList.clear();
-
- for (int i = 0; i < vAttachmentArray.length; i++) {
- this._attachmentList.add(vAttachmentArray[i]);
- }
+ if (_attachmentList != null
+ && !org.castor.util.CycleBreaker.startingToCycle(_attachmentList)) {
+ result = 37 * result + _attachmentList.hashCode();
+ org.castor.util.CycleBreaker.releaseCycleHandle(_attachmentList);
}
- /**
- * Sets the value of '_attachmentList' by copying the given
- * Vector. All elements will be checked for type safety.
- *
- * @param vAttachmentList the Vector to copy.
- */
- public void setAttachment(
- final java.util.Vector vAttachmentList) {
- // copy vector
- this._attachmentList.clear();
-
- this._attachmentList.addAll(vAttachmentList);
+ return result;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid() {
+ try {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
}
-
- /**
- * Sets the value of '_attachmentList' by setting it to the
- * given Vector. No type checking is performed.
- * @deprecated
- *
- * @param attachmentVector the Vector to set.
+ return true;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
*/
- public void setAttachmentAsReference(
- final java.util.Vector attachmentVector) {
- this._attachmentList = attachmentVector;
- }
+ public void removeAllApplicationData() {
+ this._applicationDataList.clear();
+ }
- /**
- * Sets the value of field 'lockFile'.
- *
- * @param lockFile the value of field 'lockFile'.
+ /**
*/
- public void setLockFile(
- final uk.ac.vamsas.objects.core.LockFile lockFile) {
- this._lockFile = lockFile;
- }
+ public void removeAllAttachment() {
+ this._attachmentList.clear();
+ }
- /**
- * Sets the value of field 'provenance'.
- *
- * @param provenance the value of field 'provenance'.
+ /**
*/
- public void setProvenance(
- final uk.ac.vamsas.objects.core.Provenance provenance) {
- this._provenance = provenance;
+ public void removeAllVAMSAS() {
+ this._VAMSASList.clear();
+ }
+
+ /**
+ * Method removeApplicationData.
+ *
+ * @param vApplicationData
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeApplicationData(
+ final uk.ac.vamsas.objects.core.ApplicationData vApplicationData) {
+ boolean removed = _applicationDataList.remove(vApplicationData);
+ return removed;
+ }
+
+ /**
+ * Method removeApplicationDataAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.ApplicationData removeApplicationDataAt(
+ final int index) {
+ java.lang.Object obj = this._applicationDataList.remove(index);
+ return (uk.ac.vamsas.objects.core.ApplicationData) obj;
+ }
+
+ /**
+ * Method removeAttachment.
+ *
+ * @param vAttachment
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeAttachment(
+ final uk.ac.vamsas.objects.core.Attachment vAttachment) {
+ boolean removed = _attachmentList.remove(vAttachment);
+ return removed;
+ }
+
+ /**
+ * Method removeAttachmentAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.Attachment removeAttachmentAt(final int index) {
+ java.lang.Object obj = this._attachmentList.remove(index);
+ return (uk.ac.vamsas.objects.core.Attachment) obj;
+ }
+
+ /**
+ * Method removeVAMSAS.
+ *
+ * @param vVAMSAS
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS) {
+ boolean removed = _VAMSASList.remove(vVAMSAS);
+ return removed;
+ }
+
+ /**
+ * Method removeVAMSASAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public uk.ac.vamsas.objects.core.VAMSAS removeVAMSASAt(final int index) {
+ java.lang.Object obj = this._VAMSASList.remove(index);
+ return (uk.ac.vamsas.objects.core.VAMSAS) obj;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vApplicationData
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setApplicationData(final int index,
+ final uk.ac.vamsas.objects.core.ApplicationData vApplicationData)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._applicationDataList.size()) {
+ throw new IndexOutOfBoundsException("setApplicationData: Index value '"
+ + index + "' not in range [0.."
+ + (this._applicationDataList.size() - 1) + "]");
}
- /**
- *
- *
- * @param index
- * @param vVAMSAS
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setVAMSAS(
- final int index,
- final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._VAMSASList.size()) {
- throw new IndexOutOfBoundsException("setVAMSAS: Index value '" + index + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
- }
-
- this._VAMSASList.set(index, vVAMSAS);
+ this._applicationDataList.set(index, vApplicationData);
+ }
+
+ /**
+ *
+ *
+ * @param vApplicationDataArray
+ */
+ public void setApplicationData(
+ final uk.ac.vamsas.objects.core.ApplicationData[] vApplicationDataArray) {
+ // -- copy array
+ _applicationDataList.clear();
+
+ for (int i = 0; i < vApplicationDataArray.length; i++) {
+ this._applicationDataList.add(vApplicationDataArray[i]);
}
-
- /**
- *
- *
- * @param vVAMSASArray
- */
- public void setVAMSAS(
- final uk.ac.vamsas.objects.core.VAMSAS[] vVAMSASArray) {
- //-- copy array
- _VAMSASList.clear();
-
- for (int i = 0; i < vVAMSASArray.length; i++) {
- this._VAMSASList.add(vVAMSASArray[i]);
- }
+ }
+
+ /**
+ * Sets the value of '_applicationDataList' by copying the given Vector. All
+ * elements will be checked for type safety.
+ *
+ * @param vApplicationDataList
+ * the Vector to copy.
+ */
+ public void setApplicationData(final java.util.Vector vApplicationDataList) {
+ // copy vector
+ this._applicationDataList.clear();
+
+ this._applicationDataList.addAll(vApplicationDataList);
+ }
+
+ /**
+ * Sets the value of '_applicationDataList' by setting it to the given Vector.
+ * No type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param applicationDataVector
+ * the Vector to set.
+ */
+ public void setApplicationDataAsReference(
+ final java.util.Vector applicationDataVector) {
+ this._applicationDataList = applicationDataVector;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vAttachment
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setAttachment(final int index,
+ final uk.ac.vamsas.objects.core.Attachment vAttachment)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._attachmentList.size()) {
+ throw new IndexOutOfBoundsException("setAttachment: Index value '"
+ + index + "' not in range [0.." + (this._attachmentList.size() - 1)
+ + "]");
}
- /**
- * Sets the value of '_VAMSASList' by copying the given Vector.
- * All elements will be checked for type safety.
- *
- * @param vVAMSASList the Vector to copy.
- */
- public void setVAMSAS(
- final java.util.Vector vVAMSASList) {
- // copy vector
- this._VAMSASList.clear();
-
- this._VAMSASList.addAll(vVAMSASList);
+ this._attachmentList.set(index, vAttachment);
+ }
+
+ /**
+ *
+ *
+ * @param vAttachmentArray
+ */
+ public void setAttachment(
+ final uk.ac.vamsas.objects.core.Attachment[] vAttachmentArray) {
+ // -- copy array
+ _attachmentList.clear();
+
+ for (int i = 0; i < vAttachmentArray.length; i++) {
+ this._attachmentList.add(vAttachmentArray[i]);
}
-
- /**
- * Sets the value of '_VAMSASList' by setting it to the given
- * Vector. No type checking is performed.
- * @deprecated
- *
- * @param VAMSASVector the Vector to set.
- */
- public void setVAMSASAsReference(
- final java.util.Vector VAMSASVector) {
- this._VAMSASList = VAMSASVector;
+ }
+
+ /**
+ * Sets the value of '_attachmentList' by copying the given Vector. All
+ * elements will be checked for type safety.
+ *
+ * @param vAttachmentList
+ * the Vector to copy.
+ */
+ public void setAttachment(final java.util.Vector vAttachmentList) {
+ // copy vector
+ this._attachmentList.clear();
+
+ this._attachmentList.addAll(vAttachmentList);
+ }
+
+ /**
+ * Sets the value of '_attachmentList' by setting it to the given Vector. No
+ * type checking is performed.
+ *
+ * @deprecated
+ *
+ * @param attachmentVector
+ * the Vector to set.
+ */
+ public void setAttachmentAsReference(final java.util.Vector attachmentVector) {
+ this._attachmentList = attachmentVector;
+ }
+
+ /**
+ * Sets the value of field 'lockFile'.
+ *
+ * @param lockFile
+ * the value of field 'lockFile'.
+ */
+ public void setLockFile(final uk.ac.vamsas.objects.core.LockFile lockFile) {
+ this._lockFile = lockFile;
+ }
+
+ /**
+ * Sets the value of field 'provenance'.
+ *
+ * @param provenance
+ * the value of field 'provenance'.
+ */
+ public void setProvenance(
+ final uk.ac.vamsas.objects.core.Provenance provenance) {
+ this._provenance = provenance;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vVAMSAS
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setVAMSAS(final int index,
+ final uk.ac.vamsas.objects.core.VAMSAS vVAMSAS)
+ throws java.lang.IndexOutOfBoundsException {
+ // check bounds for index
+ if (index < 0 || index >= this._VAMSASList.size()) {
+ throw new IndexOutOfBoundsException("setVAMSAS: Index value '" + index
+ + "' not in range [0.." + (this._VAMSASList.size() - 1) + "]");
}
- /**
- * Sets the value of field 'version'. The field 'version' has
- * the following description: Vamsas Document Version Number
- *
- * @param version the value of field 'version'.
- */
- public void setVersion(
- final java.lang.String version) {
- this._version = version;
- }
+ this._VAMSASList.set(index, vVAMSAS);
+ }
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled
- * uk.ac.vamsas.objects.core.VamsasDocument
- */
- public static uk.ac.vamsas.objects.core.VamsasDocument unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (uk.ac.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.VamsasDocument.class, reader);
- }
+ /**
+ *
+ *
+ * @param vVAMSASArray
+ */
+ public void setVAMSAS(final uk.ac.vamsas.objects.core.VAMSAS[] vVAMSASArray) {
+ // -- copy array
+ _VAMSASList.clear();
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
+ for (int i = 0; i < vVAMSASArray.length; i++) {
+ this._VAMSASList.add(vVAMSASArray[i]);
}
+ }
+
+ /**
+ * Sets the value of '_VAMSASList' by copying the given Vector. All elements
+ * will be checked for type safety.
+ *
+ * @param vVAMSASList
+ * the Vector to copy.
+ */
+ public void setVAMSAS(final java.util.Vector vVAMSASList) {
+ // copy vector
+ this._VAMSASList.clear();
+
+ this._VAMSASList.addAll(vVAMSASList);
+ }
+
+ /**
+ * Sets the value of '_VAMSASList' by setting it to the given Vector. No type
+ * checking is performed.
+ *
+ * @deprecated
+ *
+ * @param VAMSASVector
+ * the Vector to set.
+ */
+ public void setVAMSASAsReference(final java.util.Vector VAMSASVector) {
+ this._VAMSASList = VAMSASVector;
+ }
+
+ /**
+ * Sets the value of field 'version'. The field 'version' has the following
+ * description: Vamsas Document Version Number
+ *
+ * @param version
+ * the value of field 'version'.
+ */
+ public void setVersion(final java.lang.String version) {
+ this._version = version;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled uk.ac.vamsas.objects.core.VamsasDocument
+ */
+ public static uk.ac.vamsas.objects.core.VamsasDocument unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException {
+ return (uk.ac.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(
+ uk.ac.vamsas.objects.core.VamsasDocument.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * Direct associations between this node and any vamsas\r
- * objects\r
+ * Direct associations between this node and any vamsas objects\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Vref extends ReferenceType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Vref() {\r
- super();\r
- }\r
+public class Vref extends ReferenceType implements java.io.Serializable {\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Vref) {\r
- \r
- return true;\r
- }\r
- return false;\r
- }\r
+ public Vref() {\r
+ super();\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- \r
- return result;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ if (obj instanceof Vref) {\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled\r
- * uk.ac.vamsas.objects.core.ReferenceType\r
- */\r
- public static uk.ac.vamsas.objects.core.ReferenceType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Vref.class, reader);\r
+ return true;\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.ReferenceType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.ReferenceType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Vref.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import org.exolab.castor.xml.Marshaller;\r
import org.exolab.castor.xml.Unmarshaller;\r
\r
/**\r
- * explicitly named cross reference to\r
- * other objects in the document. \r
+ * explicitly named cross reference to other objects in the document.\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class Vxref extends ReferenceType \r
-implements java.io.Serializable\r
-{\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public Vxref() {\r
- super();\r
- }\r
+public class Vxref extends ReferenceType implements java.io.Serializable {\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Overrides the java.lang.Object.equals method.\r
- * \r
- * @param obj\r
- * @return true if the objects are equal.\r
- */\r
- public boolean equals(\r
- final java.lang.Object obj) {\r
- if ( this == obj )\r
- return true;\r
- \r
- if (super.equals(obj)==false)\r
- return false;\r
- \r
- if (obj instanceof Vxref) {\r
- \r
- return true;\r
- }\r
- return false;\r
- }\r
+ public Vxref() {\r
+ super();\r
+ }\r
\r
- /**\r
- * Overrides the java.lang.Object.hashCode method.\r
- * <p>\r
- * The following steps came from <b>Effective Java Programming\r
- * Language Guide</b> by Joshua Bloch, Chapter 3\r
- * \r
- * @return a hash code value for the object.\r
- */\r
- public int hashCode(\r
- ) {\r
- int result = super.hashCode();\r
- \r
- long tmp;\r
- \r
- return result;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isValid.\r
- * \r
- * @return true if this object is valid according to the schema\r
- */\r
- public boolean isValid(\r
- ) {\r
- try {\r
- validate();\r
- } catch (org.exolab.castor.xml.ValidationException vex) {\r
- return false;\r
- }\r
- return true;\r
- }\r
+ /**\r
+ * Overrides the java.lang.Object.equals method.\r
+ * \r
+ * @param obj\r
+ * @return true if the objects are equal.\r
+ */\r
+ public boolean equals(final java.lang.Object obj) {\r
+ if (this == obj)\r
+ return true;\r
\r
- /**\r
- * \r
- * \r
- * @param out\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void marshal(\r
- final java.io.Writer out)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, out);\r
- }\r
+ if (super.equals(obj) == false)\r
+ return false;\r
\r
- /**\r
- * \r
- * \r
- * @param handler\r
- * @throws java.io.IOException if an IOException occurs during\r
- * marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- */\r
- public void marshal(\r
- final org.xml.sax.ContentHandler handler)\r
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- Marshaller.marshal(this, handler);\r
- }\r
+ if (obj instanceof Vxref) {\r
\r
- /**\r
- * Method unmarshal.\r
- * \r
- * @param reader\r
- * @throws org.exolab.castor.xml.MarshalException if object is\r
- * null or if any SAXException is thrown during marshaling\r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- * @return the unmarshaled\r
- * uk.ac.vamsas.objects.core.ReferenceType\r
- */\r
- public static uk.ac.vamsas.objects.core.ReferenceType unmarshal(\r
- final java.io.Reader reader)\r
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
- return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Vxref.class, reader);\r
+ return true;\r
}\r
-\r
- /**\r
- * \r
- * \r
- * @throws org.exolab.castor.xml.ValidationException if this\r
- * object is an invalid instance according to the schema\r
- */\r
- public void validate(\r
- )\r
- throws org.exolab.castor.xml.ValidationException {\r
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
- validator.validate(this);\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Overrides the java.lang.Object.hashCode method.\r
+ * <p>\r
+ * The following steps came from <b>Effective Java Programming Language\r
+ * Guide</b> by Joshua Bloch, Chapter 3\r
+ * \r
+ * @return a hash code value for the object.\r
+ */\r
+ public int hashCode() {\r
+ int result = super.hashCode();\r
+\r
+ long tmp;\r
+\r
+ return result;\r
+ }\r
+\r
+ /**\r
+ * Method isValid.\r
+ * \r
+ * @return true if this object is valid according to the schema\r
+ */\r
+ public boolean isValid() {\r
+ try {\r
+ validate();\r
+ } catch (org.exolab.castor.xml.ValidationException vex) {\r
+ return false;\r
}\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param out\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void marshal(final java.io.Writer out)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, out);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @param handler\r
+ * @throws java.io.IOException\r
+ * if an IOException occurs during marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ */\r
+ public void marshal(final org.xml.sax.ContentHandler handler)\r
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ Marshaller.marshal(this, handler);\r
+ }\r
+\r
+ /**\r
+ * Method unmarshal.\r
+ * \r
+ * @param reader\r
+ * @throws org.exolab.castor.xml.MarshalException\r
+ * if object is null or if any SAXException is thrown during\r
+ * marshaling\r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ * @return the unmarshaled uk.ac.vamsas.objects.core.ReferenceType\r
+ */\r
+ public static uk.ac.vamsas.objects.core.ReferenceType unmarshal(\r
+ final java.io.Reader reader)\r
+ throws org.exolab.castor.xml.MarshalException,\r
+ org.exolab.castor.xml.ValidationException {\r
+ return (uk.ac.vamsas.objects.core.ReferenceType) Unmarshaller.unmarshal(\r
+ uk.ac.vamsas.objects.core.Vxref.class, reader);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * \r
+ * @throws org.exolab.castor.xml.ValidationException\r
+ * if this object is an invalid instance according to the schema\r
+ */\r
+ public void validate() throws org.exolab.castor.xml.ValidationException {\r
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+ validator.validate(this);\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.AlignmentAnnotation;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AlignmentAnnotationDescriptor extends uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AlignmentAnnotationDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "AlignmentAnnotation";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _graph\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_graph", "graph", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentAnnotation target = (AlignmentAnnotation) object;\r
- if (!target.hasGraph()) { return null; }\r
- return (target.getGraph() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentAnnotation target = (AlignmentAnnotation) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setGraph( ((java.lang.Boolean) value).booleanValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _graph\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _seqrefs\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_seqrefs", "seqrefs", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentAnnotation target = (AlignmentAnnotation) object;\r
- return target.getSeqrefs();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentAnnotation target = (AlignmentAnnotation) object;\r
- target.addSeqrefs( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- AlignmentAnnotation target = (AlignmentAnnotation) object;\r
- target.removeAllSeqrefs();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setMultivalued(true);\r
- desc.setHandler(handler);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _seqrefs\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- desc.setValidator(fieldValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentAnnotation target = (AlignmentAnnotation) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentAnnotation target = (AlignmentAnnotation) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+public class AlignmentAnnotationDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AlignmentAnnotationDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "AlignmentAnnotation";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _graph\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Boolean.TYPE, "_graph", "graph",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+ if (!target.hasGraph()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- }\r
+ return (target.getGraph() ? java.lang.Boolean.TRUE\r
+ : java.lang.Boolean.FALSE);\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ target.setGraph(((java.lang.Boolean) value).booleanValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _graph\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _seqrefs\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_seqrefs", "seqrefs",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+ return target.getSeqrefs();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.AlignmentAnnotation.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+ target.addSeqrefs((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+ target.removeAllSeqrefs();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setMultivalued(true);\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _seqrefs\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ desc.setValidator(fieldValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+ return target.getProvenance();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.AlignmentAnnotation.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Alignment;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AlignmentDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AlignmentDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "Alignment";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _gapChar\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_gapChar", "gapChar", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getGapChar();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.setGapChar( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _gapChar\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class AlignmentDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AlignmentDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "Alignment";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _gapChar\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_gapChar", "gapChar",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getGapChar();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.setGapChar((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _aligned\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_aligned", "aligned", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- if (!target.hasAligned()) { return null; }\r
- return (target.getAligned() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteAligned();\r
- return;\r
- }\r
- target.setAligned( ((java.lang.Boolean) value).booleanValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _aligned\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _gapChar\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _aligned\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Boolean.TYPE, "_aligned", "aligned",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ if (!target.hasAligned()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ return (target.getAligned() ? java.lang.Boolean.TRUE\r
+ : java.lang.Boolean.FALSE);\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteAligned();\r
+ return;\r
+ }\r
+ target.setAligned(((java.lang.Boolean) value).booleanValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _modifiable\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getModifiable();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.setModifiable( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _modifiable\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _aligned\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _alignmentAnnotationList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.AlignmentAnnotation.class, "_alignmentAnnotationList", "AlignmentAnnotation", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getAlignmentAnnotation();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.addAlignmentAnnotation( (uk.ac.vamsas.objects.core.AlignmentAnnotation) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.removeAllAlignmentAnnotation();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.AlignmentAnnotation();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _alignmentAnnotationList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _modifiable\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_modifiable", "modifiable",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getModifiable();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.setModifiable((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _treeList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getTree();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.addTree( (uk.ac.vamsas.objects.core.Tree) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.removeAllTree();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Tree();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _treeList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _modifiable\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _alignmentAnnotationList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.AlignmentAnnotation.class,\r
+ "_alignmentAnnotationList", "AlignmentAnnotation",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getAlignmentAnnotation();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target\r
+ .addAlignmentAnnotation((uk.ac.vamsas.objects.core.AlignmentAnnotation) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _alignmentSequenceList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.AlignmentSequence.class, "_alignmentSequenceList", "alignmentSequence", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getAlignmentSequence();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.addAlignmentSequence( (uk.ac.vamsas.objects.core.AlignmentSequence) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.removeAllAlignmentSequence();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.AlignmentSequence();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _alignmentSequenceList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.removeAllAlignmentAnnotation();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _propertyList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getProperty();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.addProperty( (uk.ac.vamsas.objects.core.Property) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.removeAllProperty();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Property();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _propertyList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.AlignmentAnnotation();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _alignmentAnnotationList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _treeList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Tree.class, "_treeList", "Tree",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getTree();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.addTree((uk.ac.vamsas.objects.core.Tree) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Alignment target = (Alignment) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Alignment target = (Alignment) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.removeAllTree();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Tree();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _treeList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _alignmentSequenceList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.AlignmentSequence.class,\r
+ "_alignmentSequenceList", "alignmentSequence",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getAlignmentSequence();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target\r
+ .addAlignmentSequence((uk.ac.vamsas.objects.core.AlignmentSequence) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.removeAllAlignmentSequence();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.AlignmentSequence();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _alignmentSequenceList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _propertyList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getProperty();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Alignment.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.addProperty((uk.ac.vamsas.objects.core.Property) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.removeAllProperty();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Property();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _propertyList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Alignment target = (Alignment) object;\r
+ return target.getProvenance();\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Alignment target = (Alignment) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Alignment.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AlignmentSequenceAnnotationDescriptor extends uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AlignmentSequenceAnnotationDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "AlignmentSequenceAnnotation";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _graph\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_graph", "graph", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
- if (!target.hasGraph()) { return null; }\r
- return (target.getGraph() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setGraph( ((java.lang.Boolean) value).booleanValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _graph\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class AlignmentSequenceAnnotationDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AlignmentSequenceAnnotationDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "AlignmentSequenceAnnotation";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _graph\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Boolean.TYPE, "_graph", "graph",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+ if (!target.hasGraph()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ return (target.getGraph() ? java.lang.Boolean.TRUE\r
+ : java.lang.Boolean.FALSE);\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
+\r
+ target.setGraph(((java.lang.Boolean) value).booleanValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- }\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _graph\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+ return target.getProvenance();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.AlignmentSequence;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AlignmentSequenceDescriptor extends uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AlignmentSequenceDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "alignmentSequence";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentSequence target = (AlignmentSequence) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentSequence target = (AlignmentSequence) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _refid\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_refid", "refid", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentSequence target = (AlignmentSequence) object;\r
- return target.getRefid();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentSequence target = (AlignmentSequence) object;\r
- target.setRefid( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _refid\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _alignmentSequenceAnnotationList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation.class, "_alignmentSequenceAnnotationList", "AlignmentSequenceAnnotation", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AlignmentSequence target = (AlignmentSequence) object;\r
- return target.getAlignmentSequenceAnnotation();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AlignmentSequence target = (AlignmentSequence) object;\r
- target.addAlignmentSequenceAnnotation( (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- AlignmentSequence target = (AlignmentSequence) object;\r
- target.removeAllAlignmentSequenceAnnotation();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _alignmentSequenceAnnotationList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+public class AlignmentSequenceDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AlignmentSequenceDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "alignmentSequence";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentSequence target = (AlignmentSequence) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentSequence target = (AlignmentSequence) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _refid\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_refid", "refid",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentSequence target = (AlignmentSequence) object;\r
+ return target.getRefid();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentSequence target = (AlignmentSequence) object;\r
+ target.setRefid((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
+ // -- validation code for: _refid\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
+ // -- _alignmentSequenceAnnotationList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation.class,\r
+ "_alignmentSequenceAnnotationList", "AlignmentSequenceAnnotation",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AlignmentSequence target = (AlignmentSequence) object;\r
+ return target.getAlignmentSequenceAnnotation();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.AlignmentSequence.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AlignmentSequence target = (AlignmentSequence) object;\r
+ target\r
+ .addAlignmentSequenceAnnotation((uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ AlignmentSequence target = (AlignmentSequence) object;\r
+ target.removeAllAlignmentSequenceAnnotation();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _alignmentSequenceAnnotationList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.AlignmentSequence.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.AnnotationElement;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AnnotationElementDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "annotationElement";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _position\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_position", "position", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AnnotationElement target = (AnnotationElement) object;\r
- if (!target.hasPosition()) { return null; }\r
- return new java.lang.Long(target.getPosition());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setPosition( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _position\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _after\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_after", "after", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AnnotationElement target = (AnnotationElement) object;\r
- if (!target.hasAfter()) { return null; }\r
- return (target.getAfter() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteAfter();\r
- return;\r
- }\r
- target.setAfter( ((java.lang.Boolean) value).booleanValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _after\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class AnnotationElementDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AnnotationElementDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "annotationElement";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _position\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_position", "position",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ if (!target.hasPosition()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AnnotationElement target = (AnnotationElement) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ return new java.lang.Long(target.getPosition());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
+\r
+ target.setPosition(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _description\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AnnotationElement target = (AnnotationElement) object;\r
- return target.getDescription();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- target.setDescription( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _description\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _position\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _after\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Boolean.TYPE, "_after", "after",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ if (!target.hasAfter()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _glyphList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Glyph.class, "_glyphList", "glyph", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AnnotationElement target = (AnnotationElement) object;\r
- return target.getGlyph();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- target.addGlyph( (uk.ac.vamsas.objects.core.Glyph) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- target.removeAllGlyph();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Glyph();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _glyphList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ return (target.getAfter() ? java.lang.Boolean.TRUE\r
+ : java.lang.Boolean.FALSE);\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteAfter();\r
+ return;\r
+ }\r
+ target.setAfter(((java.lang.Boolean) value).booleanValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _valueList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_valueList", "value", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AnnotationElement target = (AnnotationElement) object;\r
- return target.getValue();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.addValue( ((java.lang.Float) value).floatValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- AnnotationElement target = (AnnotationElement) object;\r
- target.removeAllValue();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _valueList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.FloatValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive((float) -3.4028235E38);\r
- typeValidator.setMaxInclusive((float) 3.4028235E38);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _after\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
+ // -- _description\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_description", "description",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ return target.getDescription();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ target.setDescription((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _description\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _glyphList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Glyph.class, "_glyphList", "glyph",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ return target.getGlyph();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.AnnotationElement.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ target.addGlyph((uk.ac.vamsas.objects.core.Glyph) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ target.removeAllGlyph();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Glyph();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _glyphList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _valueList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Float.TYPE, "_valueList", "value",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ return target.getValue();\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
+\r
+ target.addValue(((java.lang.Float) value).floatValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ AnnotationElement target = (AnnotationElement) object;\r
+ target.removeAllValue();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _valueList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive((float) -3.4028235E38);\r
+ typeValidator.setMaxInclusive((float) 3.4028235E38);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.AnnotationElement.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.AppData;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AppDataDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AppDataDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "appData";\r
- _elementDefinition = false;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsChoice();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- initialize element descriptors\r
- \r
- //-- _data\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(byte[].class, "_data", "data", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AppData target = (AppData) object;\r
- return target.getData();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AppData target = (AppData) object;\r
- target.setData( (byte[]) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _data\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _dataReference\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dataReference", "dataReference", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- AppData target = (AppData) object;\r
- return target.getDataReference();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- AppData target = (AppData) object;\r
- target.setDataReference( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _dataReference\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class AppDataDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AppDataDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "appData";\r
+ _elementDefinition = false;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsChoice();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- initialize element descriptors\r
+\r
+ // -- _data\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(byte[].class,\r
+ "_data", "data", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AppData target = (AppData) object;\r
+ return target.getData();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AppData target = (AppData) object;\r
+ target.setData((byte[]) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _data\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _dataReference\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_dataReference", "dataReference",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ AppData target = (AppData) object;\r
+ return target.getDataReference();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ AppData target = (AppData) object;\r
+ target.setDataReference((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.AppData.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _dataReference\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.AppData.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.ApplicationData;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class ApplicationDataDescriptor extends uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public ApplicationDataDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "ApplicationData";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _version\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ApplicationData target = (ApplicationData) object;\r
- return target.getVersion();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ApplicationData target = (ApplicationData) object;\r
- target.setVersion( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _version\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _name\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ApplicationData target = (ApplicationData) object;\r
- return target.getName();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ApplicationData target = (ApplicationData) object;\r
- target.setName( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _name\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class ApplicationDataDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public ApplicationDataDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "ApplicationData";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _version\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_version", "version",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ApplicationData target = (ApplicationData) object;\r
+ return target.getVersion();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ApplicationData target = (ApplicationData) object;\r
+ target.setVersion((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _userList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.User.class, "_userList", "User", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ApplicationData target = (ApplicationData) object;\r
- return target.getUser();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ApplicationData target = (ApplicationData) object;\r
- target.addUser( (uk.ac.vamsas.objects.core.User) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- ApplicationData target = (ApplicationData) object;\r
- target.removeAllUser();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.User();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _userList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _version\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _name\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_name", "name",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ApplicationData target = (ApplicationData) object;\r
+ return target.getName();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ApplicationData target = (ApplicationData) object;\r
+ target.setName((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _common\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Common.class, "_common", "Common", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ApplicationData target = (ApplicationData) object;\r
- return target.getCommon();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ApplicationData target = (ApplicationData) object;\r
- target.setCommon( (uk.ac.vamsas.objects.core.Common) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Common();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _common\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _name\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _userList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.User.class, "_userList", "User",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ApplicationData target = (ApplicationData) object;\r
+ return target.getUser();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ApplicationData target = (ApplicationData) object;\r
+ target.addUser((uk.ac.vamsas.objects.core.User) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _instanceList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Instance.class, "_instanceList", "Instance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ApplicationData target = (ApplicationData) object;\r
- return target.getInstance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ApplicationData target = (ApplicationData) object;\r
- target.addInstance( (uk.ac.vamsas.objects.core.Instance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- ApplicationData target = (ApplicationData) object;\r
- target.removeAllInstance();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Instance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _instanceList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ ApplicationData target = (ApplicationData) object;\r
+ target.removeAllUser();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.User();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _userList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _common\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Common.class, "_common", "Common",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ApplicationData target = (ApplicationData) object;\r
+ return target.getCommon();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ApplicationData target = (ApplicationData) object;\r
+ target.setCommon((uk.ac.vamsas.objects.core.Common) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Common();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
+ // -- validation code for: _common\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _instanceList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Instance.class, "_instanceList", "Instance",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ApplicationData target = (ApplicationData) object;\r
+ return target.getInstance();\r
+ }\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ApplicationData target = (ApplicationData) object;\r
+ target.addInstance((uk.ac.vamsas.objects.core.Instance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.ApplicationData.class;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ ApplicationData target = (ApplicationData) object;\r
+ target.removeAllInstance();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Instance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _instanceList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.ApplicationData.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Attachment;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class AttachmentDescriptor extends uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public AttachmentDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "Attachment";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _compressed\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_compressed", "compressed", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Attachment target = (Attachment) object;\r
- if (!target.hasCompressed()) { return null; }\r
- return (target.getCompressed() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Attachment target = (Attachment) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteCompressed();\r
- return;\r
- }\r
- target.setCompressed( ((java.lang.Boolean) value).booleanValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _compressed\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _type\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Attachment target = (Attachment) object;\r
- return target.getType();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Attachment target = (Attachment) object;\r
- target.setType( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _type\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _objectref\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_objectref", "objectref", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Attachment target = (Attachment) object;\r
- return target.getObjectref();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Attachment target = (Attachment) object;\r
- target.setObjectref( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _objectref\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class AttachmentDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public AttachmentDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "Attachment";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _compressed\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Boolean.TYPE, "_compressed", "compressed",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Attachment target = (Attachment) object;\r
+ if (!target.hasCompressed()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Attachment target = (Attachment) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Attachment target = (Attachment) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ return (target.getCompressed() ? java.lang.Boolean.TRUE\r
+ : java.lang.Boolean.FALSE);\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Attachment target = (Attachment) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteCompressed();\r
+ return;\r
+ }\r
+ target.setCompressed(((java.lang.Boolean) value).booleanValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
+ // -- validation code for: _compressed\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _type\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_type", "type",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Attachment target = (Attachment) object;\r
+ return target.getType();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Attachment target = (Attachment) object;\r
+ target.setType((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _type\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _objectref\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_objectref", "objectref",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Attachment target = (Attachment) object;\r
+ return target.getObjectref();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Attachment.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Attachment target = (Attachment) object;\r
+ target.setObjectref((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _objectref\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Attachment target = (Attachment) object;\r
+ return target.getId();\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Attachment target = (Attachment) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Attachment.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Common;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class CommonDescriptor extends uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public CommonDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "Common";\r
- _elementDefinition = true;\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Common.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+public class CommonDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public CommonDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "Common";\r
+ _elementDefinition = true;\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Common.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.DataSetAnnotations;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class DataSetAnnotationsDescriptor extends uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public DataSetAnnotationsDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "DataSetAnnotations";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _seqRef\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_seqRef", "seqRef", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSetAnnotations target = (DataSetAnnotations) object;\r
- return target.getSeqRef();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSetAnnotations target = (DataSetAnnotations) object;\r
- target.addSeqRef( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DataSetAnnotations target = (DataSetAnnotations) object;\r
- target.removeAllSeqRef();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setMultivalued(true);\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _seqRef\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- desc.setValidator(fieldValidator);\r
+public class DataSetAnnotationsDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public DataSetAnnotationsDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeAnnotationDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "DataSetAnnotations";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _seqRef\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_seqRef", "seqRef",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSetAnnotations target = (DataSetAnnotations) object;\r
+ return target.getSeqRef();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSetAnnotations target = (DataSetAnnotations) object;\r
+ target.addSeqRef((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSetAnnotations target = (DataSetAnnotations) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSetAnnotations target = (DataSetAnnotations) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DataSetAnnotations target = (DataSetAnnotations) object;\r
+ target.removeAllSeqRef();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setMultivalued(true);\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _seqRef\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ desc.setValidator(fieldValidator);\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.DataSetAnnotations.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSetAnnotations target = (DataSetAnnotations) object;\r
+ return target.getProvenance();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSetAnnotations target = (DataSetAnnotations) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.DataSetAnnotations.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.DataSet;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class DataSetDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public DataSetDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "DataSet";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSet target = (DataSet) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class DataSetDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public DataSetDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "DataSet";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSet target = (DataSet) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _sequenceList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Sequence.class, "_sequenceList", "Sequence", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSet target = (DataSet) object;\r
- return target.getSequence();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.addSequence( (uk.ac.vamsas.objects.core.Sequence) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.removeAllSequence();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Sequence();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _sequenceList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _sequenceList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Sequence.class, "_sequenceList", "Sequence",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSet target = (DataSet) object;\r
+ return target.getSequence();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.addSequence((uk.ac.vamsas.objects.core.Sequence) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _sequenceMappingList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.SequenceMapping.class, "_sequenceMappingList", "sequenceMapping", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSet target = (DataSet) object;\r
- return target.getSequenceMapping();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.addSequenceMapping( (uk.ac.vamsas.objects.core.SequenceMapping) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.removeAllSequenceMapping();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.SequenceMapping();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _sequenceMappingList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.removeAllSequence();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _dataSetAnnotationsList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.DataSetAnnotations.class, "_dataSetAnnotationsList", "DataSetAnnotations", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSet target = (DataSet) object;\r
- return target.getDataSetAnnotations();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.addDataSetAnnotations( (uk.ac.vamsas.objects.core.DataSetAnnotations) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.removeAllDataSetAnnotations();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.DataSetAnnotations();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _dataSetAnnotationsList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Sequence();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _sequenceList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _sequenceMappingList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.SequenceMapping.class,\r
+ "_sequenceMappingList", "sequenceMapping",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSet target = (DataSet) object;\r
+ return target.getSequenceMapping();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target\r
+ .addSequenceMapping((uk.ac.vamsas.objects.core.SequenceMapping) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _alignmentList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Alignment.class, "_alignmentList", "Alignment", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSet target = (DataSet) object;\r
- return target.getAlignment();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.addAlignment( (uk.ac.vamsas.objects.core.Alignment) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.removeAllAlignment();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Alignment();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _alignmentList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.removeAllSequenceMapping();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _treeList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSet target = (DataSet) object;\r
- return target.getTree();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.addTree( (uk.ac.vamsas.objects.core.Tree) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.removeAllTree();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Tree();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _treeList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.SequenceMapping();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _sequenceMappingList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _dataSetAnnotationsList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.DataSetAnnotations.class,\r
+ "_dataSetAnnotationsList", "DataSetAnnotations",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSet target = (DataSet) object;\r
+ return target.getDataSetAnnotations();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target\r
+ .addDataSetAnnotations((uk.ac.vamsas.objects.core.DataSetAnnotations) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DataSet target = (DataSet) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DataSet target = (DataSet) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.removeAllDataSetAnnotations();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.DataSetAnnotations();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _dataSetAnnotationsList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _alignmentList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Alignment.class, "_alignmentList",\r
+ "Alignment", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSet target = (DataSet) object;\r
+ return target.getAlignment();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.addAlignment((uk.ac.vamsas.objects.core.Alignment) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.removeAllAlignment();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Alignment();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _alignmentList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _treeList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Tree.class, "_treeList", "Tree",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSet target = (DataSet) object;\r
+ return target.getTree();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.DataSet.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.addTree((uk.ac.vamsas.objects.core.Tree) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.removeAllTree();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Tree();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _treeList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DataSet target = (DataSet) object;\r
+ return target.getProvenance();\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DataSet target = (DataSet) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.DataSet.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.DbRef;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class DbRefDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public DbRefDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "dbRef";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _source\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_source", "source", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DbRef target = (DbRef) object;\r
- return target.getSource();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.setSource( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _source\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _version\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DbRef target = (DbRef) object;\r
- return target.getVersion();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.setVersion( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _version\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class DbRefDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public DbRefDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "dbRef";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _source\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_source", "source",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DbRef target = (DbRef) object;\r
+ return target.getSource();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.setSource((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _accessionId\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_accessionId", "accessionId", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DbRef target = (DbRef) object;\r
- return target.getAccessionId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.setAccessionId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _accessionId\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _source\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _version\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_version", "version",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DbRef target = (DbRef) object;\r
+ return target.getVersion();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.setVersion((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DbRef target = (DbRef) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _version\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _accessionId\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_accessionId", "accessionId",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DbRef target = (DbRef) object;\r
+ return target.getAccessionId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.setAccessionId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _mapList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Map.class, "_mapList", "map", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DbRef target = (DbRef) object;\r
- return target.getMap();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.addMap( (uk.ac.vamsas.objects.core.Map) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.removeAllMap();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Map();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _mapList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _accessionId\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DbRef target = (DbRef) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _linkList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Link.class, "_linkList", "link", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DbRef target = (DbRef) object;\r
- return target.getLink();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.addLink( (uk.ac.vamsas.objects.core.Link) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.removeAllLink();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Link();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _linkList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _mapList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Map.class, "_mapList", "map",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DbRef target = (DbRef) object;\r
+ return target.getMap();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.addMap((uk.ac.vamsas.objects.core.Map) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _propertyList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- DbRef target = (DbRef) object;\r
- return target.getProperty();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.addProperty( (uk.ac.vamsas.objects.core.Property) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- DbRef target = (DbRef) object;\r
- target.removeAllProperty();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Property();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _propertyList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.removeAllMap();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Map();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _mapList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _linkList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Link.class, "_linkList", "link",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DbRef target = (DbRef) object;\r
+ return target.getLink();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.addLink((uk.ac.vamsas.objects.core.Link) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.removeAllLink();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Link();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _linkList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _propertyList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ DbRef target = (DbRef) object;\r
+ return target.getProperty();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.DbRef.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.addProperty((uk.ac.vamsas.objects.core.Property) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ DbRef target = (DbRef) object;\r
+ target.removeAllProperty();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Property();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _propertyList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.DbRef.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Entry;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class EntryDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public EntryDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "entry";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _user\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_user", "User", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getUser();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.setUser( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _user\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _app\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_app", "App", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getApp();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.setApp( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _app\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _action\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_action", "Action", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getAction();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.setAction( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _action\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _date\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.util.Date.class, "_date", "Date", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getDate();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.setDate( (java.util.Date) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.util.Date();\r
- }\r
- };\r
- handler = new org.exolab.castor.xml.handlers.DateFieldHandler(handler);\r
- desc.setImmutable(true);\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _date\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.DateTimeValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.DateTimeValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _propertyList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getProperty();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.addProperty( (uk.ac.vamsas.objects.core.Property) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Entry target = (Entry) object;\r
- target.removeAllProperty();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Property();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _propertyList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _paramList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Param.class, "_paramList", "param", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getParam();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.addParam( (uk.ac.vamsas.objects.core.Param) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Entry target = (Entry) object;\r
- target.removeAllParam();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Param();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _paramList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _inputList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Input.class, "_inputList", "input", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Entry target = (Entry) object;\r
- return target.getInput();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Entry target = (Entry) object;\r
- target.addInput( (uk.ac.vamsas.objects.core.Input) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Entry target = (Entry) object;\r
- target.removeAllInput();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Input();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _inputList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+public class EntryDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public EntryDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "entry";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
+ // -- _user\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_user", "User",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getUser();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.setUser((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _user\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _app\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_app", "App",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getApp();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.setApp((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Entry.class;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _app\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _action\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_action", "Action",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getAction();\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.setAction((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _action\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _date\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.util.Date.class, "_date", "Date",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getDate();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.setDate((java.util.Date) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.util.Date();\r
+ }\r
+ };\r
+ handler = new org.exolab.castor.xml.handlers.DateFieldHandler(handler);\r
+ desc.setImmutable(true);\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _date\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.DateTimeValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.DateTimeValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _propertyList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getProperty();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.addProperty((uk.ac.vamsas.objects.core.Property) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.removeAllProperty();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Property();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _propertyList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _paramList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Param.class, "_paramList", "param",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getParam();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.addParam((uk.ac.vamsas.objects.core.Param) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.removeAllParam();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Param();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _paramList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _inputList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Input.class, "_inputList", "input",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Entry target = (Entry) object;\r
+ return target.getInput();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.addInput((uk.ac.vamsas.objects.core.Input) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Entry target = (Entry) object;\r
+ target.removeAllInput();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Input();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ // -- validation code for: _inputList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Entry.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Glyph;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class GlyphDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public GlyphDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "glyph";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Glyph target = (Glyph) object;\r
- return target.getContent();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Glyph target = (Glyph) object;\r
- target.setContent( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- _dict\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dict", "dict", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Glyph target = (Glyph) object;\r
- return target.getDict();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Glyph target = (Glyph) object;\r
- target.setDict( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _dict\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class GlyphDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public GlyphDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "glyph";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Glyph target = (Glyph) object;\r
+ return target.getContent();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Glyph target = (Glyph) object;\r
+ target.setContent((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _dict\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_dict", "dict",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Glyph target = (Glyph) object;\r
+ return target.getDict();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Glyph target = (Glyph) object;\r
+ target.setDict((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Glyph.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _dict\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Glyph.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Input;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class InputDescriptor extends uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public InputDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "input";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _name\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Input target = (Input) object;\r
- return target.getName();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Input target = (Input) object;\r
- target.setName( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _name\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _objRef\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_objRef", "objRef", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Input target = (Input) object;\r
- return target.getObjRef();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Input target = (Input) object;\r
- target.addObjRef( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Input target = (Input) object;\r
- target.removeAllObjRef();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setMultivalued(true);\r
- desc.setHandler(handler);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _objRef\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- desc.setValidator(fieldValidator);\r
+public class InputDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public InputDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "input";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _name\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_name", "name",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Input target = (Input) object;\r
+ return target.getName();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Input target = (Input) object;\r
+ target.setName((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _name\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Input.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ desc.setValidator(fieldValidator);\r
+ // -- _objRef\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_objRef", "objRef",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Input target = (Input) object;\r
+ return target.getObjRef();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Input target = (Input) object;\r
+ target.addObjRef((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Input target = (Input) object;\r
+ target.removeAllObjRef();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setMultivalued(true);\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _objRef\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ desc.setValidator(fieldValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Input.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Instance;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class InstanceDescriptor extends uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public InstanceDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "Instance";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _urn\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_urn", "urn", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Instance target = (Instance) object;\r
- return target.getUrn();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Instance target = (Instance) object;\r
- target.setUrn( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _urn\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class InstanceDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public InstanceDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "Instance";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _urn\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_urn", "urn",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Instance target = (Instance) object;\r
+ return target.getUrn();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Instance target = (Instance) object;\r
+ target.setUrn((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _urn\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Instance.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Instance.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Link;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class LinkDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public LinkDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "link";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Link target = (Link) object;\r
- return target.getContent();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Link target = (Link) object;\r
- target.setContent( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- _href\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_href", "href", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Link target = (Link) object;\r
- return target.getHref();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Link target = (Link) object;\r
- target.setHref( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _href\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
+public class LinkDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public LinkDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "link";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Link target = (Link) object;\r
+ return target.getContent();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Link target = (Link) object;\r
+ target.setContent((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Link.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _href\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_href", "href",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Link target = (Link) object;\r
+ return target.getHref();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Link target = (Link) object;\r
+ target.setHref((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _href\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Link.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Local;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class LocalDescriptor extends uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public LocalDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "local";\r
- _elementDefinition = true;\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Local.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+public class LocalDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public LocalDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "local";\r
+ _elementDefinition = true;\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Local.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.LockFile;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class LockFileDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public LockFileDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument";\r
- _xmlName = "LockFile";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- LockFile target = (LockFile) object;\r
- return target.getContent();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- LockFile target = (LockFile) object;\r
- target.setContent( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class LockFileDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public LockFileDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument";\r
+ _xmlName = "LockFile";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ LockFile target = (LockFile) object;\r
+ return target.getContent();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ LockFile target = (LockFile) object;\r
+ target.setContent((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- initialize element descriptors\r
- \r
- }\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.LockFile.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.LockFile.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Map;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MapDescriptor extends uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MapDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "map";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Map target = (Map) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Map target = (Map) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class MapDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MapDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "map";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Map target = (Map) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Map target = (Map) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Map.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Map.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.MapList;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MapListDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
- /**\r
- * Field _identity.\r
- */\r
- private org.exolab.castor.xml.XMLFieldDescriptor _identity;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MapListDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "mapList";\r
- _elementDefinition = false;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _from\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_from", "from", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- MapList target = (MapList) object;\r
- if (!target.hasFrom()) { return null; }\r
- return new java.lang.Long(target.getFrom());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- MapList target = (MapList) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteFrom();\r
- return;\r
- }\r
- target.setFrom( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _from\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class MapListDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ /**\r
+ * Field _identity.\r
+ */\r
+ private org.exolab.castor.xml.XMLFieldDescriptor _identity;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MapListDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "mapList";\r
+ _elementDefinition = false;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _from\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_from", "from",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ MapList target = (MapList) object;\r
+ if (!target.hasFrom()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _to\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_to", "to", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- MapList target = (MapList) object;\r
- if (!target.hasTo()) { return null; }\r
- return new java.lang.Long(target.getTo());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- MapList target = (MapList) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteTo();\r
- return;\r
- }\r
- target.setTo( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _to\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ return new java.lang.Long(target.getFrom());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ MapList target = (MapList) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteFrom();\r
+ return;\r
+ }\r
+ target.setFrom(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _start\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- MapList target = (MapList) object;\r
- if (!target.hasStart()) { return null; }\r
- return new java.lang.Long(target.getStart());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- MapList target = (MapList) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setStart( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _start\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _from\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _to\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_to", "to",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ MapList target = (MapList) object;\r
+ if (!target.hasTo()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _end\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- MapList target = (MapList) object;\r
- if (!target.hasEnd()) { return null; }\r
- return new java.lang.Long(target.getEnd());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- MapList target = (MapList) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setEnd( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _end\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ return new java.lang.Long(target.getTo());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ MapList target = (MapList) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteTo();\r
+ return;\r
+ }\r
+ target.setTo(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _to\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _start\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_start", "start",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ MapList target = (MapList) object;\r
+ if (!target.hasStart()) {\r
+ return null;\r
+ }\r
+ return new java.lang.Long(target.getStart());\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ MapList target = (MapList) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ target.setStart(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return _identity;\r
+ // -- validation code for: _start\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _end\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_end", "end",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ MapList target = (MapList) object;\r
+ if (!target.hasEnd()) {\r
+ return null;\r
+ }\r
+ return new java.lang.Long(target.getEnd());\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.MapList.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ MapList target = (MapList) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ target.setEnd(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _end\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return _identity;\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.MapList.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.MapRangeType;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MapRangeTypeDescriptor extends uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MapRangeTypeDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "mapRangeType";\r
- _elementDefinition = false;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _unit\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_unit", "unit", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- MapRangeType target = (MapRangeType) object;\r
- if (!target.hasUnit()) { return null; }\r
- return new java.lang.Long(target.getUnit());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- MapRangeType target = (MapRangeType) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteUnit();\r
- return;\r
- }\r
- target.setUnit( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _unit\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(1L);\r
+public class MapRangeTypeDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MapRangeTypeDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "mapRangeType";\r
+ _elementDefinition = false;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _unit\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_unit", "unit",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ MapRangeType target = (MapRangeType) object;\r
+ if (!target.hasUnit()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ return new java.lang.Long(target.getUnit());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ MapRangeType target = (MapRangeType) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteUnit();\r
+ return;\r
+ }\r
+ target.setUnit(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _unit\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(1L);\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.MapRangeType.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.MapRangeType.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.MapType;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MapTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MapTypeDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "mapType";\r
- _elementDefinition = false;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- initialize element descriptors\r
- \r
- //-- _local\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Local.class, "_local", "local", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- MapType target = (MapType) object;\r
- return target.getLocal();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- MapType target = (MapType) object;\r
- target.setLocal( (uk.ac.vamsas.objects.core.Local) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Local();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _local\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _mapped\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Mapped.class, "_mapped", "mapped", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- MapType target = (MapType) object;\r
- return target.getMapped();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- MapType target = (MapType) object;\r
- target.setMapped( (uk.ac.vamsas.objects.core.Mapped) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Mapped();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _mapped\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+public class MapTypeDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MapTypeDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "mapType";\r
+ _elementDefinition = false;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- initialize element descriptors\r
+\r
+ // -- _local\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Local.class, "_local", "local",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ MapType target = (MapType) object;\r
+ return target.getLocal();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ MapType target = (MapType) object;\r
+ target.setLocal((uk.ac.vamsas.objects.core.Local) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Local();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _local\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.MapType.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ desc.setValidator(fieldValidator);\r
+ // -- _mapped\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Mapped.class, "_mapped", "mapped",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ MapType target = (MapType) object;\r
+ return target.getMapped();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ MapType target = (MapType) object;\r
+ target.setMapped((uk.ac.vamsas.objects.core.Mapped) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Mapped();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _mapped\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.MapType.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Mapped;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MappedDescriptor extends uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MappedDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "mapped";\r
- _elementDefinition = true;\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Mapped.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+public class MappedDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MappedDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapRangeTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "mapped";\r
+ _elementDefinition = true;\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Mapped.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Mapping;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class MappingDescriptor extends uk.ac.vamsas.objects.core.descriptors.MapListDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
- /**\r
- * Field _identity.\r
- */\r
- private org.exolab.castor.xml.XMLFieldDescriptor _identity;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public MappingDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapListDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "mapping";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _onto\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_onto", "onto", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Mapping target = (Mapping) object;\r
- return target.getOnto();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Mapping target = (Mapping) object;\r
- target.setOnto( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _onto\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- if (_identity == null) {\r
- return super.getIdentity();\r
+public class MappingDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.MapListDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ /**\r
+ * Field _identity.\r
+ */\r
+ private org.exolab.castor.xml.XMLFieldDescriptor _identity;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public MappingDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapListDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "mapping";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _onto\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_onto", "onto",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Mapping target = (Mapping) object;\r
+ return target.getOnto();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Mapping target = (Mapping) object;\r
+ target.setOnto((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- return _identity;\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _onto\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Mapping.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ if (_identity == null) {\r
+ return super.getIdentity();\r
}\r
+ return _identity;\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Mapping.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Newick;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class NewickDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public NewickDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "newick";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Newick target = (Newick) object;\r
- return target.getContent();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Newick target = (Newick) object;\r
- target.setContent( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- _title\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Newick target = (Newick) object;\r
- return target.getTitle();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Newick target = (Newick) object;\r
- target.setTitle( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _title\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Newick target = (Newick) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Newick target = (Newick) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _modifiable\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Newick target = (Newick) object;\r
- return target.getModifiable();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Newick target = (Newick) object;\r
- target.setModifiable( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _modifiable\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class NewickDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public NewickDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "newick";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Newick target = (Newick) object;\r
+ return target.getContent();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Newick target = (Newick) object;\r
+ target.setContent((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
\r
+ // -- _title\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_title", "title",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Newick target = (Newick) object;\r
+ return target.getTitle();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Newick target = (Newick) object;\r
+ target.setTitle((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _title\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Newick target = (Newick) object;\r
+ return target.getId();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Newick.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Newick target = (Newick) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _modifiable\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_modifiable", "modifiable",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Newick target = (Newick) object;\r
+ return target.getModifiable();\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Newick target = (Newick) object;\r
+ target.setModifiable((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ // -- validation code for: _modifiable\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Newick.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.NodeType;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class NodeTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public NodeTypeDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "nodeType";\r
- _elementDefinition = false;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- NodeType target = (NodeType) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _modifiable\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- NodeType target = (NodeType) object;\r
- return target.getModifiable();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.setModifiable( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _modifiable\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _name\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- NodeType target = (NodeType) object;\r
- return target.getName();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.setName( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _name\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _description\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- NodeType target = (NodeType) object;\r
- return target.getDescription();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.setDescription( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _description\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _vrefList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Vref.class, "_vrefList", "vref", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- NodeType target = (NodeType) object;\r
- return target.getVref();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.addVref( (uk.ac.vamsas.objects.core.Vref) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.removeAllVref();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Vref();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _vrefList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+public class NodeTypeDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public NodeTypeDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "nodeType";\r
+ _elementDefinition = false;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ NodeType target = (NodeType) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _propertyList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- NodeType target = (NodeType) object;\r
- return target.getProperty();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.addProperty( (uk.ac.vamsas.objects.core.Property) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- NodeType target = (NodeType) object;\r
- target.removeAllProperty();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Property();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _propertyList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _modifiable\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_modifiable", "modifiable",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ NodeType target = (NodeType) object;\r
+ return target.getModifiable();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.setModifiable((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _modifiable\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
+ // -- _name\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_name", "name",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ NodeType target = (NodeType) object;\r
+ return target.getName();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.setName((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _name\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _description\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_description", "description",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ NodeType target = (NodeType) object;\r
+ return target.getDescription();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.NodeType.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.setDescription((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _description\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _vrefList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Vref.class, "_vrefList", "vref",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ NodeType target = (NodeType) object;\r
+ return target.getVref();\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.addVref((uk.ac.vamsas.objects.core.Vref) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.removeAllVref();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Vref();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _vrefList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _propertyList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ NodeType target = (NodeType) object;\r
+ return target.getProperty();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.addProperty((uk.ac.vamsas.objects.core.Property) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ NodeType target = (NodeType) object;\r
+ target.removeAllProperty();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Property();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _propertyList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.NodeType.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Param;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class ParamDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
+public class ParamDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ public ParamDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "param";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Param target = (Param) object;\r
+ return target.getContent();\r
+ }\r
\r
- public ParamDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "param";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Param target = (Param) object;\r
- return target.getContent();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Param target = (Param) object;\r
- target.setContent( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- _name\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Param target = (Param) object;\r
- return target.getName();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Param target = (Param) object;\r
- target.setName( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _name\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Param target = (Param) object;\r
+ target.setContent((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _type\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Param target = (Param) object;\r
- return target.getType();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Param target = (Param) object;\r
- target.setType( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _type\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
\r
+ // -- _name\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_name", "name",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Param target = (Param) object;\r
+ return target.getName();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Param target = (Param) object;\r
+ target.setName((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _name\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _type\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_type", "type",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Param target = (Param) object;\r
+ return target.getType();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Param.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Param target = (Param) object;\r
+ target.setType((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _type\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Param.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Pos;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class PosDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public PosDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "pos";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _i\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_i", "i", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Pos target = (Pos) object;\r
- if (!target.hasI()) { return null; }\r
- return new java.lang.Integer(target.getI());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Pos target = (Pos) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setI( ((java.lang.Integer) value).intValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _i\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IntValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(-2147483648);\r
- typeValidator.setMaxInclusive(2147483647);\r
+public class PosDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public PosDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "pos";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _i\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Integer.TYPE, "_i", "i",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Pos target = (Pos) object;\r
+ if (!target.hasI()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ return new java.lang.Integer(target.getI());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Pos target = (Pos) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
+\r
+ target.setI(((java.lang.Integer) value).intValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _i\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IntValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(-2147483648);\r
+ typeValidator.setMaxInclusive(2147483647);\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Pos.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Pos.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Property;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class PropertyDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
+public class PropertyDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
+ public PropertyDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "property";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Property target = (Property) object;\r
+ return target.getContent();\r
+ }\r
\r
- public PropertyDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "property";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Property target = (Property) object;\r
- return target.getContent();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Property target = (Property) object;\r
- target.setContent( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- _name\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Property target = (Property) object;\r
- return target.getName();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Property target = (Property) object;\r
- target.setName( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _name\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Property target = (Property) object;\r
+ target.setContent((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _type\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Property target = (Property) object;\r
- return target.getType();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Property target = (Property) object;\r
- target.setType( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _type\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
\r
+ // -- _name\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_name", "name",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Property target = (Property) object;\r
+ return target.getName();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Property target = (Property) object;\r
+ target.setName((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _name\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _type\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_type", "type",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Property target = (Property) object;\r
+ return target.getType();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Property.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Property target = (Property) object;\r
+ target.setType((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _type\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Property.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Provenance;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class ProvenanceDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public ProvenanceDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "Provenance";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- initialize element descriptors\r
- \r
- //-- _entryList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Entry.class, "_entryList", "entry", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Provenance target = (Provenance) object;\r
- return target.getEntry();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Provenance target = (Provenance) object;\r
- target.addEntry( (uk.ac.vamsas.objects.core.Entry) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Provenance target = (Provenance) object;\r
- target.removeAllEntry();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Entry();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _entryList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+public class ProvenanceDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public ProvenanceDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "Provenance";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- initialize element descriptors\r
+\r
+ // -- _entryList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Entry.class, "_entryList", "entry",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Provenance target = (Provenance) object;\r
+ return target.getEntry();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Provenance target = (Provenance) object;\r
+ target.addEntry((uk.ac.vamsas.objects.core.Entry) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Provenance.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Provenance target = (Provenance) object;\r
+ target.removeAllEntry();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Entry();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _entryList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Provenance.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.RangeAnnotation;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class RangeAnnotationDescriptor extends uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public RangeAnnotationDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "rangeAnnotation";\r
- _elementDefinition = false;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class RangeAnnotationDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public RangeAnnotationDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.RangeTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "rangeAnnotation";\r
+ _elementDefinition = false;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _modifiable\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getModifiable();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.setModifiable( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _modifiable\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _modifiable\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_modifiable", "modifiable",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getModifiable();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.setModifiable((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _group\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_group", "group", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getGroup();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.setGroup( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _group\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _modifiable\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _group\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_group", "group",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getGroup();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.setGroup((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _type\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getType();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.setType( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _type\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _group\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _type\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_type", "type",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getType();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.setType((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _label\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_label", "label", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getLabel();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.setLabel( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _label\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _type\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _label\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_label", "label",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getLabel();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.setLabel((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _description\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getDescription();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.setDescription( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _description\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _label\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _description\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_description", "description",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getDescription();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.setDescription((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _status\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_status", "status", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getStatus();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.setStatus( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _status\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _description\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _status\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_status", "status",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getStatus();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.setStatus((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _annotationElementList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.AnnotationElement.class, "_annotationElementList", "annotationElement", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getAnnotationElement();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.addAnnotationElement( (uk.ac.vamsas.objects.core.AnnotationElement) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.removeAllAnnotationElement();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.AnnotationElement();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _annotationElementList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _status\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _annotationElementList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.AnnotationElement.class,\r
+ "_annotationElementList", "annotationElement",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getAnnotationElement();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target\r
+ .addAnnotationElement((uk.ac.vamsas.objects.core.AnnotationElement) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _scoreList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Score.class, "_scoreList", "score", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getScore();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.addScore( (uk.ac.vamsas.objects.core.Score) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.removeAllScore();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Score();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _scoreList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.removeAllAnnotationElement();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _linkList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Link.class, "_linkList", "link", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getLink();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.addLink( (uk.ac.vamsas.objects.core.Link) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.removeAllLink();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Link();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _linkList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.AnnotationElement();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _annotationElementList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _scoreList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Score.class, "_scoreList", "score",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getScore();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.addScore((uk.ac.vamsas.objects.core.Score) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _propertyList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- return target.getProperty();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.addProperty( (uk.ac.vamsas.objects.core.Property) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- RangeAnnotation target = (RangeAnnotation) object;\r
- target.removeAllProperty();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Property();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _propertyList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.removeAllScore();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Score();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _scoreList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _linkList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Link.class, "_linkList", "link",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getLink();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.addLink((uk.ac.vamsas.objects.core.Link) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.removeAllLink();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Link();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _linkList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _propertyList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ return target.getProperty();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.RangeAnnotation.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.addProperty((uk.ac.vamsas.objects.core.Property) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ RangeAnnotation target = (RangeAnnotation) object;\r
+ target.removeAllProperty();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Property();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _propertyList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.RangeAnnotation.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Range;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class RangeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
- /**\r
- * Field _identity.\r
- */\r
- private org.exolab.castor.xml.XMLFieldDescriptor _identity;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public RangeDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "range";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _seqAStart\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_seqAStart", "seqAStart", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Range target = (Range) object;\r
- if (!target.hasSeqAStart()) { return null; }\r
- return new java.lang.Integer(target.getSeqAStart());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Range target = (Range) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteSeqAStart();\r
- return;\r
- }\r
- target.setSeqAStart( ((java.lang.Integer) value).intValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _seqAStart\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IntValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(-2147483648);\r
- typeValidator.setMaxInclusive(2147483647);\r
+public class RangeDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ /**\r
+ * Field _identity.\r
+ */\r
+ private org.exolab.castor.xml.XMLFieldDescriptor _identity;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public RangeDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "range";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _seqAStart\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Integer.TYPE, "_seqAStart", "seqAStart",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Range target = (Range) object;\r
+ if (!target.hasSeqAStart()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _seqAEnd\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_seqAEnd", "seqAEnd", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Range target = (Range) object;\r
- if (!target.hasSeqAEnd()) { return null; }\r
- return new java.lang.Integer(target.getSeqAEnd());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Range target = (Range) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteSeqAEnd();\r
- return;\r
- }\r
- target.setSeqAEnd( ((java.lang.Integer) value).intValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _seqAEnd\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IntValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(-2147483648);\r
- typeValidator.setMaxInclusive(2147483647);\r
+ return new java.lang.Integer(target.getSeqAStart());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Range target = (Range) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteSeqAStart();\r
+ return;\r
+ }\r
+ target.setSeqAStart(((java.lang.Integer) value).intValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _seqBStart\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_seqBStart", "seqBStart", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Range target = (Range) object;\r
- if (!target.hasSeqBStart()) { return null; }\r
- return new java.lang.Integer(target.getSeqBStart());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Range target = (Range) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteSeqBStart();\r
- return;\r
- }\r
- target.setSeqBStart( ((java.lang.Integer) value).intValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _seqBStart\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IntValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(-2147483648);\r
- typeValidator.setMaxInclusive(2147483647);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _seqAStart\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IntValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(-2147483648);\r
+ typeValidator.setMaxInclusive(2147483647);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _seqAEnd\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Integer.TYPE, "_seqAEnd", "seqAEnd",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Range target = (Range) object;\r
+ if (!target.hasSeqAEnd()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _seqBEnd\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_seqBEnd", "seqBEnd", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Range target = (Range) object;\r
- if (!target.hasSeqBEnd()) { return null; }\r
- return new java.lang.Integer(target.getSeqBEnd());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Range target = (Range) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteSeqBEnd();\r
- return;\r
- }\r
- target.setSeqBEnd( ((java.lang.Integer) value).intValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _seqBEnd\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IntValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(-2147483648);\r
- typeValidator.setMaxInclusive(2147483647);\r
+ return new java.lang.Integer(target.getSeqAEnd());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Range target = (Range) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteSeqAEnd();\r
+ return;\r
+ }\r
+ target.setSeqAEnd(((java.lang.Integer) value).intValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
+ }\r
\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _seqAEnd\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IntValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(-2147483648);\r
+ typeValidator.setMaxInclusive(2147483647);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _seqBStart\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Integer.TYPE, "_seqBStart", "seqBStart",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Range target = (Range) object;\r
+ if (!target.hasSeqBStart()) {\r
+ return null;\r
+ }\r
+ return new java.lang.Integer(target.getSeqBStart());\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Range target = (Range) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteSeqBStart();\r
+ return;\r
+ }\r
+ target.setSeqBStart(((java.lang.Integer) value).intValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return _identity;\r
+ // -- validation code for: _seqBStart\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IntValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(-2147483648);\r
+ typeValidator.setMaxInclusive(2147483647);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _seqBEnd\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Integer.TYPE, "_seqBEnd", "seqBEnd",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Range target = (Range) object;\r
+ if (!target.hasSeqBEnd()) {\r
+ return null;\r
+ }\r
+ return new java.lang.Integer(target.getSeqBEnd());\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Range.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Range target = (Range) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteSeqBEnd();\r
+ return;\r
+ }\r
+ target.setSeqBEnd(((java.lang.Integer) value).intValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _seqBEnd\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IntValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(-2147483648);\r
+ typeValidator.setMaxInclusive(2147483647);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return _identity;\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Range.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.RangeType;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class RangeTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public RangeTypeDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "rangeType";\r
- _elementDefinition = false;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsChoice();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- initialize element descriptors\r
- \r
- //-- _posList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Pos.class, "_posList", "pos", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeType target = (RangeType) object;\r
- return target.getPos();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeType target = (RangeType) object;\r
- target.addPos( (uk.ac.vamsas.objects.core.Pos) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- RangeType target = (RangeType) object;\r
- target.removeAllPos();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Pos();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _posList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+public class RangeTypeDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public RangeTypeDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "rangeType";\r
+ _elementDefinition = false;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsChoice();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- initialize element descriptors\r
+\r
+ // -- _posList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Pos.class, "_posList", "pos",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeType target = (RangeType) object;\r
+ return target.getPos();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeType target = (RangeType) object;\r
+ target.addPos((uk.ac.vamsas.objects.core.Pos) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _segList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Seg.class, "_segList", "seg", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- RangeType target = (RangeType) object;\r
- return target.getSeg();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- RangeType target = (RangeType) object;\r
- target.addSeg( (uk.ac.vamsas.objects.core.Seg) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- RangeType target = (RangeType) object;\r
- target.removeAllSeg();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Seg();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _segList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ RangeType target = (RangeType) object;\r
+ target.removeAllPos();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.RangeType.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Pos();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _posList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ desc.setValidator(fieldValidator);\r
+ // -- _segList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Seg.class, "_segList", "seg",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ RangeType target = (RangeType) object;\r
+ return target.getSeg();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ RangeType target = (RangeType) object;\r
+ target.addSeg((uk.ac.vamsas.objects.core.Seg) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ RangeType target = (RangeType) object;\r
+ target.removeAllSeg();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Seg();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _segList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.RangeType.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.ReferenceType;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class ReferenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public ReferenceTypeDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "referenceType";\r
- _elementDefinition = false;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ReferenceType target = (ReferenceType) object;\r
- return target.getContent();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ReferenceType target = (ReferenceType) object;\r
- target.setContent( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ReferenceType target = (ReferenceType) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ReferenceType target = (ReferenceType) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _refs\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_refs", "refs", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- ReferenceType target = (ReferenceType) object;\r
- return target.getRefs();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- ReferenceType target = (ReferenceType) object;\r
- target.addRefs( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- ReferenceType target = (ReferenceType) object;\r
- target.removeAllRefs();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setMultivalued(true);\r
- desc.setHandler(handler);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _refs\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- desc.setValidator(fieldValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
+public class ReferenceTypeDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public ReferenceTypeDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "referenceType";\r
+ _elementDefinition = false;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ReferenceType target = (ReferenceType) object;\r
+ return target.getContent();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ReferenceType target = (ReferenceType) object;\r
+ target.setContent((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.ReferenceType.class;\r
- }\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ReferenceType target = (ReferenceType) object;\r
+ return target.getId();\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ReferenceType target = (ReferenceType) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _refs\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_refs", "refs",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ ReferenceType target = (ReferenceType) object;\r
+ return target.getRefs();\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ ReferenceType target = (ReferenceType) object;\r
+ target.addRefs((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ ReferenceType target = (ReferenceType) object;\r
+ target.removeAllRefs();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setMultivalued(true);\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _refs\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ desc.setValidator(fieldValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.ReferenceType.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Score;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class ScoreDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public ScoreDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "score";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- _content\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Float.TYPE, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Score target = (Score) object;\r
- if (!target.hasContent()) { return null; }\r
- return new java.lang.Float(target.getContent());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Score target = (Score) object;\r
- // if null, use delete method for optional primitives \r
- if (value == null) {\r
- target.deleteContent();\r
- return;\r
- }\r
- target.setContent( ((java.lang.Float) value).floatValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _content\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.FloatValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.FloatValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive((float) -3.4028235E38);\r
- typeValidator.setMaxInclusive((float) 3.4028235E38);\r
+public class ScoreDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public ScoreDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "score";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- _content\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Float.TYPE, "_content", "PCDATA",\r
+ org.exolab.castor.xml.NodeType.Text);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Score target = (Score) object;\r
+ if (!target.hasContent()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize attribute descriptors\r
- \r
- //-- _name\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Score target = (Score) object;\r
- return target.getName();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Score target = (Score) object;\r
- target.setName( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _name\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ return new java.lang.Float(target.getContent());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Score target = (Score) object;\r
+ // if null, use delete method for optional primitives\r
+ if (value == null) {\r
+ target.deleteContent();\r
+ return;\r
+ }\r
+ target.setContent(((java.lang.Float) value).floatValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _content\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.FloatValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.FloatValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive((float) -3.4028235E38);\r
+ typeValidator.setMaxInclusive((float) 3.4028235E38);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _name\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_name", "name",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Score target = (Score) object;\r
+ return target.getName();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Score target = (Score) object;\r
+ target.setName((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Score.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _name\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Score.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Seg;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class SegDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public SegDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "seg";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _start\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Seg target = (Seg) object;\r
- if (!target.hasStart()) { return null; }\r
- return new java.lang.Integer(target.getStart());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Seg target = (Seg) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setStart( ((java.lang.Integer) value).intValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _start\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IntValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(-2147483648);\r
- typeValidator.setMaxInclusive(2147483647);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _end\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Seg target = (Seg) object;\r
- if (!target.hasEnd()) { return null; }\r
- return new java.lang.Integer(target.getEnd());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Seg target = (Seg) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setEnd( ((java.lang.Integer) value).intValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _end\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IntValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setMinInclusive(-2147483648);\r
- typeValidator.setMaxInclusive(2147483647);\r
+public class SegDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public SegDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "seg";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _start\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Integer.TYPE, "_start", "start",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Seg target = (Seg) object;\r
+ if (!target.hasStart()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _inclusive\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_inclusive", "inclusive", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Seg target = (Seg) object;\r
- if (!target.hasInclusive()) { return null; }\r
- return (target.getInclusive() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Seg target = (Seg) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setInclusive( ((java.lang.Boolean) value).booleanValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _inclusive\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+ return new java.lang.Integer(target.getStart());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Seg target = (Seg) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
+\r
+ target.setStart(((java.lang.Integer) value).intValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _start\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IntValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(-2147483648);\r
+ typeValidator.setMaxInclusive(2147483647);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _end\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Integer.TYPE, "_end", "end",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Seg target = (Seg) object;\r
+ if (!target.hasEnd()) {\r
+ return null;\r
+ }\r
+ return new java.lang.Integer(target.getEnd());\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Seg target = (Seg) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ target.setEnd(((java.lang.Integer) value).intValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _end\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IntValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setMinInclusive(-2147483648);\r
+ typeValidator.setMaxInclusive(2147483647);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _inclusive\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Boolean.TYPE, "_inclusive", "inclusive",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Seg target = (Seg) object;\r
+ if (!target.hasInclusive()) {\r
+ return null;\r
+ }\r
+ return (target.getInclusive() ? java.lang.Boolean.TRUE\r
+ : java.lang.Boolean.FALSE);\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Seg.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Seg target = (Seg) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ target.setInclusive(((java.lang.Boolean) value).booleanValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _inclusive\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Seg.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Sequence;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class SequenceDescriptor extends uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public SequenceDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "Sequence";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Sequence target = (Sequence) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Sequence target = (Sequence) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class SequenceDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public SequenceDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.SequenceTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "Sequence";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Sequence target = (Sequence) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Sequence target = (Sequence) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _dictionary\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dictionary", "dictionary", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Sequence target = (Sequence) object;\r
- return target.getDictionary();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Sequence target = (Sequence) object;\r
- target.setDictionary( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _dictionary\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _dictionary\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_dictionary", "dictionary",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Sequence target = (Sequence) object;\r
+ return target.getDictionary();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Sequence target = (Sequence) object;\r
+ target.setDictionary((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _dbRefList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.DbRef.class, "_dbRefList", "dbRef", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Sequence target = (Sequence) object;\r
- return target.getDbRef();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Sequence target = (Sequence) object;\r
- target.addDbRef( (uk.ac.vamsas.objects.core.DbRef) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Sequence target = (Sequence) object;\r
- target.removeAllDbRef();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.DbRef();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _dbRefList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _dictionary\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _dbRefList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.DbRef.class, "_dbRefList", "dbRef",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Sequence target = (Sequence) object;\r
+ return target.getDbRef();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Sequence target = (Sequence) object;\r
+ target.addDbRef((uk.ac.vamsas.objects.core.DbRef) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _vxrefList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Vxref.class, "_vxrefList", "vxref", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Sequence target = (Sequence) object;\r
- return target.getVxref();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Sequence target = (Sequence) object;\r
- target.addVxref( (uk.ac.vamsas.objects.core.Vxref) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Sequence target = (Sequence) object;\r
- target.removeAllVxref();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Vxref();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _vxrefList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Sequence target = (Sequence) object;\r
+ target.removeAllDbRef();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.DbRef();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _dbRefList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _vxrefList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Vxref.class, "_vxrefList", "vxref",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Sequence target = (Sequence) object;\r
+ return target.getVxref();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Sequence target = (Sequence) object;\r
+ target.addVxref((uk.ac.vamsas.objects.core.Vxref) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Sequence target = (Sequence) object;\r
+ target.removeAllVxref();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Vxref();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _vxrefList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Sequence.class;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Sequence.class;\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.SequenceMapping;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class SequenceMappingDescriptor extends uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public SequenceMappingDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "sequenceMapping";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _loc\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_loc", "loc", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceMapping target = (SequenceMapping) object;\r
- return target.getLoc();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceMapping target = (SequenceMapping) object;\r
- target.setLoc( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _loc\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _map\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_map", "map", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceMapping target = (SequenceMapping) object;\r
- return target.getMap();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceMapping target = (SequenceMapping) object;\r
- target.setMap( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _map\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceMapping target = (SequenceMapping) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceMapping target = (SequenceMapping) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceMapping target = (SequenceMapping) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceMapping target = (SequenceMapping) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+public class SequenceMappingDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public SequenceMappingDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.MapTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "sequenceMapping";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _loc\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_loc", "loc",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ return target.getLoc();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ target.setLoc((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _loc\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _map\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_map", "map",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ return target.getMap();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ target.setMap((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
+ // -- validation code for: _map\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdRefValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ return target.getId();\r
+ }\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.SequenceMapping.class;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ return target.getProvenance();\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceMapping target = (SequenceMapping) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.SequenceMapping.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.SequenceType;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class SequenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public SequenceTypeDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "SequenceType";\r
- _elementDefinition = false;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _start\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceType target = (SequenceType) object;\r
- if (!target.hasStart()) { return null; }\r
- return new java.lang.Long(target.getStart());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceType target = (SequenceType) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setStart( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _start\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _end\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceType target = (SequenceType) object;\r
- if (!target.hasEnd()) { return null; }\r
- return new java.lang.Long(target.getEnd());\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceType target = (SequenceType) object;\r
- // ignore null values for non optional primitives\r
- if (value == null) { return; }\r
- \r
- target.setEnd( ((java.lang.Long) value).longValue());\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _end\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.LongValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _sequence\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequence", "sequence", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceType target = (SequenceType) object;\r
- return target.getSequence();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceType target = (SequenceType) object;\r
- target.setSequence( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _sequence\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class SequenceTypeDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public SequenceTypeDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "SequenceType";\r
+ _elementDefinition = false;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _start\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_start", "start",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceType target = (SequenceType) object;\r
+ if (!target.hasStart()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _name\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceType target = (SequenceType) object;\r
- return target.getName();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceType target = (SequenceType) object;\r
- target.setName( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _name\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ return new java.lang.Long(target.getStart());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceType target = (SequenceType) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
+\r
+ target.setStart(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _description\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceType target = (SequenceType) object;\r
- return target.getDescription();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceType target = (SequenceType) object;\r
- target.setDescription( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _description\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _start\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _end\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Long.TYPE, "_end", "end",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceType target = (SequenceType) object;\r
+ if (!target.hasEnd()) {\r
+ return null;\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _propertyList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- SequenceType target = (SequenceType) object;\r
- return target.getProperty();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- SequenceType target = (SequenceType) object;\r
- target.addProperty( (uk.ac.vamsas.objects.core.Property) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- SequenceType target = (SequenceType) object;\r
- target.removeAllProperty();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Property();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _propertyList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ return new java.lang.Long(target.getEnd());\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceType target = (SequenceType) object;\r
+ // ignore null values for non optional primitives\r
+ if (value == null) {\r
+ return;\r
+ }\r
+\r
+ target.setEnd(((java.lang.Long) value).longValue());\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _end\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.LongValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.LongValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
\r
+ // -- _sequence\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_sequence", "sequence",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceType target = (SequenceType) object;\r
+ return target.getSequence();\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceType target = (SequenceType) object;\r
+ target.setSequence((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
- }\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _sequence\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _name\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_name", "name",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceType target = (SequenceType) object;\r
+ return target.getName();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.SequenceType.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceType target = (SequenceType) object;\r
+ target.setName((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _name\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _description\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_description", "description",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceType target = (SequenceType) object;\r
+ return target.getDescription();\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceType target = (SequenceType) object;\r
+ target.setDescription((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
+ // -- validation code for: _description\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _propertyList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ SequenceType target = (SequenceType) object;\r
+ return target.getProperty();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ SequenceType target = (SequenceType) object;\r
+ target.addProperty((uk.ac.vamsas.objects.core.Property) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ SequenceType target = (SequenceType) object;\r
+ target.removeAllProperty();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Property();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _propertyList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.SequenceType.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Tree;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public TreeDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "Tree";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Tree target = (Tree) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Tree target = (Tree) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class TreeDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public TreeDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "Tree";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Tree target = (Tree) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _modifiable\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Tree target = (Tree) object;\r
- return target.getModifiable();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Tree target = (Tree) object;\r
- target.setModifiable( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _modifiable\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _modifiable\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_modifiable", "modifiable",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Tree target = (Tree) object;\r
+ return target.getModifiable();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.setModifiable((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _title\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Tree target = (Tree) object;\r
- return target.getTitle();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Tree target = (Tree) object;\r
- target.setTitle( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _title\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _modifiable\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _title\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_title", "title",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Tree target = (Tree) object;\r
+ return target.getTitle();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.setTitle((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _newickList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Newick.class, "_newickList", "newick", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Tree target = (Tree) object;\r
- return target.getNewick();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Tree target = (Tree) object;\r
- target.addNewick( (uk.ac.vamsas.objects.core.Newick) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Tree target = (Tree) object;\r
- target.removeAllNewick();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Newick();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _newickList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _title\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _newickList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Newick.class, "_newickList", "newick",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Tree target = (Tree) object;\r
+ return target.getNewick();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.addNewick((uk.ac.vamsas.objects.core.Newick) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _treenodeList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Treenode.class, "_treenodeList", "treenode", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Tree target = (Tree) object;\r
- return target.getTreenode();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Tree target = (Tree) object;\r
- target.addTreenode( (uk.ac.vamsas.objects.core.Treenode) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Tree target = (Tree) object;\r
- target.removeAllTreenode();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Treenode();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _treenodeList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.removeAllNewick();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _propertyList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Tree target = (Tree) object;\r
- return target.getProperty();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Tree target = (Tree) object;\r
- target.addProperty( (uk.ac.vamsas.objects.core.Property) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Tree target = (Tree) object;\r
- target.removeAllProperty();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Property();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _propertyList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Newick();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _newickList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _treenodeList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Treenode.class, "_treenodeList", "treenode",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Tree target = (Tree) object;\r
+ return target.getTreenode();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.addTreenode((uk.ac.vamsas.objects.core.Treenode) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Tree target = (Tree) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Tree target = (Tree) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.removeAllTreenode();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Treenode();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _treenodeList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _propertyList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Property.class, "_propertyList", "property",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Tree target = (Tree) object;\r
+ return target.getProperty();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.addProperty((uk.ac.vamsas.objects.core.Property) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.removeAllProperty();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Property();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _propertyList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Tree target = (Tree) object;\r
+ return target.getProvenance();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Tree.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Tree target = (Tree) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Tree.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Treenode;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class TreenodeDescriptor extends uk.ac.vamsas.objects.core.descriptors.NodeTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public TreenodeDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.NodeTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "treenode";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _treeId\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_treeId", "treeId", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setReference(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Treenode target = (Treenode) object;\r
- return target.getTreeId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Treenode target = (Treenode) object;\r
- target.addTreeId( (java.lang.Object) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- Treenode target = (Treenode) object;\r
- target.removeAllTreeId();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.Object();\r
- }\r
- };\r
- desc.setMultivalued(true);\r
- desc.setHandler(handler);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _treeId\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- desc.setValidator(fieldValidator);\r
+public class TreenodeDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.NodeTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public TreenodeDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.NodeTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "treenode";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _treeId\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.Object.class, "_treeId", "treeId",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setReference(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Treenode target = (Treenode) object;\r
+ return target.getTreeId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Treenode target = (Treenode) object;\r
+ target.addTreeId((java.lang.Object) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _nodespec\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_nodespec", "nodespec", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- Treenode target = (Treenode) object;\r
- return target.getNodespec();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- Treenode target = (Treenode) object;\r
- target.setNodespec( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _nodespec\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ Treenode target = (Treenode) object;\r
+ target.removeAllTreeId();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.Object();\r
+ }\r
+ };\r
+ desc.setMultivalued(true);\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _treeId\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdRefsValidator typeValidator = new org.exolab.castor.xml.validators.IdRefsValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ desc.setValidator(fieldValidator);\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _nodespec\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_nodespec", "nodespec",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ Treenode target = (Treenode) object;\r
+ return target.getNodespec();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ Treenode target = (Treenode) object;\r
+ target.setNodespec((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _nodespec\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Treenode.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Treenode.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.User;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class UserDescriptor extends uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public UserDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "User";\r
- _elementDefinition = true;\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _fullname\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_fullname", "fullname", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- User target = (User) object;\r
- return target.getFullname();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- User target = (User) object;\r
- target.setFullname( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _fullname\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _organization\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_organization", "organization", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- User target = (User) object;\r
- return target.getOrganization();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- User target = (User) object;\r
- target.setOrganization( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _organization\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+public class UserDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public UserDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.AppDataDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "User";\r
+ _elementDefinition = true;\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _fullname\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_fullname", "fullname",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ User target = (User) object;\r
+ return target.getFullname();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ User target = (User) object;\r
+ target.setFullname((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _fullname\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _organization\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_organization", "organization",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ User target = (User) object;\r
+ return target.getOrganization();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ User target = (User) object;\r
+ target.setOrganization((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.User.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _organization\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.User.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.VAMSAS;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public VAMSASDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "VAMSAS";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- _id\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
- super.setIdentity(desc);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VAMSAS target = (VAMSAS) object;\r
- return target.getId();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VAMSAS target = (VAMSAS) object;\r
- target.setId( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new java.lang.String();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _id\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.IdValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
- fieldValidator.setValidator(typeValidator);\r
+public class VAMSASDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public VAMSASDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "VAMSAS";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- _id\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_id", "id",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ super.setIdentity(desc);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VAMSAS target = (VAMSAS) object;\r
+ return target.getId();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VAMSAS target = (VAMSAS) object;\r
+ target.setId((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _modifiable\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VAMSAS target = (VAMSAS) object;\r
- return target.getModifiable();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VAMSAS target = (VAMSAS) object;\r
- target.setModifiable( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _modifiable\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new java.lang.String();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _id\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.IdValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.IdValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _modifiable\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_modifiable", "modifiable",\r
+ org.exolab.castor.xml.NodeType.Attribute);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VAMSAS target = (VAMSAS) object;\r
+ return target.getModifiable();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VAMSAS target = (VAMSAS) object;\r
+ target.setModifiable((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- initialize element descriptors\r
- \r
- //-- _treeList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VAMSAS target = (VAMSAS) object;\r
- return target.getTree();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VAMSAS target = (VAMSAS) object;\r
- target.addTree( (uk.ac.vamsas.objects.core.Tree) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- VAMSAS target = (VAMSAS) object;\r
- target.removeAllTree();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Tree();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _treeList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _modifiable\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- initialize element descriptors\r
+\r
+ // -- _treeList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Tree.class, "_treeList", "Tree",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VAMSAS target = (VAMSAS) object;\r
+ return target.getTree();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VAMSAS target = (VAMSAS) object;\r
+ target.addTree((uk.ac.vamsas.objects.core.Tree) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _dataSetList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.DataSet.class, "_dataSetList", "DataSet", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VAMSAS target = (VAMSAS) object;\r
- return target.getDataSet();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VAMSAS target = (VAMSAS) object;\r
- target.addDataSet( (uk.ac.vamsas.objects.core.DataSet) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- VAMSAS target = (VAMSAS) object;\r
- target.removeAllDataSet();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.DataSet();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _dataSetList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ VAMSAS target = (VAMSAS) object;\r
+ target.removeAllTree();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Tree();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _treeList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _dataSetList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.DataSet.class, "_dataSetList", "DataSet",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VAMSAS target = (VAMSAS) object;\r
+ return target.getDataSet();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VAMSAS target = (VAMSAS) object;\r
+ target.addDataSet((uk.ac.vamsas.objects.core.DataSet) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ VAMSAS target = (VAMSAS) object;\r
+ target.removeAllDataSet();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.DataSet();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _dataSetList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.VAMSAS.class;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.VAMSAS.class;\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.VamsasDocument;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class VamsasDocumentDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public VamsasDocumentDescriptor() {\r
- super();\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument";\r
- _xmlName = "VamsasDocument";\r
- _elementDefinition = true;\r
- \r
- //-- set grouping compositor\r
- setCompositorAsSequence();\r
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
- org.exolab.castor.mapping.FieldHandler handler = null;\r
- org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
- //-- initialize attribute descriptors\r
- \r
- //-- initialize element descriptors\r
- \r
- //-- _version\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "Version", org.exolab.castor.xml.NodeType.Element);\r
- desc.setImmutable(true);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VamsasDocument target = (VamsasDocument) object;\r
- return target.getVersion();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.setVersion( (java.lang.String) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return null;\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument");\r
- desc.setRequired(true);\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _version\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
- org.exolab.castor.xml.validators.StringValidator typeValidator;\r
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
- fieldValidator.setValidator(typeValidator);\r
- typeValidator.setWhiteSpace("preserve");\r
- }\r
- desc.setValidator(fieldValidator);\r
- //-- _lockFile\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.LockFile.class, "_lockFile", "LockFile", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VamsasDocument target = (VamsasDocument) object;\r
- return target.getLockFile();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.setLockFile( (uk.ac.vamsas.objects.core.LockFile) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.LockFile();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _lockFile\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
+public class VamsasDocumentDescriptor extends\r
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public VamsasDocumentDescriptor() {\r
+ super();\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument";\r
+ _xmlName = "VamsasDocument";\r
+ _elementDefinition = true;\r
+\r
+ // -- set grouping compositor\r
+ setCompositorAsSequence();\r
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;\r
+ org.exolab.castor.mapping.FieldHandler handler = null;\r
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;\r
+ // -- initialize attribute descriptors\r
+\r
+ // -- initialize element descriptors\r
+\r
+ // -- _version\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ java.lang.String.class, "_version", "Version",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ desc.setImmutable(true);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ return target.getVersion();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.setVersion((java.lang.String) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _provenance\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VamsasDocument target = (VamsasDocument) object;\r
- return target.getProvenance();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.setProvenance( (uk.ac.vamsas.objects.core.Provenance) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Provenance();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(false);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _provenance\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return null;\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _version\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
+ org.exolab.castor.xml.validators.StringValidator typeValidator;\r
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();\r
+ fieldValidator.setValidator(typeValidator);\r
+ typeValidator.setWhiteSpace("preserve");\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _lockFile\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.LockFile.class, "_lockFile", "LockFile",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ return target.getLockFile();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.setLockFile((uk.ac.vamsas.objects.core.LockFile) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _VAMSASList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.VAMSAS.class, "_VAMSASList", "VAMSAS", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VamsasDocument target = (VamsasDocument) object;\r
- return target.getVAMSAS();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.addVAMSAS( (uk.ac.vamsas.objects.core.VAMSAS) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.removeAllVAMSAS();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.VAMSAS();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setRequired(true);\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _VAMSASList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(1);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.LockFile();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasDocument");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _lockFile\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _provenance\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Provenance.class, "_provenance",\r
+ "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ return target.getProvenance();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.setProvenance((uk.ac.vamsas.objects.core.Provenance) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _applicationDataList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.ApplicationData.class, "_applicationDataList", "ApplicationData", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VamsasDocument target = (VamsasDocument) object;\r
- return target.getApplicationData();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.addApplicationData( (uk.ac.vamsas.objects.core.ApplicationData) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.removeAllApplicationData();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.ApplicationData();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _applicationDataList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Provenance();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(false);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _provenance\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ { // -- local scope\r
+ }\r
+ desc.setValidator(fieldValidator);\r
+ // -- _VAMSASList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.VAMSAS.class, "_VAMSASList", "VAMSAS",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ return target.getVAMSAS();\r
+ }\r
+\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.addVAMSAS((uk.ac.vamsas.objects.core.VAMSAS) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
- //-- _attachmentList\r
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(uk.ac.vamsas.objects.core.Attachment.class, "_attachmentList", "Attachment", org.exolab.castor.xml.NodeType.Element);\r
- handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
- public java.lang.Object getValue( java.lang.Object object ) \r
- throws IllegalStateException\r
- {\r
- VamsasDocument target = (VamsasDocument) object;\r
- return target.getAttachment();\r
- }\r
- public void setValue( java.lang.Object object, java.lang.Object value) \r
- throws IllegalStateException, IllegalArgumentException\r
- {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.addAttachment( (uk.ac.vamsas.objects.core.Attachment) value);\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {\r
- try {\r
- VamsasDocument target = (VamsasDocument) object;\r
- target.removeAllAttachment();\r
- } catch (java.lang.Exception ex) {\r
- throw new IllegalStateException(ex.toString());\r
- }\r
- }\r
- public java.lang.Object newInstance(java.lang.Object parent) {\r
- return new uk.ac.vamsas.objects.core.Attachment();\r
- }\r
- };\r
- desc.setHandler(handler);\r
- desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
- desc.setMultivalued(true);\r
- addFieldDescriptor(desc);\r
- \r
- //-- validation code for: _attachmentList\r
- fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
- fieldValidator.setMinOccurs(0);\r
- { //-- local scope\r
+ }\r
+\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.removeAllVAMSAS();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
}\r
- desc.setValidator(fieldValidator);\r
+ }\r
+\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.VAMSAS();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setRequired(true);\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
+\r
+ // -- validation code for: _VAMSASList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(1);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _applicationDataList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.ApplicationData.class,\r
+ "_applicationDataList", "ApplicationData",\r
+ org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ return target.getApplicationData();\r
+ }\r
\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target\r
+ .addApplicationData((uk.ac.vamsas.objects.core.ApplicationData) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.removeAllApplicationData();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.ApplicationData();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
+ // -- validation code for: _applicationDataList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ // -- _attachmentList\r
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(\r
+ uk.ac.vamsas.objects.core.Attachment.class, "_attachmentList",\r
+ "Attachment", org.exolab.castor.xml.NodeType.Element);\r
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+ public java.lang.Object getValue(java.lang.Object object)\r
+ throws IllegalStateException {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ return target.getAttachment();\r
+ }\r
\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.VamsasDocument.class;\r
- }\r
+ public void setValue(java.lang.Object object, java.lang.Object value)\r
+ throws IllegalStateException, IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.addAttachment((uk.ac.vamsas.objects.core.Attachment) value);\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
+ public void resetValue(Object object) throws IllegalStateException,\r
+ IllegalArgumentException {\r
+ try {\r
+ VamsasDocument target = (VamsasDocument) object;\r
+ target.removeAllAttachment();\r
+ } catch (java.lang.Exception ex) {\r
+ throw new IllegalStateException(ex.toString());\r
+ }\r
+ }\r
\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
+ public java.lang.Object newInstance(java.lang.Object parent) {\r
+ return new uk.ac.vamsas.objects.core.Attachment();\r
+ }\r
+ };\r
+ desc.setHandler(handler);\r
+ desc.setNameSpaceURI("http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes");\r
+ desc.setMultivalued(true);\r
+ addFieldDescriptor(desc);\r
\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
+ // -- validation code for: _attachmentList\r
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+ fieldValidator.setMinOccurs(0);\r
+ { // -- local scope\r
}\r
+ desc.setValidator(fieldValidator);\r
+ }\r
\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.VamsasDocument.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Vref;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class VrefDescriptor extends uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public VrefDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "vref";\r
- _elementDefinition = true;\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Vref.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+public class VrefDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public VrefDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "vref";\r
+ _elementDefinition = true;\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Vref.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
/*\r
- * This class was automatically generated with \r
- * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
- * Schema.\r
- * $Id$\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.objects.core.descriptors;\r
\r
- //---------------------------------/\r
- //- Imported classes and packages -/\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
//---------------------------------/\r
\r
import uk.ac.vamsas.objects.core.Vxref;\r
* \r
* @version $Revision$ $Date$\r
*/\r
-public class VxrefDescriptor extends uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor {\r
-\r
-\r
- //--------------------------/\r
- //- Class/Member Variables -/\r
- //--------------------------/\r
-\r
- /**\r
- * Field _elementDefinition.\r
- */\r
- private boolean _elementDefinition;\r
-\r
- /**\r
- * Field _nsPrefix.\r
- */\r
- private java.lang.String _nsPrefix;\r
-\r
- /**\r
- * Field _nsURI.\r
- */\r
- private java.lang.String _nsURI;\r
-\r
- /**\r
- * Field _xmlName.\r
- */\r
- private java.lang.String _xmlName;\r
-\r
-\r
- //----------------/\r
- //- Constructors -/\r
- //----------------/\r
-\r
- public VxrefDescriptor() {\r
- super();\r
- setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor());\r
- _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
- _xmlName = "vxref";\r
- _elementDefinition = true;\r
- }\r
-\r
-\r
- //-----------/\r
- //- Methods -/\r
- //-----------/\r
-\r
- /**\r
- * Method getAccessMode.\r
- * \r
- * @return the access mode specified for this class.\r
- */\r
- public org.exolab.castor.mapping.AccessMode getAccessMode(\r
- ) {\r
- return null;\r
- }\r
-\r
- /**\r
- * Method getIdentity.\r
- * \r
- * @return the identity field, null if this class has no\r
- * identity.\r
- */\r
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(\r
- ) {\r
- return super.getIdentity();\r
- }\r
-\r
- /**\r
- * Method getJavaClass.\r
- * \r
- * @return the Java class represented by this descriptor.\r
- */\r
- public java.lang.Class getJavaClass(\r
- ) {\r
- return uk.ac.vamsas.objects.core.Vxref.class;\r
- }\r
-\r
- /**\r
- * Method getNameSpacePrefix.\r
- * \r
- * @return the namespace prefix to use when marshaling as XML.\r
- */\r
- public java.lang.String getNameSpacePrefix(\r
- ) {\r
- return _nsPrefix;\r
- }\r
-\r
- /**\r
- * Method getNameSpaceURI.\r
- * \r
- * @return the namespace URI used when marshaling and\r
- * unmarshaling as XML.\r
- */\r
- public java.lang.String getNameSpaceURI(\r
- ) {\r
- return _nsURI;\r
- }\r
-\r
- /**\r
- * Method getValidator.\r
- * \r
- * @return a specific validator for the class described by this\r
- * ClassDescriptor.\r
- */\r
- public org.exolab.castor.xml.TypeValidator getValidator(\r
- ) {\r
- return this;\r
- }\r
-\r
- /**\r
- * Method getXMLName.\r
- * \r
- * @return the XML Name for the Class being described.\r
- */\r
- public java.lang.String getXMLName(\r
- ) {\r
- return _xmlName;\r
- }\r
-\r
- /**\r
- * Method isElementDefinition.\r
- * \r
- * @return true if XML schema definition of this Class is that\r
- * of a global\r
- * element or element with anonymous type definition.\r
- */\r
- public boolean isElementDefinition(\r
- ) {\r
- return _elementDefinition;\r
- }\r
+public class VxrefDescriptor extends\r
+ uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor {\r
+\r
+ // --------------------------/\r
+ // - Class/Member Variables -/\r
+ // --------------------------/\r
+\r
+ /**\r
+ * Field _elementDefinition.\r
+ */\r
+ private boolean _elementDefinition;\r
+\r
+ /**\r
+ * Field _nsPrefix.\r
+ */\r
+ private java.lang.String _nsPrefix;\r
+\r
+ /**\r
+ * Field _nsURI.\r
+ */\r
+ private java.lang.String _nsURI;\r
+\r
+ /**\r
+ * Field _xmlName.\r
+ */\r
+ private java.lang.String _xmlName;\r
+\r
+ // ----------------/\r
+ // - Constructors -/\r
+ // ----------------/\r
+\r
+ public VxrefDescriptor() {\r
+ super();\r
+ setExtendsWithoutFlatten(new uk.ac.vamsas.objects.core.descriptors.ReferenceTypeDescriptor());\r
+ _nsURI = "http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes";\r
+ _xmlName = "vxref";\r
+ _elementDefinition = true;\r
+ }\r
+\r
+ // -----------/\r
+ // - Methods -/\r
+ // -----------/\r
+\r
+ /**\r
+ * Method getAccessMode.\r
+ * \r
+ * @return the access mode specified for this class.\r
+ */\r
+ public org.exolab.castor.mapping.AccessMode getAccessMode() {\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Method getIdentity.\r
+ * \r
+ * @return the identity field, null if this class has no identity.\r
+ */\r
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity() {\r
+ return super.getIdentity();\r
+ }\r
+\r
+ /**\r
+ * Method getJavaClass.\r
+ * \r
+ * @return the Java class represented by this descriptor.\r
+ */\r
+ public java.lang.Class getJavaClass() {\r
+ return uk.ac.vamsas.objects.core.Vxref.class;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpacePrefix.\r
+ * \r
+ * @return the namespace prefix to use when marshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpacePrefix() {\r
+ return _nsPrefix;\r
+ }\r
+\r
+ /**\r
+ * Method getNameSpaceURI.\r
+ * \r
+ * @return the namespace URI used when marshaling and unmarshaling as XML.\r
+ */\r
+ public java.lang.String getNameSpaceURI() {\r
+ return _nsURI;\r
+ }\r
+\r
+ /**\r
+ * Method getValidator.\r
+ * \r
+ * @return a specific validator for the class described by this\r
+ * ClassDescriptor.\r
+ */\r
+ public org.exolab.castor.xml.TypeValidator getValidator() {\r
+ return this;\r
+ }\r
+\r
+ /**\r
+ * Method getXMLName.\r
+ * \r
+ * @return the XML Name for the Class being described.\r
+ */\r
+ public java.lang.String getXMLName() {\r
+ return _xmlName;\r
+ }\r
+\r
+ /**\r
+ * Method isElementDefinition.\r
+ * \r
+ * @return true if XML schema definition of this Class is that of a global\r
+ * element or element with anonymous type definition.\r
+ */\r
+ public boolean isElementDefinition() {\r
+ return _elementDefinition;\r
+ }\r
\r
}\r
-/**
- *
- */
-package uk.ac.vamsas.objects.utils;
-import java.util.Vector;
-
-
-import uk.ac.vamsas.client.ClientHandle;
-import uk.ac.vamsas.client.UserHandle;
-import uk.ac.vamsas.client.simpleclient.VamsasArchive;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.objects.core.*;
-/**
- * Form, accessors and validation for ApplicationData references in
- * vamsas document.
- * TODO: LATER:extend XML Schema to properly validate against the same forms required by this class
- * TODO: VAMSAS: URNS for appDatas are supposed to be unique, aren't they ?
- */
-public class AppDataReference {
- /**
- * search interface for collecting particular types of AppDatas in a vamsas document
- * @author jimp
- *
- */
- interface IAppDSearch {
- /**
- * process the appData Vobject d
- * @param d
- * @return true if appData should be collected
- */
- public boolean process(AppData d);
- }
- /**
- * collect all appData reference strings in a vamsas document
- * @param doc
- * @return vector of String objects
- */
- static public Vector getAppDataReferences(VamsasDocument doc) {
- if ((doc!=null) && (doc.getApplicationDataCount()>0)) {
- Vector apdrefs = new Vector();
- ApplicationData[] appdatas = doc.getApplicationData();
- for (int q=0; q<appdatas.length; q++) {
- String refstring=appdatas[q].getDataReference();
- if (refstring!=null)
- apdrefs.add(refstring);
- User users[] = appdatas[q].getUser();
-
- if (users!=null)
- for (int u=0; u<users.length; u++) {
- refstring=users[u].getDataReference();
- if (refstring!=null)
- apdrefs.add(new String(refstring)); // avoid referencing.
- }
- }
- if (apdrefs.size()>0)
- return apdrefs;
- }
- return null;
- }
- /**
- * General search through the set of AppData objects for a particular profile of Client and User handle.
- * @param doc
- * @param test interface implemented by the filter selecting particular AppDatas.
- * @param cascade if true only User objects for ApplicationData objects that test.process returned true will be tested.
- * @return set of uk.ac.vamsas.objects.core.AppData objects for which test.process returned true
- */
- static public Vector searchAppDatas(VamsasDocument doc, IAppDSearch test, boolean cascade) {
- if ((doc!=null) && (doc.getApplicationDataCount()>0)) {
- Vector apdrefs = new Vector();
- ApplicationData[] appdatas = doc.getApplicationData();
- for (int q=0; q<appdatas.length; q++) {
- boolean t;
- if (t=test.process(appdatas[q]))
- apdrefs.add(appdatas[q]);
- if (t || cascade) {
- User users[] = appdatas[q].getUser();
- if (users!=null)
- for (int u=0; u<users.length; u++)
- if (test.process(users[u]))
- apdrefs.add(users[u]);
- }
- }
- if (apdrefs.size()>0)
- return apdrefs;
- }
- return null;
- }
- static public boolean equals(User p, UserHandle u) {
- if (p.getFullname().equals(u.getFullName())
- && p.getOrganization().equals(u.getOrganization()))
- return true;
- return false;
- }
- /**
- * returns true if Name matches in c and p, and Urn's match (or c.getUrn()==null) and Version's match (or c.getVersion()==null)
- * @param p
- * @param c
- * @return match of p on template c.
- */
- static public boolean equals(ApplicationData p, ClientHandle c) {
- if (
- //((c.getClientUrn()==null) || p.getUrn().equals(c.getClientUrn()))
- //&&
- (p.getName().equals(c.getClientName()))
- &&
- ((c.getVersion()==null) || (p.getVersion().equals(c.getVersion())))
- )
- return true;
- return false;
- }
- /**
- * Searches document appData structure for particular combinations of client and user data
- * @param doc the data
- * @param user template user data to match against
- * @see AppDataReference.equals(uk.ac.vamsas.objects.core.User, uk.ac.vamsas.client.UserHandle)
- * @param app
- * @see AppDataReference.equals(uk.ac.vamsas.objects.core.ApplicationData, uk.ac.vamsas.client.ClientHandle)
- * @return set of matching client app datas for this client and user combination
- */
- static public Vector getUserandApplicationsData(VamsasDocument doc, UserHandle user, ClientHandle app) {
- if (doc==null) {
- return null;
- }
- final UserHandle u = user;
- final ClientHandle c = app;
-
- IAppDSearch match = new IAppDSearch() {
- public boolean process(AppData p) {
- if (p instanceof User) {
- if (AppDataReference.equals((User) p, u))
- return true;
- } else
- if (p instanceof ApplicationData) {
- if (AppDataReference.equals((ApplicationData) p, c))
- return true;
- }
- return false;
- }
- };
-
- return searchAppDatas(doc, match, true); // only return AppDatas belonging to appdata app.
- }
- /**
- * safely creates a new appData reference
- * @param dest destination document Vobject
- * @param entry base application reference to make unique
- */
- public static String uniqueAppDataReference(VamsasDocument dest,String base) {
- String urn = base.replace('/','_').replace('\\','_').replace(':', '_').replace('.', '_');
- int v = 1;
- for (int i=0, j=dest.getApplicationDataCount(); i<j; i++) {
- ApplicationData o = dest.getApplicationData()[i];
- // ensure new urn is really unique
- while (o.getDataReference()!=null && o.getDataReference().equals(urn)) {
- urn = base+"_"+v++;
- }
- }
- return urn;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+import java.util.Vector;\r
+\r
+import uk.ac.vamsas.client.ClientHandle;\r
+import uk.ac.vamsas.client.UserHandle;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchive;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.objects.core.*;\r
+\r
+/**\r
+ * Form, accessors and validation for ApplicationData references in vamsas\r
+ * document. TODO: LATER:extend XML Schema to properly validate against the same\r
+ * forms required by this class TODO: VAMSAS: URNS for appDatas are supposed to\r
+ * be unique, aren't they ?\r
+ */\r
+public class AppDataReference {\r
+ /**\r
+ * search interface for collecting particular types of AppDatas in a vamsas\r
+ * document\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+ interface IAppDSearch {\r
+ /**\r
+ * process the appData Vobject d\r
+ * \r
+ * @param d\r
+ * @return true if appData should be collected\r
+ */\r
+ public boolean process(AppData d);\r
+ }\r
+\r
+ /**\r
+ * collect all appData reference strings in a vamsas document\r
+ * \r
+ * @param doc\r
+ * @return vector of String objects\r
+ */\r
+ static public Vector getAppDataReferences(VamsasDocument doc) {\r
+ if ((doc != null) && (doc.getApplicationDataCount() > 0)) {\r
+ Vector apdrefs = new Vector();\r
+ ApplicationData[] appdatas = doc.getApplicationData();\r
+ for (int q = 0; q < appdatas.length; q++) {\r
+ String refstring = appdatas[q].getDataReference();\r
+ if (refstring != null)\r
+ apdrefs.add(refstring);\r
+ User users[] = appdatas[q].getUser();\r
+\r
+ if (users != null)\r
+ for (int u = 0; u < users.length; u++) {\r
+ refstring = users[u].getDataReference();\r
+ if (refstring != null)\r
+ apdrefs.add(new String(refstring)); // avoid referencing.\r
+ }\r
+ }\r
+ if (apdrefs.size() > 0)\r
+ return apdrefs;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * General search through the set of AppData objects for a particular profile\r
+ * of Client and User handle.\r
+ * \r
+ * @param doc\r
+ * @param test\r
+ * interface implemented by the filter selecting particular AppDatas.\r
+ * @param cascade\r
+ * if true only User objects for ApplicationData objects that\r
+ * test.process returned true will be tested.\r
+ * @return set of uk.ac.vamsas.objects.core.AppData objects for which\r
+ * test.process returned true\r
+ */\r
+ static public Vector searchAppDatas(VamsasDocument doc, IAppDSearch test,\r
+ boolean cascade) {\r
+ if ((doc != null) && (doc.getApplicationDataCount() > 0)) {\r
+ Vector apdrefs = new Vector();\r
+ ApplicationData[] appdatas = doc.getApplicationData();\r
+ for (int q = 0; q < appdatas.length; q++) {\r
+ boolean t;\r
+ if (t = test.process(appdatas[q]))\r
+ apdrefs.add(appdatas[q]);\r
+ if (t || cascade) {\r
+ User users[] = appdatas[q].getUser();\r
+ if (users != null)\r
+ for (int u = 0; u < users.length; u++)\r
+ if (test.process(users[u]))\r
+ apdrefs.add(users[u]);\r
+ }\r
+ }\r
+ if (apdrefs.size() > 0)\r
+ return apdrefs;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ static public boolean equals(User p, UserHandle u) {\r
+ if (p.getFullname().equals(u.getFullName())\r
+ && p.getOrganization().equals(u.getOrganization()))\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * returns true if Name matches in c and p, and Urn's match (or\r
+ * c.getUrn()==null) and Version's match (or c.getVersion()==null)\r
+ * \r
+ * @param p\r
+ * @param c\r
+ * @return match of p on template c.\r
+ */\r
+ static public boolean equals(ApplicationData p, ClientHandle c) {\r
+ if (\r
+ // ((c.getClientUrn()==null) || p.getUrn().equals(c.getClientUrn()))\r
+ // &&\r
+ (p.getName().equals(c.getClientName()))\r
+ && ((c.getVersion() == null) || (p.getVersion().equals(c.getVersion()))))\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * Searches document appData structure for particular combinations of client\r
+ * and user data\r
+ * \r
+ * @param doc\r
+ * the data\r
+ * @param user\r
+ * template user data to match against\r
+ * @see AppDataReference.equals(uk.ac.vamsas.objects.core.User,\r
+ * uk.ac.vamsas.client.UserHandle)\r
+ * @param app\r
+ * @see AppDataReference.equals(uk.ac.vamsas.objects.core.ApplicationData,\r
+ * uk.ac.vamsas.client.ClientHandle)\r
+ * @return set of matching client app datas for this client and user\r
+ * combination\r
+ */\r
+ static public Vector getUserandApplicationsData(VamsasDocument doc,\r
+ UserHandle user, ClientHandle app) {\r
+ if (doc == null) {\r
+ return null;\r
+ }\r
+ final UserHandle u = user;\r
+ final ClientHandle c = app;\r
+\r
+ IAppDSearch match = new IAppDSearch() {\r
+ public boolean process(AppData p) {\r
+ if (p instanceof User) {\r
+ if (AppDataReference.equals((User) p, u))\r
+ return true;\r
+ } else if (p instanceof ApplicationData) {\r
+ if (AppDataReference.equals((ApplicationData) p, c))\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+ };\r
+\r
+ return searchAppDatas(doc, match, true); // only return AppDatas belonging\r
+ // to appdata app.\r
+ }\r
+\r
+ /**\r
+ * safely creates a new appData reference\r
+ * \r
+ * @param dest\r
+ * destination document Vobject\r
+ * @param entry\r
+ * base application reference to make unique\r
+ */\r
+ public static String uniqueAppDataReference(VamsasDocument dest, String base) {\r
+ String urn = base.replace('/', '_').replace('\\', '_').replace(':', '_')\r
+ .replace('.', '_');\r
+ int v = 1;\r
+ for (int i = 0, j = dest.getApplicationDataCount(); i < j; i++) {\r
+ ApplicationData o = dest.getApplicationData()[i];\r
+ // ensure new urn is really unique\r
+ while (o.getDataReference() != null && o.getDataReference().equals(urn)) {\r
+ urn = base + "_" + v++;\r
+ }\r
+ }\r
+ return urn;\r
+ }\r
+}\r
-package uk.ac.vamsas.objects.utils;
-
-
-import uk.ac.vamsas.objects.core.*;
-import uk.ac.vamsas.objects.utils.document.VersionEntries;
-
-/**
- * various vamsas-client independent helpers
- * for creating and manipulating the vamsasDocument Vobject
- * @author jimp
- *
- */
-public class DocumentStuff {
- public static VamsasDocument newVamsasDocument(VAMSAS root[], String version) {
- return newVamsasDocument(root, ProvenanceStuff.newProvenance(
- "AUTO:org.vamsas.DocumentStuff.newVamsasDocument",
- "Vamsas Document created"),
- version);
- }
- public static VamsasDocument newVamsasDocument(VAMSAS root[]) {
- return newVamsasDocument(root, ProvenanceStuff.newProvenance(
- "AUTO:org.vamsas.DocumentStuff.newVamsasDocument",
- "Vamsas Document created"),
- VersionEntries.latestVersion());
- }
- public static VamsasDocument newVamsasDocument(VAMSAS root[], Provenance p, String version) {
- VamsasDocument doc = new VamsasDocument();
- for (int r=0; r<root.length; r++) {
- doc.addVAMSAS(root[r]);
- }
- doc.setProvenance(p);
- doc.setVersion(version);
- return doc;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+import uk.ac.vamsas.objects.core.*;\r
+import uk.ac.vamsas.objects.utils.document.VersionEntries;\r
+\r
+/**\r
+ * various vamsas-client independent helpers for creating and manipulating the\r
+ * vamsasDocument Vobject\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class DocumentStuff {\r
+ public static VamsasDocument newVamsasDocument(VAMSAS root[], String version) {\r
+ return newVamsasDocument(root, ProvenanceStuff.newProvenance(\r
+ "AUTO:org.vamsas.DocumentStuff.newVamsasDocument",\r
+ "Vamsas Document created"), version);\r
+ }\r
+\r
+ public static VamsasDocument newVamsasDocument(VAMSAS root[]) {\r
+ return newVamsasDocument(root, ProvenanceStuff.newProvenance(\r
+ "AUTO:org.vamsas.DocumentStuff.newVamsasDocument",\r
+ "Vamsas Document created"), VersionEntries.latestVersion());\r
+ }\r
+\r
+ public static VamsasDocument newVamsasDocument(VAMSAS root[], Provenance p,\r
+ String version) {\r
+ VamsasDocument doc = new VamsasDocument();\r
+ for (int r = 0; r < root.length; r++) {\r
+ doc.addVAMSAS(root[r]);\r
+ }\r
+ doc.setProvenance(p);\r
+ doc.setVersion(version);\r
+ return doc;\r
+ }\r
+}\r
/*\r
- * Cay S. Horstmann & Gary Cornell, Core Java\r
- * Published By Sun Microsystems Press/Prentice-Hall\r
- * Copyright (C) 1997 Sun Microsystems Inc.\r
- * All Rights Reserved.\r
- *\r
- * Permission to use, copy, modify, and distribute this \r
- * software and its documentation for NON-COMMERCIAL purposes\r
- * and without fee is hereby granted provided that this \r
- * copyright notice appears in all copies. \r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
* \r
- * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR \r
- * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE \r
- * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A \r
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS\r
- * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED \r
- * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING \r
- * THIS SOFTWARE OR ITS DERIVATIVES.\r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
/**\r
* A class for formatting numbers that follows printf conventions.\r
* Also implements C-like atoi and atof functions\r
\r
import java.io.*;\r
\r
-public class Format { /**\r
+public class Format {\r
+/**\r
* Formats the number following printf conventions.\r
* Main limitation: Can only handle one format parameter at a time\r
* Use multiple Format objects to format more than one number\r
}\r
\r
/**\r
- * prints a formatted number following printf conventions\r
- * @param s a PrintStream\r
- * @param fmt the format string\r
- * @param x the double to print\r
- */\r
+ * prints a formatted number following printf conventions\r
+ * \r
+ * @param s\r
+ * a PrintStream\r
+ * @param fmt\r
+ * the format string\r
+ * @param x\r
+ * the double to print\r
+ */\r
\r
public static void print(java.io.PrintStream s, String fmt, double x) {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
/**\r
- * prints a formatted number following printf conventions\r
- * @param s a PrintStream\r
- * @param fmt the format string\r
- * @param x the long to print\r
- */\r
+ * prints a formatted number following printf conventions\r
+ * \r
+ * @param s\r
+ * a PrintStream\r
+ * @param fmt\r
+ * the format string\r
+ * @param x\r
+ * the long to print\r
+ */\r
public static void print(java.io.PrintStream s, String fmt, long x) {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
/**\r
- * prints a formatted number following printf conventions\r
- * @param s a PrintStream\r
- * @param fmt the format string\r
- * @param x the character to \r
- */\r
+ * prints a formatted number following printf conventions\r
+ * \r
+ * @param s\r
+ * a PrintStream\r
+ * @param fmt\r
+ * the format string\r
+ * @param x\r
+ * the character to\r
+ */\r
\r
public static void print(java.io.PrintStream s, String fmt, char x) {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
/**\r
- * prints a formatted number following printf conventions\r
- * @param s a PrintStream, fmt the format string\r
- * @param x a string that represents the digits to print\r
- */\r
+ * prints a formatted number following printf conventions\r
+ * \r
+ * @param s\r
+ * a PrintStream, fmt the format string\r
+ * @param x\r
+ * a string that represents the digits to print\r
+ */\r
\r
public static void print(java.io.PrintStream s, String fmt, String x) {\r
s.print(new Format(fmt).form(x));\r
}\r
\r
/**\r
- * Converts a string of digits (decimal, octal or hex) to an integer\r
- * @param s a string\r
- * @return the numeric value of the prefix of s representing a base 10 integer\r
- */\r
+ * Converts a string of digits (decimal, octal or hex) to an integer\r
+ * \r
+ * @param s\r
+ * a string\r
+ * @return the numeric value of the prefix of s representing a base 10 integer\r
+ */\r
\r
public static int atoi(String s) {\r
- return (int)atol(s);\r
+ return (int) atol(s);\r
}\r
\r
/**\r
- * Converts a string of digits (decimal, octal or hex) to a long integer\r
- * @param s a string\r
- * @return the numeric value of the prefix of s representing a base 10 integer\r
- */\r
+ * Converts a string of digits (decimal, octal or hex) to a long integer\r
+ * \r
+ * @param s\r
+ * a string\r
+ * @return the numeric value of the prefix of s representing a base 10 integer\r
+ */\r
\r
public static long atol(String s) {\r
int i = 0;\r
while (i < s.length() && Character.isWhitespace(s.charAt(i)))\r
i++;\r
if (i < s.length() && s.charAt(i) == '0') {\r
- if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X'))\r
+ if (i + 1 < s.length()\r
+ && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X'))\r
return parseLong(s.substring(i + 2), 16);\r
else\r
return parseLong(s, 8);\r
if ('0' <= ch && ch < '0' + base)\r
r = r * base + ch - '0';\r
else if ('A' <= ch && ch < 'A' + base - 10)\r
- r = r * base + ch - 'A' + 10 ;\r
+ r = r * base + ch - 'A' + 10;\r
else if ('a' <= ch && ch < 'a' + base - 10)\r
- r = r * base + ch - 'a' + 10 ;\r
+ r = r * base + ch - 'a' + 10;\r
else\r
return r * sign;\r
i++;\r
}\r
\r
/**\r
- * Converts a string of digits to an double\r
- * @param s a string\r
- */\r
+ * Converts a string of digits to an double\r
+ * \r
+ * @param s\r
+ * a string\r
+ */\r
\r
public static double atof(String s) {\r
int i = 0;\r
else\r
return sign * r;\r
} else if (ch == 'e' || ch == 'E') {\r
- long e = (int)parseLong(s.substring(i + 1), 10);\r
+ long e = (int) parseLong(s.substring(i + 1), 10);\r
return sign * r * Math.pow(10, e);\r
} else\r
return sign * r;\r
}\r
\r
/**\r
- * Formats a double into a string (like sprintf in C)\r
- * @param x the number to format\r
- * @return the formatted string \r
- * @exception IllegalArgumentException if bad argument\r
- */\r
+ * Formats a double into a string (like sprintf in C)\r
+ * \r
+ * @param x\r
+ * the number to format\r
+ * @return the formatted string\r
+ * @exception IllegalArgumentException\r
+ * if bad argument\r
+ */\r
\r
public String form(double x) {\r
String r;\r
}\r
\r
/**\r
- * Formats a long integer into a string (like sprintf in C)\r
- * @param x the number to format\r
- * @return the formatted string \r
- */\r
+ * Formats a long integer into a string (like sprintf in C)\r
+ * \r
+ * @param x\r
+ * the number to format\r
+ * @return the formatted string\r
+ */\r
\r
public String form(long x) {\r
String r;\r
}\r
\r
/**\r
- * Formats a character into a string (like sprintf in C)\r
- * @param x the value to format\r
- * @return the formatted string \r
- */\r
+ * Formats a character into a string (like sprintf in C)\r
+ * \r
+ * @param x\r
+ * the value to format\r
+ * @return the formatted string\r
+ */\r
\r
public String form(char c) {\r
if (fmt != 'c')\r
}\r
\r
/**\r
- * Formats a string into a larger string (like sprintf in C)\r
- * @param x the value to format\r
- * @return the formatted string \r
- */\r
+ * Formats a string into a larger string (like sprintf in C)\r
+ * \r
+ * @param x\r
+ * the value to format\r
+ * @return the formatted string\r
+ */\r
\r
public String form(String s) {\r
if (fmt != 's')\r
return pad(s);\r
}\r
\r
-\r
/**\r
- * a test stub for the format class\r
- */\r
+ * a test stub for the format class\r
+ */\r
\r
public static void main(String[] a) {\r
double x = 1.23456789012;\r
return "0";\r
String r = "";\r
while (x != 0) {\r
- r = d.charAt((int)(x & m)) + r;\r
+ r = d.charAt((int) (x & m)) + r;\r
x = x >>> n;\r
}\r
return r;\r
if (leading_zeroes)\r
w = width;\r
else if ((fmt == 'd' || fmt == 'i' || fmt == 'x' || fmt == 'X' || fmt == 'o')\r
- && precision > 0)\r
+ && precision > 0)\r
w = precision;\r
\r
return p + repeat('0', w - p.length() - r.length()) + r;\r
}\r
\r
private String fixed_format(double d) {\r
- boolean removeTrailing\r
- = (fmt == 'G' || fmt == 'g') && !alternate;\r
+ boolean removeTrailing = (fmt == 'G' || fmt == 'g') && !alternate;\r
// remove trailing zeroes and decimal point\r
\r
if (d > 0x7FFFFFFFFFFFFFFFL)\r
return exp_format(d);\r
if (precision == 0)\r
- return (long)(d + 0.5) + (removeTrailing ? "" : ".");\r
+ return (long) (d + 0.5) + (removeTrailing ? "" : ".");\r
\r
- long whole = (long)d;\r
+ long whole = (long) d;\r
double fr = d - whole; // fractional part\r
if (fr >= 1 || fr < 0)\r
return exp_format(d);\r
}\r
\r
private int width;\r
+\r
private int precision;\r
+\r
private String pre;\r
+\r
private String post;\r
+\r
private boolean leading_zeroes;\r
+\r
private boolean show_plus;\r
+\r
private boolean alternate;\r
+\r
private boolean show_space;\r
+\r
private boolean left_align;\r
+\r
private char fmt; // one of cdeEfgGiosxXos\r
}\r
-\r
-\r
-\r
-\r
-\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.objects.utils;\r
\r
/**\r
- * dict attribute values for glyph symbol sets found in uk.ac.vamsas.objects.core.AnnotationElement\r
- * TODO: add validators and multilength symbols.\r
+ * dict attribute values for glyph symbol sets found in\r
+ * uk.ac.vamsas.objects.core.AnnotationElement TODO: add validators and\r
+ * multilength symbols.\r
+ * \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class GlyphDictionary {\r
/**\r
* standard H, E, or C three state secondary structure assignment.\r
*/\r
- static final public String PROTEIN_SS_3STATE="aasecstr_3"; // HE, blank or C\r
+ static final public String PROTEIN_SS_3STATE = "aasecstr_3"; // HE, blank or C\r
+\r
/**\r
* default glyph type attribute indicates a UTF8 character\r
*/\r
- static final public String DEFAULT="utf8";\r
+ static final public String DEFAULT = "utf8";\r
+\r
/**\r
- * kyte and doolittle hydrophobicity\r
- * TODO: specify this glyph set.\r
+ * kyte and doolittle hydrophobicity TODO: specify this glyph set.\r
*/\r
- static final public String PROTEIN_HD_HYDRO="kd_hydrophobicity";\r
+ static final public String PROTEIN_HD_HYDRO = "kd_hydrophobicity";\r
}\r
-/*
- * This code was originated from
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-package uk.ac.vamsas.objects.utils;
-
-import java.util.*;
-
-/**
- * MapList
- * Simple way of bijectively mapping a non-contiguous linear range to another non-contiguous linear range
- * Use at your own risk!
- * TODO: efficient implementation of private posMap method
- * TODO: test/ensure that sense of from and to ratio start position is conserved (codon start position recovery)
- * TODO: optimize to use int[][] arrays rather than vectors.
- */
-public class MapList
-{
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(MapList obj) {
- if (obj==this)
- return true;
- if (obj!=null && obj.fromRatio==fromRatio && obj.toRatio==toRatio
- && obj.fromShifts!=null && obj.toShifts!=null) {
- int i,iSize=fromShifts.size(),j,jSize=obj.fromShifts.size();
- if (iSize!=jSize)
- return false;
- for (i=0,iSize=fromShifts.size(),j=0, jSize=obj.fromShifts.size(); i<iSize;) {
- int[] mi=(int[]) fromShifts.elementAt(i++);
- int[] mj=(int[]) obj.fromShifts.elementAt(j++);
- if (mi[0]!=mj[0] || mi[1]!=mj[1])
- return false;
- }
- iSize=toShifts.size();
- jSize=obj.toShifts.size();
- if (iSize!=jSize)
- return false;
- for (i=0,j=0; i<iSize;) {
- int[] mi=(int[]) toShifts.elementAt(i++);
- int[] mj=(int[]) obj.toShifts.elementAt(j++);
- if (mi[0]!=mj[0] || mi[1]!=mj[1])
- return false;
- }
- return true;
- }
- return false;
- }
- public Vector fromShifts;
- public Vector toShifts;
- int fromRatio; // number of steps in fromShifts to one toRatio unit
- int toRatio; // number of steps in toShifts to one fromRatio
-
- /**
- *
- * @return series of intervals mapped in from
- */
- public int[] getFromRanges()
- {
- return getRanges(fromShifts);
- }
- public int[] getToRanges()
- {
- return getRanges(toShifts);
- }
-
- private int[] getRanges(Vector shifts)
- {
- int[] rnges = new int[2*shifts.size()];
- Enumeration e = shifts.elements();
- int i=0;
- while (e.hasMoreElements())
- {
- int r[] = (int[]) e.nextElement();
- rnges[i++] = r[0];
- rnges[i++] = r[1];
- }
- return rnges;
- }
- /**
- * lowest and highest value in the from Map
- */
- int[] fromRange=null;
- /**
- * lowest and highest value in the to Map
- */
- int[] toRange=null;
- /**
- *
- * @return length of mapped phrase in from
- */
- public int getFromRatio()
- {
- return fromRatio;
- }
- /**
- *
- * @return length of mapped phrase in to
- */
- public int getToRatio()
- {
- return toRatio;
- }
- public int getFromLowest() {
- return fromRange[0];
- }
- public int getFromHighest() {
- return fromRange[1];
- }
- public int getToLowest() {
- return toRange[0];
- }
- public int getToHighest() {
- return toRange[1];
- }
- private void ensureRange(int[] limits, int pos) {
- if (limits[0]>pos)
- limits[0]=pos;
- if (limits[1]<pos)
- limits[1]=pos;
- }
- public MapList(int from[], int to[], int fromRatio, int toRatio)
- {
- fromRange=new int[] { from[0],from[1] };
- toRange=new int[] { to[0],to[1] };
-
- fromShifts = new Vector();
- for (int i=0;i<from.length; i+=2)
- {
- ensureRange(fromRange, from[i]);
- ensureRange(fromRange, from[i+1]);
-
- fromShifts.addElement(new int[]
- {from[i], from[i + 1]});
- }
- toShifts = new Vector();
- for (int i=0;i<to.length; i+=2)
- {
- ensureRange(toRange, to[i]);
- ensureRange(toRange, to[i+1]);
- toShifts.addElement(new int[]
- {to[i], to[i + 1]});
- }
- this.fromRatio=fromRatio;
- this.toRatio=toRatio;
- }
- public MapList(MapList map)
- {
- this.fromRange = new int[]
- { map.fromRange[0], map.fromRange[1] };
- this.toRange = new int[]
- { map.toRange[0], map.toRange[1] };
- this.fromRatio = map.fromRatio;
- this.toRatio = map.toRatio;
- if (map.fromShifts != null)
- {
- this.fromShifts = new Vector();
- Enumeration e = map.fromShifts.elements();
- while (e.hasMoreElements())
- {
- int[] el = (int[]) e.nextElement();
- fromShifts.addElement(new int[]
- { el[0], el[1] });
- }
- }
- if (map.toShifts != null)
- {
- this.toShifts = new Vector();
- Enumeration e = map.toShifts.elements();
- while (e.hasMoreElements())
- {
- int[] el = (int[]) e.nextElement();
- toShifts.addElement(new int[]
- { el[0], el[1] });
- }
- }
- }
- /**
- * get all mapped positions from 'from' to 'to'
- * @return int[][] { int[] { fromStart, fromFinish, toStart, toFinish }, int [fromFinish-fromStart+2] { toStart..toFinish mappings}}
- */
- public int[][] makeFromMap()
- {
- return posMap(fromShifts, fromRatio, toShifts, toRatio);
- }
- /**
- * get all mapped positions from 'to' to 'from'
- * @return int[to position]=position mapped in from
- */
- public int[][] makeToMap()
- {
- return posMap(toShifts,toRatio, fromShifts, fromRatio);
- }
- /**
- * construct an int map for intervals in intVals
- * @param intVals
- * @return int[] { from, to pos in range }, int[range.to-range.from+1] returning mapped position
- */
- private int[][] posMap(Vector intVals, int ratio, Vector toIntVals,
- int toRatio)
- {
- int iv=0,ivSize = intVals.size();
- if (iv>=ivSize)
- {
- return null;
- }
- int[] intv=(int[]) intVals.elementAt(iv++);
- int from=intv[0],to=intv[1];
- if (from > to)
- {
- from = intv[1];
- to=intv[0];
- }
- while (iv<ivSize)
- {
- intv = (int[]) intVals.elementAt(iv++);
- if (intv[0]<from)
- {
- from=intv[0];
- }
- if (intv[1]<from)
- {
- from=intv[1];
- }
- if (intv[0]>to)
- {
- to=intv[0];
- }
- if (intv[1]>to)
- {
- to=intv[1];
- }
- }
- int tF=0,tT=0;
- int mp[][] = new int[to-from+2][];
- for (int i = 0; i < mp.length; i++)
- {
- int[] m = shift(i+from,intVals,ratio,toIntVals, toRatio);
- if (m != null)
- {
- if (i == 0)
- {
- tF=tT=m[0];
- }
- else
- {
- if (m[0] < tF)
- {
- tF=m[0];
- }
- if (m[0] > tT)
- {
- tT=m[0];
- }
- }
- }
- mp[i] = m;
- }
- int[][] map = new int[][]
- {
- new int[]
- {
- from, to, tF, tT}, new int[to - from + 2]};
-
- map[0][2] = tF;
- map[0][3] = tT;
-
- for (int i = 0; i < mp.length; i++)
- {
- if (mp[i] != null)
- {
- map[1][i] = mp[i][0]-tF;
- }
- else
- {
- map[1][i] = -1; // indicates an out of range mapping
- }
- }
- return map;
- }
- /**
- * addShift
- * @param pos start position for shift (in original reference frame)
- * @param shift length of shift
- *
- public void addShift(int pos, int shift)
- {
- int sidx = 0;
- int[] rshift=null;
- while (sidx<shifts.size() && (rshift=(int[]) shifts.elementAt(sidx))[0]<pos)
- sidx++;
- if (sidx==shifts.size())
- shifts.insertElementAt(new int[] { pos, shift}, sidx);
- else
- rshift[1]+=shift;
- }
- */
- /**
- * shift from pos to To(pos)
- *
- * @param pos int
- * @return int shifted position in To, frameshift in From, direction of mapped symbol in To
- */
- public int[] shiftFrom(int pos)
- {
- return shift(pos, fromShifts, fromRatio, toShifts, toRatio);
- }
-
- /**
- * inverse of shiftFrom - maps pos in To to a position in From
- * @param pos (in To)
- * @return shifted position in From, frameshift in To, direction of mapped symbol in From
- */
- public int[] shiftTo(int pos)
- {
- return shift(pos, toShifts, toRatio, fromShifts, fromRatio);
- }
- /**
- *
- * @param fromShifts
- * @param fromRatio
- * @param toShifts
- * @param toRatio
- * @return
- */
- private int[] shift(int pos, Vector fromShifts, int fromRatio,
- Vector toShifts, int toRatio)
- {
- int[] fromCount = countPos(fromShifts, pos);
- if (fromCount==null)
- {
- return null;
- }
- int fromRemainder=(fromCount[0]-1) % fromRatio;
- int toCount = 1+(((fromCount[0]-1) / fromRatio) * toRatio);
- int[] toPos = countToPos(toShifts, toCount);
- if (toPos==null)
- {
- return null; // throw new Error("Bad Mapping!");
- }
- //System.out.println(fromCount[0]+" "+fromCount[1]+" "+toCount);
- return new int[]
- {
- toPos[0], fromRemainder, toPos[1]};
- }
- /**
- * count how many positions pos is along the series of intervals.
- * @param intVals
- * @param pos
- * @return number of positions or null if pos is not within intervals
- */
- private int[] countPos(Vector intVals, int pos)
- {
- int count=0,intv[],iv=0,ivSize=intVals.size();
- while (iv<ivSize)
- {
- intv = (int[])intVals.elementAt(iv++);
- if (intv[0] <= intv[1])
- {
- if (pos >= intv[0] && pos <= intv[1])
- {
- return new int[]
- {
- count + pos - intv[0] + 1, +1};
- }
- else
- {
- count+=intv[1]-intv[0]+1;
- }
- }
- else
- {
- if (pos >= intv[1] && pos <= intv[0])
- {
- return new int[]
- {
- count + intv[0] - pos + 1, -1};
- }
- else
- {
- count+=intv[0]-intv[1]+1;
- }
- }
- }
- return null;
- }
- /**
- * count out pos positions into a series of intervals and return the position
- * @param intVals
- * @param pos
- * @return position pos in interval set
- */
- private int[] countToPos(Vector intVals, int pos)
- {
- int count = 0, diff = 0, iv=0,ivSize=intVals.size(), intv[] =
- {
- 0, 0};
- while (iv<ivSize)
- {
- intv = (int[])intVals.elementAt(iv++);
- diff = intv[1]-intv[0];
- if (diff >= 0)
- {
- if (pos <= count + 1 + diff)
- {
- return new int[]
- {
- pos - count - 1 + intv[0], +1};
- }
- else
- {
- count+=1+diff;
- }
- }
- else
- {
- if (pos <= count + 1 - diff)
- {
- return new int[]
- {
- intv[0] - (pos - count - 1), -1};
- }
- else
- {
- count+=1-diff;
- }
- }
- }
- return null;//(diff<0) ? (intv[1]-1) : (intv[0]+1);
- }
- /**
- * find series of intervals mapping from start-end in the From map.
- * @param start position in to map
- * @param end position in to map
- * @return series of ranges in from map
- */
- public int[] locateInFrom(int start, int end) {
- // inefficient implementation
- int fromStart[] = shiftTo(start);
- int fromEnd[] = shiftTo(end); // needs to be inclusive of end of symbol position
- if (fromStart==null || fromEnd==null)
- return null;
- int iv[] = getIntervals(fromShifts, fromStart, fromEnd,fromRatio);
- return iv;
- }
-
- /**
- * find series of intervals mapping from start-end in the to map.
- * @param start position in from map
- * @param end position in from map
- * @return series of ranges in to map
- */
- public int[] locateInTo(int start, int end) {
- // inefficient implementation
- int toStart[] = shiftFrom(start);
- int toEnd[] = shiftFrom(end);
- if (toStart==null || toEnd==null)
- return null;
- int iv[] = getIntervals(toShifts, toStart, toEnd, toRatio);
- return iv;
- }
- /**
- * like shift - except returns the intervals in the given vector of shifts which were spanned
- * in traversing fromStart to fromEnd
- * @param fromShifts2
- * @param fromStart
- * @param fromEnd
- * @param fromRatio2
- * @return series of from,to intervals from from first position of starting region to final position of ending region inclusive
- */
- private int[] getIntervals(Vector fromShifts2, int[] fromStart, int[] fromEnd, int fromRatio2)
- {
- int startpos,endpos;
- startpos = fromStart[0]; // first position in fromStart
- endpos = fromEnd[0]+fromEnd[2]*(fromRatio2-1); // last position in fromEnd
- int intv=0,intvSize= fromShifts2.size();
- int iv[],i=0,fs=-1,fe=-1; // containing intervals
- while (intv<intvSize && (fs==-1 || fe==-1)) {
- iv = (int[]) fromShifts2.elementAt(intv++);
- if (iv[0]<=iv[1]) {
- if (fs==-1 && startpos>=iv[0] && startpos<=iv[1]) {
- fs = i;
- }
- if (fe==-1 && endpos>=iv[0] && endpos<=iv[1]) {
- fe = i;
- }
- } else {
- if (fs==-1 && startpos<=iv[0] && startpos>=iv[1]) {
- fs = i;
- }
- if (fe==-1 && endpos<=iv[0] && endpos>=iv[1]) {
- fe = i;
- }
- }
- i++;
- }
- if (fs==fe && fe==-1)
- return null;
- Vector ranges=new Vector();
- if (fs<=fe) {
- intv = fs;
- i=fs;
- // truncate initial interval
- iv = (int[]) fromShifts2.elementAt(intv++);
- iv = new int[] { iv[0], iv[1]};// clone
- if (i==fs)
- iv[0] = startpos;
- while (i!=fe) {
- ranges.addElement(iv); // add initial range
- iv = (int[]) fromShifts2.elementAt(intv++); // get next interval
- iv = new int[] { iv[0], iv[1]};// clone
- i++;
- }
- if (i==fe)
- iv[1] = endpos;
- ranges.addElement(iv); // add only - or final range
- } else {
- // walk from end of interval.
- i=fromShifts2.size()-1;
- while (i>fs) {
- i--;
- }
- iv = (int[]) fromShifts2.elementAt(i);
- iv = new int[] { iv[1], iv[0]};// reverse and clone
- // truncate initial interval
- if (i==fs)
- {
- iv[0] = startpos;
- }
- while (--i!=fe) { // fix apparent logic bug when fe==-1
- ranges.addElement(iv); // add (truncated) reversed interval
- iv = (int[]) fromShifts2.elementAt(i);
- iv = new int[] { iv[1], iv[0] }; // reverse and clone
- }
- if (i==fe) {
- // interval is already reversed
- iv[1] = endpos;
- }
- ranges.addElement(iv); // add only - or final range
- }
- // create array of start end intervals.
- int[] range = null;
- if (ranges!=null && ranges.size()>0)
- {
- range = new int[ranges.size()*2];
- intv = 0;
- intvSize=ranges.size();
- i=0;
- while (intv<intvSize)
- {
- iv = (int[]) ranges.elementAt(intv);
- range[i++] = iv[0];
- range[i++] = iv[1];
- ranges.setElementAt(null, intv++); // remove
- }
- }
- return range;
- }
- /**
- * get the 'initial' position of mpos in To
- * @param mpos position in from
- * @return position of first word in to reference frame
- */
-public int getToPosition(int mpos)
-{
- int[] mp = shiftTo(mpos);
- if (mp!=null)
- {
- return mp[0];
- }
- return mpos;
-}
-/**
- * get range of positions in To frame for the mpos word in From
- * @param mpos position in From
- * @return null or int[] first position in To for mpos, last position in to for Mpos
- */
-public int[] getToWord(int mpos) {
- int[] mp=shiftTo(mpos);
- if (mp!=null) {
- return new int[] {mp[0], mp[0]+mp[2]*(getFromRatio()-1)};
- }
- return null;
-}
-/**
- * get From position in the associated
- * reference frame for position pos in the
- * associated sequence.
- * @param pos
- * @return
- */
-public int getMappedPosition(int pos) {
- int[] mp = shiftFrom(pos);
- if (mp!=null)
- {
- return mp[0];
- }
- return pos;
-}
-public int[] getMappedWord(int pos) {
- int[] mp = shiftFrom(pos);
- if (mp!=null)
- {
- return new int[] { mp[0], mp[0]+mp[2]*(getToRatio()-1)};
- }
- return null;
-}
-
- /**
- * test routine. not incremental.
- * @param ml
- * @param fromS
- * @param fromE
- */
- public static void testMap(MapList ml, int fromS, int fromE)
- {
- for (int from = 1; from <= 25; from++)
- {
- int[] too=ml.shiftFrom(from);
- System.out.print("ShiftFrom("+from+")==");
- if (too==null)
- {
- System.out.print("NaN\n");
- }
- else
- {
- System.out.print(too[0]+" % "+too[1]+" ("+too[2]+")");
- System.out.print("\t+--+\t");
- int[] toofrom=ml.shiftTo(too[0]);
- if (toofrom != null)
- {
- if (toofrom[0]!=from)
- {
- System.err.println("Mapping not reflexive:" + from + " " + too[0] +
- "->" + toofrom[0]);
- }
- System.out.println("ShiftTo(" + too[0] + ")==" + toofrom[0] + " % " +
- toofrom[1]+" ("+toofrom[2]+")");
- }
- else
- {
- System.out.println("ShiftTo(" + too[0] + ")==" +
- "NaN! - not Bijective Mapping!");
- }
- }
- }
- int mmap[][] = ml.makeFromMap();
- System.out.println("FromMap : (" + mmap[0][0] + " " + mmap[0][1] + " " +
- mmap[0][2] + " " + mmap[0][3] + " ");
- for (int i = 1; i <= mmap[1].length; i++)
- {
- if (mmap[1][i - 1] == -1)
- {
- System.out.print(i+"=XXX");
-
- }
- else
- {
- System.out.print(i+"="+(mmap[0][2]+mmap[1][i-1]));
- }
- if (i % 20==0)
- {
- System.out.print("\n");
- }
- else
- {
- System.out.print(",");
- }
- }
- //test range function
- System.out.print("\nTest locateInFrom\n");
- {
- int f=mmap[0][2],t=mmap[0][3];
- while (f<=t) {
- System.out.println("Range "+f+" to "+t);
- int rng[] = ml.locateInFrom(f,t);
- if (rng!=null)
- {
- for (int i=0; i<rng.length; i++) {
- System.out.print(rng[i]+((i%2==0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- System.out.print("\nReversed\n");
- rng = ml.locateInFrom(t,f);
- if (rng!=null)
- {
- for (int i=0; i<rng.length; i++) {
- System.out.print(rng[i]+((i%2==0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- System.out.print("\n");
- f++;t--;
- }
- }
- System.out.print("\n");
- mmap = ml.makeToMap();
- System.out.println("ToMap : (" + mmap[0][0] + " " + mmap[0][1] + " " +
- mmap[0][2] + " " + mmap[0][3] + " ");
- for (int i = 1; i <= mmap[1].length; i++)
- {
- if (mmap[1][i - 1] == -1)
- {
- System.out.print(i+"=XXX");
-
- }
- else
- {
- System.out.print(i+"="+(mmap[0][2]+mmap[1][i-1]));
- }
- if (i % 20==0)
- {
- System.out.print("\n");
- }
- else
- {
- System.out.print(",");
- }
- }
- System.out.print("\n");
- //test range function
- System.out.print("\nTest locateInTo\n");
- {
- int f=mmap[0][2],t=mmap[0][3];
- while (f<=t) {
- System.out.println("Range "+f+" to "+t);
- int rng[] = ml.locateInTo(f,t);
- if (rng!=null) {
- for (int i=0; i<rng.length; i++) {
- System.out.print(rng[i]+((i%2==0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- System.out.print("\nReversed\n");
- rng = ml.locateInTo(t,f);
- if (rng!=null)
- {
- for (int i=0; i<rng.length; i++) {
- System.out.print(rng[i]+((i%2==0) ? "," : ";"));
- }
- }
- else
- {
- System.out.println("No range!");
- }
- f++; t--;
- System.out.print("\n");
- }
- }
-
- }
-
- public static void main(String argv[])
- {
- MapList ml = new MapList(new int[]
- {1, 5, 10, 15, 25, 20},
- new int[]
- {51, 1}, 1, 3);
- MapList ml1 = new MapList(new int[]
- {1, 3, 17, 4},
- new int[]
- {51, 1}, 1, 3);
- MapList ml2 = new MapList(new int[] { 1, 60 },
- new int[] { 1, 20 }, 3, 1);
- // test internal consistency
- int to[] = new int[51];
- MapList.testMap(ml, 1, 60);
- /*
- for (int from=1; from<=51; from++) {
- int[] too=ml.shiftTo(from);
- int[] toofrom=ml.shiftFrom(too[0]);
- System.out.println("ShiftFrom("+from+")=="+too[0]+" % "+too[1]+"\t+-+\tShiftTo("+too[0]+")=="+toofrom[0]+" % "+toofrom[1]);
- }*/
- System.out.print("Success?\n"); // if we get here - something must be working!
- }
- /**
- *
- * @return a MapList whose From range is this maplist's To Range, and vice versa
- */
- public MapList getInverse()
- {
- return new MapList(getToRanges(), getFromRanges(), getToRatio(), getFromRatio());
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+import java.util.*;\r
+\r
+/**\r
+ * MapList Simple way of bijectively mapping a non-contiguous linear range to\r
+ * another non-contiguous linear range Use at your own risk! TODO: efficient\r
+ * implementation of private posMap method TODO: test/ensure that sense of from\r
+ * and to ratio start position is conserved (codon start position recovery)\r
+ * TODO: optimize to use int[][] arrays rather than vectors.\r
+ */\r
+public class MapList {\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.lang.Object#equals(java.lang.Object)\r
+ */\r
+ public boolean equals(MapList obj) {\r
+ if (obj == this)\r
+ return true;\r
+ if (obj != null && obj.fromRatio == fromRatio && obj.toRatio == toRatio\r
+ && obj.fromShifts != null && obj.toShifts != null) {\r
+ int i, iSize = fromShifts.size(), j, jSize = obj.fromShifts.size();\r
+ if (iSize != jSize)\r
+ return false;\r
+ for (i = 0, iSize = fromShifts.size(), j = 0, jSize = obj.fromShifts\r
+ .size(); i < iSize;) {\r
+ int[] mi = (int[]) fromShifts.elementAt(i++);\r
+ int[] mj = (int[]) obj.fromShifts.elementAt(j++);\r
+ if (mi[0] != mj[0] || mi[1] != mj[1])\r
+ return false;\r
+ }\r
+ iSize = toShifts.size();\r
+ jSize = obj.toShifts.size();\r
+ if (iSize != jSize)\r
+ return false;\r
+ for (i = 0, j = 0; i < iSize;) {\r
+ int[] mi = (int[]) toShifts.elementAt(i++);\r
+ int[] mj = (int[]) obj.toShifts.elementAt(j++);\r
+ if (mi[0] != mj[0] || mi[1] != mj[1])\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ public Vector fromShifts;\r
+\r
+ public Vector toShifts;\r
+\r
+ int fromRatio; // number of steps in fromShifts to one toRatio unit\r
+\r
+ int toRatio; // number of steps in toShifts to one fromRatio\r
+\r
+ /**\r
+ * \r
+ * @return series of intervals mapped in from\r
+ */\r
+ public int[] getFromRanges() {\r
+ return getRanges(fromShifts);\r
+ }\r
+\r
+ public int[] getToRanges() {\r
+ return getRanges(toShifts);\r
+ }\r
+\r
+ private int[] getRanges(Vector shifts) {\r
+ int[] rnges = new int[2 * shifts.size()];\r
+ Enumeration e = shifts.elements();\r
+ int i = 0;\r
+ while (e.hasMoreElements()) {\r
+ int r[] = (int[]) e.nextElement();\r
+ rnges[i++] = r[0];\r
+ rnges[i++] = r[1];\r
+ }\r
+ return rnges;\r
+ }\r
+\r
+ /**\r
+ * lowest and highest value in the from Map\r
+ */\r
+ int[] fromRange = null;\r
+\r
+ /**\r
+ * lowest and highest value in the to Map\r
+ */\r
+ int[] toRange = null;\r
+\r
+ /**\r
+ * \r
+ * @return length of mapped phrase in from\r
+ */\r
+ public int getFromRatio() {\r
+ return fromRatio;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return length of mapped phrase in to\r
+ */\r
+ public int getToRatio() {\r
+ return toRatio;\r
+ }\r
+\r
+ public int getFromLowest() {\r
+ return fromRange[0];\r
+ }\r
+\r
+ public int getFromHighest() {\r
+ return fromRange[1];\r
+ }\r
+\r
+ public int getToLowest() {\r
+ return toRange[0];\r
+ }\r
+\r
+ public int getToHighest() {\r
+ return toRange[1];\r
+ }\r
+\r
+ private void ensureRange(int[] limits, int pos) {\r
+ if (limits[0] > pos)\r
+ limits[0] = pos;\r
+ if (limits[1] < pos)\r
+ limits[1] = pos;\r
+ }\r
+\r
+ public MapList(int from[], int to[], int fromRatio, int toRatio) {\r
+ fromRange = new int[] { from[0], from[1] };\r
+ toRange = new int[] { to[0], to[1] };\r
+\r
+ fromShifts = new Vector();\r
+ for (int i = 0; i < from.length; i += 2) {\r
+ ensureRange(fromRange, from[i]);\r
+ ensureRange(fromRange, from[i + 1]);\r
+\r
+ fromShifts.addElement(new int[] { from[i], from[i + 1] });\r
+ }\r
+ toShifts = new Vector();\r
+ for (int i = 0; i < to.length; i += 2) {\r
+ ensureRange(toRange, to[i]);\r
+ ensureRange(toRange, to[i + 1]);\r
+ toShifts.addElement(new int[] { to[i], to[i + 1] });\r
+ }\r
+ this.fromRatio = fromRatio;\r
+ this.toRatio = toRatio;\r
+ }\r
+\r
+ public MapList(MapList map) {\r
+ this.fromRange = new int[] { map.fromRange[0], map.fromRange[1] };\r
+ this.toRange = new int[] { map.toRange[0], map.toRange[1] };\r
+ this.fromRatio = map.fromRatio;\r
+ this.toRatio = map.toRatio;\r
+ if (map.fromShifts != null) {\r
+ this.fromShifts = new Vector();\r
+ Enumeration e = map.fromShifts.elements();\r
+ while (e.hasMoreElements()) {\r
+ int[] el = (int[]) e.nextElement();\r
+ fromShifts.addElement(new int[] { el[0], el[1] });\r
+ }\r
+ }\r
+ if (map.toShifts != null) {\r
+ this.toShifts = new Vector();\r
+ Enumeration e = map.toShifts.elements();\r
+ while (e.hasMoreElements()) {\r
+ int[] el = (int[]) e.nextElement();\r
+ toShifts.addElement(new int[] { el[0], el[1] });\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * get all mapped positions from 'from' to 'to'\r
+ * \r
+ * @return int[][] { int[] { fromStart, fromFinish, toStart, toFinish }, int\r
+ * [fromFinish-fromStart+2] { toStart..toFinish mappings}}\r
+ */\r
+ public int[][] makeFromMap() {\r
+ return posMap(fromShifts, fromRatio, toShifts, toRatio);\r
+ }\r
+\r
+ /**\r
+ * get all mapped positions from 'to' to 'from'\r
+ * \r
+ * @return int[to position]=position mapped in from\r
+ */\r
+ public int[][] makeToMap() {\r
+ return posMap(toShifts, toRatio, fromShifts, fromRatio);\r
+ }\r
+\r
+ /**\r
+ * construct an int map for intervals in intVals\r
+ * \r
+ * @param intVals\r
+ * @return int[] { from, to pos in range }, int[range.to-range.from+1]\r
+ * returning mapped position\r
+ */\r
+ private int[][] posMap(Vector intVals, int ratio, Vector toIntVals,\r
+ int toRatio) {\r
+ int iv = 0, ivSize = intVals.size();\r
+ if (iv >= ivSize) {\r
+ return null;\r
+ }\r
+ int[] intv = (int[]) intVals.elementAt(iv++);\r
+ int from = intv[0], to = intv[1];\r
+ if (from > to) {\r
+ from = intv[1];\r
+ to = intv[0];\r
+ }\r
+ while (iv < ivSize) {\r
+ intv = (int[]) intVals.elementAt(iv++);\r
+ if (intv[0] < from) {\r
+ from = intv[0];\r
+ }\r
+ if (intv[1] < from) {\r
+ from = intv[1];\r
+ }\r
+ if (intv[0] > to) {\r
+ to = intv[0];\r
+ }\r
+ if (intv[1] > to) {\r
+ to = intv[1];\r
+ }\r
+ }\r
+ int tF = 0, tT = 0;\r
+ int mp[][] = new int[to - from + 2][];\r
+ for (int i = 0; i < mp.length; i++) {\r
+ int[] m = shift(i + from, intVals, ratio, toIntVals, toRatio);\r
+ if (m != null) {\r
+ if (i == 0) {\r
+ tF = tT = m[0];\r
+ } else {\r
+ if (m[0] < tF) {\r
+ tF = m[0];\r
+ }\r
+ if (m[0] > tT) {\r
+ tT = m[0];\r
+ }\r
+ }\r
+ }\r
+ mp[i] = m;\r
+ }\r
+ int[][] map = new int[][] { new int[] { from, to, tF, tT },\r
+ new int[to - from + 2] };\r
+\r
+ map[0][2] = tF;\r
+ map[0][3] = tT;\r
+\r
+ for (int i = 0; i < mp.length; i++) {\r
+ if (mp[i] != null) {\r
+ map[1][i] = mp[i][0] - tF;\r
+ } else {\r
+ map[1][i] = -1; // indicates an out of range mapping\r
+ }\r
+ }\r
+ return map;\r
+ }\r
+\r
+ /**\r
+ * addShift\r
+ * \r
+ * @param pos\r
+ * start position for shift (in original reference frame)\r
+ * @param shift\r
+ * length of shift\r
+ * \r
+ * public void addShift(int pos, int shift) { int sidx = 0; int[]\r
+ * rshift=null; while (sidx<shifts.size() && (rshift=(int[])\r
+ * shifts.elementAt(sidx))[0]<pos) sidx++; if (sidx==shifts.size())\r
+ * shifts.insertElementAt(new int[] { pos, shift}, sidx); else\r
+ * rshift[1]+=shift; }\r
+ */\r
+ /**\r
+ * shift from pos to To(pos)\r
+ * \r
+ * @param pos\r
+ * int\r
+ * @return int shifted position in To, frameshift in From, direction of mapped\r
+ * symbol in To\r
+ */\r
+ public int[] shiftFrom(int pos) {\r
+ return shift(pos, fromShifts, fromRatio, toShifts, toRatio);\r
+ }\r
+\r
+ /**\r
+ * inverse of shiftFrom - maps pos in To to a position in From\r
+ * \r
+ * @param pos\r
+ * (in To)\r
+ * @return shifted position in From, frameshift in To, direction of mapped\r
+ * symbol in From\r
+ */\r
+ public int[] shiftTo(int pos) {\r
+ return shift(pos, toShifts, toRatio, fromShifts, fromRatio);\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @param fromShifts\r
+ * @param fromRatio\r
+ * @param toShifts\r
+ * @param toRatio\r
+ * @return\r
+ */\r
+ private int[] shift(int pos, Vector fromShifts, int fromRatio,\r
+ Vector toShifts, int toRatio) {\r
+ int[] fromCount = countPos(fromShifts, pos);\r
+ if (fromCount == null) {\r
+ return null;\r
+ }\r
+ int fromRemainder = (fromCount[0] - 1) % fromRatio;\r
+ int toCount = 1 + (((fromCount[0] - 1) / fromRatio) * toRatio);\r
+ int[] toPos = countToPos(toShifts, toCount);\r
+ if (toPos == null) {\r
+ return null; // throw new Error("Bad Mapping!");\r
+ }\r
+ // System.out.println(fromCount[0]+" "+fromCount[1]+" "+toCount);\r
+ return new int[] { toPos[0], fromRemainder, toPos[1] };\r
+ }\r
+\r
+ /**\r
+ * count how many positions pos is along the series of intervals.\r
+ * \r
+ * @param intVals\r
+ * @param pos\r
+ * @return number of positions or null if pos is not within intervals\r
+ */\r
+ private int[] countPos(Vector intVals, int pos) {\r
+ int count = 0, intv[], iv = 0, ivSize = intVals.size();\r
+ while (iv < ivSize) {\r
+ intv = (int[]) intVals.elementAt(iv++);\r
+ if (intv[0] <= intv[1]) {\r
+ if (pos >= intv[0] && pos <= intv[1]) {\r
+ return new int[] { count + pos - intv[0] + 1, +1 };\r
+ } else {\r
+ count += intv[1] - intv[0] + 1;\r
+ }\r
+ } else {\r
+ if (pos >= intv[1] && pos <= intv[0]) {\r
+ return new int[] { count + intv[0] - pos + 1, -1 };\r
+ } else {\r
+ count += intv[0] - intv[1] + 1;\r
+ }\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * count out pos positions into a series of intervals and return the position\r
+ * \r
+ * @param intVals\r
+ * @param pos\r
+ * @return position pos in interval set\r
+ */\r
+ private int[] countToPos(Vector intVals, int pos) {\r
+ int count = 0, diff = 0, iv = 0, ivSize = intVals.size(), intv[] = { 0, 0 };\r
+ while (iv < ivSize) {\r
+ intv = (int[]) intVals.elementAt(iv++);\r
+ diff = intv[1] - intv[0];\r
+ if (diff >= 0) {\r
+ if (pos <= count + 1 + diff) {\r
+ return new int[] { pos - count - 1 + intv[0], +1 };\r
+ } else {\r
+ count += 1 + diff;\r
+ }\r
+ } else {\r
+ if (pos <= count + 1 - diff) {\r
+ return new int[] { intv[0] - (pos - count - 1), -1 };\r
+ } else {\r
+ count += 1 - diff;\r
+ }\r
+ }\r
+ }\r
+ return null;// (diff<0) ? (intv[1]-1) : (intv[0]+1);\r
+ }\r
+\r
+ /**\r
+ * find series of intervals mapping from start-end in the From map.\r
+ * \r
+ * @param start\r
+ * position in to map\r
+ * @param end\r
+ * position in to map\r
+ * @return series of ranges in from map\r
+ */\r
+ public int[] locateInFrom(int start, int end) {\r
+ // inefficient implementation\r
+ int fromStart[] = shiftTo(start);\r
+ int fromEnd[] = shiftTo(end); // needs to be inclusive of end of symbol\r
+ // position\r
+ if (fromStart == null || fromEnd == null)\r
+ return null;\r
+ int iv[] = getIntervals(fromShifts, fromStart, fromEnd, fromRatio);\r
+ return iv;\r
+ }\r
+\r
+ /**\r
+ * find series of intervals mapping from start-end in the to map.\r
+ * \r
+ * @param start\r
+ * position in from map\r
+ * @param end\r
+ * position in from map\r
+ * @return series of ranges in to map\r
+ */\r
+ public int[] locateInTo(int start, int end) {\r
+ // inefficient implementation\r
+ int toStart[] = shiftFrom(start);\r
+ int toEnd[] = shiftFrom(end);\r
+ if (toStart == null || toEnd == null)\r
+ return null;\r
+ int iv[] = getIntervals(toShifts, toStart, toEnd, toRatio);\r
+ return iv;\r
+ }\r
+\r
+ /**\r
+ * like shift - except returns the intervals in the given vector of shifts\r
+ * which were spanned in traversing fromStart to fromEnd\r
+ * \r
+ * @param fromShifts2\r
+ * @param fromStart\r
+ * @param fromEnd\r
+ * @param fromRatio2\r
+ * @return series of from,to intervals from from first position of starting\r
+ * region to final position of ending region inclusive\r
+ */\r
+ private int[] getIntervals(Vector fromShifts2, int[] fromStart,\r
+ int[] fromEnd, int fromRatio2) {\r
+ int startpos, endpos;\r
+ startpos = fromStart[0]; // first position in fromStart\r
+ endpos = fromEnd[0] + fromEnd[2] * (fromRatio2 - 1); // last position in\r
+ // fromEnd\r
+ int intv = 0, intvSize = fromShifts2.size();\r
+ int iv[], i = 0, fs = -1, fe = -1; // containing intervals\r
+ while (intv < intvSize && (fs == -1 || fe == -1)) {\r
+ iv = (int[]) fromShifts2.elementAt(intv++);\r
+ if (iv[0] <= iv[1]) {\r
+ if (fs == -1 && startpos >= iv[0] && startpos <= iv[1]) {\r
+ fs = i;\r
+ }\r
+ if (fe == -1 && endpos >= iv[0] && endpos <= iv[1]) {\r
+ fe = i;\r
+ }\r
+ } else {\r
+ if (fs == -1 && startpos <= iv[0] && startpos >= iv[1]) {\r
+ fs = i;\r
+ }\r
+ if (fe == -1 && endpos <= iv[0] && endpos >= iv[1]) {\r
+ fe = i;\r
+ }\r
+ }\r
+ i++;\r
+ }\r
+ if (fs == fe && fe == -1)\r
+ return null;\r
+ Vector ranges = new Vector();\r
+ if (fs <= fe) {\r
+ intv = fs;\r
+ i = fs;\r
+ // truncate initial interval\r
+ iv = (int[]) fromShifts2.elementAt(intv++);\r
+ iv = new int[] { iv[0], iv[1] };// clone\r
+ if (i == fs)\r
+ iv[0] = startpos;\r
+ while (i != fe) {\r
+ ranges.addElement(iv); // add initial range\r
+ iv = (int[]) fromShifts2.elementAt(intv++); // get next interval\r
+ iv = new int[] { iv[0], iv[1] };// clone\r
+ i++;\r
+ }\r
+ if (i == fe)\r
+ iv[1] = endpos;\r
+ ranges.addElement(iv); // add only - or final range\r
+ } else {\r
+ // walk from end of interval.\r
+ i = fromShifts2.size() - 1;\r
+ while (i > fs) {\r
+ i--;\r
+ }\r
+ iv = (int[]) fromShifts2.elementAt(i);\r
+ iv = new int[] { iv[1], iv[0] };// reverse and clone\r
+ // truncate initial interval\r
+ if (i == fs) {\r
+ iv[0] = startpos;\r
+ }\r
+ while (--i != fe) { // fix apparent logic bug when fe==-1\r
+ ranges.addElement(iv); // add (truncated) reversed interval\r
+ iv = (int[]) fromShifts2.elementAt(i);\r
+ iv = new int[] { iv[1], iv[0] }; // reverse and clone\r
+ }\r
+ if (i == fe) {\r
+ // interval is already reversed\r
+ iv[1] = endpos;\r
+ }\r
+ ranges.addElement(iv); // add only - or final range\r
+ }\r
+ // create array of start end intervals.\r
+ int[] range = null;\r
+ if (ranges != null && ranges.size() > 0) {\r
+ range = new int[ranges.size() * 2];\r
+ intv = 0;\r
+ intvSize = ranges.size();\r
+ i = 0;\r
+ while (intv < intvSize) {\r
+ iv = (int[]) ranges.elementAt(intv);\r
+ range[i++] = iv[0];\r
+ range[i++] = iv[1];\r
+ ranges.setElementAt(null, intv++); // remove\r
+ }\r
+ }\r
+ return range;\r
+ }\r
+\r
+ /**\r
+ * get the 'initial' position of mpos in To\r
+ * \r
+ * @param mpos\r
+ * position in from\r
+ * @return position of first word in to reference frame\r
+ */\r
+ public int getToPosition(int mpos) {\r
+ int[] mp = shiftTo(mpos);\r
+ if (mp != null) {\r
+ return mp[0];\r
+ }\r
+ return mpos;\r
+ }\r
+\r
+ /**\r
+ * get range of positions in To frame for the mpos word in From\r
+ * \r
+ * @param mpos\r
+ * position in From\r
+ * @return null or int[] first position in To for mpos, last position in to\r
+ * for Mpos\r
+ */\r
+ public int[] getToWord(int mpos) {\r
+ int[] mp = shiftTo(mpos);\r
+ if (mp != null) {\r
+ return new int[] { mp[0], mp[0] + mp[2] * (getFromRatio() - 1) };\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * get From position in the associated reference frame for position pos in the\r
+ * associated sequence.\r
+ * \r
+ * @param pos\r
+ * @return\r
+ */\r
+ public int getMappedPosition(int pos) {\r
+ int[] mp = shiftFrom(pos);\r
+ if (mp != null) {\r
+ return mp[0];\r
+ }\r
+ return pos;\r
+ }\r
+\r
+ public int[] getMappedWord(int pos) {\r
+ int[] mp = shiftFrom(pos);\r
+ if (mp != null) {\r
+ return new int[] { mp[0], mp[0] + mp[2] * (getToRatio() - 1) };\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * test routine. not incremental.\r
+ * \r
+ * @param ml\r
+ * @param fromS\r
+ * @param fromE\r
+ */\r
+ public static void testMap(MapList ml, int fromS, int fromE) {\r
+ for (int from = 1; from <= 25; from++) {\r
+ int[] too = ml.shiftFrom(from);\r
+ System.out.print("ShiftFrom(" + from + ")==");\r
+ if (too == null) {\r
+ System.out.print("NaN\n");\r
+ } else {\r
+ System.out.print(too[0] + " % " + too[1] + " (" + too[2] + ")");\r
+ System.out.print("\t+--+\t");\r
+ int[] toofrom = ml.shiftTo(too[0]);\r
+ if (toofrom != null) {\r
+ if (toofrom[0] != from) {\r
+ System.err.println("Mapping not reflexive:" + from + " " + too[0]\r
+ + "->" + toofrom[0]);\r
+ }\r
+ System.out.println("ShiftTo(" + too[0] + ")==" + toofrom[0] + " % "\r
+ + toofrom[1] + " (" + toofrom[2] + ")");\r
+ } else {\r
+ System.out.println("ShiftTo(" + too[0] + ")=="\r
+ + "NaN! - not Bijective Mapping!");\r
+ }\r
+ }\r
+ }\r
+ int mmap[][] = ml.makeFromMap();\r
+ System.out.println("FromMap : (" + mmap[0][0] + " " + mmap[0][1] + " "\r
+ + mmap[0][2] + " " + mmap[0][3] + " ");\r
+ for (int i = 1; i <= mmap[1].length; i++) {\r
+ if (mmap[1][i - 1] == -1) {\r
+ System.out.print(i + "=XXX");\r
+\r
+ } else {\r
+ System.out.print(i + "=" + (mmap[0][2] + mmap[1][i - 1]));\r
+ }\r
+ if (i % 20 == 0) {\r
+ System.out.print("\n");\r
+ } else {\r
+ System.out.print(",");\r
+ }\r
+ }\r
+ // test range function\r
+ System.out.print("\nTest locateInFrom\n");\r
+ {\r
+ int f = mmap[0][2], t = mmap[0][3];\r
+ while (f <= t) {\r
+ System.out.println("Range " + f + " to " + t);\r
+ int rng[] = ml.locateInFrom(f, t);\r
+ if (rng != null) {\r
+ for (int i = 0; i < rng.length; i++) {\r
+ System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));\r
+ }\r
+ } else {\r
+ System.out.println("No range!");\r
+ }\r
+ System.out.print("\nReversed\n");\r
+ rng = ml.locateInFrom(t, f);\r
+ if (rng != null) {\r
+ for (int i = 0; i < rng.length; i++) {\r
+ System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));\r
+ }\r
+ } else {\r
+ System.out.println("No range!");\r
+ }\r
+ System.out.print("\n");\r
+ f++;\r
+ t--;\r
+ }\r
+ }\r
+ System.out.print("\n");\r
+ mmap = ml.makeToMap();\r
+ System.out.println("ToMap : (" + mmap[0][0] + " " + mmap[0][1] + " "\r
+ + mmap[0][2] + " " + mmap[0][3] + " ");\r
+ for (int i = 1; i <= mmap[1].length; i++) {\r
+ if (mmap[1][i - 1] == -1) {\r
+ System.out.print(i + "=XXX");\r
+\r
+ } else {\r
+ System.out.print(i + "=" + (mmap[0][2] + mmap[1][i - 1]));\r
+ }\r
+ if (i % 20 == 0) {\r
+ System.out.print("\n");\r
+ } else {\r
+ System.out.print(",");\r
+ }\r
+ }\r
+ System.out.print("\n");\r
+ // test range function\r
+ System.out.print("\nTest locateInTo\n");\r
+ {\r
+ int f = mmap[0][2], t = mmap[0][3];\r
+ while (f <= t) {\r
+ System.out.println("Range " + f + " to " + t);\r
+ int rng[] = ml.locateInTo(f, t);\r
+ if (rng != null) {\r
+ for (int i = 0; i < rng.length; i++) {\r
+ System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));\r
+ }\r
+ } else {\r
+ System.out.println("No range!");\r
+ }\r
+ System.out.print("\nReversed\n");\r
+ rng = ml.locateInTo(t, f);\r
+ if (rng != null) {\r
+ for (int i = 0; i < rng.length; i++) {\r
+ System.out.print(rng[i] + ((i % 2 == 0) ? "," : ";"));\r
+ }\r
+ } else {\r
+ System.out.println("No range!");\r
+ }\r
+ f++;\r
+ t--;\r
+ System.out.print("\n");\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ public static void main(String argv[]) {\r
+ MapList ml = new MapList(new int[] { 1, 5, 10, 15, 25, 20 }, new int[] {\r
+ 51, 1 }, 1, 3);\r
+ MapList ml1 = new MapList(new int[] { 1, 3, 17, 4 }, new int[] { 51, 1 },\r
+ 1, 3);\r
+ MapList ml2 = new MapList(new int[] { 1, 60 }, new int[] { 1, 20 }, 3, 1);\r
+ // test internal consistency\r
+ int to[] = new int[51];\r
+ MapList.testMap(ml, 1, 60);\r
+ /*\r
+ * for (int from=1; from<=51; from++) { int[] too=ml.shiftTo(from); int[]\r
+ * toofrom=ml.shiftFrom(too[0]);\r
+ * System.out.println("ShiftFrom("+from+")=="+too\r
+ * [0]+" % "+too[1]+"\t+-+\tShiftTo("\r
+ * +too[0]+")=="+toofrom[0]+" % "+toofrom[1]); }\r
+ */\r
+ System.out.print("Success?\n"); // if we get here - something must be\r
+ // working!\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return a MapList whose From range is this maplist's To Range, and vice\r
+ * versa\r
+ */\r
+ public MapList getInverse() {\r
+ return new MapList(getToRanges(), getFromRanges(), getToRatio(),\r
+ getFromRatio());\r
+ }\r
+}\r
-package uk.ac.vamsas.objects.utils;
-/*
- * This code was originated from
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-import java.util.Vector;
-
-public class Mapping
-{
- /**
- * Contains the start-end pairs mapping from the associated sequence to the
- * sequence in the database coordinate system it also takes care of step
- * difference between coordinate systems
- */
- MapList map = null;
-
- /**
- * The seuqence that map maps the associated seuqence to (if any).
- SequenceI to = null;
- */
- public Mapping(MapList map)
- {
- super();
- this.map = map;
- }
-
-/* public Mapping(SequenceI to, MapList map)
- {
- this(map);
- this.to = to;
- }
-*/
- /**
- * create a new mapping from
- *
- * (in Jalview) param to was
- * the destination sequence being mapped
- * @param local
- * int[] {start,end,start,end} series on associated sequence
- * @param mapped
- * int[] {start,end,...} ranges on the reference frame being mapped
- * to
- * @param i
- * step size on associated sequence
- * @param j
- * step size on mapped frame
- */
- public Mapping(//SequenceI to,
- int[] local, int[] mapped, int i, int j)
- {
- this(new MapList(local, mapped, i, j));
- }
-
- /**
- * create a duplicate (and independent) mapping object with the same reference
- * to any SequenceI being mapped to.
- *
- * @param map2
- */
- public Mapping(Mapping map2)
- {
- if (map2 != this && map2 != null)
- {
- if (map2.map != null)
- {
- map = new MapList(map2.map);
- }
- }
- }
-
- /**
- * @return the map
- */
- public MapList getMap()
- {
- return map;
- }
-
- /**
- * @param map
- * the map to set
- */
- public void setMap(MapList map)
- {
- this.map = map;
- }
-
- /**
- * Equals that compares both the to references and MapList mappings.
- *
- * @param other
- * @return
- */
- public boolean equals(Mapping other)
- {
- if (other == null)
- return false;
- if (other == this)
- return true;
- if ((map != null && other.map == null)
- || (map == null && other.map != null))
- return false;
- if (map.equals(other.map))
- return true;
- return false;
- }
-
- /**
- * get the 'initial' position in the associated sequence for a position in the
- * mapped reference frame
- *
- * @param mpos
- * @return
- */
- public int getPosition(int mpos)
- {
- if (map != null)
- {
- int[] mp = map.shiftTo(mpos);
- if (mp != null)
- {
- return mp[0];
- }
- }
- return mpos;
- }
-
- /**
- * gets boundary in direction of mapping
- *
- * @param position
- * in mapped reference frame
- * @return int{start, end} positions in associated sequence (in direction of
- * mapped word)
- */
- public int[] getWord(int mpos)
- {
- if (map != null)
- {
- return map.getToWord(mpos);
- }
- return null;
- }
-
- /**
- * width of mapped unit in associated sequence
- *
- */
- public int getWidth()
- {
- if (map != null)
- {
- return map.getFromRatio();
- }
- return 1;
- }
-
- /**
- * width of unit in mapped reference frame
- *
- * @return
- */
- public int getMappedWidth()
- {
- if (map != null)
- {
- return map.getToRatio();
- }
- return 1;
- }
-
- /**
- * get mapped position in the associated reference frame for position pos in
- * the associated sequence.
- *
- * @param pos
- * @return
- */
- public int getMappedPosition(int pos)
- {
- if (map != null)
- {
- int[] mp = map.shiftFrom(pos);
- if (mp != null)
- {
- return mp[0];
- }
- }
- return pos;
- }
-
- public int[] getMappedWord(int pos)
- {
- if (map != null)
- {
- int[] mp = map.shiftFrom(pos);
- if (mp != null)
- {
- return new int[]
- { mp[0], mp[0] + mp[2] * (map.getToRatio() - 1) };
- }
- }
- return null;
- }
-
- /**
- * locates the region of feature f in the associated (local) sequence's reference
- * frame
- *
- * @param f
- * @return int[] { start1, end1, ... starti, endi } for the corresponding interval in local reference frame
- */
- public int[] locateFeature(int begin, int end)
- {
- if (true)
- { // f.getBegin()!=f.getEnd()) {
- if (map != null)
- {
- int[] frange = map.locateInFrom(begin, end); //f.getBegin(), f.getEnd());
- /* left in as an example as to how this is used in Jalview
- * SequenceFeature[] vf = new SequenceFeature[frange.length / 2];
- for (int i = 0, v = 0; i < frange.length; i += 2, v++)
- {
- vf[v] = new SequenceFeature(f);
- vf[v].setBegin(frange[i]);
- vf[v].setEnd(frange[i + 1]);
- if (frange.length > 2)
- vf[v].setDescription(f.getDescription() + "\nPart " + v);
- }
- */
- return frange;
- }
- }
- // give up and just return the interval unchanged - this might not be the correct behaviour
- return new int[] { begin, end };
- }
-
- /**
- * return a series of contigs on the associated sequence corresponding to the
- * from,to interval on the mapped reference frame
- *
- * @param from
- * @param to
- * @return int[] { from_i, to_i for i=1 to n contiguous regions in the
- * associated sequence}
- */
- public int[] locateRange(int from, int to)
- {
- if (map != null)
- {
- if (from <= to)
- {
- from = (map.getToLowest() < from) ? from : map.getToLowest();
- to = (map.getToHighest() > to) ? to : map.getToHighest();
- if (from > to)
- return null;
- }
- else
- {
- from = (map.getToHighest() > from) ? from : map.getToHighest();
- to = (map.getToLowest() < to) ? to : map.getToLowest();
- if (from < to)
- return null;
- }
- return map.locateInFrom(from, to);
- }
- return new int[]
- { from, to };
- }
-
- /**
- * return a series of mapped contigs mapped from a range on the associated
- * sequence
- *
- * @param from
- * @param to
- * @return
- */
- public int[] locateMappedRange(int from, int to)
- {
- if (map != null)
- {
-
- if (from <= to)
- {
- from = (map.getFromLowest() < from) ? from : map.getFromLowest();
- to = (map.getFromHighest() > to) ? to : map.getFromHighest();
- if (from > to)
- return null;
- }
- else
- {
- from = (map.getFromHighest() > from) ? from : map.getFromHighest();
- to = (map.getFromLowest() < to) ? to : map.getFromLowest();
- if (from < to)
- return null;
- }
- return map.locateInTo(from, to);
- }
- return new int[]
- { from, to };
- }
-
- /**
- * return a new mapping object with a maplist modifed to only map the visible
- * regions defined by viscontigs.
- *
- * @param viscontigs
- * @return
- */
- public Mapping intersectVisContigs(int[] viscontigs)
- {
- Mapping copy = new Mapping(this);
- if (map != null)
- {
- Vector toRange = new Vector();
- Vector fromRange = new Vector();
- for (int vc = 0; vc < viscontigs.length; vc += 2)
- {
- // find a mapped range in this visible region
- int[] mpr = locateMappedRange(1+viscontigs[vc], viscontigs[vc + 1]-1);
- if (mpr != null)
- {
- for (int m = 0; m < mpr.length; m += 2)
- {
- toRange.addElement(new int[]
- { mpr[m], mpr[m + 1] });
- int[] xpos = locateRange(mpr[m], mpr[m + 1]);
- for (int x = 0; x < xpos.length; x += 2)
- {
- fromRange.addElement(new int[]
- { xpos[x], xpos[x + 1] });
- }
- }
- }
- }
- int[] from = new int[fromRange.size()*2];
- int[] to = new int[toRange.size()*2];
- int[] r;
- for (int f=0,fSize=fromRange.size(); f<fSize; f++)
- {
- r = (int[]) fromRange.elementAt(f);
- from[f*2] = r[0];
- from[f*2+1] = r[1];
- }
- for (int f=0,fSize=toRange.size(); f<fSize; f++)
- {
- r = (int[]) toRange.elementAt(f);
- to[f*2] = r[0];
- to[f*2+1] = r[1];
- }
- copy.setMap(new MapList(from, to, map.getFromRatio(), map.getToRatio()));
- }
- return copy;
- }
- public static void main(String[] args)
- {
- /**
- * trite test of the intersectVisContigs method
- * for a simple DNA -> Protein exon map and a range of visContigs
- */
- MapList fk = new MapList(new int[] { 1,6,8,13,15,23}, new int[] { 1,7}, 3, 1);
- Mapping m = new Mapping(fk);
- Mapping m_1 = m.intersectVisContigs(new int[] {fk.getFromLowest(), fk.getFromHighest()});
- Mapping m_2 = m.intersectVisContigs(new int[] {1,7,11,20});
- System.out.println(""+m_1.map.getFromRanges());
- // this test was for debugging purposes only - it should run without exceptions, but the
- // integrity of the mapping was checked using an interactive debugger rather than programmatically.
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+/*\r
+ * This code was originated from\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ */\r
+\r
+import java.util.Vector;\r
+\r
+public class Mapping {\r
+ /**\r
+ * Contains the start-end pairs mapping from the associated sequence to the\r
+ * sequence in the database coordinate system it also takes care of step\r
+ * difference between coordinate systems\r
+ */\r
+ MapList map = null;\r
+\r
+ /**\r
+ * The seuqence that map maps the associated seuqence to (if any). SequenceI\r
+ * to = null;\r
+ */\r
+ public Mapping(MapList map) {\r
+ super();\r
+ this.map = map;\r
+ }\r
+\r
+ /*\r
+ * public Mapping(SequenceI to, MapList map) { this(map); this.to = to; }\r
+ */\r
+ /**\r
+ * create a new mapping from\r
+ * \r
+ * (in Jalview) param to was the destination sequence being mapped\r
+ * \r
+ * @param local\r
+ * int[] {start,end,start,end} series on associated sequence\r
+ * @param mapped\r
+ * int[] {start,end,...} ranges on the reference frame being mapped\r
+ * to\r
+ * @param i\r
+ * step size on associated sequence\r
+ * @param j\r
+ * step size on mapped frame\r
+ */\r
+ public Mapping(// SequenceI to,\r
+ int[] local, int[] mapped, int i, int j) {\r
+ this(new MapList(local, mapped, i, j));\r
+ }\r
+\r
+ /**\r
+ * create a duplicate (and independent) mapping object with the same reference\r
+ * to any SequenceI being mapped to.\r
+ * \r
+ * @param map2\r
+ */\r
+ public Mapping(Mapping map2) {\r
+ if (map2 != this && map2 != null) {\r
+ if (map2.map != null) {\r
+ map = new MapList(map2.map);\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * @return the map\r
+ */\r
+ public MapList getMap() {\r
+ return map;\r
+ }\r
+\r
+ /**\r
+ * @param map\r
+ * the map to set\r
+ */\r
+ public void setMap(MapList map) {\r
+ this.map = map;\r
+ }\r
+\r
+ /**\r
+ * Equals that compares both the to references and MapList mappings.\r
+ * \r
+ * @param other\r
+ * @return\r
+ */\r
+ public boolean equals(Mapping other) {\r
+ if (other == null)\r
+ return false;\r
+ if (other == this)\r
+ return true;\r
+ if ((map != null && other.map == null)\r
+ || (map == null && other.map != null))\r
+ return false;\r
+ if (map.equals(other.map))\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * get the 'initial' position in the associated sequence for a position in the\r
+ * mapped reference frame\r
+ * \r
+ * @param mpos\r
+ * @return\r
+ */\r
+ public int getPosition(int mpos) {\r
+ if (map != null) {\r
+ int[] mp = map.shiftTo(mpos);\r
+ if (mp != null) {\r
+ return mp[0];\r
+ }\r
+ }\r
+ return mpos;\r
+ }\r
+\r
+ /**\r
+ * gets boundary in direction of mapping\r
+ * \r
+ * @param position\r
+ * in mapped reference frame\r
+ * @return int{start, end} positions in associated sequence (in direction of\r
+ * mapped word)\r
+ */\r
+ public int[] getWord(int mpos) {\r
+ if (map != null) {\r
+ return map.getToWord(mpos);\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * width of mapped unit in associated sequence\r
+ * \r
+ */\r
+ public int getWidth() {\r
+ if (map != null) {\r
+ return map.getFromRatio();\r
+ }\r
+ return 1;\r
+ }\r
+\r
+ /**\r
+ * width of unit in mapped reference frame\r
+ * \r
+ * @return\r
+ */\r
+ public int getMappedWidth() {\r
+ if (map != null) {\r
+ return map.getToRatio();\r
+ }\r
+ return 1;\r
+ }\r
+\r
+ /**\r
+ * get mapped position in the associated reference frame for position pos in\r
+ * the associated sequence.\r
+ * \r
+ * @param pos\r
+ * @return\r
+ */\r
+ public int getMappedPosition(int pos) {\r
+ if (map != null) {\r
+ int[] mp = map.shiftFrom(pos);\r
+ if (mp != null) {\r
+ return mp[0];\r
+ }\r
+ }\r
+ return pos;\r
+ }\r
+\r
+ public int[] getMappedWord(int pos) {\r
+ if (map != null) {\r
+ int[] mp = map.shiftFrom(pos);\r
+ if (mp != null) {\r
+ return new int[] { mp[0], mp[0] + mp[2] * (map.getToRatio() - 1) };\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * locates the region of feature f in the associated (local) sequence's\r
+ * reference frame\r
+ * \r
+ * @param f\r
+ * @return int[] { start1, end1, ... starti, endi } for the corresponding\r
+ * interval in local reference frame\r
+ */\r
+ public int[] locateFeature(int begin, int end) {\r
+ if (true) { // f.getBegin()!=f.getEnd()) {\r
+ if (map != null) {\r
+ int[] frange = map.locateInFrom(begin, end); // f.getBegin(),\r
+ // f.getEnd());\r
+ /*\r
+ * left in as an example as to how this is used in Jalview\r
+ * SequenceFeature[] vf = new SequenceFeature[frange.length / 2]; for\r
+ * (int i = 0, v = 0; i < frange.length; i += 2, v++) { vf[v] = new\r
+ * SequenceFeature(f); vf[v].setBegin(frange[i]); vf[v].setEnd(frange[i\r
+ * + 1]); if (frange.length > 2) vf[v].setDescription(f.getDescription()\r
+ * + "\nPart " + v); }\r
+ */\r
+ return frange;\r
+ }\r
+ }\r
+ // give up and just return the interval unchanged - this might not be the\r
+ // correct behaviour\r
+ return new int[] { begin, end };\r
+ }\r
+\r
+ /**\r
+ * return a series of contigs on the associated sequence corresponding to the\r
+ * from,to interval on the mapped reference frame\r
+ * \r
+ * @param from\r
+ * @param to\r
+ * @return int[] { from_i, to_i for i=1 to n contiguous regions in the\r
+ * associated sequence}\r
+ */\r
+ public int[] locateRange(int from, int to) {\r
+ if (map != null) {\r
+ if (from <= to) {\r
+ from = (map.getToLowest() < from) ? from : map.getToLowest();\r
+ to = (map.getToHighest() > to) ? to : map.getToHighest();\r
+ if (from > to)\r
+ return null;\r
+ } else {\r
+ from = (map.getToHighest() > from) ? from : map.getToHighest();\r
+ to = (map.getToLowest() < to) ? to : map.getToLowest();\r
+ if (from < to)\r
+ return null;\r
+ }\r
+ return map.locateInFrom(from, to);\r
+ }\r
+ return new int[] { from, to };\r
+ }\r
+\r
+ /**\r
+ * return a series of mapped contigs mapped from a range on the associated\r
+ * sequence\r
+ * \r
+ * @param from\r
+ * @param to\r
+ * @return\r
+ */\r
+ public int[] locateMappedRange(int from, int to) {\r
+ if (map != null) {\r
+\r
+ if (from <= to) {\r
+ from = (map.getFromLowest() < from) ? from : map.getFromLowest();\r
+ to = (map.getFromHighest() > to) ? to : map.getFromHighest();\r
+ if (from > to)\r
+ return null;\r
+ } else {\r
+ from = (map.getFromHighest() > from) ? from : map.getFromHighest();\r
+ to = (map.getFromLowest() < to) ? to : map.getFromLowest();\r
+ if (from < to)\r
+ return null;\r
+ }\r
+ return map.locateInTo(from, to);\r
+ }\r
+ return new int[] { from, to };\r
+ }\r
+\r
+ /**\r
+ * return a new mapping object with a maplist modifed to only map the visible\r
+ * regions defined by viscontigs.\r
+ * \r
+ * @param viscontigs\r
+ * @return\r
+ */\r
+ public Mapping intersectVisContigs(int[] viscontigs) {\r
+ Mapping copy = new Mapping(this);\r
+ if (map != null) {\r
+ Vector toRange = new Vector();\r
+ Vector fromRange = new Vector();\r
+ for (int vc = 0; vc < viscontigs.length; vc += 2) {\r
+ // find a mapped range in this visible region\r
+ int[] mpr = locateMappedRange(1 + viscontigs[vc],\r
+ viscontigs[vc + 1] - 1);\r
+ if (mpr != null) {\r
+ for (int m = 0; m < mpr.length; m += 2) {\r
+ toRange.addElement(new int[] { mpr[m], mpr[m + 1] });\r
+ int[] xpos = locateRange(mpr[m], mpr[m + 1]);\r
+ for (int x = 0; x < xpos.length; x += 2) {\r
+ fromRange.addElement(new int[] { xpos[x], xpos[x + 1] });\r
+ }\r
+ }\r
+ }\r
+ }\r
+ int[] from = new int[fromRange.size() * 2];\r
+ int[] to = new int[toRange.size() * 2];\r
+ int[] r;\r
+ for (int f = 0, fSize = fromRange.size(); f < fSize; f++) {\r
+ r = (int[]) fromRange.elementAt(f);\r
+ from[f * 2] = r[0];\r
+ from[f * 2 + 1] = r[1];\r
+ }\r
+ for (int f = 0, fSize = toRange.size(); f < fSize; f++) {\r
+ r = (int[]) toRange.elementAt(f);\r
+ to[f * 2] = r[0];\r
+ to[f * 2 + 1] = r[1];\r
+ }\r
+ copy.setMap(new MapList(from, to, map.getFromRatio(), map.getToRatio()));\r
+ }\r
+ return copy;\r
+ }\r
+\r
+ public static void main(String[] args) {\r
+ /**\r
+ * trite test of the intersectVisContigs method for a simple DNA -> Protein\r
+ * exon map and a range of visContigs\r
+ */\r
+ MapList fk = new MapList(new int[] { 1, 6, 8, 13, 15, 23 }, new int[] { 1,\r
+ 7 }, 3, 1);\r
+ Mapping m = new Mapping(fk);\r
+ Mapping m_1 = m.intersectVisContigs(new int[] { fk.getFromLowest(),\r
+ fk.getFromHighest() });\r
+ Mapping m_2 = m.intersectVisContigs(new int[] { 1, 7, 11, 20 });\r
+ System.out.println("" + m_1.map.getFromRanges());\r
+ // this test was for debugging purposes only - it should run without\r
+ // exceptions, but the\r
+ // integrity of the mapping was checked using an interactive debugger rather\r
+ // than programmatically.\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.objects.utils;\r
\r
import java.util.Enumeration;\r
import uk.ac.vamsas.objects.core.Property;\r
\r
public class Properties {\r
- public static Property newProperty(String name, String type, String content)\r
- {\r
+ public static Property newProperty(String name, String type, String content) {\r
Property vProperty = new Property();\r
vProperty.setName(name);\r
- if (type != null)\r
- {\r
+ if (type != null) {\r
vProperty.setType(type);\r
- }\r
- else\r
- {\r
+ } else {\r
vProperty.setType(STRINGTYPE);\r
}\r
vProperty.setContent(content);\r
return vProperty;\r
}\r
- final public static String STRINGTYPE="string";\r
- final public static String FLOATTYPE="float";\r
- final public static String INTEGERTYPE="integer";\r
- final public static String BOOLEANTYPE="boolean";\r
+\r
+ final public static String STRINGTYPE = "string";\r
+\r
+ final public static String FLOATTYPE = "float";\r
+\r
+ final public static String INTEGERTYPE = "integer";\r
+\r
+ final public static String BOOLEANTYPE = "boolean";\r
+\r
/**\r
- * add newprop to properties, or update the value of an existing property with the same exact name and type.\r
- * Note - this routine will stop after encounting the first occurance of a Property with the same name and type, no others will be affected. \r
+ * add newprop to properties, or update the value of an existing property with\r
+ * the same exact name and type. Note - this routine will stop after\r
+ * encounting the first occurance of a Property with the same name and type,\r
+ * no others will be affected.\r
+ * \r
* @param properties\r
- * @param newprop \r
- * @return true if property was added or its value updated. false if no change was made.\r
+ * @param newprop\r
+ * @return true if property was added or its value updated. false if no change\r
+ * was made.\r
*/\r
- public static boolean addOrReplace(Vector properties, Property newprop)\r
- {\r
- if (properties.size()>0)\r
- {\r
+ public static boolean addOrReplace(Vector properties, Property newprop) {\r
+ if (properties.size() > 0) {\r
Enumeration en = properties.elements();\r
- while (en.hasMoreElements())\r
- {\r
+ while (en.hasMoreElements()) {\r
Object el = en.nextElement();\r
- if (el instanceof Property)\r
- {\r
+ if (el instanceof Property) {\r
Property prop = (Property) el;\r
- if (prop.getName().equals(newprop.getName()) && \r
- prop.getType().equals(newprop.getType()))\r
- {\r
- if (prop.getContent().equals(newprop.getContent()))\r
- {\r
+ if (prop.getName().equals(newprop.getName())\r
+ && prop.getType().equals(newprop.getType())) {\r
+ if (prop.getContent().equals(newprop.getContent())) {\r
return false;\r
- } else {\r
+ } else {\r
prop.setContent(newprop.getContent());\r
return true;\r
}\r
}\r
} else {\r
- throw new Error("Implementation Error: properties must be a Vector of uk.ac.vamsas.objects.core.Property objects only.");\r
+ throw new Error(\r
+ "Implementation Error: properties must be a Vector of uk.ac.vamsas.objects.core.Property objects only.");\r
}\r
}\r
- } \r
+ }\r
properties.addElement(newprop);\r
return true;\r
}\r
+\r
/**\r
- * validate property p against the known type strings and try to parse the content string accordingly \r
+ * validate property p against the known type strings and try to parse the\r
+ * content string accordingly\r
+ * \r
* @param p\r
- * @return true if the content parses as the given type (if it is known)\r
- * TODO: decide if an isValidType method is also necessary.\r
+ * @return true if the content parses as the given type (if it is known) TODO:\r
+ * decide if an isValidType method is also necessary.\r
*/\r
- public static boolean isValid(Property p)\r
- {\r
- if (p.getType().equalsIgnoreCase(STRINGTYPE))\r
- {\r
+ public static boolean isValid(Property p) {\r
+ if (p.getType().equalsIgnoreCase(STRINGTYPE)) {\r
return true;\r
- } else\r
- if (p.getType().equalsIgnoreCase(BOOLEANTYPE))\r
- {\r
- try {\r
- Boolean bool = new Boolean(p.getContent());\r
- return true;\r
- } catch (Exception e)\r
- {\r
- return false;\r
- }\r
- } else\r
- if (p.getType().equalsIgnoreCase(FLOATTYPE))\r
- {\r
- try {\r
- Float fv = new Float(p.getContent());\r
- return true;\r
- } catch (Exception e)\r
- {\r
- return false;\r
- }\r
+ } else if (p.getType().equalsIgnoreCase(BOOLEANTYPE)) {\r
+ try {\r
+ Boolean bool = new Boolean(p.getContent());\r
+ return true;\r
+ } catch (Exception e) {\r
+ return false;\r
}\r
- else\r
- if( p.getType().equalsIgnoreCase(INTEGERTYPE))\r
- {\r
-\r
- try {\r
- Integer fv = new Integer(p.getContent());\r
- return true;\r
- } catch (Exception e)\r
- {\r
- return false;\r
- } \r
- }\r
+ } else if (p.getType().equalsIgnoreCase(FLOATTYPE)) {\r
+ try {\r
+ Float fv = new Float(p.getContent());\r
+ return true;\r
+ } catch (Exception e) {\r
+ return false;\r
+ }\r
+ } else if (p.getType().equalsIgnoreCase(INTEGERTYPE)) {\r
+\r
+ try {\r
+ Integer fv = new Integer(p.getContent());\r
+ return true;\r
+ } catch (Exception e) {\r
+ return false;\r
+ }\r
+ }\r
return false;\r
}\r
+\r
/**\r
- * String content test \r
+ * String content test\r
+ * \r
* @param p\r
- * @return true if the property is a string \r
+ * @return true if the property is a string\r
*/\r
- public static boolean isString(Property p)\r
- {\r
+ public static boolean isString(Property p) {\r
return isType(p, STRINGTYPE);\r
}\r
+\r
/**\r
- * Float content test \r
+ * Float content test\r
+ * \r
* @param p\r
- * @return true if the property is a string \r
+ * @return true if the property is a string\r
*/\r
- public static boolean isFloat(Property p)\r
- {\r
+ public static boolean isFloat(Property p) {\r
return isType(p, FLOATTYPE);\r
}\r
+\r
/**\r
- * Integer content test \r
+ * Integer content test\r
+ * \r
* @param p\r
- * @return true if the property is a string \r
+ * @return true if the property is a string\r
*/\r
- public static boolean isInteger(Property p)\r
- {\r
+ public static boolean isInteger(Property p) {\r
return isType(p, INTEGERTYPE);\r
}\r
+\r
/**\r
- * Boolean content test \r
+ * Boolean content test\r
+ * \r
* @param p\r
- * @return true if the property is a string \r
+ * @return true if the property is a string\r
*/\r
- public static boolean isBoolean(Property p)\r
- {\r
+ public static boolean isBoolean(Property p) {\r
return isType(p, BOOLEANTYPE);\r
}\r
+\r
/**\r
* \r
- * @param p the property to test for type\r
- * @param typeString one of the string constants in this class\r
+ * @param p\r
+ * the property to test for type\r
+ * @param typeString\r
+ * one of the string constants in this class\r
* @return true if p is of type 'typeString'\r
*/\r
public static boolean isType(Property p, String typeString) {\r
- return (p==null) ? false : (p.getType().toLowerCase().equals(typeString));\r
+ return (p == null) ? false : (p.getType().toLowerCase().equals(typeString));\r
}\r
- \r
+\r
}\r
-package uk.ac.vamsas.objects.utils;
-
-import java.util.Date;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.objects.core.Entry;
-import uk.ac.vamsas.objects.core.Provenance;
-
-public class ProvenanceStuff {
-
- /**
- * stuff for making and doing things with provenance objects.
- */
- static Log log = LogFactory.getLog(ProvenanceStuff.class);
-
- /**
- * @param app TODO
- * @param action
- * text for action entry
- * @return new Provenance entry for ArchiveWriter created docs.
- * TODO: Verify and move to SimpleClient class for provenance handling
- */
- public static Entry newProvenanceEntry(String app, String user, String action) {
- log.debug("Adding ProvenanceEntry("+user+","+action+")");
- Entry e = new Entry();
- e.setApp(app);
- e.setAction(action);
- e.setUser(user);
- e.setDate(new Date());
- return e;
- }
- public static Provenance newProvenance(Entry entry) {
- Provenance list = new Provenance();
- list.addEntry(entry);
- return list;
- }
- public static Provenance newProvenance(String user, String action) {
- return newProvenance(ProvenanceStuff.newProvenanceEntry("vamsasApp:ExampleVamsasClient/alpha", user, action));
- }
- public static Provenance newProvenance(String app, String user, String action) {
- return newProvenance(ProvenanceStuff.newProvenanceEntry(app, user, action));
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+import java.util.Date;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.objects.core.Entry;\r
+import uk.ac.vamsas.objects.core.Provenance;\r
+\r
+public class ProvenanceStuff {\r
+\r
+ /**\r
+ * stuff for making and doing things with provenance objects.\r
+ */\r
+ static Log log = LogFactory.getLog(ProvenanceStuff.class);\r
+\r
+ /**\r
+ * @param app\r
+ * TODO\r
+ * @param action\r
+ * text for action entry\r
+ * @return new Provenance entry for ArchiveWriter created docs. TODO: Verify\r
+ * and move to SimpleClient class for provenance handling\r
+ */\r
+ public static Entry newProvenanceEntry(String app, String user, String action) {\r
+ log.debug("Adding ProvenanceEntry(" + user + "," + action + ")");\r
+ Entry e = new Entry();\r
+ e.setApp(app);\r
+ e.setAction(action);\r
+ e.setUser(user);\r
+ e.setDate(new Date());\r
+ return e;\r
+ }\r
+\r
+ public static Provenance newProvenance(Entry entry) {\r
+ Provenance list = new Provenance();\r
+ list.addEntry(entry);\r
+ return list;\r
+ }\r
+\r
+ public static Provenance newProvenance(String user, String action) {\r
+ return newProvenance(ProvenanceStuff.newProvenanceEntry(\r
+ "vamsasApp:ExampleVamsasClient/alpha", user, action));\r
+ }\r
+\r
+ public static Provenance newProvenance(String app, String user, String action) {\r
+ return newProvenance(ProvenanceStuff.newProvenanceEntry(app, user, action));\r
+ }\r
+\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.objects.utils;\r
\r
import java.util.Vector;\r
import uk.ac.vamsas.objects.core.Seg;\r
\r
/**\r
- * Utilities for working with RangeType and MapType objects.\r
- * Derived from bitter experience.\r
+ * Utilities for working with RangeType and MapType objects. Derived from bitter\r
+ * experience.\r
+ * \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class Range {\r
- static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getFactory().getLog(Range.class);\r
+ static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getFactory().getLog(Range.class);\r
\r
/**\r
* get start<end range of segment, adjusting for inclusivity flag and\r
* polarity.\r
- *\r
+ * \r
* @param visSeg\r
- * @param ensureDirection when true - always ensure start is less than end.\r
- * @return int[] { start, end, direction} where direction==1 for range running from end to start.\r
+ * @param ensureDirection\r
+ * when true - always ensure start is less than end.\r
+ * @return int[] { start, end, direction} where direction==1 for range running\r
+ * from end to start.\r
*/\r
- public static int[] getSegRange(Seg visSeg, boolean ensureDirection)\r
- {\r
+ public static int[] getSegRange(Seg visSeg, boolean ensureDirection) {\r
boolean incl = visSeg.getInclusive();\r
// adjust for inclusive flag.\r
int pol = (visSeg.getStart() <= visSeg.getEnd()) ? 1 : -1; // polarity of\r
// region.\r
int start = visSeg.getStart() + (incl ? 0 : pol);\r
int end = visSeg.getEnd() + (incl ? 0 : -pol);\r
- if (ensureDirection && pol == -1)\r
- {\r
+ if (ensureDirection && pol == -1) {\r
// jalview doesn't deal with inverted ranges, yet.\r
int t = end;\r
end = start;\r
start = t;\r
}\r
- return new int[]\r
- {\r
- start, end, pol < 0 ? 1 : 0};\r
+ return new int[] { start, end, pol < 0 ? 1 : 0 };\r
}\r
\r
/**\r
* get real bounds of a RangeType's specification. start and end are an\r
- * inclusive range within which all segments and positions lie.\r
- * TODO: refactor to vamsas utils\r
+ * inclusive range within which all segments and positions lie. TODO: refactor\r
+ * to vamsas utils\r
+ * \r
* @param dseta\r
* @return int[] { start, end}\r
*/\r
- public static int[] getBounds(RangeType dseta)\r
- {\r
- if (dseta != null)\r
- {\r
+ public static int[] getBounds(RangeType dseta) {\r
+ if (dseta != null) {\r
int[] se = null;\r
- if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)\r
- {\r
- throw new Error("Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
+ if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0) {\r
+ throw new Error(\r
+ "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
}\r
- if (dseta.getSegCount() > 0)\r
- {\r
+ if (dseta.getSegCount() > 0) {\r
se = getSegRange(dseta.getSeg(0), true);\r
- for (int s = 1, sSize = dseta.getSegCount(); s < sSize; s++)\r
- {\r
+ for (int s = 1, sSize = dseta.getSegCount(); s < sSize; s++) {\r
int nse[] = getSegRange(dseta.getSeg(s), true);\r
- if (se[0] > nse[0])\r
- {\r
+ if (se[0] > nse[0]) {\r
se[0] = nse[0];\r
}\r
- if (se[1] < nse[1])\r
- {\r
+ if (se[1] < nse[1]) {\r
se[1] = nse[1];\r
}\r
}\r
}\r
- if (dseta.getPosCount() > 0)\r
- {\r
- // could do a polarity for pos range too. and pass back indication of discontinuities.\r
+ if (dseta.getPosCount() > 0) {\r
+ // could do a polarity for pos range too. and pass back indication of\r
+ // discontinuities.\r
int pos = dseta.getPos(0).getI();\r
- se = new int[]\r
- {\r
- pos, pos};\r
- for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)\r
- {\r
+ se = new int[] { pos, pos };\r
+ for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++) {\r
pos = dseta.getPos(p).getI();\r
- if (se[0] > pos)\r
- {\r
+ if (se[0] > pos) {\r
se[0] = pos;\r
}\r
- if (se[1] < pos)\r
- {\r
+ if (se[1] < pos) {\r
se[1] = pos;\r
}\r
}\r
}\r
\r
/**\r
- * map from a rangeType's internal frame to the referenced object's coordinate frame.\r
+ * map from a rangeType's internal frame to the referenced object's coordinate\r
+ * frame.\r
+ * \r
* @param dseta\r
* @return int [] { ref(pos)...} for all pos in rangeType's frame.\r
*/\r
- public static int[] getMapping(RangeType dseta)\r
- {\r
+ public static int[] getMapping(RangeType dseta) {\r
Vector posList = new Vector();\r
- if (dseta != null)\r
- {\r
+ if (dseta != null) {\r
int[] se = null;\r
- if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)\r
- {\r
- throw new Error("Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
+ if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0) {\r
+ throw new Error(\r
+ "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
}\r
- if (dseta.getSegCount() > 0)\r
- {\r
- for (int s = 0, sSize = dseta.getSegCount(); s < sSize; s++)\r
- {\r
+ if (dseta.getSegCount() > 0) {\r
+ for (int s = 0, sSize = dseta.getSegCount(); s < sSize; s++) {\r
se = getSegRange(dseta.getSeg(s), false);\r
int se_end = se[1 - se[2]] + (se[2] == 0 ? 1 : -1);\r
- for (int p = se[se[2]]; p != se_end; p += se[2] == 0 ? 1 : -1)\r
- {\r
+ for (int p = se[se[2]]; p != se_end; p += se[2] == 0 ? 1 : -1) {\r
posList.add(new Integer(p));\r
}\r
}\r
- }\r
- else if (dseta.getPosCount() > 0)\r
- {\r
+ } else if (dseta.getPosCount() > 0) {\r
int pos = dseta.getPos(0).getI();\r
\r
- for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)\r
- {\r
+ for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++) {\r
pos = dseta.getPos(p).getI();\r
posList.add(new Integer(pos));\r
}\r
}\r
}\r
- if (posList != null && posList.size() > 0)\r
- {\r
+ if (posList != null && posList.size() > 0) {\r
int[] range = new int[posList.size()];\r
- for (int i = 0; i < range.length; i++)\r
- {\r
- range[i] = ( (Integer) posList.elementAt(i)).intValue();\r
+ for (int i = 0; i < range.length; i++) {\r
+ range[i] = ((Integer) posList.elementAt(i)).intValue();\r
}\r
posList.clear();\r
return range;\r
return null;\r
}\r
\r
- public static int[] getIntervals(RangeType range)\r
- {\r
- int[] intervals=null;\r
+ public static int[] getIntervals(RangeType range) {\r
+ int[] intervals = null;\r
Vector posList = new Vector();\r
- if (range != null)\r
- {\r
+ if (range != null) {\r
int[] se = null;\r
- if (range.getSegCount() > 0 && range.getPosCount() > 0)\r
- {\r
- throw new Error("Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
-}\r
- if (range.getSegCount() > 0)\r
- {\r
- for (int s = 0, sSize = range.getSegCount(); s < sSize; s++)\r
- {\r
+ if (range.getSegCount() > 0 && range.getPosCount() > 0) {\r
+ throw new Error(\r
+ "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
+ }\r
+ if (range.getSegCount() > 0) {\r
+ for (int s = 0, sSize = range.getSegCount(); s < sSize; s++) {\r
se = getSegRange(range.getSeg(s), false);\r
posList.addElement(new Integer(se[0]));\r
posList.addElement(new Integer(se[1]));\r
}\r
- }\r
- else if (range.getPosCount() > 0)\r
- {\r
+ } else if (range.getPosCount() > 0) {\r
int pos = range.getPos(0).getI();\r
- for (int p = 0, pSize = range.getPosCount(); p < pSize; p++)\r
- {\r
+ for (int p = 0, pSize = range.getPosCount(); p < pSize; p++) {\r
pos = range.getPos(p).getI();\r
posList.add(new Integer(pos));\r
posList.add(new Integer(pos));\r
}\r
}\r
}\r
- if (posList != null && posList.size() > 0)\r
- {\r
- intervals=new int[posList.size()];\r
+ if (posList != null && posList.size() > 0) {\r
+ intervals = new int[posList.size()];\r
java.util.Enumeration e = posList.elements();\r
- int i=0;\r
- while (e.hasMoreElements())\r
- {\r
- intervals[i++] = ((Integer)e.nextElement()).intValue();\r
+ int i = 0;\r
+ while (e.hasMoreElements()) {\r
+ intervals[i++] = ((Integer) e.nextElement()).intValue();\r
}\r
}\r
return intervals;\r
}\r
+\r
/**\r
* initialise a range type object from a set of start/end inclusive intervals\r
+ * \r
* @param mrt\r
* @param range\r
*/\r
- public static void initRangeType(RangeType mrt, int[] range)\r
- {\r
- for (int i=0; i<range.length; i+=2)\r
- {\r
+ public static void initRangeType(RangeType mrt, int[] range) {\r
+ for (int i = 0; i < range.length; i += 2) {\r
Seg vSeg = new Seg();\r
vSeg.setStart(range[i]);\r
- vSeg.setEnd(range[i+1]);\r
+ vSeg.setEnd(range[i + 1]);\r
vSeg.setInclusive(true);\r
mrt.addSeg(vSeg);\r
}\r
\r
/**\r
* \r
- * @param maprange where the from range is the local mapped range, and the to range is the 'mapped' range in the MapRangeType\r
+ * @param maprange\r
+ * where the from range is the local mapped range, and the to range\r
+ * is the 'mapped' range in the MapRangeType\r
* @param default unit for local\r
* @param default unit for mapped\r
* @return MapList\r
*/\r
- public static MapList parsemapType(MapType maprange, int localu, int mappedu)\r
- {\r
+ public static MapList parsemapType(MapType maprange, int localu, int mappedu) {\r
MapList ml = null;\r
int[] localRange = getIntervals(maprange.getLocal());\r
int[] mappedRange = getIntervals(maprange.getMapped());\r
- long lu = maprange.getLocal().hasUnit() ? maprange.getLocal().getUnit() : localu;\r
- long mu = maprange.getMapped().hasUnit() ? maprange.getMapped().getUnit() : mappedu;\r
- ml = new MapList(localRange, mappedRange, (int)lu, (int)mu);\r
+ long lu = maprange.getLocal().hasUnit() ? maprange.getLocal().getUnit()\r
+ : localu;\r
+ long mu = maprange.getMapped().hasUnit() ? maprange.getMapped().getUnit()\r
+ : mappedu;\r
+ ml = new MapList(localRange, mappedRange, (int) lu, (int) mu);\r
return ml;\r
}\r
+\r
/**\r
* Parse map with default units of 1,1\r
+ * \r
* @param map\r
* @return MapList representing map\r
*/\r
- public static MapList parsemapType(MapType map)\r
- {\r
- if (!map.getLocal().hasUnit() || !map.getMapped().hasUnit())\r
- {\r
- if (log.isDebugEnabled())\r
- { \r
- log.debug(\r
- "using default mapping length of 1:1 for map "\r
- +(map.isRegistered() ? map.getVorbaId().toString() : ("<no Id registered> "+map.toString())));\r
+ public static MapList parsemapType(MapType map) {\r
+ if (!map.getLocal().hasUnit() || !map.getMapped().hasUnit()) {\r
+ if (log.isDebugEnabled()) {\r
+ log.debug("using default mapping length of 1:1 for map "\r
+ + (map.isRegistered() ? map.getVorbaId().toString()\r
+ : ("<no Id registered> " + map.toString())));\r
}\r
}\r
- return parsemapType(map, 1, 1); \r
+ return parsemapType(map, 1, 1);\r
}\r
\r
/**\r
* initialise a MapType object from a MapList object.\r
+ * \r
* @param maprange\r
* @param ml\r
* @param setUnits\r
*/\r
- public static void initMapType(MapType maprange, MapList ml, boolean setUnits)\r
- {\r
+ public static void initMapType(MapType maprange, MapList ml, boolean setUnits) {\r
initMapType(maprange, ml, setUnits, false);\r
}\r
+\r
/**\r
* \r
* @param maprange\r
* @param ml\r
* @param setUnits\r
- * @param reverse - reverse MapList mapping for Local and Mapped ranges and units \r
+ * @param reverse\r
+ * - reverse MapList mapping for Local and Mapped ranges and units\r
*/\r
- public static void initMapType(MapType maprange, MapList ml, boolean setUnits, boolean reverse)\r
- {\r
+ public static void initMapType(MapType maprange, MapList ml,\r
+ boolean setUnits, boolean reverse) {\r
maprange.setLocal(new Local());\r
maprange.setMapped(new Mapped());\r
- if (!reverse)\r
- {\r
+ if (!reverse) {\r
initRangeType(maprange.getLocal(), ml.getFromRanges());\r
initRangeType(maprange.getMapped(), ml.getToRanges());\r
- } else {\r
- initRangeType(maprange.getLocal(), ml.getToRanges());\r
- initRangeType(maprange.getMapped(), ml.getFromRanges());\r
- }\r
- if (setUnits)\r
- {\r
- if (!reverse)\r
- { \r
+ } else {\r
+ initRangeType(maprange.getLocal(), ml.getToRanges());\r
+ initRangeType(maprange.getMapped(), ml.getFromRanges());\r
+ }\r
+ if (setUnits) {\r
+ if (!reverse) {\r
maprange.getLocal().setUnit(ml.getFromRatio());\r
maprange.getMapped().setUnit(ml.getToRatio());\r
} else {\r
}\r
}\r
\r
-}
\ No newline at end of file
+}\r
-/*
- * Created on 17-May-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package uk.ac.vamsas.objects.utils;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.regex.Pattern;
-
-import uk.ac.vamsas.objects.core.AlignmentSequence;
-import uk.ac.vamsas.objects.core.Sequence;
-import uk.ac.vamsas.objects.core.SequenceType;
-
-/**
- * @author jimp
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-public class Seq {
-
- public static void write_PirSeq(OutputStream os, SequenceType seq, int wid) throws IOException {
- BufferedWriter pir_out = new BufferedWriter(new OutputStreamWriter(os));
- pir_out.write(">P1;"+seq.getName()+"\n");
- int width = (wid<1) ? 80 : wid;
- for (int j=0,k=seq.getSequence().length(); j<k; j+=width)
- if (j+width<k)
- pir_out.write(seq.getSequence().substring(j,j+width)+"\n");
- else
- pir_out.write(seq.getSequence().substring(j)+"\n");
- pir_out.flush();
- }
-
- public static void write_FastaSeq(OutputStream os, SequenceType seq) throws IOException {
- BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));
- fasta_out.write(">"+seq.getName()+"\n");
- fasta_out.write(seq.getSequence()+"\n");
- fasta_out.flush();
- }
-
- public static void write_FastaSeq(OutputStream os, SequenceType seq, int wid) throws IOException {
- BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));
- fasta_out.write(">"+seq.getName()+"\n");
- int width = (wid<1) ? 80 : wid;
- for (int j=0,k=seq.getSequence().length(); j<k; j+=width)
- if (j+width<k)
- fasta_out.write(seq.getSequence().substring(j,j+width)+"\n");
- else
- fasta_out.write(seq.getSequence().substring(j)+"\n");
- fasta_out.flush();
- }
- /**
- *validate a SequenceType Vobject as an info:iubmb.org/aminoacid SequenceType
- *This version resolves references to Sequence objects from AlignmentSequence
- *TODO: Define info: urn for dictionary string (could also be regex of valid characters!)
- * @param s
- * @param dict TODO
- * @return true if a valid amino acid sequence Vobject
- */
- private static boolean valid_aadictionary_string(String s, String dict) {
- if (s==null)
- return false;
- // validate against dictionary
- // TODO generalise to resolve dictionary against info: urn for dictionary type
- Pattern aa_repl = Pattern.compile("[ARNDCQEGHILKMFPSTWYVUX]+", Pattern.CASE_INSENSITIVE);
- String remnants = aa_repl.matcher(s).replaceAll("");
- return !remnants.matches("//S+");
- }
-
- public static Sequence newSequence(String Name, String Sequence, String Dictionary, int start, int end) {
- //TODO: make hierarchy reflecting the SeqType Vobject.
- Sequence seq= new Sequence();
- seq.setDictionary(Dictionary);
- seq.setName(Name);
- seq.setSequence(Sequence);
- seq.setStart(start);
- if (start<=end) {
- if ((end-start)!=Sequence.length())
- seq.setEnd(start+Sequence.length());
- } else {
- // reverse topology mapping. TODO: VAMSAS: decide if allowed to do start>end on Sequence Vobject
- if ((start-end)!=Sequence.length())
- seq.setEnd(end+Sequence.length());
- }
- return seq;
- }
- public static AlignmentSequence newAlignmentSequence(String name, String alSequence, Sequence refseq, long start, long end) {
- if (refseq!=null) {
- AlignmentSequence asq = new AlignmentSequence();
- asq.setName(name);
- asq.setSequence(alSequence);
- asq.setRefid(refseq);
- if (end>refseq.getEnd() || end<start || end==-1)
- end = refseq.getEnd();
- asq.setEnd(end);
- if (start<refseq.getStart())
- start = refseq.getStart();
- asq.setStart(start);
- return asq;
- }
- return null;
- }
- public static boolean is_valid_aa_seq(SequenceType s) {
- Sequence q;
- boolean validref=false;
- if (s instanceof Sequence) {
- q=(Sequence) s;
- if (q.getDictionary()!=null
-
- && q.getDictionary().length()>0
- || !q.getDictionary().equals(SymbolDictionary.STANDARD_AA))
- return false;
- return valid_aadictionary_string(q.getSequence(), SymbolDictionary.STANDARD_AA);
- }
-
- // follow references
- if (s instanceof AlignmentSequence) {
- Object w = (((AlignmentSequence) s).getRefid());
- if (w!=null && w!=s && w instanceof SequenceType)
- return is_valid_aa_seq((SequenceType) w)
- && valid_aadictionary_string(((AlignmentSequence) s).getSequence(), SymbolDictionary.STANDARD_AA);
- }
-
- return false;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+import java.io.BufferedWriter;\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.io.OutputStreamWriter;\r
+import java.util.regex.Pattern;\r
+\r
+import uk.ac.vamsas.objects.core.AlignmentSequence;\r
+import uk.ac.vamsas.objects.core.Sequence;\r
+import uk.ac.vamsas.objects.core.SequenceType;\r
+\r
+/**\r
+ * @author jimp\r
+ * \r
+ * TODO To change the template for this generated type comment go to\r
+ * Window - Preferences - Java - Code Style - Code Templates\r
+ */\r
+public class Seq {\r
+\r
+ public static void write_PirSeq(OutputStream os, SequenceType seq, int wid)\r
+ throws IOException {\r
+ BufferedWriter pir_out = new BufferedWriter(new OutputStreamWriter(os));\r
+ pir_out.write(">P1;" + seq.getName() + "\n");\r
+ int width = (wid < 1) ? 80 : wid;\r
+ for (int j = 0, k = seq.getSequence().length(); j < k; j += width)\r
+ if (j + width < k)\r
+ pir_out.write(seq.getSequence().substring(j, j + width) + "\n");\r
+ else\r
+ pir_out.write(seq.getSequence().substring(j) + "\n");\r
+ pir_out.flush();\r
+ }\r
+\r
+ public static void write_FastaSeq(OutputStream os, SequenceType seq)\r
+ throws IOException {\r
+ BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));\r
+ fasta_out.write(">" + seq.getName() + "\n");\r
+ fasta_out.write(seq.getSequence() + "\n");\r
+ fasta_out.flush();\r
+ }\r
+\r
+ public static void write_FastaSeq(OutputStream os, SequenceType seq, int wid)\r
+ throws IOException {\r
+ BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));\r
+ fasta_out.write(">" + seq.getName() + "\n");\r
+ int width = (wid < 1) ? 80 : wid;\r
+ for (int j = 0, k = seq.getSequence().length(); j < k; j += width)\r
+ if (j + width < k)\r
+ fasta_out.write(seq.getSequence().substring(j, j + width) + "\n");\r
+ else\r
+ fasta_out.write(seq.getSequence().substring(j) + "\n");\r
+ fasta_out.flush();\r
+ }\r
+\r
+ /**\r
+ *validate a SequenceType Vobject as an info:iubmb.org/aminoacid SequenceType\r
+ * This version resolves references to Sequence objects from AlignmentSequence\r
+ * TODO: Define info: urn for dictionary string (could also be regex of valid\r
+ * characters!)\r
+ * \r
+ * @param s\r
+ * @param dict\r
+ * TODO\r
+ * @return true if a valid amino acid sequence Vobject\r
+ */\r
+ private static boolean valid_aadictionary_string(String s, String dict) {\r
+ if (s == null)\r
+ return false;\r
+ // validate against dictionary\r
+ // TODO generalise to resolve dictionary against info: urn for dictionary\r
+ // type\r
+ Pattern aa_repl = Pattern.compile("[ARNDCQEGHILKMFPSTWYVUX]+",\r
+ Pattern.CASE_INSENSITIVE);\r
+ String remnants = aa_repl.matcher(s).replaceAll("");\r
+ return !remnants.matches("//S+");\r
+ }\r
+\r
+ public static Sequence newSequence(String Name, String Sequence,\r
+ String Dictionary, int start, int end) {\r
+ // TODO: make hierarchy reflecting the SeqType Vobject.\r
+ Sequence seq = new Sequence();\r
+ seq.setDictionary(Dictionary);\r
+ seq.setName(Name);\r
+ seq.setSequence(Sequence);\r
+ seq.setStart(start);\r
+ if (start <= end) {\r
+ if ((end - start) != Sequence.length())\r
+ seq.setEnd(start + Sequence.length());\r
+ } else {\r
+ // reverse topology mapping. TODO: VAMSAS: decide if allowed to do\r
+ // start>end on Sequence Vobject\r
+ if ((start - end) != Sequence.length())\r
+ seq.setEnd(end + Sequence.length());\r
+ }\r
+ return seq;\r
+ }\r
+\r
+ public static AlignmentSequence newAlignmentSequence(String name,\r
+ String alSequence, Sequence refseq, long start, long end) {\r
+ if (refseq != null) {\r
+ AlignmentSequence asq = new AlignmentSequence();\r
+ asq.setName(name);\r
+ asq.setSequence(alSequence);\r
+ asq.setRefid(refseq);\r
+ if (end > refseq.getEnd() || end < start || end == -1)\r
+ end = refseq.getEnd();\r
+ asq.setEnd(end);\r
+ if (start < refseq.getStart())\r
+ start = refseq.getStart();\r
+ asq.setStart(start);\r
+ return asq;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ public static boolean is_valid_aa_seq(SequenceType s) {\r
+ Sequence q;\r
+ boolean validref = false;\r
+ if (s instanceof Sequence) {\r
+ q = (Sequence) s;\r
+ if (q.getDictionary() != null\r
+\r
+ && q.getDictionary().length() > 0\r
+ || !q.getDictionary().equals(SymbolDictionary.STANDARD_AA))\r
+ return false;\r
+ return valid_aadictionary_string(q.getSequence(),\r
+ SymbolDictionary.STANDARD_AA);\r
+ }\r
+\r
+ // follow references\r
+ if (s instanceof AlignmentSequence) {\r
+ Object w = (((AlignmentSequence) s).getRefid());\r
+ if (w != null && w != s && w instanceof SequenceType)\r
+ return is_valid_aa_seq((SequenceType) w)\r
+ && valid_aadictionary_string(((AlignmentSequence) s).getSequence(),\r
+ SymbolDictionary.STANDARD_AA);\r
+ }\r
+\r
+ return false;\r
+ }\r
+}\r
-/*
- * Created on 17-May-2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package uk.ac.vamsas.objects.utils;
-
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.regex.Pattern;
-
-import uk.ac.vamsas.objects.core.*;
-
-/**
- * @author jimp
- *
- * TODO To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Style - Code Templates
- */
-public class SeqAln extends uk.ac.vamsas.objects.core.Alignment {
-
- public static Sequence[] ReadClustalFile(InputStream os) throws Exception {
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- Pattern nonGap = Pattern.compile("[A-Z*0-9]", Pattern.CASE_INSENSITIVE);
- String gapchars = "";
- char gapchar = '-';
-
- int i = 0;
- boolean flag = false;
-
- Vector headers = new Vector();
- Hashtable seqhash = new Hashtable();
- Sequence[] seqs = null;
- int noSeqs = 0;
- String line;
-
- try {
- BufferedReader ins = new BufferedReader(new InputStreamReader(os));
- while ((line = ins.readLine()) != null) {
- if (line.indexOf(" ") != 0) {
- java.util.StringTokenizer str = new StringTokenizer(line, " ");
- String id = "";
-
- if (str.hasMoreTokens()) {
- id = str.nextToken();
- if (id.equals("CLUSTAL")) {
- flag = true;
- } else {
- if (flag) {
- StringBuffer tempseq;
- if (seqhash.containsKey(id)) {
- tempseq = (StringBuffer) seqhash.get(id);
- } else {
- tempseq = new StringBuffer();
- seqhash.put(id, tempseq);
- }
-
- if (!(headers.contains(id))) {
- headers.addElement(id);
- }
-
- tempseq.append(str.nextToken());
- }
- }
- }
- }
- }
-
- } catch (IOException e) {
- throw (new Exception("Exception parsing clustal file ", e));
- }
-
- if (flag) {
- noSeqs = headers.size();
-
- // Add sequences to the hash
- seqs = new Sequence[headers.size()];
- for (i = 0; i < headers.size(); i++) {
- if (seqhash.get(headers.elementAt(i)) != null) {
- // TODO: develop automatic dictionary typing for sequences
- Sequence newSeq = Seq.newSequence(headers.elementAt(i).toString(),
- seqhash.get(headers.elementAt(i).toString()).toString(),
- SymbolDictionary.STANDARD_AA,0,0);
-
- seqs[i] = newSeq;
-
- } else {
- throw (new Exception("Bizarreness! Can't find sequence for "
- + headers.elementAt(i)));
- }
- }
- }
- return seqs;
- }
-
- public static void WriteClustalWAlignment(java.io.OutputStream os,
- Alignment seqAl) throws IOException {
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- AlignmentSequence[] s = seqAl.getAlignmentSequence();
-
- java.io.BufferedWriter out = new BufferedWriter(
- new java.io.OutputStreamWriter(os));
-
- out.write("CLUSTAL\n\n");
-
- int max = 0;
- int maxid = 0;
-
- int i = 0;
-
- while (i < s.length && s[i] != null) {
- String tmp = s[i].getId();
-
- if (s[i].getSequence().length() > max) {
- max = s[i].getSequence().length();
- }
- if (tmp.length() > maxid) {
- maxid = tmp.length();
- }
- i++;
- }
-
- if (maxid < 15) {
- maxid = 15;
- }
- maxid++;
- int len = 60;
- int nochunks = max / len + 1;
-
- for (i = 0; i < nochunks; i++) {
- int j = 0;
- while (j < s.length && s[j] != null) {
- out.write(new Format("%-" + maxid + "s").form(s[j].getId() + " "));
- int start = i * len;
- int end = start + len;
-
- if (end < s[j].getSequence().length() && start < s[j].getSequence().length()) {
- out.write(s[j].getSequence().substring(start, end) + "\n");
- } else {
- if (start < s[j].getSequence().length()) {
- out.write(s[j].getSequence().substring(start) + "\n");
- }
- }
- j++;
- }
- out.write("\n");
-
- }
- }
- /**
- * manufacture an alignment/dataset from an array of sequences
- * @param origin
- * @param seqs
- * @return
- * @throws Exception
- */
- public static Alignment make_Alignment(Entry origin,
- Sequence[] seqs) throws Exception {
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- Alignment al = new Alignment();
- al.setProvenance(ProvenanceStuff.newProvenance(origin));
-
- Pattern nonGap = Pattern.compile("[A-Z*0-9]", Pattern.CASE_INSENSITIVE);
- boolean gapsset = false;
- char gapchar = '-';
- int seqLength = 0;
-
- for (int i = 0, nseq = seqs.length; i < nseq; i++) {
- String seq = seqs[i].getSequence();
- String gaps = nonGap.matcher(seq).replaceAll("");
- if (seqLength == 0) {
- seqLength = seq.length();
- } else if (seqLength != seq.length())
- throw (new Exception(i + "th Sequence (>" + seqs[i].getId()
- + ") is not aligned.\n"));// TODO: move this to assertions part of
- // Alignment
-
- // common check for any sequence...
- if (gaps != null && gaps.length() > 0) {
- if (!gapsset)
- gapchar = gaps.charAt(0);
- for (int c = 0, gc = gaps.length(); c < gc; c++) {
- if (gapchar != gaps.charAt(c)) {
- throw (new IOException("Inconsistent gap characters in sequence "
- + i + ": '" + seq + "'"));
- }
- }
- }
- AlignmentSequence sq = new AlignmentSequence();
- // TODO: use as basis of default AlignSequence(Sequence) constructor.
- sq.setSequence(seq);
- sq.setName(seqs[i].getId());
- sq.setRefid(seqs[i].getVorbaId());
- sq.setStart(seqs[i].getStart());
- sq.setEnd(seqs[i].getEnd());
- al.addAlignmentSequence(sq);
- }
- al.setGapChar(String.valueOf(gapchar));
- return al;
- }
-
- public static Alignment read_FastaAlignment(InputStream os, Entry entry)
- throws Exception {
- Sequence[] seqs;
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- try {
- seqs = SeqSet.read_SeqFasta(os);
- if (seqs == null)
- throw (new Exception("Empty alignment stream!\n"));
- } catch (Exception e) {
- throw new Exception("Invalid fasta alignment\n", e);
- }
-
- return make_Alignment(entry, seqs);
- }
-
- public static Alignment read_ClustalAlignment(InputStream os, Entry entry)
- throws Exception {
- Sequence[] seqs;
- try {
- seqs = SeqAln.ReadClustalFile(os);
- if (seqs == null)
- throw (new Exception("Empty alignment stream!\n"));
- } catch (Exception e) {
- throw new Exception("Invalid fasta alignment\n", e);
- }
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- return make_Alignment(entry, seqs);
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+import java.io.BufferedOutputStream;\r
+import java.io.BufferedReader;\r
+import java.io.BufferedWriter;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+import java.util.Hashtable;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+import java.util.regex.Pattern;\r
+\r
+import uk.ac.vamsas.objects.core.*;\r
+\r
+/**\r
+ * @author jimp\r
+ * \r
+ * TODO To change the template for this generated type comment go to\r
+ * Window - Preferences - Java - Code Style - Code Templates\r
+ */\r
+public class SeqAln extends uk.ac.vamsas.objects.core.Alignment {\r
+\r
+ public static Sequence[] ReadClustalFile(InputStream os) throws Exception {\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ Pattern nonGap = Pattern.compile("[A-Z*0-9]", Pattern.CASE_INSENSITIVE);\r
+ String gapchars = "";\r
+ char gapchar = '-';\r
+\r
+ int i = 0;\r
+ boolean flag = false;\r
+\r
+ Vector headers = new Vector();\r
+ Hashtable seqhash = new Hashtable();\r
+ Sequence[] seqs = null;\r
+ int noSeqs = 0;\r
+ String line;\r
+\r
+ try {\r
+ BufferedReader ins = new BufferedReader(new InputStreamReader(os));\r
+ while ((line = ins.readLine()) != null) {\r
+ if (line.indexOf(" ") != 0) {\r
+ java.util.StringTokenizer str = new StringTokenizer(line, " ");\r
+ String id = "";\r
+\r
+ if (str.hasMoreTokens()) {\r
+ id = str.nextToken();\r
+ if (id.equals("CLUSTAL")) {\r
+ flag = true;\r
+ } else {\r
+ if (flag) {\r
+ StringBuffer tempseq;\r
+ if (seqhash.containsKey(id)) {\r
+ tempseq = (StringBuffer) seqhash.get(id);\r
+ } else {\r
+ tempseq = new StringBuffer();\r
+ seqhash.put(id, tempseq);\r
+ }\r
+\r
+ if (!(headers.contains(id))) {\r
+ headers.addElement(id);\r
+ }\r
+\r
+ tempseq.append(str.nextToken());\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ } catch (IOException e) {\r
+ throw (new Exception("Exception parsing clustal file ", e));\r
+ }\r
+\r
+ if (flag) {\r
+ noSeqs = headers.size();\r
+\r
+ // Add sequences to the hash\r
+ seqs = new Sequence[headers.size()];\r
+ for (i = 0; i < headers.size(); i++) {\r
+ if (seqhash.get(headers.elementAt(i)) != null) {\r
+ // TODO: develop automatic dictionary typing for sequences\r
+ Sequence newSeq = Seq.newSequence(headers.elementAt(i).toString(),\r
+ seqhash.get(headers.elementAt(i).toString()).toString(),\r
+ SymbolDictionary.STANDARD_AA, 0, 0);\r
+\r
+ seqs[i] = newSeq;\r
+\r
+ } else {\r
+ throw (new Exception("Bizarreness! Can't find sequence for "\r
+ + headers.elementAt(i)));\r
+ }\r
+ }\r
+ }\r
+ return seqs;\r
+ }\r
+\r
+ public static void WriteClustalWAlignment(java.io.OutputStream os,\r
+ Alignment seqAl) throws IOException {\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ AlignmentSequence[] s = seqAl.getAlignmentSequence();\r
+\r
+ java.io.BufferedWriter out = new BufferedWriter(\r
+ new java.io.OutputStreamWriter(os));\r
+\r
+ out.write("CLUSTAL\n\n");\r
+\r
+ int max = 0;\r
+ int maxid = 0;\r
+\r
+ int i = 0;\r
+\r
+ while (i < s.length && s[i] != null) {\r
+ String tmp = s[i].getId();\r
+\r
+ if (s[i].getSequence().length() > max) {\r
+ max = s[i].getSequence().length();\r
+ }\r
+ if (tmp.length() > maxid) {\r
+ maxid = tmp.length();\r
+ }\r
+ i++;\r
+ }\r
+\r
+ if (maxid < 15) {\r
+ maxid = 15;\r
+ }\r
+ maxid++;\r
+ int len = 60;\r
+ int nochunks = max / len + 1;\r
+\r
+ for (i = 0; i < nochunks; i++) {\r
+ int j = 0;\r
+ while (j < s.length && s[j] != null) {\r
+ out.write(new Format("%-" + maxid + "s").form(s[j].getId() + " "));\r
+ int start = i * len;\r
+ int end = start + len;\r
+\r
+ if (end < s[j].getSequence().length()\r
+ && start < s[j].getSequence().length()) {\r
+ out.write(s[j].getSequence().substring(start, end) + "\n");\r
+ } else {\r
+ if (start < s[j].getSequence().length()) {\r
+ out.write(s[j].getSequence().substring(start) + "\n");\r
+ }\r
+ }\r
+ j++;\r
+ }\r
+ out.write("\n");\r
+\r
+ }\r
+ }\r
+\r
+ /**\r
+ * manufacture an alignment/dataset from an array of sequences\r
+ * \r
+ * @param origin\r
+ * @param seqs\r
+ * @return\r
+ * @throws Exception\r
+ */\r
+ public static Alignment make_Alignment(Entry origin, Sequence[] seqs)\r
+ throws Exception {\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ Alignment al = new Alignment();\r
+ al.setProvenance(ProvenanceStuff.newProvenance(origin));\r
+\r
+ Pattern nonGap = Pattern.compile("[A-Z*0-9]", Pattern.CASE_INSENSITIVE);\r
+ boolean gapsset = false;\r
+ char gapchar = '-';\r
+ int seqLength = 0;\r
+\r
+ for (int i = 0, nseq = seqs.length; i < nseq; i++) {\r
+ String seq = seqs[i].getSequence();\r
+ String gaps = nonGap.matcher(seq).replaceAll("");\r
+ if (seqLength == 0) {\r
+ seqLength = seq.length();\r
+ } else if (seqLength != seq.length())\r
+ throw (new Exception(i + "th Sequence (>" + seqs[i].getId()\r
+ + ") is not aligned.\n"));// TODO: move this to assertions part of\r
+ // Alignment\r
+\r
+ // common check for any sequence...\r
+ if (gaps != null && gaps.length() > 0) {\r
+ if (!gapsset)\r
+ gapchar = gaps.charAt(0);\r
+ for (int c = 0, gc = gaps.length(); c < gc; c++) {\r
+ if (gapchar != gaps.charAt(c)) {\r
+ throw (new IOException("Inconsistent gap characters in sequence "\r
+ + i + ": '" + seq + "'"));\r
+ }\r
+ }\r
+ }\r
+ AlignmentSequence sq = new AlignmentSequence();\r
+ // TODO: use as basis of default AlignSequence(Sequence) constructor.\r
+ sq.setSequence(seq);\r
+ sq.setName(seqs[i].getId());\r
+ sq.setRefid(seqs[i].getVorbaId());\r
+ sq.setStart(seqs[i].getStart());\r
+ sq.setEnd(seqs[i].getEnd());\r
+ al.addAlignmentSequence(sq);\r
+ }\r
+ al.setGapChar(String.valueOf(gapchar));\r
+ return al;\r
+ }\r
+\r
+ public static Alignment read_FastaAlignment(InputStream os, Entry entry)\r
+ throws Exception {\r
+ Sequence[] seqs;\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ try {\r
+ seqs = SeqSet.read_SeqFasta(os);\r
+ if (seqs == null)\r
+ throw (new Exception("Empty alignment stream!\n"));\r
+ } catch (Exception e) {\r
+ throw new Exception("Invalid fasta alignment\n", e);\r
+ }\r
+\r
+ return make_Alignment(entry, seqs);\r
+ }\r
+\r
+ public static Alignment read_ClustalAlignment(InputStream os, Entry entry)\r
+ throws Exception {\r
+ Sequence[] seqs;\r
+ try {\r
+ seqs = SeqAln.ReadClustalFile(os);\r
+ if (seqs == null)\r
+ throw (new Exception("Empty alignment stream!\n"));\r
+ } catch (Exception e) {\r
+ throw new Exception("Invalid fasta alignment\n", e);\r
+ }\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ return make_Alignment(entry, seqs);\r
+ }\r
+}\r
-/*
- * Created on 17-May-2005
- * Slurped into VamsasClient object set on 12th Jan 2006
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package uk.ac.vamsas.objects.utils;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.regex.Pattern;
-
-import uk.ac.vamsas.objects.core.*;
-
-/**
- * @author jimp
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-public class SeqSet {
-
- public static void write_Fasta(OutputStream os, SequenceType[] seqs) throws IOException {
- write_Fasta(os, seqs, 80);
- }
-
- public static void write_Fasta(OutputStream os, SequenceType[] seqs, boolean width80) throws IOException {
- write_Fasta(os, seqs, (width80) ? 80 : 0);
- }
-
- public static void write_Fasta(OutputStream os, SequenceType[] seqs, int width) throws IOException {
- int i, nseq = seqs.length;
- BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- for (i=0; i<nseq; i++) {
- fasta_out.write(">"+seqs[i].getName()+"\n");
- if (width<=0) {
- fasta_out.write(seqs[i].getSequence()+"\n");
- } else {
- // TODO: adapt to SymbolDictionary labelwidths
- String tempseq = seqs[i].getSequence();
- int j=0, k=tempseq.length();
- while (j<k) {
- int d = k-j;
- if (d>=width) {
- fasta_out.write(tempseq, j, width);
- } else {
- fasta_out.write(tempseq, j, d);
- }
- fasta_out.write("\n");
- j+=width;
- }
- }
- }
- fasta_out.flush();
- }
- /**
- * TODO: introduce a dictionary parameter for qualified sequence symbols
- * Reads a sequence set from a stream - will only read prescribed amino acid
- * symbols.
- * @param os
- * @return
- * @throws IOException
- */
- public static Sequence[] read_SeqFasta(InputStream os) throws IOException {
- Vector seqs = new Vector();
- int nseq = 0;
- BufferedReader infasta = new BufferedReader(new InputStreamReader(os));
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- // TODO: decide on return type - SequenceType is a partly complete vamsas Vobject - either for a dataset or alignment sequence
- // so could go in either!
- String line;
- Sequence seq = null;
- Pattern aaMatch = Pattern.compile("[ARNDCQEGHILKMFPSTUWYV]", Pattern.CASE_INSENSITIVE);
- String sname = "", seqstr=null;
- do {
- line = infasta.readLine();
- if (line==null || line.startsWith(">")) {
- if (seqstr!=null)
- seqs.add((Object) Seq.newSequence(sname.substring(1), seqstr, SymbolDictionary.STANDARD_AA, 0,0));
- sname = line; // remove >
- seqstr="";
- } else {
- String subseq = Pattern.compile("//s+").matcher(line).replaceAll("");
- seqstr += subseq;
- }
- } while (line!=null);
- nseq = seqs.size();
- if (nseq>0) {
- // TODO:POSS: should really return a sequence if there's only one in the file.
- Sequence[] seqset = new Sequence[nseq];
- for (int i=0; i<nseq; i++) {
- seqset[i] = (Sequence) seqs.elementAt(i);
- }
- return seqset;
- }
-
- return null;
- }
-
- public static Hashtable uniquify(SequenceType[] sequences) {
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- // TODO: do we need this with vamsas sequences ?
- // Generate a safely named sequence set and a hash to recover the sequence names
- Hashtable map = new Hashtable();
- for (int i = 0; i < sequences.length; i++) {
- String safename = new String("Sequence" + i);
- map.put(safename, sequences[i].getName());
- sequences[i].setName(safename);
- }
- return map;
- }
-
- public static boolean deuniquify(Hashtable map, SequenceType[] sequences) {
- System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
- // TODO: do we need this with vamsas sequences ?
- // recover unsafe sequence names for a sequence set
- boolean allfound = true;
- for (int i = 0; i < sequences.length; i++) {
- if (map.containsKey(sequences[i].getName())) {
- String unsafename = (String) map.get(sequences[i].getName());
- sequences[i].setName(unsafename);
- } else {
- allfound = false;
- }
- }
- return allfound;
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+import java.io.BufferedReader;\r
+import java.io.BufferedWriter;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+import java.io.OutputStream;\r
+import java.io.OutputStreamWriter;\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+import java.util.regex.Pattern;\r
+\r
+import uk.ac.vamsas.objects.core.*;\r
+\r
+/**\r
+ * @author jimp\r
+ * \r
+ * TODO To change the template for this generated type comment go to\r
+ * Window - Preferences - Java - Code Style - Code Templates\r
+ */\r
+public class SeqSet {\r
+\r
+ public static void write_Fasta(OutputStream os, SequenceType[] seqs)\r
+ throws IOException {\r
+ write_Fasta(os, seqs, 80);\r
+ }\r
+\r
+ public static void write_Fasta(OutputStream os, SequenceType[] seqs,\r
+ boolean width80) throws IOException {\r
+ write_Fasta(os, seqs, (width80) ? 80 : 0);\r
+ }\r
+\r
+ public static void write_Fasta(OutputStream os, SequenceType[] seqs, int width)\r
+ throws IOException {\r
+ int i, nseq = seqs.length;\r
+ BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ for (i = 0; i < nseq; i++) {\r
+ fasta_out.write(">" + seqs[i].getName() + "\n");\r
+ if (width <= 0) {\r
+ fasta_out.write(seqs[i].getSequence() + "\n");\r
+ } else {\r
+ // TODO: adapt to SymbolDictionary labelwidths\r
+ String tempseq = seqs[i].getSequence();\r
+ int j = 0, k = tempseq.length();\r
+ while (j < k) {\r
+ int d = k - j;\r
+ if (d >= width) {\r
+ fasta_out.write(tempseq, j, width);\r
+ } else {\r
+ fasta_out.write(tempseq, j, d);\r
+ }\r
+ fasta_out.write("\n");\r
+ j += width;\r
+ }\r
+ }\r
+ }\r
+ fasta_out.flush();\r
+ }\r
+\r
+ /**\r
+ * TODO: introduce a dictionary parameter for qualified sequence symbols Reads\r
+ * a sequence set from a stream - will only read prescribed amino acid\r
+ * symbols.\r
+ * \r
+ * @param os\r
+ * @return\r
+ * @throws IOException\r
+ */\r
+ public static Sequence[] read_SeqFasta(InputStream os) throws IOException {\r
+ Vector seqs = new Vector();\r
+ int nseq = 0;\r
+ BufferedReader infasta = new BufferedReader(new InputStreamReader(os));\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ // TODO: decide on return type - SequenceType is a partly complete vamsas\r
+ // Vobject - either for a dataset or alignment sequence\r
+ // so could go in either!\r
+ String line;\r
+ Sequence seq = null;\r
+ Pattern aaMatch = Pattern.compile("[ARNDCQEGHILKMFPSTUWYV]",\r
+ Pattern.CASE_INSENSITIVE);\r
+ String sname = "", seqstr = null;\r
+ do {\r
+ line = infasta.readLine();\r
+ if (line == null || line.startsWith(">")) {\r
+ if (seqstr != null)\r
+ seqs.add((Object) Seq.newSequence(sname.substring(1), seqstr,\r
+ SymbolDictionary.STANDARD_AA, 0, 0));\r
+ sname = line; // remove >\r
+ seqstr = "";\r
+ } else {\r
+ String subseq = Pattern.compile("//s+").matcher(line).replaceAll("");\r
+ seqstr += subseq;\r
+ }\r
+ } while (line != null);\r
+ nseq = seqs.size();\r
+ if (nseq > 0) {\r
+ // TODO:POSS: should really return a sequence if there's only one in the\r
+ // file.\r
+ Sequence[] seqset = new Sequence[nseq];\r
+ for (int i = 0; i < nseq; i++) {\r
+ seqset[i] = (Sequence) seqs.elementAt(i);\r
+ }\r
+ return seqset;\r
+ }\r
+\r
+ return null;\r
+ }\r
+\r
+ public static Hashtable uniquify(SequenceType[] sequences) {\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ // TODO: do we need this with vamsas sequences ?\r
+ // Generate a safely named sequence set and a hash to recover the sequence\r
+ // names\r
+ Hashtable map = new Hashtable();\r
+ for (int i = 0; i < sequences.length; i++) {\r
+ String safename = new String("Sequence" + i);\r
+ map.put(safename, sequences[i].getName());\r
+ sequences[i].setName(safename);\r
+ }\r
+ return map;\r
+ }\r
+\r
+ public static boolean deuniquify(Hashtable map, SequenceType[] sequences) {\r
+ System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this\r
+ // method\r
+ // TODO: do we need this with vamsas sequences ?\r
+ // recover unsafe sequence names for a sequence set\r
+ boolean allfound = true;\r
+ for (int i = 0; i < sequences.length; i++) {\r
+ if (map.containsKey(sequences[i].getName())) {\r
+ String unsafename = (String) map.get(sequences[i].getName());\r
+ sequences[i].setName(unsafename);\r
+ } else {\r
+ allfound = false;\r
+ }\r
+ }\r
+ return allfound;\r
+ }\r
+\r
+}\r
-package uk.ac.vamsas.objects.utils;
-
-public class SymbolDictionary {
- /**
- * defines standard names and properties for vamsas sequence dictionaries
- */
- static final public String STANDARD_AA="info:iubmb.org/aminoacids"; // strict 1 letter code
- static final public String STANDARD_NA="info:iubmb.org/nucleosides";// strict 1 letter code (do not allow arbitrary rare nucleosides)
- /**
- * TODO: Vamsas Dictionary properties interface
- * an interface for dictionary provides :
- * validation for a string
- * symbolwidth (or symbol next/previous)
- * mappings to certain other dictionaries (one2three, etc)
- * gap-character test
- *
- */
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils;\r
+\r
+public class SymbolDictionary {\r
+ /**\r
+ * defines standard names and properties for vamsas sequence dictionaries\r
+ */\r
+ static final public String STANDARD_AA = "info:iubmb.org/aminoacids"; // strict\r
+ // 1\r
+ // letter\r
+ // code\r
+\r
+ static final public String STANDARD_NA = "info:iubmb.org/nucleosides";// strict\r
+ // 1\r
+ // letter\r
+ // code\r
+ // (do\r
+ // not\r
+ // allow\r
+ // arbitrary\r
+ // rare\r
+ // nucleosides)\r
+ /**\r
+ * TODO: Vamsas Dictionary properties interface an interface for dictionary\r
+ * provides : validation for a string symbolwidth (or symbol next/previous)\r
+ * mappings to certain other dictionaries (one2three, etc) gap-character test\r
+ * \r
+ */\r
+\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.objects.utils;\r
\r
import java.io.IOException;\r
public class Trees {\r
\r
/**\r
- * TODO: implement\r
- * helper functions based on NewickFile tree parser\r
+ * TODO: implement helper functions based on NewickFile tree parser\r
* \r
- * 1. create a newickfile object from a newick string.\r
- * 2. let user map a vamsas object to each node by setting that node's ((SequenceNode)node).setElement(VorbaId) \r
- * 3. generate Tree object with newickString as a newick string, and added treenodes to record mapping to vorba ids\r
+ * 1. create a newickfile object from a newick string. 2. let user map a\r
+ * vamsas object to each node by setting that node's\r
+ * ((SequenceNode)node).setElement(VorbaId) 3. generate Tree object with\r
+ * newickString as a newick string, and added treenodes to record mapping to\r
+ * vorba ids\r
*/\r
- \r
+\r
}\r
-/**
- *
- */
-package uk.ac.vamsas.objects.utils.document;
-
-import java.util.Hashtable;
-
-/**
- * enumerates versions for the VamsasDocument.Version string
- * provides version comparison methods
- * TODO: LATER: associate schema versions with these strings
- */
-public class VersionEntries {
- public static final String ALPHA_VERSION="alpha";
- public static final String BETA_VERSION="beta";
- protected static Hashtable versions;
- static {
- versions = new Hashtable();
- // integers represent version hierarchy - 0 precedes 1
- versions.put(ALPHA_VERSION, new Integer(0));
- versions.put(BETA_VERSION, new Integer(1));
- }
- // TODO: LATER: decide on best pattern for enumeration classes (ie - need an ordered list of versions, and validator, plus explicit enum-strings)
- public static boolean isVersion(String vstring) {
- return versions.containsKey(vstring);
- }
- /**
- * returns 0 if levels are equivalent,
- * 1 if higher is valid and higher,
- * 2 if lower is valid and higher
- * -1 if both levels are invalid
- * @param higher
- * @param lower
- * @return
- */
- public static int compare(String higher, String lower) {
- int v_1 = versions.containsKey(higher) ? ((Integer) versions.get(higher)).intValue() : -1;
- int v_2 = versions.containsKey(lower) ? ((Integer) versions.get(lower)).intValue() : -1;
- int comp = v_1<v_2 ? 2 : v_1 == v_2 ? 0 : 1;
- return (comp==0) ? (v_1!=-1 ? 0 : -1) : comp;
- }
- /**
- * @return the latest version that this vamsas library supports
- */
- public static String latestVersion() {
- return BETA_VERSION;
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.objects.utils.document;\r
+\r
+import java.util.Hashtable;\r
+\r
+/**\r
+ * enumerates versions for the VamsasDocument.Version string provides version\r
+ * comparison methods TODO: LATER: associate schema versions with these strings\r
+ */\r
+public class VersionEntries {\r
+ public static final String ALPHA_VERSION = "alpha";\r
+\r
+ public static final String BETA_VERSION = "beta";\r
+\r
+ protected static Hashtable versions;\r
+ static {\r
+ versions = new Hashtable();\r
+ // integers represent version hierarchy - 0 precedes 1\r
+ versions.put(ALPHA_VERSION, new Integer(0));\r
+ versions.put(BETA_VERSION, new Integer(1));\r
+ }\r
+\r
+ // TODO: LATER: decide on best pattern for enumeration classes (ie - need an\r
+ // ordered list of versions, and validator, plus explicit enum-strings)\r
+ public static boolean isVersion(String vstring) {\r
+ return versions.containsKey(vstring);\r
+ }\r
+\r
+ /**\r
+ * returns 0 if levels are equivalent, 1 if higher is valid and higher, 2 if\r
+ * lower is valid and higher -1 if both levels are invalid\r
+ * \r
+ * @param higher\r
+ * @param lower\r
+ * @return\r
+ */\r
+ public static int compare(String higher, String lower) {\r
+ int v_1 = versions.containsKey(higher) ? ((Integer) versions.get(higher))\r
+ .intValue() : -1;\r
+ int v_2 = versions.containsKey(lower) ? ((Integer) versions.get(lower))\r
+ .intValue() : -1;\r
+ int comp = v_1 < v_2 ? 2 : v_1 == v_2 ? 0 : 1;\r
+ return (comp == 0) ? (v_1 != -1 ? 0 : -1) : comp;\r
+ }\r
+\r
+ /**\r
+ * @return the latest version that this vamsas library supports\r
+ */\r
+ public static String latestVersion() {\r
+ return BETA_VERSION;\r
+ }\r
+\r
+}\r
-/**\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
* \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package uk.ac.vamsas.objects.utils.trees;\r
\r
BinaryNode parent;\r
\r
/** bootstrap is non-negative integer */\r
- public int bootstrap=-1;\r
+ public int bootstrap = -1;\r
\r
/**\r
* Creates a new BinaryNode object.\r
}\r
\r
/**\r
- * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children\r
- * of this node (removing any old references) a null parameter DOES NOT mean\r
- * that the pointer to the corresponding child node is set to NULL - you\r
- * should use setChild(null), or detach() for this.\r
+ * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children of\r
+ * this node (removing any old references) a null parameter DOES NOT mean that\r
+ * the pointer to the corresponding child node is set to NULL - you should use\r
+ * setChild(null), or detach() for this.\r
* \r
*/\r
public void SetChildren(BinaryNode leftchild, BinaryNode rightchild) {\r
}\r
/**\r
* \r
- * @return unquoted string of form VorbaId|v|node name string\r
- public String getNewickNodeName() {\r
- if (element!=null || name!=null)\r
- {\r
- return ((element!=null) ? element.getVorbaId().getId()+"|v|" : "")\r
- + ((name == null) ? "" : name);\r
- }\r
- return "";\r
- }\r
- \r
- * note we probably don't need this now\r
-\r
- * public boolean parseNodeNameString(uk.ac.vamsas.client.ClientDocument binder)\r
- {\r
- \r
- if (element==null && name!=null && name.indexOf("|v|")>-1)\r
- {\r
- element = binder.getObject(null).getVorbaId(); // TODO: fix THIS ! name.substring(0, name.indexOf("|v")));\r
- \r
- }\r
- return false;\r
- }*/\r
-}
\ No newline at end of file
+ * @return unquoted string of form VorbaId|v|node name string public String\r
+ * getNewickNodeName() { if (element!=null || name!=null) { return\r
+ * ((element!=null) ? element.getVorbaId().getId()+"|v|" : "") +\r
+ * ((name == null) ? "" : name); } return ""; }\r
+ * \r
+ * note we probably don't need this now\r
+ * \r
+ * public boolean\r
+ * parseNodeNameString(uk.ac.vamsas.client.ClientDocument binder) {\r
+ * \r
+ * if (element==null && name!=null && name.indexOf("|v|")>-1) {\r
+ * element = binder.getObject(null).getVorbaId(); // TODO: fix THIS !\r
+ * name.substring(0, name.indexOf("|v")));\r
+ * \r
+ * } return false; }\r
+ */\r
+}\r
/*\r
- * originally from \r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
* \r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
// NewickFile.java\r
// Tree I/O\r
// http://evolution.genetics.washington.edu/phylip/newick_doc.html\r
}\r
\r
/**\r
- * call this to convert the newick string into a binary node linked tree\r
- * Note: this is automatically called by the constructors, so you normally\r
- * wouldn't need to use this.\r
+ * call this to convert the newick string into a binary node linked tree Note:\r
+ * this is automatically called by the constructors, so you normally wouldn't\r
+ * need to use this.\r
* \r
* @throws IOException\r
* if the newick string cannot be parsed.\r
\r
Matcher mjsyms = majorsyms.matcher(nf);\r
char schar;\r
- int nextcp=0;\r
+ int nextcp = 0;\r
int ncp = cp;\r
- while (mjsyms.find(cp) && (Error == null)) {\r
+ while (mjsyms.find(cp) && (Error == null)) {\r
int fcp = mjsyms.start();\r
\r
switch (schar = nf.charAt(fcp)) {\r
"Wayward semicolon (depth=" + d + ")", 7, fcp, nf);\r
}\r
\r
- // Skip Comment or structured/extended NH format info\r
+ // Skip Comment or structured/extended NH format info\r
if (schar == '[') {\r
- if ((nextcp=nf.indexOf(']', fcp)) > -1) {\r
+ if ((nextcp = nf.indexOf(']', fcp)) > -1) {\r
// verified that comment is properly terminated.\r
// now skip the comment field\r
nextcp++;\r
- break; // go and search for the next node separator, leaving ncp at beginning of node info\r
+ break; // go and search for the next node separator, leaving ncp at\r
+ // beginning of node info\r
} else {\r
Error = ErrorStringrange(Error, "Unterminated comment", 3, fcp, nf);\r
nextcp = 0;\r
break;\r
}\r
}\r
- \r
- // Parse simpler field strings from substring between ncp and node separator\r
+\r
+ // Parse simpler field strings from substring between ncp and node\r
+ // separator\r
String fstring = nf.substring(ncp, fcp);\r
// extract any comments from the nodeinfo.\r
- while (fstring.indexOf(']')>-1)\r
- {\r
- int cstart=fstring.indexOf('[');\r
- int cend=fstring.indexOf(']');\r
- String comment = fstring.substring(cstart+1,cend); // TODO: put this somewhere ?\r
- fstring = fstring.substring(0, cstart)+fstring.substring(cend+1);\r
+ while (fstring.indexOf(']') > -1) {\r
+ int cstart = fstring.indexOf('[');\r
+ int cend = fstring.indexOf(']');\r
+ String comment = fstring.substring(cstart + 1, cend); // TODO: put\r
+ // this\r
+ // somewhere ?\r
+ fstring = fstring.substring(0, cstart) + fstring.substring(cend + 1);\r
}\r
Matcher uqnodename = Pattern.compile("^([^' :;\\](),]+).*").matcher(\r
fstring);\r
Matcher nbootstrap = Pattern.compile("\\s*([+0-9]+)\\s*:.*").matcher(\r
fstring);\r
\r
- if (nbootstrap.matches())\r
- {\r
- if (nodename!=null && nbootstrap.group(1).equals(nodename)) \r
- {\r
- nodename=null; // empty nodename - only bootstrap value\r
+ if (nbootstrap.matches()) {\r
+ if (nodename != null && nbootstrap.group(1).equals(nodename)) {\r
+ nodename = null; // empty nodename - only bootstrap value\r
}\r
- if ((nodename==null || nodename.length()==0) || nbootstrap.start(1)>=uqnodename.end(1))\r
- {\r
+ if ((nodename == null || nodename.length() == 0)\r
+ || nbootstrap.start(1) >= uqnodename.end(1)) {\r
try {\r
bootstrap = (new Integer(nbootstrap.group(1))).intValue();\r
HasBootstrap = true;\r
}\r
}\r
}\r
- \r
+\r
Matcher ndist = Pattern.compile(".*:([-0-9Ee.+]+)").matcher(fstring);\r
boolean nodehasdistance = false;\r
\r
public uk.ac.vamsas.objects.core.Treenode[] matchTreeNodeNames(\r
String[] names, Vobject[] boundObjects) {\r
// todo!\r
- // also - need to reconstruct a names object id mapping (or BInaryNode) mapping for the parsed tree file\r
+ // also - need to reconstruct a names object id mapping (or BInaryNode)\r
+ // mapping for the parsed tree file\r
return null;\r
}\r
\r
private String nodeName(String name) {\r
if (NodeSafeName[0].matcher(name).find()) {\r
return QuoteChar + NodeSafeName[1].matcher(name).replaceAll("''")\r
- + QuoteChar; // quite \r
+ + QuoteChar; // quite\r
} else {\r
return NodeSafeName[2].matcher(name).replaceAll("_"); // whitespace\r
}\r
* @return DOCUMENT ME!\r
*/\r
private String printNodeField(SequenceNode c) {\r
- return //c.getNewickNodeName()\r
+ return // c.getNewickNodeName()\r
((c.getName() == null) ? "" : nodeName(c.getName()))\r
- + ((HasBootstrap) ? ((c.getBootstrap() > -1) ? (((c.getName()==null) ? " " : "") + c.getBootstrap())\r
- : "") : "") + ((HasDistances) ? (":" + c.dist) : "");\r
+ + ((HasBootstrap) ? ((c.getBootstrap() > -1) ? (((c.getName() == null) ? " "\r
+ : "") + c.getBootstrap())\r
+ : "")\r
+ : "") + ((HasDistances) ? (":" + c.dist) : "");\r
}\r
\r
/**\r
private String printRootField(SequenceNode root) {\r
return (printRootInfo) ? (((root.getName() == null) ? "" : nodeName(root\r
.getName()))\r
- + ((HasBootstrap) ? ((root.getBootstrap() > -1) ? ((root.getName()!=null ? " " : "") + root\r
- .getBootstrap()) : "") : "") + ((RootHasDistance) ? (":" + root.dist)\r
- : ""))\r
+ + ((HasBootstrap) ? ((root.getBootstrap() > -1) ? ((root.getName() != null ? " "\r
+ : "") + root.getBootstrap())\r
+ : "")\r
+ : "") + ((RootHasDistance) ? (":" + root.dist) : ""))\r
: "";\r
}\r
\r
\r
/**\r
* Search for leaf nodes.\r
- *\r
- * @param node root node to search from\r
- * @param leaves Vector of leaves to add leaf node objects too.\r
- *\r
+ * \r
+ * @param node\r
+ * root node to search from\r
+ * @param leaves\r
+ * Vector of leaves to add leaf node objects too.\r
+ * \r
* @return Vector of leaf nodes on binary tree\r
*/\r
public Vector findLeaves(SequenceNode node, Vector leaves) {\r
return leaves;\r
}\r
\r
- if ((node.left() == null) && (node.right() == null)) // Interior node detection\r
+ if ((node.left() == null) && (node.right() == null)) // Interior node\r
+ // detection\r
{\r
leaves.addElement(node);\r
\r
return leaves;\r
} else {\r
- /* TODO: Identify internal nodes... if (node.isSequenceLabel())\r
- {\r
- leaves.addElement(node);\r
- }*/\r
+ /*\r
+ * TODO: Identify internal nodes... if (node.isSequenceLabel()) {\r
+ * leaves.addElement(node); }\r
+ */\r
findLeaves((SequenceNode) node.left(), leaves);\r
findLeaves((SequenceNode) node.right(), leaves);\r
}\r
}\r
\r
/**\r
- * make tree node vector from a newick tree structure with associated vamsas objects\r
+ * make tree node vector from a newick tree structure with associated vamsas\r
+ * objects\r
+ * \r
* @param ntree\r
* @return Treenode definitions for nodes with associated objects\r
*/\r
}\r
\r
/**\r
- * make treenode vector for a parsed tree with/out leaf node associations \r
- * @param ignoreplaceholders if true means only associated nodes are returned\r
+ * make treenode vector for a parsed tree with/out leaf node associations\r
+ * \r
+ * @param ignoreplaceholders\r
+ * if true means only associated nodes are returned\r
* @return treenode vector for associated or all leaves\r
*/\r
public Treenode[] makeTreeNodes(boolean ignoreplaceholders) {\r
}\r
\r
/**\r
- *\r
- * re-decorate the newick node representation with the VorbaId of an object mapped by its corresponding TreeNode. \r
- * Note: this only takes the first object in the first set of references.\r
+ * \r
+ * re-decorate the newick node representation with the VorbaId of an object\r
+ * mapped by its corresponding TreeNode. Note: this only takes the first\r
+ * object in the first set of references.\r
+ * \r
* @param tn\r
- * @return vector of mappings { treenode, SequenceNode, Vobject for VorbaId on sequence node }\r
+ * @return vector of mappings { treenode, SequenceNode, Vobject for VorbaId on\r
+ * sequence node }\r
*/\r
public Vector attachTreeMap(Treenode[] tn) {\r
if (root != null || tn == null)\r
-/**\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
* \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package uk.ac.vamsas.objects.utils.trees;\r
\r
\r
/**\r
* @param dummy\r
- * true if node is created for the representation of polytomous\r
- * trees\r
+ * true if node is created for the representation of polytomous trees\r
*/\r
public boolean isDummy() {\r
return dummy;\r
return c;\r
}\r
\r
-}
\ No newline at end of file
+}\r
+/*
+ * This file is part of the Vamsas Client version 0.1.
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
+ * Andrew Waterhouse and Dominik Lindner.
+ *
+ * Earlier versions have also been incorporated into Jalview version 2.4
+ * since 2008, and TOPALi version 2 since 2007.
+ *
+ * The Vamsas Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Vamsas Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
+ */
package uk.ac.vamsas.test;
import uk.ac.vamsas.client.*;
}
public String Usage = "ExampleApplication :/n [-arena <vamsasFileDirectory>][-session <vamsasSessionURN>] <action> [+<arguments>]\n"
- + "<action> is one of :\n\tsave,new,watch\n"+
- "-arena and -session are not yet supported"; // TODO for release
+ + "<action> is one of :\n\tsave,new,watch\n"
+ + "-arena and -session are not yet supported"; // TODO for release
String sess = null;
String importFile = null;
String outputFile = null;
- boolean newSession=false;
- boolean imported=false;
+
+ boolean newSession = false;
+
+ boolean imported = false;
+
private boolean parseArgs(String args[]) {
if (args.length == 0) {
return false;
boolean parsed = false;
while (!parsed && cpos < args.length) {
// TODO: note importDocument not yet supported.
- //if (args[cpos].toLowerCase().equals("load") && cpos + 1 < args.length) {
- // importFile = args[cpos + 1];
- // cpos += 2;
- // continue;
- //}
+ // if (args[cpos].toLowerCase().equals("load") && cpos + 1 < args.length)
+ // {
+ // importFile = args[cpos + 1];
+ // cpos += 2;
+ // continue;
+ // }
if (args[cpos].toLowerCase().equals("new") && cpos + 1 < args.length) {
importFile = args[cpos + 1];
- newSession=true;
+ newSession = true;
cpos += 2;
continue;
}
// get an Iclient with session data
app = new ClientHandle("uk.ac.vamsas.test.ExampleApplication", "0.1");
user = new UserHandle("arnolduser", "deathsdoor");
- if (sess!=null && importFile!=null)
- {
- System.err.println("Import of an existing document into an existing session is not fully supported yet.");
+ if (sess != null && importFile != null) {
+ System.err
+ .println("Import of an existing document into an existing session is not fully supported yet.");
System.exit(3);
}
try {
System.out.println("Connecting to " + sess);
vorbaclient = clientfactory.getIClient(app, user, sess);
} else {
- if (newSession)
- {
- if (importFile==null)
- {
+ if (newSession) {
+ if (importFile == null) {
System.out.println("Connecting to a new VAMSAS Session.");
vorbaclient = clientfactory.getNewSessionIClient(app, user);
} else {
- System.out.println("Connecting to a new VAMSAS Session to share data in existing document:"+importFile);
+ System.out
+ .println("Connecting to a new VAMSAS Session to share data in existing document:"
+ + importFile);
File vfile = new File(importFile);
- vorbaclient = clientfactory.openAsNewSessionIClient(app, user, vfile);
- System.out.println("Succesfully imported document into new session.");
+ vorbaclient = clientfactory.openAsNewSessionIClient(app, user,
+ vfile);
+ System.out
+ .println("Succesfully imported document into new session.");
imported = true;
- importFile=null;
+ importFile = null;
}
} else {
- vorbaclient = clientfactory.getIClient(app, user);
+ vorbaclient = clientfactory.getIClient(app, user);
}
}
- }
- catch (InvalidSessionDocumentException e) {
- System.err.println("Failed to create a session to share "+importFile);
+ } catch (InvalidSessionDocumentException e) {
+ System.err.println("Failed to create a session to share " + importFile);
System.err.println("Sorry it didn't work out. This is what went wrong:");
e.printStackTrace(System.err);
System.exit(3);
- }
- catch (NoDefaultSessionException e) {
+ } catch (NoDefaultSessionException e) {
System.err
.println("There appear to be several sessions to choose from :");
String[] sessions = clientfactory.getCurrentSessions();
File vfile = new File(importFile);
try {
vorbaclient.importDocument(vfile);
- imported=true;
+ imported = true;
} catch (Exception e) {
System.err.println("Failed to import file " + importFile);
System.err.println("Exception received was " + e);
// get document data
try {
IClientDocument cdoc = vorbaclient.getClientDocument();
- if (imported)
- {
- if (cdoc.getVamsasRoots()==null || cdoc.getVamsasRoots()[0].getDataSetCount()<1)
- {
- System.err.println("Imported an Empty vamsas document. Is this correct ?");
+ if (imported) {
+ if (cdoc.getVamsasRoots() == null
+ || cdoc.getVamsasRoots()[0].getDataSetCount() < 1) {
+ System.err
+ .println("Imported an Empty vamsas document. Is this correct ?");
}
}
processVamsasDocument(cdoc);
}
try {
Thread.sleep(200);
- } catch (Exception e){}
+ } catch (Exception e) {
+ }
}
} else {
if (System.currentTimeMillis() > shutdown) {
-/**
- *
- */
-package uk.ac.vamsas.test.objects;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.objects.core.*;
-import uk.ac.vamsas.objects.utils.*;
-import uk.ac.vamsas.objects.utils.document.*;
-import uk.ac.vamsas.test.simpleclient.ArchiveReports;
-
-/**
- * @author jim
- * test XSD-Java binding classes in uk.ac.vamsas.objects.core
- */
-public class Core {
- static Log log = LogFactory.getLog(Core.class);
-
- /**
- *
- * complete any automatically completable entries in the dataset
- * @param ds
- */
- public static String user = "uk.ac.vamsas.test.objects.Core";
-
- public static void complete(DataSet ds) {
- Sequence[] q = ds.getSequence();
- for (int i=0,j=q.length; i<j; i++) {
- q[i].setStart(i+1);
- q[i].setEnd(q[i].getSequence().length()+i+1);
- }
- }
-
- public static VAMSAS getDemoVamsas() {
- VAMSAS v=new VAMSAS();
- DataSet ds = new DataSet();
- ds.addSequence(Seq.newSequence("Dummy1","ASDFLEQ",SymbolDictionary.STANDARD_AA, 5, 11));
- ds.addSequence(Seq.newSequence("Dummy2","ASFLEQ",SymbolDictionary.STANDARD_AA, 5, 10));
- ds.addSequence(Seq.newSequence("Dummy3","ADFEQ",SymbolDictionary.STANDARD_AA, 3, 7));
- ds.setProvenance(ProvenanceStuff.newProvenance(user, "constructed some dummy sequences"));
- complete(ds);
- v.addDataSet(ds);
- Alignment al = new Alignment();
- al.setProvenance(ProvenanceStuff.newProvenance(user, "Created dummy alignment"));
- // rely on newAlignmentSequence to set start/end correctly
- al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned1", "ASDFLEQ", ds.getSequence(0), -1, -1));
- al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned2", "AS-FLEQ", ds.getSequence(1), -1, -1));
- al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned3", "A-DF-EQ", ds.getSequence(2), -1, -1));
- al.setGapChar("-");
- ds.addAlignment(al);
- // TODO: create annotations
- // TODO: create tree
- return v;
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
-
- /**
- * test constants and controlled vocab utils
- */
- System.out.println("VersionEntries.compare(invalid, ALPHA) returned "+VersionEntries.compare("invalid", VersionEntries.ALPHA_VERSION));
- System.out.println("VersionEntries.compare(ALPHA, invalid) returned "+VersionEntries.compare(VersionEntries.ALPHA_VERSION, "invalid"));
- System.out.println("VersionEntries.compare(BETA, ALPHA) returned "+VersionEntries.compare(VersionEntries.BETA_VERSION,VersionEntries.ALPHA_VERSION));
- System.out.println("VersionEntries.compare(ALPHA, BETA) returned "+VersionEntries.compare(VersionEntries.ALPHA_VERSION,VersionEntries.BETA_VERSION));
- System.out.println("VersionEntries.compare(ALPHA, ALPHA) returned "+VersionEntries.compare(VersionEntries.ALPHA_VERSION,VersionEntries.ALPHA_VERSION));
- System.out.println("VersionEntries.compare(invalid, invalid) returned "+VersionEntries.compare("invalid", "invalid"));
- System.out.println("VersionEntries.latestVersion()="+VersionEntries.latestVersion()+
- ", dict_aa="+SymbolDictionary.STANDARD_AA+", dict_na="+SymbolDictionary.STANDARD_NA);
- /**
- * Test utils and autogenerated Vobject interfaces
- */
-
- VamsasDocument doc = DocumentStuff.newVamsasDocument(new VAMSAS[] { getDemoVamsas() },
- ProvenanceStuff.newProvenance("org.vamsas.objects.test.Core", "Created demo vamsasDocument"),
- VersionEntries.latestVersion());
- ArchiveReports.reportDocument(doc, null, true, System.out);
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.objects;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.objects.core.*;\r
+import uk.ac.vamsas.objects.utils.*;\r
+import uk.ac.vamsas.objects.utils.document.*;\r
+import uk.ac.vamsas.test.simpleclient.ArchiveReports;\r
+\r
+/**\r
+ * @author jim test XSD-Java binding classes in uk.ac.vamsas.objects.core\r
+ */\r
+public class Core {\r
+ static Log log = LogFactory.getLog(Core.class);\r
+\r
+ /**\r
+ * \r
+ * complete any automatically completable entries in the dataset\r
+ * \r
+ * @param ds\r
+ */\r
+ public static String user = "uk.ac.vamsas.test.objects.Core";\r
+\r
+ public static void complete(DataSet ds) {\r
+ Sequence[] q = ds.getSequence();\r
+ for (int i = 0, j = q.length; i < j; i++) {\r
+ q[i].setStart(i + 1);\r
+ q[i].setEnd(q[i].getSequence().length() + i + 1);\r
+ }\r
+ }\r
+\r
+ public static VAMSAS getDemoVamsas() {\r
+ VAMSAS v = new VAMSAS();\r
+ DataSet ds = new DataSet();\r
+ ds.addSequence(Seq.newSequence("Dummy1", "ASDFLEQ",\r
+ SymbolDictionary.STANDARD_AA, 5, 11));\r
+ ds.addSequence(Seq.newSequence("Dummy2", "ASFLEQ",\r
+ SymbolDictionary.STANDARD_AA, 5, 10));\r
+ ds.addSequence(Seq.newSequence("Dummy3", "ADFEQ",\r
+ SymbolDictionary.STANDARD_AA, 3, 7));\r
+ ds.setProvenance(ProvenanceStuff.newProvenance(user,\r
+ "constructed some dummy sequences"));\r
+ complete(ds);\r
+ v.addDataSet(ds);\r
+ Alignment al = new Alignment();\r
+ al.setProvenance(ProvenanceStuff.newProvenance(user,\r
+ "Created dummy alignment"));\r
+ // rely on newAlignmentSequence to set start/end correctly\r
+ al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned1", "ASDFLEQ", ds\r
+ .getSequence(0), -1, -1));\r
+ al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned2", "AS-FLEQ", ds\r
+ .getSequence(1), -1, -1));\r
+ al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned3", "A-DF-EQ", ds\r
+ .getSequence(2), -1, -1));\r
+ al.setGapChar("-");\r
+ ds.addAlignment(al);\r
+ // TODO: create annotations\r
+ // TODO: create tree\r
+ return v;\r
+ }\r
+\r
+ /**\r
+ * @param args\r
+ */\r
+ public static void main(String[] args) {\r
+\r
+ /**\r
+ * test constants and controlled vocab utils\r
+ */\r
+ System.out.println("VersionEntries.compare(invalid, ALPHA) returned "\r
+ + VersionEntries.compare("invalid", VersionEntries.ALPHA_VERSION));\r
+ System.out.println("VersionEntries.compare(ALPHA, invalid) returned "\r
+ + VersionEntries.compare(VersionEntries.ALPHA_VERSION, "invalid"));\r
+ System.out.println("VersionEntries.compare(BETA, ALPHA) returned "\r
+ + VersionEntries.compare(VersionEntries.BETA_VERSION,\r
+ VersionEntries.ALPHA_VERSION));\r
+ System.out.println("VersionEntries.compare(ALPHA, BETA) returned "\r
+ + VersionEntries.compare(VersionEntries.ALPHA_VERSION,\r
+ VersionEntries.BETA_VERSION));\r
+ System.out.println("VersionEntries.compare(ALPHA, ALPHA) returned "\r
+ + VersionEntries.compare(VersionEntries.ALPHA_VERSION,\r
+ VersionEntries.ALPHA_VERSION));\r
+ System.out.println("VersionEntries.compare(invalid, invalid) returned "\r
+ + VersionEntries.compare("invalid", "invalid"));\r
+ System.out.println("VersionEntries.latestVersion()="\r
+ + VersionEntries.latestVersion() + ", dict_aa="\r
+ + SymbolDictionary.STANDARD_AA + ", dict_na="\r
+ + SymbolDictionary.STANDARD_NA);\r
+ /**\r
+ * Test utils and autogenerated Vobject interfaces\r
+ */\r
+\r
+ VamsasDocument doc = DocumentStuff.newVamsasDocument(\r
+ new VAMSAS[] { getDemoVamsas() }, ProvenanceStuff.newProvenance(\r
+ "org.vamsas.objects.test.Core", "Created demo vamsasDocument"),\r
+ VersionEntries.latestVersion());\r
+ ArchiveReports.reportDocument(doc, null, true, System.out);\r
+ }\r
+}\r
-/**
- *
- */
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.exolab.castor.xml.MarshalException;
-import org.exolab.castor.xml.ValidationException;
-
-import uk.ac.vamsas.client.AppDataOutputStream;
-import uk.ac.vamsas.client.ClientHandle;
-import uk.ac.vamsas.client.IVorbaIdFactory;
-import uk.ac.vamsas.client.SessionHandle;
-import uk.ac.vamsas.client.UserHandle;
-import uk.ac.vamsas.client.Vobject;
-import uk.ac.vamsas.client.VorbaId;
-import uk.ac.vamsas.client.simpleclient.FileWatcher;
-import uk.ac.vamsas.client.simpleclient.IdFactory;
-import uk.ac.vamsas.client.simpleclient.SessionFile;
-import uk.ac.vamsas.client.simpleclient.SimpleDocBinding;
-import uk.ac.vamsas.client.simpleclient.SimpleDocument;
-import uk.ac.vamsas.client.simpleclient.VamsasArchive;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.client.simpleclient.VamsasFile;
-import uk.ac.vamsas.objects.core.AppData;
-import uk.ac.vamsas.objects.core.ApplicationData;
-import uk.ac.vamsas.objects.core.User;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-import uk.ac.vamsas.objects.utils.AppDataReference;
-import uk.ac.vamsas.objects.utils.DocumentStuff;
-import uk.ac.vamsas.objects.utils.ProvenanceStuff;
-import uk.ac.vamsas.objects.utils.SeqSet;
-import uk.ac.vamsas.objects.utils.document.VersionEntries;
-import uk.ac.vamsas.test.objects.Core;
-
-/**
- * @author jimp
- * test the VamsasFile routines for watching, reading and updating a vamsas document jar file.
- * simple document access base class.
- */
-public class ArchiveClient extends IdFactory {
-
- private Log log = LogFactory.getLog(ArchiveClient.class);
- // protected UserHandle user=null;
- // protected ClientHandle me = new ClientHandle("ArchiveClient","0.01");
- VamsasFile vsess;
-
- /**
- * @param user
- * @param vsess
- */
- public ArchiveClient(UserHandle user, VamsasFile vsess) {
- super(new SessionHandle("vamsasfile://"+vsess.getVamsasFile()), new ClientHandle("ArchiveClient","0.01"), user);
- this.vsess = vsess;
- valid();
- }
- private void _openVsess(File vsess) {
- try {
- this.vsess = new VamsasFile(vsess);
- }
- catch (Exception e) {
- log.error("Couldn't open session for file "+vsess,e);
- this.vsess = null;
- }
- }
- public ArchiveClient(String username, String organization, File vsess) {
- super(new SessionHandle("vamsasfile://"+vsess), new ClientHandle("ArchiveClient","0.01"), new UserHandle(username, organization));
- _openVsess(vsess);
- valid();
- }
- public ArchiveClient(String username, String organization, String clientName, String clientVersion, File vsess) {
- super(new SessionHandle("vamsasfile://"+vsess), new ClientHandle(clientName, clientVersion), new UserHandle(username, organization));
- _openVsess(vsess);
- valid();
- }
- public void valid() {
- if (vsess==null)
- throw new Error("ArchiveClient instance is invalid!.");
- }
- /**
- * set this to false if watch loop should end immediately
- */
- protected boolean watchForChange=true;
- public static int WATCH_SLEEP=300;
- /**
- * watch the document file for updates.
- * @param time - length of time to watch for.
- * @return read only IO interface for session document.
- */
- public ClientDoc watch(long time) {
- valid();
- vsess.unLock(); // doh.
- FileWatcher watcher = new FileWatcher(vsess.getVamsasFile());
- // watcher.setState();
- watchForChange=true;
- long endtime=System.currentTimeMillis()+time;
- try {
- uk.ac.vamsas.client.simpleclient.Lock doclock;
- do {
- doclock=watcher.getChangedState();
- if (doclock==null)
- Thread.sleep(WATCH_SLEEP);
- } while (watchForChange && doclock==null && (time==0 || endtime>System.currentTimeMillis())); // tuning.
- if (doclock==null)
- return null;
- else {
- return getUpdateable(vsess.getLock(doclock));
- /*VamsasArchiveReader varc = new VamsasArchiveReader(vsess.getVamsasFile());
- return _getReadonly(varc);*/
- }
- } catch (Exception e) {
- log.error("Whilst watching file "+vsess.getVamsasFile(), e);
- }
- return null;
- }
-
- // from ClientDocument.getClientAppdata
- private AppData[] getAppData(VamsasDocument doc) {
- // TODO: codefest - not yet tested or merged in to SimpleClient
- if (doc==null) {
- log.debug("extractAppData called for null document object");
- return null;
- }
- AppData appsGlobal=null, usersData=null;
- Vector apldataset = AppDataReference.getUserandApplicationsData(
- doc, this.getUserHandle(), this.getClientHandle());
- if (apldataset!=null) {
- if (apldataset.size()>0) {
- AppData clientdat = (AppData) apldataset.get(0);
- if (clientdat instanceof ApplicationData) {
- appsGlobal = (ApplicationData) clientdat;
- if (apldataset.size()>1) {
- clientdat = (AppData) apldataset.get(1);
- if (clientdat instanceof User) {
- usersData = (User) clientdat;
- }
- if (apldataset.size()>2)
- log.info("Ignoring additional ("+(apldataset.size()-2)+") AppDatas returned by document appdata query.");
- }
- } else {
- log.warn("Unexpected entry in AppDataReference query: id="+clientdat.getVorbaId()+" type="+clientdat.getClass().getName());
- }
- apldataset.removeAllElements(); // destroy references.
- }
- }
- return new AppData[] { appsGlobal, usersData};
- }
-
- protected ClientDoc _getReadonly(VamsasArchiveReader vreader) throws IOException, ValidationException, MarshalException {
- valid();
- if (vreader!=null) {
- SimpleDocBinding docb = new SimpleDocBinding();
- docb.setVorba(this);
- VamsasDocument d;
- d = docb.getVamsasDocument(vreader);
-
- if (d!=null) {
- ClientDoc creader = new ClientDoc(d, null, vreader, getClientHandle().getClientUrn(), getProvenanceUser(), getVorbaIdHash());
- return creader;
- }
- }
- return null;
- }
- /**
- * from SimpleClient
- * @return user field for a provenance entry
- */
- protected String getProvenanceUser() {
- return new String(getUserHandle().getFullName()+" ["+getClientHandle().getClientUrn()+"]");
- }
-
- public ClientDoc getUpdateable() {
- return getUpdateable(null);
- }
- public ClientDoc getUpdateable(uk.ac.vamsas.client.simpleclient.Lock lock) {
- getVorbaIdHash().clear();
- valid();
- try {
- // patiently wait for a lock on the document.
- long tries=5000;
- while (lock==null && ((lock=vsess.getLock())==null || !lock.isLocked()) && --tries>0) {
-// Thread.sleep(1);
- log.debug("Trying to get a document lock for the "+tries+"'th time.");
- }
- VamsasArchive varc = new VamsasArchive(vsess, true, false); // read archive, write as vamsasDocument, don't erase original contents.
- varc.setVorba(this);
- VamsasDocument d = varc.getVamsasDocument(getProvenanceUser(), "Created new document.", VersionEntries.latestVersion()); // VAMSAS: provenance user and client combined
-
- if (d==null) {
- log.warn("Backing out from opening a VamsasArchive writable IO session");
- varc.cancelArchive();
- return null;
- }
- ClientDoc cdoc = new ClientDoc(d, varc, varc.getOriginalArchiveReader(), getClientHandle().getClientUrn(), getProvenanceUser(), getVorbaIdHash());
- return cdoc;
- // do appHandle?
- } catch (Exception e) {
- log.error("Failed to get Updateable version of "+vsess.getVamsasFile(), e);
- }
- return null;
- }
- /**
- * trust client to not do anything stupid to the document roots which will now be written to the archive.
- * @param cdoc
- * @return true if write was a success.
- */
- public boolean doUpdate(ClientDoc cdoc) {
- valid();
- if (cdoc==null) {
- log.warn("Invalid ClientDoc passed to uk.ac.vamsas.test.simpleclient.doUpdate()");
- return false;
- }
- if (cdoc.iohandler==null) {
- log.warn("Read only ClientDoc object passed to uk.ac.vamsas.test.simpleclient.doUpdate()");
- return false;
- }
- if (cdoc.iohandler.getVorba()!=this) {
- log.error("Mismatch between ClientDoc instances and ArchiveClient instances!");
- return false;
- }
- try {
- // do any appDatas first.
- if (cdoc.iohandler.transferRemainingAppDatas())
- log.debug("Remaining appdatas were transfered.");
- cdoc.updateDocumentRoots();
- cdoc.iohandler.putVamsasDocument(cdoc.doc);
- cdoc.iohandler.closeArchive();
- this.extantids.clear();// we forget our ids after we close the document.
- cdoc.iohandler=null;
- cdoc = null;
- vsess.unLock();
- } catch (Exception e) {
- log.warn("While updating archive in "+vsess.getVamsasFile(),e);
- return false;
- }
- return true;
- }
- /**
- * @param args
- */
- public static void usage() {
- throw new Error("Usage: Username Organization VamsasFile [command,args]*");
- }
- public static void main(String[] args) {
- // really simple.
- if (args.length<3)
- usage();
-
- ArchiveClient client = new ArchiveClient(args[0],args[1], new File(args[2]));
- ClientDoc cdoc=null;
- // sanity test.
- try {
- cdoc = client.getUpdateable();
- // ArchiveReports.reportDocument(cdoc.doc, cdoc.getReader(), true, System.out);
- System.out.println("Report Roots :");
- ArchiveReports.rootReport(cdoc.getVamsasRoots(), true, System.out);
- cdoc.addVamsasRoot(Core.getDemoVamsas());
- System.out.println("Doing update.");
- client.doUpdate(cdoc);
- cdoc.closeDoc();
- cdoc = null;
- int u=5;
- while (--u>0) {
- System.out.println("Watch for more... ("+u+" left)");
- ClientDoc ucdoc = client.watch(0000);
- if (ucdoc!=null) {
- System.out.println("****\nUpdate detected at "+new Date());
- ArchiveReports.reportDocument(ucdoc.doc, ucdoc.getReader(), true, System.out);
- ucdoc.closeDoc();
- ucdoc=null;
- } else {
- System.out.println("!!!! Null document update detected at "+new Date());
- }
- }
- }
- catch (Exception e) {
- client.log.error("Broken!", e);
- }
- System.out.println("Finished at "+new Date());
- }
- public uk.ac.vamsas.client.Vobject getObject(VorbaId id) {
- Hashtable idhash = this.getVorbaIdHash();
- if (idhash!=null && idhash.containsKey(id))
- return (Vobject) idhash.get(id);
- return null;
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.util.Date;\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.ValidationException;\r
+\r
+import uk.ac.vamsas.client.AppDataOutputStream;\r
+import uk.ac.vamsas.client.ClientHandle;\r
+import uk.ac.vamsas.client.IVorbaIdFactory;\r
+import uk.ac.vamsas.client.SessionHandle;\r
+import uk.ac.vamsas.client.UserHandle;\r
+import uk.ac.vamsas.client.Vobject;\r
+import uk.ac.vamsas.client.VorbaId;\r
+import uk.ac.vamsas.client.simpleclient.FileWatcher;\r
+import uk.ac.vamsas.client.simpleclient.IdFactory;\r
+import uk.ac.vamsas.client.simpleclient.SessionFile;\r
+import uk.ac.vamsas.client.simpleclient.SimpleDocBinding;\r
+import uk.ac.vamsas.client.simpleclient.SimpleDocument;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchive;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.client.simpleclient.VamsasFile;\r
+import uk.ac.vamsas.objects.core.AppData;\r
+import uk.ac.vamsas.objects.core.ApplicationData;\r
+import uk.ac.vamsas.objects.core.User;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+import uk.ac.vamsas.objects.utils.AppDataReference;\r
+import uk.ac.vamsas.objects.utils.DocumentStuff;\r
+import uk.ac.vamsas.objects.utils.ProvenanceStuff;\r
+import uk.ac.vamsas.objects.utils.SeqSet;\r
+import uk.ac.vamsas.objects.utils.document.VersionEntries;\r
+import uk.ac.vamsas.test.objects.Core;\r
+\r
+/**\r
+ * @author jimp test the VamsasFile routines for watching, reading and updating\r
+ * a vamsas document jar file. simple document access base class.\r
+ */\r
+public class ArchiveClient extends IdFactory {\r
+\r
+ private Log log = LogFactory.getLog(ArchiveClient.class);\r
+\r
+ // protected UserHandle user=null;\r
+ // protected ClientHandle me = new ClientHandle("ArchiveClient","0.01");\r
+ VamsasFile vsess;\r
+\r
+ /**\r
+ * @param user\r
+ * @param vsess\r
+ */\r
+ public ArchiveClient(UserHandle user, VamsasFile vsess) {\r
+ super(new SessionHandle("vamsasfile://" + vsess.getVamsasFile()),\r
+ new ClientHandle("ArchiveClient", "0.01"), user);\r
+ this.vsess = vsess;\r
+ valid();\r
+ }\r
+\r
+ private void _openVsess(File vsess) {\r
+ try {\r
+ this.vsess = new VamsasFile(vsess);\r
+ } catch (Exception e) {\r
+ log.error("Couldn't open session for file " + vsess, e);\r
+ this.vsess = null;\r
+ }\r
+ }\r
+\r
+ public ArchiveClient(String username, String organization, File vsess) {\r
+ super(new SessionHandle("vamsasfile://" + vsess), new ClientHandle(\r
+ "ArchiveClient", "0.01"), new UserHandle(username, organization));\r
+ _openVsess(vsess);\r
+ valid();\r
+ }\r
+\r
+ public ArchiveClient(String username, String organization, String clientName,\r
+ String clientVersion, File vsess) {\r
+ super(new SessionHandle("vamsasfile://" + vsess), new ClientHandle(\r
+ clientName, clientVersion), new UserHandle(username, organization));\r
+ _openVsess(vsess);\r
+ valid();\r
+ }\r
+\r
+ public void valid() {\r
+ if (vsess == null)\r
+ throw new Error("ArchiveClient instance is invalid!.");\r
+ }\r
+\r
+ /**\r
+ * set this to false if watch loop should end immediately\r
+ */\r
+ protected boolean watchForChange = true;\r
+\r
+ public static int WATCH_SLEEP = 300;\r
+\r
+ /**\r
+ * watch the document file for updates.\r
+ * \r
+ * @param time\r
+ * - length of time to watch for.\r
+ * @return read only IO interface for session document.\r
+ */\r
+ public ClientDoc watch(long time) {\r
+ valid();\r
+ vsess.unLock(); // doh.\r
+ FileWatcher watcher = new FileWatcher(vsess.getVamsasFile());\r
+ // watcher.setState();\r
+ watchForChange = true;\r
+ long endtime = System.currentTimeMillis() + time;\r
+ try {\r
+ uk.ac.vamsas.client.simpleclient.Lock doclock;\r
+ do {\r
+ doclock = watcher.getChangedState();\r
+ if (doclock == null)\r
+ Thread.sleep(WATCH_SLEEP);\r
+ } while (watchForChange && doclock == null\r
+ && (time == 0 || endtime > System.currentTimeMillis())); // tuning.\r
+ if (doclock == null)\r
+ return null;\r
+ else {\r
+ return getUpdateable(vsess.getLock(doclock));\r
+ /*\r
+ * VamsasArchiveReader varc = new\r
+ * VamsasArchiveReader(vsess.getVamsasFile()); return\r
+ * _getReadonly(varc);\r
+ */\r
+ }\r
+ } catch (Exception e) {\r
+ log.error("Whilst watching file " + vsess.getVamsasFile(), e);\r
+ }\r
+ return null;\r
+ }\r
+\r
+ // from ClientDocument.getClientAppdata\r
+ private AppData[] getAppData(VamsasDocument doc) {\r
+ // TODO: codefest - not yet tested or merged in to SimpleClient\r
+ if (doc == null) {\r
+ log.debug("extractAppData called for null document object");\r
+ return null;\r
+ }\r
+ AppData appsGlobal = null, usersData = null;\r
+ Vector apldataset = AppDataReference.getUserandApplicationsData(doc, this\r
+ .getUserHandle(), this.getClientHandle());\r
+ if (apldataset != null) {\r
+ if (apldataset.size() > 0) {\r
+ AppData clientdat = (AppData) apldataset.get(0);\r
+ if (clientdat instanceof ApplicationData) {\r
+ appsGlobal = (ApplicationData) clientdat;\r
+ if (apldataset.size() > 1) {\r
+ clientdat = (AppData) apldataset.get(1);\r
+ if (clientdat instanceof User) {\r
+ usersData = (User) clientdat;\r
+ }\r
+ if (apldataset.size() > 2)\r
+ log.info("Ignoring additional (" + (apldataset.size() - 2)\r
+ + ") AppDatas returned by document appdata query.");\r
+ }\r
+ } else {\r
+ log.warn("Unexpected entry in AppDataReference query: id="\r
+ + clientdat.getVorbaId() + " type="\r
+ + clientdat.getClass().getName());\r
+ }\r
+ apldataset.removeAllElements(); // destroy references.\r
+ }\r
+ }\r
+ return new AppData[] { appsGlobal, usersData };\r
+ }\r
+\r
+ protected ClientDoc _getReadonly(VamsasArchiveReader vreader)\r
+ throws IOException, ValidationException, MarshalException {\r
+ valid();\r
+ if (vreader != null) {\r
+ SimpleDocBinding docb = new SimpleDocBinding();\r
+ docb.setVorba(this);\r
+ VamsasDocument d;\r
+ d = docb.getVamsasDocument(vreader);\r
+\r
+ if (d != null) {\r
+ ClientDoc creader = new ClientDoc(d, null, vreader, getClientHandle()\r
+ .getClientUrn(), getProvenanceUser(), getVorbaIdHash());\r
+ return creader;\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * from SimpleClient\r
+ * \r
+ * @return user field for a provenance entry\r
+ */\r
+ protected String getProvenanceUser() {\r
+ return new String(getUserHandle().getFullName() + " ["\r
+ + getClientHandle().getClientUrn() + "]");\r
+ }\r
+\r
+ public ClientDoc getUpdateable() {\r
+ return getUpdateable(null);\r
+ }\r
+\r
+ public ClientDoc getUpdateable(uk.ac.vamsas.client.simpleclient.Lock lock) {\r
+ getVorbaIdHash().clear();\r
+ valid();\r
+ try {\r
+ // patiently wait for a lock on the document.\r
+ long tries = 5000;\r
+ while (lock == null\r
+ && ((lock = vsess.getLock()) == null || !lock.isLocked())\r
+ && --tries > 0) {\r
+ // Thread.sleep(1);\r
+ log.debug("Trying to get a document lock for the " + tries\r
+ + "'th time.");\r
+ }\r
+ VamsasArchive varc = new VamsasArchive(vsess, true, false); // read\r
+ // archive,\r
+ // write as\r
+ // vamsasDocument,\r
+ // don't erase\r
+ // original\r
+ // contents.\r
+ varc.setVorba(this);\r
+ VamsasDocument d = varc.getVamsasDocument(getProvenanceUser(),\r
+ "Created new document.", VersionEntries.latestVersion()); // VAMSAS:\r
+ // provenance\r
+ // user and\r
+ // client\r
+ // combined\r
+\r
+ if (d == null) {\r
+ log\r
+ .warn("Backing out from opening a VamsasArchive writable IO session");\r
+ varc.cancelArchive();\r
+ return null;\r
+ }\r
+ ClientDoc cdoc = new ClientDoc(d, varc, varc.getOriginalArchiveReader(),\r
+ getClientHandle().getClientUrn(), getProvenanceUser(),\r
+ getVorbaIdHash());\r
+ return cdoc;\r
+ // do appHandle?\r
+ } catch (Exception e) {\r
+ log.error("Failed to get Updateable version of " + vsess.getVamsasFile(),\r
+ e);\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * trust client to not do anything stupid to the document roots which will now\r
+ * be written to the archive.\r
+ * \r
+ * @param cdoc\r
+ * @return true if write was a success.\r
+ */\r
+ public boolean doUpdate(ClientDoc cdoc) {\r
+ valid();\r
+ if (cdoc == null) {\r
+ log\r
+ .warn("Invalid ClientDoc passed to uk.ac.vamsas.test.simpleclient.doUpdate()");\r
+ return false;\r
+ }\r
+ if (cdoc.iohandler == null) {\r
+ log\r
+ .warn("Read only ClientDoc object passed to uk.ac.vamsas.test.simpleclient.doUpdate()");\r
+ return false;\r
+ }\r
+ if (cdoc.iohandler.getVorba() != this) {\r
+ log\r
+ .error("Mismatch between ClientDoc instances and ArchiveClient instances!");\r
+ return false;\r
+ }\r
+ try {\r
+ // do any appDatas first.\r
+ if (cdoc.iohandler.transferRemainingAppDatas())\r
+ log.debug("Remaining appdatas were transfered.");\r
+ cdoc.updateDocumentRoots();\r
+ cdoc.iohandler.putVamsasDocument(cdoc.doc);\r
+ cdoc.iohandler.closeArchive();\r
+ this.extantids.clear();// we forget our ids after we close the document.\r
+ cdoc.iohandler = null;\r
+ cdoc = null;\r
+ vsess.unLock();\r
+ } catch (Exception e) {\r
+ log.warn("While updating archive in " + vsess.getVamsasFile(), e);\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * @param args\r
+ */\r
+ public static void usage() {\r
+ throw new Error("Usage: Username Organization VamsasFile [command,args]*");\r
+ }\r
+\r
+ public static void main(String[] args) {\r
+ // really simple.\r
+ if (args.length < 3)\r
+ usage();\r
+\r
+ ArchiveClient client = new ArchiveClient(args[0], args[1],\r
+ new File(args[2]));\r
+ ClientDoc cdoc = null;\r
+ // sanity test.\r
+ try {\r
+ cdoc = client.getUpdateable();\r
+ // ArchiveReports.reportDocument(cdoc.doc, cdoc.getReader(), true,\r
+ // System.out);\r
+ System.out.println("Report Roots :");\r
+ ArchiveReports.rootReport(cdoc.getVamsasRoots(), true, System.out);\r
+ cdoc.addVamsasRoot(Core.getDemoVamsas());\r
+ System.out.println("Doing update.");\r
+ client.doUpdate(cdoc);\r
+ cdoc.closeDoc();\r
+ cdoc = null;\r
+ int u = 5;\r
+ while (--u > 0) {\r
+ System.out.println("Watch for more... (" + u + " left)");\r
+ ClientDoc ucdoc = client.watch(0000);\r
+ if (ucdoc != null) {\r
+ System.out.println("****\nUpdate detected at " + new Date());\r
+ ArchiveReports.reportDocument(ucdoc.doc, ucdoc.getReader(), true,\r
+ System.out);\r
+ ucdoc.closeDoc();\r
+ ucdoc = null;\r
+ } else {\r
+ System.out.println("!!!! Null document update detected at "\r
+ + new Date());\r
+ }\r
+ }\r
+ } catch (Exception e) {\r
+ client.log.error("Broken!", e);\r
+ }\r
+ System.out.println("Finished at " + new Date());\r
+ }\r
+\r
+ public uk.ac.vamsas.client.Vobject getObject(VorbaId id) {\r
+ Hashtable idhash = this.getVorbaIdHash();\r
+ if (idhash != null && idhash.containsKey(id))\r
+ return (Vobject) idhash.get(id);\r
+ return null;\r
+ }\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-
-public class ArchiveReader {
- /**
- * tests VamsasArchiveReader archive reader on a vamsas jar file
- * @param args
- */
- public static void main(String args[]) {
-
- try {
- File av = new File(args[0]);
- VamsasArchiveReader var = new VamsasArchiveReader(av);
- VAMSAS roots[]=null;
- if (var.isValid()) {
- InputStreamReader vdoc = new InputStreamReader(var.getVamsasDocumentStream());
- VamsasDocument doc = VamsasDocument.unmarshal(vdoc);
- if (ArchiveReports.reportDocument(doc, var, true, System.out)) {
- roots = doc.getVAMSAS();
- }
- } else {
- InputStream vxmlis = var.getVamsasXmlStream();
-
- if (vxmlis!=null) { // Might be an old vamsas file.
- BufferedInputStream ixml = new BufferedInputStream(var.getVamsasXmlStream());
- InputStreamReader vxml = new InputStreamReader(ixml);
- VAMSAS root;
- // unmarshal seems to always close the stream (should check this)
- if ((root = VAMSAS.unmarshal(vxml))!=null) {
- System.out.println("Read a root.");
- roots = new VAMSAS[1];
- roots[0] = root;
- }
- }
- }
- if (!ArchiveReports.rootReport(roots, true, System.out))
- System.err.print(args[0]+" is not a valid vamsas archive.");
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.File;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+\r
+public class ArchiveReader {\r
+ /**\r
+ * tests VamsasArchiveReader archive reader on a vamsas jar file\r
+ * \r
+ * @param args\r
+ */\r
+ public static void main(String args[]) {\r
+\r
+ try {\r
+ File av = new File(args[0]);\r
+ VamsasArchiveReader var = new VamsasArchiveReader(av);\r
+ VAMSAS roots[] = null;\r
+ if (var.isValid()) {\r
+ InputStreamReader vdoc = new InputStreamReader(var\r
+ .getVamsasDocumentStream());\r
+ VamsasDocument doc = VamsasDocument.unmarshal(vdoc);\r
+ if (ArchiveReports.reportDocument(doc, var, true, System.out)) {\r
+ roots = doc.getVAMSAS();\r
+ }\r
+ } else {\r
+ InputStream vxmlis = var.getVamsasXmlStream();\r
+\r
+ if (vxmlis != null) { // Might be an old vamsas file.\r
+ BufferedInputStream ixml = new BufferedInputStream(var\r
+ .getVamsasXmlStream());\r
+ InputStreamReader vxml = new InputStreamReader(ixml);\r
+ VAMSAS root;\r
+ // unmarshal seems to always close the stream (should check this)\r
+ if ((root = VAMSAS.unmarshal(vxml)) != null) {\r
+ System.out.println("Read a root.");\r
+ roots = new VAMSAS[1];\r
+ roots[0] = root;\r
+ }\r
+ }\r
+ }\r
+ if (!ArchiveReports.rootReport(roots, true, System.out))\r
+ System.err.print(args[0] + " is not a valid vamsas archive.");\r
+ } catch (Exception e) {\r
+ e.printStackTrace(System.err);\r
+ }\r
+ }\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-
-import uk.ac.vamsas.client.ClientDocument;
-import uk.ac.vamsas.client.Vobject;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.objects.core.Alignment;
-import uk.ac.vamsas.objects.core.AppData;
-import uk.ac.vamsas.objects.core.ApplicationData;
-import uk.ac.vamsas.objects.core.DataSet;
-import uk.ac.vamsas.objects.core.Entry;
-import uk.ac.vamsas.objects.core.Instance;
-import uk.ac.vamsas.objects.core.Provenance;
-import uk.ac.vamsas.objects.core.Tree;
-import uk.ac.vamsas.objects.core.User;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-/**
- * this class contains static methods for writing info to stdout about a vamsas document
- * Methods have a 'cascade' switch to indicate if sub-objects should have info printed on them.
- * Methods return true or false - indicating if the Vobject was valid or not
- * TODO: LATER: propagate true/false return so that an invalid vamsas Vobject invalidates the whole document
- * @author jimp
- *
- */
-public class ArchiveReports {
- /**
- * print an informative summary on a VamsasDocument
- * @param outstr TODO
- * @param document - the document itself
- * @param archive - document source archive for resolving any appData refs
- * @return
- */
- public static boolean reportProvenance(Provenance p, PrintStream outstr) {
- if (p==null) {
- outstr.println("No Provenance");
- return false;
- }
- Entry[] pe = p.getEntry();
- for (int i=0; i<pe.length; i++) {
- outstr.print(pe[i].getDate()+"\t'"+pe[i].getUser()+"'\t"+pe[i].getApp()+"\t'"+pe[i].getAction()+"' ");
- outputVobjectState(pe[i], outstr);
- }
- return true;
- }
- public static boolean appDataEntryReport(AppData appD, VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {
- if (appD!=null) {
- boolean nulldata=false;
- if (appD.getDataReference()!=null) {
- String appData=appD.getDataReference();
- if (appData==null) { outstr.println("Empty DataReference - not valid ?"); }
- else
- if (appData.length()>1) {
- outstr.print("a reference ("+appData+")");
- InputStream jstrm;
- if ((jstrm=archive.getAppdataStream(appData))!=null)
- outstr.println(" which resolves to a JarEntry.");
- else {
- outstr.println(" which does not resolve to a JarEntry.");
- outstr.println("Unresolved appdata reference '"+appData+"'");
- }
- } else {
- nulldata=true;
- }
- } else {
- if (appD.getData()==null)
- nulldata &= true;
- else
- outstr.println("an embedded chunk of "+appD.getData().length+" bytes.");
- }
- if (nulldata)
- outstr.println("Null AppData reference/data chunk.");
- }
- return true;
- }
-
- public static boolean appDataReport(ApplicationData appD, VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {
- if (appD!=null) {
- // Report on root appData
- appDataEntryReport(appD, archive, cascade, outstr);
- if (appD.getInstanceCount()>0) {
- Instance inst[] = appD.getInstance();
- for (int i=0,j=inst.hashCode(); i<j; i++) {
- outstr.println("Data for App Instance URN: '"+inst[i].getUrn());
- appDataEntryReport(inst[i],archive,cascade,outstr);
- }
- }
- if (appD.getUserCount()>0) {
- User users[] = appD.getUser();
- for (int i=0,j=users.length; i<j; i++) {
- outstr.println("Data for User '"+users[i].getFullname()+"' of '"+users[i].getOrganization()+"'");
- appDataEntryReport(users[i], archive, cascade, outstr);
- }
- }
- }
-
- return true;
- }
- public static boolean reportDocument(VamsasDocument document, VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {
- if (document!=null) {
- outstr.println("Vamsas Document version '"+document.getVersion()+"'");
- reportProvenance(document.getProvenance(), outstr);
- outstr.print("Document contains "+document.getVAMSASCount()+" VAMSAS Elements and "+document.getApplicationDataCount()+" Application data elements.\n");
- if (document.getVAMSASCount()>0 && cascade)
- rootReport(document.getVAMSAS(), true, outstr);
- if (document.getApplicationDataCount()>0) {
- outstr.print("There are "+document.getApplicationDataCount()+" ApplicationData references.\n");
- ApplicationData appd[] = document.getApplicationData();
- for (int i=0,j=appd.length; i<j; i++) {
- outstr.print("Application "+i+": '"+appd[i].getName()+"'\nVersion '"+appd[i].getVersion()+"'\n");
- outstr.print("AppData is :");
- appDataReport(appd[i], archive, cascade, outstr);
- }
-
- }
- return true;
- } else {
- outstr.println("Document Object is null");
- }
- return false;
- }
-
- /**
- * summarises all the datasets in a vamsas document.
- * @param roots
- * @param cascade TODO
- * @param outstr TODO
- * @return
- */
- public static boolean rootReport(VAMSAS[] roots, boolean cascade, PrintStream outstr) {
- if (roots!=null) {
- for (int i=0; i<roots.length; i++) {
- VAMSAS r = roots[i];
- int ds, tr;
- outstr.print("Vamsas Root "+i+" (id="
- +((r.getId()!=null) ? r.getId():"<none>")
- +") contains "+(ds=r.getDataSetCount())+" DataSets, "
- + (tr=r.getTreeCount())+" Global trees\n");
- outputVobjectState(r, outstr);
- if (cascade) {
- for (int j=0; j<ds; j++) {
- outstr.println("Dataset "+j);
- cascade = datasetReport(r.getDataSet(j), true, outstr) && cascade ;
- }
- for (int j=0; j<tr; j++) {
- outstr.println("Global tree "+j);
- cascade = treeReport(r.getTree(j), true, outstr) && cascade;
- }
- }
- }
- return true;
- }
- return false;
- }
- public static void outputVobjectState(Vobject v, PrintStream outstr) {
- outstr.print(" (Object is: ");
- boolean comma=false;
- if (v.is__stored_in_document()) {
- outstr.print(" stored");
- comma=true;
- }
- if (v.isNewInDocument()) {
- if (comma)
- outstr.print(",");
- comma=true;
- outstr.print(" new in document");
- }
- if (v.isUpdated()) {
- if (comma)
- outstr.print(",");
- comma=true;
- outstr.print(" updated since last read");
- }
- outstr.println(")");
- }
- public static boolean datasetReport(DataSet ds, boolean cascade, PrintStream outstr) {
- if (cascade)
- reportProvenance(ds.getProvenance(), outstr);
- outputVobjectState(ds, outstr);
- outstr.println("Dataset contains : "+ds.getSequenceCount()
- +" sequences, "+ds.getAlignmentCount()+" alignments and "+ds.getTreeCount()+" trees.");
- if (cascade)
- alignmentReport(ds.getAlignment(), true, outstr);
- return true;
- }
- public static boolean alignmentReport(Alignment[] al, boolean cascade, PrintStream outstr) {
- boolean val=true;
- if (al!=null && al.length>0) {
- for (int i=0; i<al.length; i++) {
- outstr.println("Alignment "+i+(al[i].isRegistered() ? " ("+al[i].getVorbaId()+")" : " (unregistered)"));
- outputVobjectState(al[i], outstr);
- if (cascade)
- reportProvenance(al[i].getProvenance(), outstr);
- outstr.println("Involves "+al[i].getAlignmentSequenceCount()+" sequences, has "
- +al[i].getAlignmentAnnotationCount()+" annotations and "+al[i].getTreeCount()+" trees.");
- if (cascade) {
- for (int t=0; t<al[i].getTreeCount(); t++)
- treeReport(al[i].getTree(t), true, outstr);
- }
- }
- }
- return val;
- }
- public static boolean treeReport(Tree t, boolean cascade, PrintStream outstr) {
- outstr.print("Tree: '"+t.getTitle()+"' ");
- outputVobjectState(t, outstr);
- return !cascade || reportProvenance(t.getProvenance(), outstr);
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.InputStream;\r
+import java.io.PrintStream;\r
+import java.io.PrintWriter;\r
+\r
+import uk.ac.vamsas.client.ClientDocument;\r
+import uk.ac.vamsas.client.Vobject;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.objects.core.Alignment;\r
+import uk.ac.vamsas.objects.core.AppData;\r
+import uk.ac.vamsas.objects.core.ApplicationData;\r
+import uk.ac.vamsas.objects.core.DataSet;\r
+import uk.ac.vamsas.objects.core.Entry;\r
+import uk.ac.vamsas.objects.core.Instance;\r
+import uk.ac.vamsas.objects.core.Provenance;\r
+import uk.ac.vamsas.objects.core.Tree;\r
+import uk.ac.vamsas.objects.core.User;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+\r
+/**\r
+ * this class contains static methods for writing info to stdout about a vamsas\r
+ * document Methods have a 'cascade' switch to indicate if sub-objects should\r
+ * have info printed on them. Methods return true or false - indicating if the\r
+ * Vobject was valid or not TODO: LATER: propagate true/false return so that an\r
+ * invalid vamsas Vobject invalidates the whole document\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class ArchiveReports {\r
+ /**\r
+ * print an informative summary on a VamsasDocument\r
+ * \r
+ * @param outstr\r
+ * TODO\r
+ * @param document\r
+ * - the document itself\r
+ * @param archive\r
+ * - document source archive for resolving any appData refs\r
+ * @return\r
+ */\r
+ public static boolean reportProvenance(Provenance p, PrintStream outstr) {\r
+ if (p == null) {\r
+ outstr.println("No Provenance");\r
+ return false;\r
+ }\r
+ Entry[] pe = p.getEntry();\r
+ for (int i = 0; i < pe.length; i++) {\r
+ outstr.print(pe[i].getDate() + "\t'" + pe[i].getUser() + "'\t"\r
+ + pe[i].getApp() + "\t'" + pe[i].getAction() + "' ");\r
+ outputVobjectState(pe[i], outstr);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ public static boolean appDataEntryReport(AppData appD,\r
+ VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {\r
+ if (appD != null) {\r
+ boolean nulldata = false;\r
+ if (appD.getDataReference() != null) {\r
+ String appData = appD.getDataReference();\r
+ if (appData == null) {\r
+ outstr.println("Empty DataReference - not valid ?");\r
+ } else if (appData.length() > 1) {\r
+ outstr.print("a reference (" + appData + ")");\r
+ InputStream jstrm;\r
+ if ((jstrm = archive.getAppdataStream(appData)) != null)\r
+ outstr.println(" which resolves to a JarEntry.");\r
+ else {\r
+ outstr.println(" which does not resolve to a JarEntry.");\r
+ outstr.println("Unresolved appdata reference '" + appData + "'");\r
+ }\r
+ } else {\r
+ nulldata = true;\r
+ }\r
+ } else {\r
+ if (appD.getData() == null)\r
+ nulldata &= true;\r
+ else\r
+ outstr.println("an embedded chunk of " + appD.getData().length\r
+ + " bytes.");\r
+ }\r
+ if (nulldata)\r
+ outstr.println("Null AppData reference/data chunk.");\r
+ }\r
+ return true;\r
+ }\r
+\r
+ public static boolean appDataReport(ApplicationData appD,\r
+ VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {\r
+ if (appD != null) {\r
+ // Report on root appData\r
+ appDataEntryReport(appD, archive, cascade, outstr);\r
+ if (appD.getInstanceCount() > 0) {\r
+ Instance inst[] = appD.getInstance();\r
+ for (int i = 0, j = inst.hashCode(); i < j; i++) {\r
+ outstr.println("Data for App Instance URN: '" + inst[i].getUrn());\r
+ appDataEntryReport(inst[i], archive, cascade, outstr);\r
+ }\r
+ }\r
+ if (appD.getUserCount() > 0) {\r
+ User users[] = appD.getUser();\r
+ for (int i = 0, j = users.length; i < j; i++) {\r
+ outstr.println("Data for User '" + users[i].getFullname() + "' of '"\r
+ + users[i].getOrganization() + "'");\r
+ appDataEntryReport(users[i], archive, cascade, outstr);\r
+ }\r
+ }\r
+ }\r
+\r
+ return true;\r
+ }\r
+\r
+ public static boolean reportDocument(VamsasDocument document,\r
+ VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {\r
+ if (document != null) {\r
+ outstr.println("Vamsas Document version '" + document.getVersion() + "'");\r
+ reportProvenance(document.getProvenance(), outstr);\r
+ outstr.print("Document contains " + document.getVAMSASCount()\r
+ + " VAMSAS Elements and " + document.getApplicationDataCount()\r
+ + " Application data elements.\n");\r
+ if (document.getVAMSASCount() > 0 && cascade)\r
+ rootReport(document.getVAMSAS(), true, outstr);\r
+ if (document.getApplicationDataCount() > 0) {\r
+ outstr.print("There are " + document.getApplicationDataCount()\r
+ + " ApplicationData references.\n");\r
+ ApplicationData appd[] = document.getApplicationData();\r
+ for (int i = 0, j = appd.length; i < j; i++) {\r
+ outstr.print("Application " + i + ": '" + appd[i].getName()\r
+ + "'\nVersion '" + appd[i].getVersion() + "'\n");\r
+ outstr.print("AppData is :");\r
+ appDataReport(appd[i], archive, cascade, outstr);\r
+ }\r
+\r
+ }\r
+ return true;\r
+ } else {\r
+ outstr.println("Document Object is null");\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * summarises all the datasets in a vamsas document.\r
+ * \r
+ * @param roots\r
+ * @param cascade\r
+ * TODO\r
+ * @param outstr\r
+ * TODO\r
+ * @return\r
+ */\r
+ public static boolean rootReport(VAMSAS[] roots, boolean cascade,\r
+ PrintStream outstr) {\r
+ if (roots != null) {\r
+ for (int i = 0; i < roots.length; i++) {\r
+ VAMSAS r = roots[i];\r
+ int ds, tr;\r
+ outstr.print("Vamsas Root " + i + " (id="\r
+ + ((r.getId() != null) ? r.getId() : "<none>") + ") contains "\r
+ + (ds = r.getDataSetCount()) + " DataSets, "\r
+ + (tr = r.getTreeCount()) + " Global trees\n");\r
+ outputVobjectState(r, outstr);\r
+ if (cascade) {\r
+ for (int j = 0; j < ds; j++) {\r
+ outstr.println("Dataset " + j);\r
+ cascade = datasetReport(r.getDataSet(j), true, outstr) && cascade;\r
+ }\r
+ for (int j = 0; j < tr; j++) {\r
+ outstr.println("Global tree " + j);\r
+ cascade = treeReport(r.getTree(j), true, outstr) && cascade;\r
+ }\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ public static void outputVobjectState(Vobject v, PrintStream outstr) {\r
+ outstr.print(" (Object is: ");\r
+ boolean comma = false;\r
+ if (v.is__stored_in_document()) {\r
+ outstr.print(" stored");\r
+ comma = true;\r
+ }\r
+ if (v.isNewInDocument()) {\r
+ if (comma)\r
+ outstr.print(",");\r
+ comma = true;\r
+ outstr.print(" new in document");\r
+ }\r
+ if (v.isUpdated()) {\r
+ if (comma)\r
+ outstr.print(",");\r
+ comma = true;\r
+ outstr.print(" updated since last read");\r
+ }\r
+ outstr.println(")");\r
+ }\r
+\r
+ public static boolean datasetReport(DataSet ds, boolean cascade,\r
+ PrintStream outstr) {\r
+ if (cascade)\r
+ reportProvenance(ds.getProvenance(), outstr);\r
+ outputVobjectState(ds, outstr);\r
+ outstr.println("Dataset contains : " + ds.getSequenceCount()\r
+ + " sequences, " + ds.getAlignmentCount() + " alignments and "\r
+ + ds.getTreeCount() + " trees.");\r
+ if (cascade)\r
+ alignmentReport(ds.getAlignment(), true, outstr);\r
+ return true;\r
+ }\r
+\r
+ public static boolean alignmentReport(Alignment[] al, boolean cascade,\r
+ PrintStream outstr) {\r
+ boolean val = true;\r
+ if (al != null && al.length > 0) {\r
+ for (int i = 0; i < al.length; i++) {\r
+ outstr.println("Alignment "\r
+ + i\r
+ + (al[i].isRegistered() ? " (" + al[i].getVorbaId() + ")"\r
+ : " (unregistered)"));\r
+ outputVobjectState(al[i], outstr);\r
+ if (cascade)\r
+ reportProvenance(al[i].getProvenance(), outstr);\r
+ outstr.println("Involves " + al[i].getAlignmentSequenceCount()\r
+ + " sequences, has " + al[i].getAlignmentAnnotationCount()\r
+ + " annotations and " + al[i].getTreeCount() + " trees.");\r
+ if (cascade) {\r
+ for (int t = 0; t < al[i].getTreeCount(); t++)\r
+ treeReport(al[i].getTree(t), true, outstr);\r
+ }\r
+ }\r
+ }\r
+ return val;\r
+ }\r
+\r
+ public static boolean treeReport(Tree t, boolean cascade, PrintStream outstr) {\r
+ outstr.print("Tree: '" + t.getTitle() + "' ");\r
+ outputVobjectState(t, outstr);\r
+ return !cascade || reportProvenance(t.getProvenance(), outstr);\r
+ }\r
+\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-
-import uk.ac.vamsas.client.simpleclient.SessionFile;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.client.simpleclient.VamsasFile;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-
-public class ArchiveStreamReader {
- /**
- * tests VamsasArchiveReader archive reader on a vamsas jar file opened as a stream
- * @param args
- */
- public static void main(String args[]) {
-
- try {
- VamsasFile av = new VamsasFile(new File(args[0]));
- VamsasArchiveReader var = new VamsasArchiveReader(av.getLock());
- VAMSAS roots[]=null;
- if (var.isValid()) {
- InputStreamReader vdoc = new InputStreamReader(var.getVamsasDocumentStream());
- VamsasDocument doc = VamsasDocument.unmarshal(vdoc);
- if (ArchiveReports.reportDocument(doc, var, true, System.out)) {
- roots = doc.getVAMSAS();
- }
- } else {
- InputStream vxmlis = var.getVamsasXmlStream();
-
- if (vxmlis!=null) { // Might be an old vamsas file.
- BufferedInputStream ixml = new BufferedInputStream(var.getVamsasXmlStream());
- InputStreamReader vxml = new InputStreamReader(ixml);
- VAMSAS root;
- // unmarshal seems to always close the stream (should check this)
- if ((root = VAMSAS.unmarshal(vxml))!=null) {
- System.out.println("Read a root.");
- roots = new VAMSAS[1];
- roots[0] = root;
- }
- }
- }
- if (!ArchiveReports.rootReport(roots, true, System.out))
- System.err.print(args[0]+" is not a valid vamsas archive.");
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.BufferedInputStream;\r
+import java.io.File;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+\r
+import uk.ac.vamsas.client.simpleclient.SessionFile;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.client.simpleclient.VamsasFile;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+\r
+public class ArchiveStreamReader {\r
+ /**\r
+ * tests VamsasArchiveReader archive reader on a vamsas jar file opened as a\r
+ * stream\r
+ * \r
+ * @param args\r
+ */\r
+ public static void main(String args[]) {\r
+\r
+ try {\r
+ VamsasFile av = new VamsasFile(new File(args[0]));\r
+ VamsasArchiveReader var = new VamsasArchiveReader(av.getLock());\r
+ VAMSAS roots[] = null;\r
+ if (var.isValid()) {\r
+ InputStreamReader vdoc = new InputStreamReader(var\r
+ .getVamsasDocumentStream());\r
+ VamsasDocument doc = VamsasDocument.unmarshal(vdoc);\r
+ if (ArchiveReports.reportDocument(doc, var, true, System.out)) {\r
+ roots = doc.getVAMSAS();\r
+ }\r
+ } else {\r
+ InputStream vxmlis = var.getVamsasXmlStream();\r
+\r
+ if (vxmlis != null) { // Might be an old vamsas file.\r
+ BufferedInputStream ixml = new BufferedInputStream(var\r
+ .getVamsasXmlStream());\r
+ InputStreamReader vxml = new InputStreamReader(ixml);\r
+ VAMSAS root;\r
+ // unmarshal seems to always close the stream (should check this)\r
+ if ((root = VAMSAS.unmarshal(vxml)) != null) {\r
+ System.out.println("Read a root.");\r
+ roots = new VAMSAS[1];\r
+ roots[0] = root;\r
+ }\r
+ }\r
+ }\r
+ if (!ArchiveReports.rootReport(roots, true, System.out))\r
+ System.err.print(args[0] + " is not a valid vamsas archive.");\r
+ } catch (Exception e) {\r
+ e.printStackTrace(System.err);\r
+ }\r
+ }\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.File;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.ClientHandle;
-import uk.ac.vamsas.client.simpleclient.FileWatcher;
-import uk.ac.vamsas.client.simpleclient.Lock;
-import uk.ac.vamsas.client.simpleclient.SimpleDocument;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.client.simpleclient.VamsasFile;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-/**
- * demo of archive watching process - should mimic the clientsfileTest watcher/monitor process.
- * @author jimp
- *
- */
-public class ArchiveWatcher {
- private static Log log = LogFactory.getLog(ArchiveWatcher.class);
- private static CommandProcessor cproc=new CommandProcessor();
- static {
- cproc.addCommand("new", 0, "no args");
- cproc.addCommand("delete", 0, "no args");
- cproc.addCommand("watch", 0, "no args");
- cproc.addCommand("file", 1, "Need vamsas archive as argument.");
- }
-
- public static void main(String[] args) {
- try {
-
- if (args!=null && args.length>0) {
- File archive = new File(args[0]);
- log.info("Watching file "+args[0]);
- int argc=1;
- while (argc < args.length) {
- // vars needed for operations
- ClientHandle ch;
- int com = cproc.getCommand(args, argc);
- argc++;
- switch (com) {
- case 0:
- // new
- log.info("Doing locked deletion and new-file creation.");
- {
- if (!archive.exists())
- archive.createNewFile();
- VamsasFile sf = new VamsasFile(archive);
- Lock l = sf.getLock();
- archive.delete();
- archive.createNewFile();
- sf.unLock();
- }
- break;
- case 1:
- // delete
- log.info("Deleting "+archive+" without locking it first.");
- archive.delete();
- break;
- case 2:
- // watch
- log.info("Endlessly Watching file "+archive);
- /* if (!archive.exists())
- archive.createNewFile();
- */ // watch the new file... - taken straight from ClientsFileTest
- FileWatcher w = new FileWatcher(archive);
- while (true) {
- // get watcher's lock to ensure state change is fixed for retrieval
- Lock chlock = w.getChangedState();
- if (chlock != null) {
- log.info("Got lock on "+archive+(archive.exists() ? " exists l="+archive.length() : "(non existant)"));
- if (archive.length()>0) {
- VamsasArchiveReader vreader = new VamsasArchiveReader(archive);
- SimpleDocument sdoc = new SimpleDocument("testing vamsas watcher");
- try {
- VamsasDocument d = sdoc.getVamsasDocument(vreader);
- if (d!=null) {
- ArchiveReports.reportDocument(d, vreader, false, System.out);
- }
- System.out.println("Update at "+System.currentTimeMillis()+"\n\n********************************************************\n");
- } catch (Exception e) {
- log.error("Unmarshalling failed.",e);
- }
- vreader.close();
- w.setState();
- }
- }
- }
- // break;
- case 3: // set file
- archive = new File(args[argc++]);
- break;
- case 4:
- break;
- default:
- log.warn("Unknown command + "+args[argc++]);
- }
- }
- }
- } catch (Exception e) {
- log.error(e);
- }
-
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.ClientHandle;\r
+import uk.ac.vamsas.client.simpleclient.FileWatcher;\r
+import uk.ac.vamsas.client.simpleclient.Lock;\r
+import uk.ac.vamsas.client.simpleclient.SimpleDocument;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.client.simpleclient.VamsasFile;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+\r
+/**\r
+ * demo of archive watching process - should mimic the clientsfileTest\r
+ * watcher/monitor process.\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class ArchiveWatcher {\r
+ private static Log log = LogFactory.getLog(ArchiveWatcher.class);\r
+\r
+ private static CommandProcessor cproc = new CommandProcessor();\r
+ static {\r
+ cproc.addCommand("new", 0, "no args");\r
+ cproc.addCommand("delete", 0, "no args");\r
+ cproc.addCommand("watch", 0, "no args");\r
+ cproc.addCommand("file", 1, "Need vamsas archive as argument.");\r
+ }\r
+\r
+ public static void main(String[] args) {\r
+ try {\r
+\r
+ if (args != null && args.length > 0) {\r
+ File archive = new File(args[0]);\r
+ log.info("Watching file " + args[0]);\r
+ int argc = 1;\r
+ while (argc < args.length) {\r
+ // vars needed for operations\r
+ ClientHandle ch;\r
+ int com = cproc.getCommand(args, argc);\r
+ argc++;\r
+ switch (com) {\r
+ case 0:\r
+ // new\r
+ log.info("Doing locked deletion and new-file creation.");\r
+ {\r
+ if (!archive.exists())\r
+ archive.createNewFile();\r
+ VamsasFile sf = new VamsasFile(archive);\r
+ Lock l = sf.getLock();\r
+ archive.delete();\r
+ archive.createNewFile();\r
+ sf.unLock();\r
+ }\r
+ break;\r
+ case 1:\r
+ // delete\r
+ log.info("Deleting " + archive + " without locking it first.");\r
+ archive.delete();\r
+ break;\r
+ case 2:\r
+ // watch\r
+ log.info("Endlessly Watching file " + archive);\r
+ /*\r
+ * if (!archive.exists()) archive.createNewFile();\r
+ */// watch the new file... - taken straight from ClientsFileTest\r
+ FileWatcher w = new FileWatcher(archive);\r
+ while (true) {\r
+ // get watcher's lock to ensure state change is fixed for\r
+ // retrieval\r
+ Lock chlock = w.getChangedState();\r
+ if (chlock != null) {\r
+ log.info("Got lock on "\r
+ + archive\r
+ + (archive.exists() ? " exists l=" + archive.length()\r
+ : "(non existant)"));\r
+ if (archive.length() > 0) {\r
+ VamsasArchiveReader vreader = new VamsasArchiveReader(archive);\r
+ SimpleDocument sdoc = new SimpleDocument(\r
+ "testing vamsas watcher");\r
+ try {\r
+ VamsasDocument d = sdoc.getVamsasDocument(vreader);\r
+ if (d != null) {\r
+ ArchiveReports.reportDocument(d, vreader, false,\r
+ System.out);\r
+ }\r
+ System.out\r
+ .println("Update at "\r
+ + System.currentTimeMillis()\r
+ + "\n\n********************************************************\n");\r
+ } catch (Exception e) {\r
+ log.error("Unmarshalling failed.", e);\r
+ }\r
+ vreader.close();\r
+ w.setState();\r
+ }\r
+ }\r
+ }\r
+ // break;\r
+ case 3: // set file\r
+ archive = new File(args[argc++]);\r
+ break;\r
+ case 4:\r
+ break;\r
+ default:\r
+ log.warn("Unknown command + " + args[argc++]);\r
+ }\r
+ }\r
+ }\r
+ } catch (Exception e) {\r
+ log.error(e);\r
+ }\r
+\r
+ }\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import uk.ac.vamsas.objects.core.Alignment;
-import uk.ac.vamsas.objects.core.ApplicationData;
-import uk.ac.vamsas.objects.core.Entry;
-import uk.ac.vamsas.objects.core.Instance;
-import uk.ac.vamsas.objects.core.Provenance;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-import uk.ac.vamsas.objects.utils.ProvenanceStuff;
-import uk.ac.vamsas.client.simpleclient.VamsasArchive;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-
-public class ArchiveWriter {
-
- /**
- * Test program for writing archive files.
- * form is ArchiveWriter new/modified argive command list
- */
-
- static Log log = LogFactory.getLog(ArchiveWriter.class);
-
- private static void mergeVecs(Object[] destvec, Object[] svec1, Object[] svec2) {
- int i;
- for (i=0; i<svec1.length; i++)
- destvec[i] = svec1[i];
- for (int j=0; j<svec2.length; i++, j++)
- destvec[i] = svec2[j];
- }
- // Merge appDataReferences require transfer of jar entries, perhaps with a renaming of the entry.
- // Merge appDatas require eventually unique URNS
- // TODO: merging global appdata from different documents where same app has written them causes conflict
-
- public static Hashtable hashOfAppDatas(Hashtable ht, Instance[] appdatas) {
- if (ht==null)
- ht = new Hashtable();
- for (int i=0, j=appdatas.length; i<j; i++) {
- if (!ht.containsKey(appdatas[i].getUrn())) {
- Hashtable aphash = new Hashtable();
- ht.put(appdatas[i].getUrn(), aphash);
- aphash.put(appdatas[i], appdatas[i].getDataReference());
- } else {
- // ensure urns and references are unique
-
-
- }
-
- }
- return ht;
- }
- /**
- * safely copies an appData from one archive to another.
- * @param darc destination archive
- * @param dest destination document Vobject
- * @param sarc source archive reader
- * @param entry application data to be copied from source archive
- */
- public static void addAppDataEntry(VamsasArchive darc, VamsasDocument dest, VamsasArchiveReader sarc, ApplicationData entry) {
- // TODO: fix instances
- // check uniqueness of instance's[] entry.urn amongst dest.ApplicationData[].getInstances[].urn
- // check uniqueness of entry.user[].urn amongst dest.ApplicationData[].user[].urn
- // check uniqueness of entry.user
- // entry.getAppDataChoice().getData() or getDataReference is unique
- ApplicationData newo = new ApplicationData();
- for (int i=0, j=dest.getApplicationDataCount(); i<j; i++) {
- ApplicationData o = dest.getApplicationData()[i];
- // ensure new urn is really unique
- //String urn = entry.getUrn();
- int v = 1;
- //while (o.getUrn().equals(urn)) {
- // urn = entry.getUrn()+v++;
- // }
- // uniqueness of urn
- // check each user ApplicationData
- // uniqueness (again)
- // copy over valid objects
- //
- }
- }
- /**
- * Copy new datasets and appdatas from one vamsas document to another.
- * @param darc
- * @param dest
- * @param sarc
- * @param source
- * @return true if merge was successful.
- */
- public static boolean mergeDocs(VamsasArchive darc, VamsasDocument dest, VamsasArchiveReader sarc, VamsasDocument source) {
- log.debug("mergeDocs entered.");
- // search for appDatas in cdoc
- VAMSAS[] newr = new VAMSAS[dest.getVAMSASCount()+source.getVAMSASCount()];
- mergeVecs(newr, dest.getVAMSAS(), source.getVAMSAS());
- dest.setVAMSAS(newr);
- /** TODO: LATER: should verify that all ids really are unique in newly merged document. If not then what ?
- * investigate possibility of having an id translation between appDatas and the core document -
- * the mapping is stored when an external application performs a merge, but when the owning
- * Application accesses the Vobject, the vorba_id is updated to the new one when it writes its
- * references in to its appdata again
- */
- if (source.getApplicationDataCount()>0) {
- ApplicationData[] newdat = new ApplicationData[source.getApplicationDataCount()+dest.getApplicationDataCount()];
- ApplicationData[] sappd = source.getApplicationData();
- // check refs and update/modify if necessary
- for (int i=0; i<sappd.length; i++) {
- addAppDataEntry(darc, dest, sarc, sappd[i]);
- }
-
- }
-
- return true; // success
- }
-
- private static CommandProcessor cproc;
- static {
- cproc.addCommand("new", 0, "no args");
- cproc.addCommand("add", 1, "Need another vamsas document archive filename as argument.");
- cproc.addCommand("repair", 0, "no args");
- cproc.addCommand("list", 0, "no args");
- cproc.addCommand("monitor", 0, "no args");
- }
-
- public static void main(String argv[]) {
- /**
- * TODO: switches for setting user identities for writing to vamsas document
- */
- if (argv.length<1) {
- log.fatal("Usage : <archive to create> [(commands)]");
- return;
- }
- File newarch = new File(argv[0]);
- int argpos = 0;
- try {
- // test fully fledged doc construction
- VamsasArchive varc = new VamsasArchive(newarch, true);
- VamsasDocument docroot;
- docroot = new VamsasDocument();
- docroot.setProvenance(ProvenanceStuff.newProvenance("ArchiveWriter", "user", "Created new Vamsas Document"));
- while (++argpos<argv.length) {
- File archive = new File(argv[argpos]);
- InputStream istream;
- if (archive.exists()) {
- VamsasArchiveReader vdoc = new VamsasArchiveReader(archive);
- if (vdoc.isValid()) {
- istream = vdoc.getVamsasDocumentStream();
- if (istream!=null) {
- VamsasDocument cdocroot = VamsasDocument.unmarshal(new InputStreamReader(istream));
- if (cdocroot!=null)
- mergeDocs(varc, docroot, vdoc, cdocroot);
- } else
- log.warn("Unexpectedly null document stream from existing document "+archive);
- } else {
- // updating an oldformat stream ?
- if ((istream = vdoc.getVamsasXmlStream())!=null) {
- // make a new vamsas document from the vamsas.xml entry
- VAMSAS root = VAMSAS.unmarshal(new InputStreamReader(istream)); // TODO: verify only one VAMSAS element per vamsas.xml entry.
- docroot.getProvenance().addEntry(ProvenanceStuff.newProvenanceEntry("ArchiveWriter", "user", "added vamsas.xml from "+argv[argpos-1]));
- docroot.addVAMSAS(root);
- }
- }
- } else {
- // Begin a new vamsas document
- PrintWriter docwriter = varc.getDocumentOutputStream();
- }
- }
- } catch (Exception e) {
- log.error("Whilst manipulating "+argv[0], e);
- }
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+import java.io.PrintWriter;\r
+import java.text.DateFormat;\r
+import java.util.Date;\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import uk.ac.vamsas.objects.core.Alignment;\r
+import uk.ac.vamsas.objects.core.ApplicationData;\r
+import uk.ac.vamsas.objects.core.Entry;\r
+import uk.ac.vamsas.objects.core.Instance;\r
+import uk.ac.vamsas.objects.core.Provenance;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+import uk.ac.vamsas.objects.utils.ProvenanceStuff;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchive;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+\r
+public class ArchiveWriter {\r
+\r
+ /**\r
+ * Test program for writing archive files. form is ArchiveWriter new/modified\r
+ * argive command list\r
+ */\r
+\r
+ static Log log = LogFactory.getLog(ArchiveWriter.class);\r
+\r
+ private static void mergeVecs(Object[] destvec, Object[] svec1, Object[] svec2) {\r
+ int i;\r
+ for (i = 0; i < svec1.length; i++)\r
+ destvec[i] = svec1[i];\r
+ for (int j = 0; j < svec2.length; i++, j++)\r
+ destvec[i] = svec2[j];\r
+ }\r
+\r
+ // Merge appDataReferences require transfer of jar entries, perhaps with a\r
+ // renaming of the entry.\r
+ // Merge appDatas require eventually unique URNS\r
+ // TODO: merging global appdata from different documents where same app has\r
+ // written them causes conflict\r
+\r
+ public static Hashtable hashOfAppDatas(Hashtable ht, Instance[] appdatas) {\r
+ if (ht == null)\r
+ ht = new Hashtable();\r
+ for (int i = 0, j = appdatas.length; i < j; i++) {\r
+ if (!ht.containsKey(appdatas[i].getUrn())) {\r
+ Hashtable aphash = new Hashtable();\r
+ ht.put(appdatas[i].getUrn(), aphash);\r
+ aphash.put(appdatas[i], appdatas[i].getDataReference());\r
+ } else {\r
+ // ensure urns and references are unique\r
+\r
+ }\r
+\r
+ }\r
+ return ht;\r
+ }\r
+\r
+ /**\r
+ * safely copies an appData from one archive to another.\r
+ * \r
+ * @param darc\r
+ * destination archive\r
+ * @param dest\r
+ * destination document Vobject\r
+ * @param sarc\r
+ * source archive reader\r
+ * @param entry\r
+ * application data to be copied from source archive\r
+ */\r
+ public static void addAppDataEntry(VamsasArchive darc, VamsasDocument dest,\r
+ VamsasArchiveReader sarc, ApplicationData entry) {\r
+ // TODO: fix instances\r
+ // check uniqueness of instance's[] entry.urn amongst\r
+ // dest.ApplicationData[].getInstances[].urn\r
+ // check uniqueness of entry.user[].urn amongst\r
+ // dest.ApplicationData[].user[].urn\r
+ // check uniqueness of entry.user\r
+ // entry.getAppDataChoice().getData() or getDataReference is unique\r
+ ApplicationData newo = new ApplicationData();\r
+ for (int i = 0, j = dest.getApplicationDataCount(); i < j; i++) {\r
+ ApplicationData o = dest.getApplicationData()[i];\r
+ // ensure new urn is really unique\r
+ // String urn = entry.getUrn();\r
+ int v = 1;\r
+ // while (o.getUrn().equals(urn)) {\r
+ // urn = entry.getUrn()+v++;\r
+ // }\r
+ // uniqueness of urn\r
+ // check each user ApplicationData\r
+ // uniqueness (again)\r
+ // copy over valid objects\r
+ // \r
+ }\r
+ }\r
+\r
+ /**\r
+ * Copy new datasets and appdatas from one vamsas document to another.\r
+ * \r
+ * @param darc\r
+ * @param dest\r
+ * @param sarc\r
+ * @param source\r
+ * @return true if merge was successful.\r
+ */\r
+ public static boolean mergeDocs(VamsasArchive darc, VamsasDocument dest,\r
+ VamsasArchiveReader sarc, VamsasDocument source) {\r
+ log.debug("mergeDocs entered.");\r
+ // search for appDatas in cdoc\r
+ VAMSAS[] newr = new VAMSAS[dest.getVAMSASCount() + source.getVAMSASCount()];\r
+ mergeVecs(newr, dest.getVAMSAS(), source.getVAMSAS());\r
+ dest.setVAMSAS(newr);\r
+ /**\r
+ * TODO: LATER: should verify that all ids really are unique in newly merged\r
+ * document. If not then what ? investigate possibility of having an id\r
+ * translation between appDatas and the core document - the mapping is\r
+ * stored when an external application performs a merge, but when the owning\r
+ * Application accesses the Vobject, the vorba_id is updated to the new one\r
+ * when it writes its references in to its appdata again\r
+ */\r
+ if (source.getApplicationDataCount() > 0) {\r
+ ApplicationData[] newdat = new ApplicationData[source\r
+ .getApplicationDataCount()\r
+ + dest.getApplicationDataCount()];\r
+ ApplicationData[] sappd = source.getApplicationData();\r
+ // check refs and update/modify if necessary\r
+ for (int i = 0; i < sappd.length; i++) {\r
+ addAppDataEntry(darc, dest, sarc, sappd[i]);\r
+ }\r
+\r
+ }\r
+\r
+ return true; // success\r
+ }\r
+\r
+ private static CommandProcessor cproc;\r
+ static {\r
+ cproc.addCommand("new", 0, "no args");\r
+ cproc.addCommand("add", 1,\r
+ "Need another vamsas document archive filename as argument.");\r
+ cproc.addCommand("repair", 0, "no args");\r
+ cproc.addCommand("list", 0, "no args");\r
+ cproc.addCommand("monitor", 0, "no args");\r
+ }\r
+\r
+ public static void main(String argv[]) {\r
+ /**\r
+ * TODO: switches for setting user identities for writing to vamsas document\r
+ */\r
+ if (argv.length < 1) {\r
+ log.fatal("Usage : <archive to create> [(commands)]");\r
+ return;\r
+ }\r
+ File newarch = new File(argv[0]);\r
+ int argpos = 0;\r
+ try {\r
+ // test fully fledged doc construction\r
+ VamsasArchive varc = new VamsasArchive(newarch, true);\r
+ VamsasDocument docroot;\r
+ docroot = new VamsasDocument();\r
+ docroot.setProvenance(ProvenanceStuff.newProvenance("ArchiveWriter",\r
+ "user", "Created new Vamsas Document"));\r
+ while (++argpos < argv.length) {\r
+ File archive = new File(argv[argpos]);\r
+ InputStream istream;\r
+ if (archive.exists()) {\r
+ VamsasArchiveReader vdoc = new VamsasArchiveReader(archive);\r
+ if (vdoc.isValid()) {\r
+ istream = vdoc.getVamsasDocumentStream();\r
+ if (istream != null) {\r
+ VamsasDocument cdocroot = VamsasDocument\r
+ .unmarshal(new InputStreamReader(istream));\r
+ if (cdocroot != null)\r
+ mergeDocs(varc, docroot, vdoc, cdocroot);\r
+ } else\r
+ log\r
+ .warn("Unexpectedly null document stream from existing document "\r
+ + archive);\r
+ } else {\r
+ // updating an oldformat stream ?\r
+ if ((istream = vdoc.getVamsasXmlStream()) != null) {\r
+ // make a new vamsas document from the vamsas.xml entry\r
+ VAMSAS root = VAMSAS.unmarshal(new InputStreamReader(istream)); // TODO:\r
+ // verify\r
+ // only\r
+ // one\r
+ // VAMSAS\r
+ // element\r
+ // per\r
+ // vamsas.xml\r
+ // entry.\r
+ docroot.getProvenance().addEntry(\r
+ ProvenanceStuff.newProvenanceEntry("ArchiveWriter", "user",\r
+ "added vamsas.xml from " + argv[argpos - 1]));\r
+ docroot.addVAMSAS(root);\r
+ }\r
+ }\r
+ } else {\r
+ // Begin a new vamsas document\r
+ PrintWriter docwriter = varc.getDocumentOutputStream();\r
+ }\r
+ }\r
+ } catch (Exception e) {\r
+ log.error("Whilst manipulating " + argv[0], e);\r
+ }\r
+ }\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.IClientAppdata;
-import uk.ac.vamsas.client.Vobject;
-import uk.ac.vamsas.client.VorbaId;
-import uk.ac.vamsas.client.simpleclient.ClientDocument;
-import uk.ac.vamsas.client.simpleclient.VamsasArchive;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.objects.core.Entry;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-import uk.ac.vamsas.objects.utils.ProvenanceStuff;
-
-// simple holder to pass to client.
-public class ClientDoc extends uk.ac.vamsas.client.ClientDocument {
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientDocument#getClientAppdata()
- */
- public IClientAppdata getClientAppdata() {
- throw new Error("Appdata access is not implemented in the test.simpleclient.ClientDoc instance."); // TODO Auto-generated method stub
- }
- protected boolean isModified=false;
- private Log log = LogFactory.getLog(ClientDoc.class);
- protected VamsasDocument doc;
- public uk.ac.vamsas.objects.core.VAMSAS[] _VamsasRoots;
- protected VamsasArchive iohandler=null;
- protected VamsasArchiveReader reader=null;
- private String user=null;
- private String app=null;
-
- /**
- * @param doc
- * @param iohandler
- * @param reader
- * @param app
- * @param user
- */
- public ClientDoc(VamsasDocument doc, VamsasArchive iohandler, VamsasArchiveReader reader, String app, String user, Hashtable objrefs) {
- super(objrefs, (iohandler!=null) ? iohandler.getVorba() : null);
- this.doc = doc;
- this.iohandler = iohandler;
- this.reader = reader;
- this.app = app;
- this.user = user;
- this.objrefs = objrefs;
- _VamsasRoots = doc.getVAMSAS();
- }
- // AppDataOutputStream appd;
- //AppDataOutputStream userd;
- /* (non-Javadoc)
- * @see java.lang.Object#finalize()
- */
- protected Entry getProvenanceEntry(String action) {
- // VAMSAS: modify schema to allow referencing of user field (plus other issues, ClientUrn field, machine readable action, input parameters, additional data generated notes
- Entry prov = ProvenanceStuff.newProvenanceEntry(app, user, action);
- return prov;
- }
- public VAMSAS[] getVamsasRoots() {
- if (doc==null) {
- log.debug("Null document for getVamsasRoots(), returning null");
- return null;
- }
- if (iohandler==null) {
- // LATER: decide on read-only status of ClientDocument object
- log.warn("getVamsasRoots() called on possibly read-only document.");
- }
- if (_VamsasRoots!=null)
- return _VamsasRoots;
- VAMSAS[] roots = doc.getVAMSAS();
- if (roots == null) {
- // Make a new one to return to client to get filled.
- _VamsasRoots = new VAMSAS[] { new VAMSAS() };
- // Do provenance now. just in case.
- doc.getProvenance().addEntry(getProvenanceEntry("Created new document root [id="+_VamsasRoots[0].getId()+"]"));
- doc.addVAMSAS(_VamsasRoots[0]);
- } else {
- _VamsasRoots = new VAMSAS[roots.length];
- for (int r=0;r<roots.length; r++)
- _VamsasRoots[r] = roots[r];
- }
- return _VamsasRoots;
- }
-
- private int _contains(VAMSAS root, VAMSAS[] docRoots) {
- if (root==null)
- return -1;
- if (docRoots==null || docRoots.length==0)
- return -1;
- VorbaId r_id = root.getVorbaId();
- for (int i=0,j=docRoots.length; i<j; i++) {
- VorbaId n_id=null;
- if (docRoots[i]==root || (docRoots[i]!=null && (n_id=docRoots[i].getVorbaId())!=null && n_id.equals(r_id)))
- return i;
- }
- return -1;
- }
-/**
- * verify that newr version is really an intact version of the
- * @param newVersion (may be modified)
- * @param oldVersion
- * @return true if newVersion is a valid root that preserves original references
- */
- private boolean isValidUpdate(VAMSAS newVersion, final VAMSAS oldVersion) {
- // ideal - this cascades down the two structures, ensuring that all ID'd objects in one are present in the other.
- if (oldVersion==newVersion) {
- // may be a virgin root element.
- if (!newVersion.isRegistered())
- iohandler.getVorba().makeVorbaId(newVersion);
- // Should retrieve original version and compare - unless local hashes can be used to determine if resultSet has been truncated.
- // just do internal validation for moment.
- if (newVersion.isValid())
- return true;
- return false;
- } else {
- // redundant ? if (oldVersion.is__stored_in_document())
- if (!newVersion.isRegistered())
- iohandler.getVorba().makeVorbaId(newVersion);
- if (newVersion.isValid())
- return true;
- }
- return false;
- }
- /**
- /**
- * merge old and new root vectors
- * @param newr This array may be written to
- * @param original
- * @param the client document (usually this) which this root set belongs to.
- * @return merged vector of vamsas roots
- */
- private VAMSAS[] _combineRoots(VAMSAS[] newr, final VAMSAS[] original, ClientDoc modflag) {
- Vector rts = new Vector();
- boolean modified=false;
- for (int i=0,j=original.length; i<j; i++) {
- int k = _contains(original[i], newr);
- if (k>-1) {
- if (isValidUpdate(newr[k], original[i])) {
- modified=true;
- rts.add(newr[k]);
- newr[k]=null;
- } else {
- // LATER: try harder to merge ducument roots.
- log.warn("Couldn't merge new VAMSAS root "+newr[k].getId());
- newr[k] = null; // LATER: this means we ignore mangled roots. NOT GOOD
- }
- } else {
- // add in order.
- rts.add(original[i]);
- }
- }
- // add remaining (new) roots
- for (int i=0,j=newr.length; i<j; i++) {
- if (newr[i]!=null) {
- rts.add(newr[i]);
- modified=true;
- }
- }
- newr = new VAMSAS[rts.size()];
- for (int i=0,j=rts.size(); i<j; i++)
- newr[i] = (VAMSAS) rts.get(i);
- if (modflag!=null)
- modflag.isModified = modified;
- return newr;
- }
-
- /**
- * update the document with new roots.
- * LATER: decide: this affects the next call to getVamsasRoots()
- * @see org.vamsas.IClientDocument.setVamsasRoots
- */
- public void setVamsasRoots(VAMSAS[] newroots) {
- if (doc==null) {
- log.debug("setVamsasRoots called on null document.");
- return;
- }
- VAMSAS[] newr;
- if (newroots==null) {
- log.debug("setVamsasRoots(null) - do nothing.");
- return;
- }
- // are we dealing with same array ?
- if (_VamsasRoots!=newroots) {
- // merge roots into local version.
- newr = new VAMSAS[newroots.length];
- for (int i=0;i<newr.length;i++)
- newr[i] = newroots[i];
- newr=_combineRoots(newr,_VamsasRoots,this);
- } else {
- newr = new VAMSAS[_VamsasRoots.length];
- for (int i=0;i<newr.length;i++)
- newr[i]=_VamsasRoots[i];
- }
- // actually compare with document root set for final combination (to ensure nothing is lost)
- _VamsasRoots = _combineRoots(newr, doc.getVAMSAS(), this);
- }
-
-
- /* (non-Javadoc)
- * LATER: decide: this affects the next call to getVamsasRoots()
- * @see uk.ac.vamsas.client.IClientDocument#addVamsasRoot(uk.ac.vamsas.objects.core.VAMSAS)
- */
- public void addVamsasRoot(VAMSAS newroot) {
- if (doc==null) {
- log.debug("addVamsasRoots called on null document.");
- return;
- }
- VAMSAS[] newroots = _combineRoots(new VAMSAS[] {newroot}, _VamsasRoots, this);
- _VamsasRoots = newroots;
- }
-
- public VamsasArchiveReader getReader() {
- return reader;
- }
- private void _finalize() {
- log.debug("finalizing clientDoc");
- if (doc!=null) {
- doc = null;
- }
- if (_VamsasRoots!=null) {
- for (int i=0; i<_VamsasRoots.length; i++)
- _VamsasRoots[i]=null;
- _VamsasRoots=null;
-
- }
-
- if (reader!=null) {
- log.debug("Closing and removing reader reference");
- reader.close();
- reader=null;
- }
- if (iohandler!=null) {
- log.debug("Removing ioHandler reference.");
- iohandler.cancelArchive();
- iohandler=null;
- }
- }
- protected void finalize() throws Throwable {
- _finalize();
- super.finalize();
- }
- private java.util.Hashtable objrefs=null;
-
- public VorbaId[] registerObjects(Vobject[] unregistered) {
- if (doc==null) {
- log.warn("registerObjects[] called on null document.");
- return null;
- }
- if (objrefs==null) {
- log.warn("registerObjects[] called for null objrefs hasharray.");
- return null;
- }
- if (unregistered!=null) {
- VorbaId ids[] = new VorbaId[unregistered.length];
- for (int i=0,k=unregistered.length; i<k; i++)
- if (unregistered[i]!=null) {
- log.warn("Null Vobject passed to registerObject[] at position "+i);
- return null;
- } else {
- ids[i]=registerObject(unregistered[i]);
- }
- log.debug("Registered "+unregistered.length+" objects - total of "+objrefs.size()+" ids.");
- return ids;
- }
- return null;
- }
- /* (non-Javadoc)
- * @see uk.ac.vamsas.client.IClientDocument#registerObject(uk.ac.vamsas.client.Vobject)
- */
- public VorbaId registerObject(Vobject unregistered) {
- if (doc==null) {
- log.warn("registerObjects called on null document.");
- return null;
- }
- if (objrefs==null) {
- log.warn("registerObjects called for null objrefs hasharray.");
- return null;
- }
- if (iohandler==null) {
- log.warn("registerObjects called for read only document.");
- return null;
- }
-
- if (unregistered!=null) {
- VorbaId id = this._registerObject(unregistered);
- log.debug("Registered object - total of "+objrefs.size()+" ids.");
- return id;
- }
- log.warn("Null Vobject passed to registerObject.");
- return null;
- }
- /*
- * (non-Javadoc)
- *
- * @see uk.ac.vamsas.client.IClientDocument#getObject(uk.ac.vamsas.client.VorbaId)
- */
- public Vobject getObject(VorbaId id) {
- if (objrefs==null) {
- log.debug("getObject called on null objrefs list.");
- return null;
- }
- if (objrefs.containsKey(id.getId()))
- return (Vobject) objrefs.get(id.getId());
- log.debug("Returning null Vobject reference for id "+id.getId());
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see uk.ac.vamsas.client.IClientDocument#getObjects(uk.ac.vamsas.client.VorbaId[])
- */
- public Vobject[] getObjects(VorbaId[] ids) {
- if (objrefs==null) {
- log.debug("getObject[] called on null objrefs list.");
- return null;
- }
- Vobject[] vo = new Vobject[ids.length];
- for (int i=0,j=ids.length; i<j;i++)
- if (objrefs.containsKey(ids[i]))
- vo[i] = (Vobject) objrefs.get(ids[i]);
- else
- log.debug("Returning null Vobject reference for id "+ids[i].getId());
- return vo;
- }
- protected void updateDocumentRoots() {
- if (doc==null) {
- log.error("updateDocumentRoots called on null document. Probably an implementation error.");
- return;
- }
- if (isModified) {
- if (_VamsasRoots!=null) {
- doc.setVAMSAS(_VamsasRoots);
- _VamsasRoots=null;
- }
- }
- }
- /**
- * tell vamsas client to close the document and reset the object. Once closed, nothing can be done with the object.
- *
- */
- public void closeDoc() {
- if (doc!=null) {
- log.debug("Closing open document.");
- _finalize();
- } else {
- log.warn("Ignoring closeDoc on invalid document.");
- }
- }
-
-}
\ No newline at end of file
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.IClientAppdata;\r
+import uk.ac.vamsas.client.Vobject;\r
+import uk.ac.vamsas.client.VorbaId;\r
+import uk.ac.vamsas.client.simpleclient.ClientDocument;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchive;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.objects.core.Entry;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+import uk.ac.vamsas.objects.utils.ProvenanceStuff;\r
+\r
+// simple holder to pass to client.\r
+public class ClientDoc extends uk.ac.vamsas.client.ClientDocument {\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see uk.ac.vamsas.client.IClientDocument#getClientAppdata()\r
+ */\r
+ public IClientAppdata getClientAppdata() {\r
+ throw new Error(\r
+ "Appdata access is not implemented in the test.simpleclient.ClientDoc instance."); // TODO\r
+ // Auto-generated\r
+ // method\r
+ // stub\r
+ }\r
+\r
+ protected boolean isModified = false;\r
+\r
+ private Log log = LogFactory.getLog(ClientDoc.class);\r
+\r
+ protected VamsasDocument doc;\r
+\r
+ public uk.ac.vamsas.objects.core.VAMSAS[] _VamsasRoots;\r
+\r
+ protected VamsasArchive iohandler = null;\r
+\r
+ protected VamsasArchiveReader reader = null;\r
+\r
+ private String user = null;\r
+\r
+ private String app = null;\r
+\r
+ /**\r
+ * @param doc\r
+ * @param iohandler\r
+ * @param reader\r
+ * @param app\r
+ * @param user\r
+ */\r
+ public ClientDoc(VamsasDocument doc, VamsasArchive iohandler,\r
+ VamsasArchiveReader reader, String app, String user, Hashtable objrefs) {\r
+ super(objrefs, (iohandler != null) ? iohandler.getVorba() : null);\r
+ this.doc = doc;\r
+ this.iohandler = iohandler;\r
+ this.reader = reader;\r
+ this.app = app;\r
+ this.user = user;\r
+ this.objrefs = objrefs;\r
+ _VamsasRoots = doc.getVAMSAS();\r
+ }\r
+\r
+ // AppDataOutputStream appd;\r
+ // AppDataOutputStream userd;\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.lang.Object#finalize()\r
+ */\r
+ protected Entry getProvenanceEntry(String action) {\r
+ // VAMSAS: modify schema to allow referencing of user field (plus other\r
+ // issues, ClientUrn field, machine readable action, input parameters,\r
+ // additional data generated notes\r
+ Entry prov = ProvenanceStuff.newProvenanceEntry(app, user, action);\r
+ return prov;\r
+ }\r
+\r
+ public VAMSAS[] getVamsasRoots() {\r
+ if (doc == null) {\r
+ log.debug("Null document for getVamsasRoots(), returning null");\r
+ return null;\r
+ }\r
+ if (iohandler == null) {\r
+ // LATER: decide on read-only status of ClientDocument object\r
+ log.warn("getVamsasRoots() called on possibly read-only document.");\r
+ }\r
+ if (_VamsasRoots != null)\r
+ return _VamsasRoots;\r
+ VAMSAS[] roots = doc.getVAMSAS();\r
+ if (roots == null) {\r
+ // Make a new one to return to client to get filled.\r
+ _VamsasRoots = new VAMSAS[] { new VAMSAS() };\r
+ // Do provenance now. just in case.\r
+ doc.getProvenance().addEntry(\r
+ getProvenanceEntry("Created new document root [id="\r
+ + _VamsasRoots[0].getId() + "]"));\r
+ doc.addVAMSAS(_VamsasRoots[0]);\r
+ } else {\r
+ _VamsasRoots = new VAMSAS[roots.length];\r
+ for (int r = 0; r < roots.length; r++)\r
+ _VamsasRoots[r] = roots[r];\r
+ }\r
+ return _VamsasRoots;\r
+ }\r
+\r
+ private int _contains(VAMSAS root, VAMSAS[] docRoots) {\r
+ if (root == null)\r
+ return -1;\r
+ if (docRoots == null || docRoots.length == 0)\r
+ return -1;\r
+ VorbaId r_id = root.getVorbaId();\r
+ for (int i = 0, j = docRoots.length; i < j; i++) {\r
+ VorbaId n_id = null;\r
+ if (docRoots[i] == root\r
+ || (docRoots[i] != null && (n_id = docRoots[i].getVorbaId()) != null && n_id\r
+ .equals(r_id)))\r
+ return i;\r
+ }\r
+ return -1;\r
+ }\r
+\r
+ /**\r
+ * verify that newr version is really an intact version of the\r
+ * \r
+ * @param newVersion\r
+ * (may be modified)\r
+ * @param oldVersion\r
+ * @return true if newVersion is a valid root that preserves original\r
+ * references\r
+ */\r
+ private boolean isValidUpdate(VAMSAS newVersion, final VAMSAS oldVersion) {\r
+ // ideal - this cascades down the two structures, ensuring that all ID'd\r
+ // objects in one are present in the other.\r
+ if (oldVersion == newVersion) {\r
+ // may be a virgin root element.\r
+ if (!newVersion.isRegistered())\r
+ iohandler.getVorba().makeVorbaId(newVersion);\r
+ // Should retrieve original version and compare - unless local hashes can\r
+ // be used to determine if resultSet has been truncated.\r
+ // just do internal validation for moment.\r
+ if (newVersion.isValid())\r
+ return true;\r
+ return false;\r
+ } else {\r
+ // redundant ? if (oldVersion.is__stored_in_document())\r
+ if (!newVersion.isRegistered())\r
+ iohandler.getVorba().makeVorbaId(newVersion);\r
+ if (newVersion.isValid())\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /**\r
+ * /** merge old and new root vectors\r
+ * \r
+ * @param newr\r
+ * This array may be written to\r
+ * @param original\r
+ * @param the\r
+ * client document (usually this) which this root set belongs to.\r
+ * @return merged vector of vamsas roots\r
+ */\r
+ private VAMSAS[] _combineRoots(VAMSAS[] newr, final VAMSAS[] original,\r
+ ClientDoc modflag) {\r
+ Vector rts = new Vector();\r
+ boolean modified = false;\r
+ for (int i = 0, j = original.length; i < j; i++) {\r
+ int k = _contains(original[i], newr);\r
+ if (k > -1) {\r
+ if (isValidUpdate(newr[k], original[i])) {\r
+ modified = true;\r
+ rts.add(newr[k]);\r
+ newr[k] = null;\r
+ } else {\r
+ // LATER: try harder to merge ducument roots.\r
+ log.warn("Couldn't merge new VAMSAS root " + newr[k].getId());\r
+ newr[k] = null; // LATER: this means we ignore mangled roots. NOT GOOD\r
+ }\r
+ } else {\r
+ // add in order.\r
+ rts.add(original[i]);\r
+ }\r
+ }\r
+ // add remaining (new) roots\r
+ for (int i = 0, j = newr.length; i < j; i++) {\r
+ if (newr[i] != null) {\r
+ rts.add(newr[i]);\r
+ modified = true;\r
+ }\r
+ }\r
+ newr = new VAMSAS[rts.size()];\r
+ for (int i = 0, j = rts.size(); i < j; i++)\r
+ newr[i] = (VAMSAS) rts.get(i);\r
+ if (modflag != null)\r
+ modflag.isModified = modified;\r
+ return newr;\r
+ }\r
+\r
+ /**\r
+ * update the document with new roots. LATER: decide: this affects the next\r
+ * call to getVamsasRoots()\r
+ * \r
+ * @see org.vamsas.IClientDocument.setVamsasRoots\r
+ */\r
+ public void setVamsasRoots(VAMSAS[] newroots) {\r
+ if (doc == null) {\r
+ log.debug("setVamsasRoots called on null document.");\r
+ return;\r
+ }\r
+ VAMSAS[] newr;\r
+ if (newroots == null) {\r
+ log.debug("setVamsasRoots(null) - do nothing.");\r
+ return;\r
+ }\r
+ // are we dealing with same array ?\r
+ if (_VamsasRoots != newroots) {\r
+ // merge roots into local version.\r
+ newr = new VAMSAS[newroots.length];\r
+ for (int i = 0; i < newr.length; i++)\r
+ newr[i] = newroots[i];\r
+ newr = _combineRoots(newr, _VamsasRoots, this);\r
+ } else {\r
+ newr = new VAMSAS[_VamsasRoots.length];\r
+ for (int i = 0; i < newr.length; i++)\r
+ newr[i] = _VamsasRoots[i];\r
+ }\r
+ // actually compare with document root set for final combination (to ensure\r
+ // nothing is lost)\r
+ _VamsasRoots = _combineRoots(newr, doc.getVAMSAS(), this);\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc) LATER: decide: this affects the next call to getVamsasRoots()\r
+ * \r
+ * @see\r
+ * uk.ac.vamsas.client.IClientDocument#addVamsasRoot(uk.ac.vamsas.objects.\r
+ * core.VAMSAS)\r
+ */\r
+ public void addVamsasRoot(VAMSAS newroot) {\r
+ if (doc == null) {\r
+ log.debug("addVamsasRoots called on null document.");\r
+ return;\r
+ }\r
+ VAMSAS[] newroots = _combineRoots(new VAMSAS[] { newroot }, _VamsasRoots,\r
+ this);\r
+ _VamsasRoots = newroots;\r
+ }\r
+\r
+ public VamsasArchiveReader getReader() {\r
+ return reader;\r
+ }\r
+\r
+ private void _finalize() {\r
+ log.debug("finalizing clientDoc");\r
+ if (doc != null) {\r
+ doc = null;\r
+ }\r
+ if (_VamsasRoots != null) {\r
+ for (int i = 0; i < _VamsasRoots.length; i++)\r
+ _VamsasRoots[i] = null;\r
+ _VamsasRoots = null;\r
+\r
+ }\r
+\r
+ if (reader != null) {\r
+ log.debug("Closing and removing reader reference");\r
+ reader.close();\r
+ reader = null;\r
+ }\r
+ if (iohandler != null) {\r
+ log.debug("Removing ioHandler reference.");\r
+ iohandler.cancelArchive();\r
+ iohandler = null;\r
+ }\r
+ }\r
+\r
+ protected void finalize() throws Throwable {\r
+ _finalize();\r
+ super.finalize();\r
+ }\r
+\r
+ private java.util.Hashtable objrefs = null;\r
+\r
+ public VorbaId[] registerObjects(Vobject[] unregistered) {\r
+ if (doc == null) {\r
+ log.warn("registerObjects[] called on null document.");\r
+ return null;\r
+ }\r
+ if (objrefs == null) {\r
+ log.warn("registerObjects[] called for null objrefs hasharray.");\r
+ return null;\r
+ }\r
+ if (unregistered != null) {\r
+ VorbaId ids[] = new VorbaId[unregistered.length];\r
+ for (int i = 0, k = unregistered.length; i < k; i++)\r
+ if (unregistered[i] != null) {\r
+ log.warn("Null Vobject passed to registerObject[] at position " + i);\r
+ return null;\r
+ } else {\r
+ ids[i] = registerObject(unregistered[i]);\r
+ }\r
+ log.debug("Registered " + unregistered.length + " objects - total of "\r
+ + objrefs.size() + " ids.");\r
+ return ids;\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * uk.ac.vamsas.client.IClientDocument#registerObject(uk.ac.vamsas.client.\r
+ * Vobject)\r
+ */\r
+ public VorbaId registerObject(Vobject unregistered) {\r
+ if (doc == null) {\r
+ log.warn("registerObjects called on null document.");\r
+ return null;\r
+ }\r
+ if (objrefs == null) {\r
+ log.warn("registerObjects called for null objrefs hasharray.");\r
+ return null;\r
+ }\r
+ if (iohandler == null) {\r
+ log.warn("registerObjects called for read only document.");\r
+ return null;\r
+ }\r
+\r
+ if (unregistered != null) {\r
+ VorbaId id = this._registerObject(unregistered);\r
+ log.debug("Registered object - total of " + objrefs.size() + " ids.");\r
+ return id;\r
+ }\r
+ log.warn("Null Vobject passed to registerObject.");\r
+ return null;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * uk.ac.vamsas.client.IClientDocument#getObject(uk.ac.vamsas.client.VorbaId)\r
+ */\r
+ public Vobject getObject(VorbaId id) {\r
+ if (objrefs == null) {\r
+ log.debug("getObject called on null objrefs list.");\r
+ return null;\r
+ }\r
+ if (objrefs.containsKey(id.getId()))\r
+ return (Vobject) objrefs.get(id.getId());\r
+ log.debug("Returning null Vobject reference for id " + id.getId());\r
+ return null;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * uk.ac.vamsas.client.IClientDocument#getObjects(uk.ac.vamsas.client.VorbaId\r
+ * [])\r
+ */\r
+ public Vobject[] getObjects(VorbaId[] ids) {\r
+ if (objrefs == null) {\r
+ log.debug("getObject[] called on null objrefs list.");\r
+ return null;\r
+ }\r
+ Vobject[] vo = new Vobject[ids.length];\r
+ for (int i = 0, j = ids.length; i < j; i++)\r
+ if (objrefs.containsKey(ids[i]))\r
+ vo[i] = (Vobject) objrefs.get(ids[i]);\r
+ else\r
+ log.debug("Returning null Vobject reference for id " + ids[i].getId());\r
+ return vo;\r
+ }\r
+\r
+ protected void updateDocumentRoots() {\r
+ if (doc == null) {\r
+ log\r
+ .error("updateDocumentRoots called on null document. Probably an implementation error.");\r
+ return;\r
+ }\r
+ if (isModified) {\r
+ if (_VamsasRoots != null) {\r
+ doc.setVAMSAS(_VamsasRoots);\r
+ _VamsasRoots = null;\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * tell vamsas client to close the document and reset the object. Once closed,\r
+ * nothing can be done with the object.\r
+ * \r
+ */\r
+ public void closeDoc() {\r
+ if (doc != null) {\r
+ log.debug("Closing open document.");\r
+ _finalize();\r
+ } else {\r
+ log.warn("Ignoring closeDoc on invalid document.");\r
+ }\r
+ }\r
+\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Vector;
-
-
-import uk.ac.vamsas.client.ClientHandle;
-import uk.ac.vamsas.client.simpleclient.ClientsFile;
-import uk.ac.vamsas.client.simpleclient.FileWatcher;
-import uk.ac.vamsas.client.simpleclient.Lock;
-
-public class ClientsFileTest {
- private static CommandProcessor cproc;
-
- private static Vector commands;
- static {
- cproc = new CommandProcessor();
- ClientsFileTest.commands = new Vector();
- ClientsFileTest.commands.add(new String("add"));
- cproc.addCommand("add", 2, "for the Client's 'Name' and 'Version'");
- ClientsFileTest.commands.add(new String("remove"));
- cproc.addCommand("remove", 3, "for the Client's 'Name', Version and URN");
- ClientsFileTest.commands.add(new String("list"));
- cproc.addCommand("list", 0, "no args needed");
- ClientsFileTest.commands.add(new String("clear"));
- cproc.addCommand("clear", 0, "no args needed");
- ClientsFileTest.commands.add(new String("watch"));
- cproc.addCommand("watch", 0, "no args needed");
- ClientsFileTest.commands.add(new String("monitor"));
- cproc.addCommand("monitor", 2, "for the Client's 'Name' and 'Version'");
- }
-
- private static void complainArgs(int argl, int argpos, String cmd,
- int argneed, String msg) {
- if (argl - argpos < argneed)
- throw new Error(cmd + " needs " + argneed + " arguments : " + msg);
- }
-
- public static void main(String[] args) {
- java.io.File cf = new java.io.File(args[0]);
- System.out.println("Connecting to clientFile " + args[0]);
- ClientsFile cfhand;
- try {
- cfhand = new ClientsFile(cf);
- } catch (Exception e) {
- e.printStackTrace(System.err);
- return;
- }
- int argc = 1;
- while (argc < args.length) {
- // vars needed for operations
- ClientHandle ch;
- int com = cproc.getCommand(args, argc);
- argc++;
- switch (com) {
- case 0:
- // Add
- int pos = cfhand.addClient(ch = new ClientHandle(args[argc],
- args[argc + 1]));
- argc += 2;
- if (pos != 0)
- System.out.println("Client added at " + pos + " as urn:"
- + ch.getClientUrn());
- else
- System.out.println("Client was not added.");
- break;
- case 1:
- // remove
- ch = new ClientHandle(args[argc], args[argc + 1]);
- ch.setClientUrn(args[argc + 2]);
- argc += 3;
- cfhand.removeClient(ch, null);
- System.out.println("Client removed (apparently)");
- break;
- case 2:
- // list
- ClientHandle[] chlist = cfhand.retrieveClientList();
- if (chlist != null) {
- for (int chi = 0, che = chlist.length; chi < che; chi++) {
- System.out.println("Client " + chi + " ("
- + chlist[chi].getClientName() + " " + chlist[chi].getVersion()
- + " " + chlist[chi].getClientUrn() + ")");
- }
- } else {
- System.out.println("Client list is empty.");
- }
- break;
- case 3:
- // clear
- //cfhand.get = null;
- //cf.delete();
- try {
-
- cfhand.clearList();
-
- } catch (Exception e) {
- System.err.println("Failed on new empty clientfile creation!");
- e.printStackTrace(System.err);
- }
- break;
- case 4:
- // watch
- FileWatcher w = new FileWatcher(cf);
- while (cf.exists()) {
- // get watcher's lock to ensure state change is fixed for retrieval
- Lock chlock = w.getChangedState();
- if (chlock != null) {
- ClientHandle[] cl = cfhand.retrieveClientList(chlock);
- System.out.println("-- Watching " + cf.getName());
- //while (w.hasChanged())
- // ;
- if (cl != null) {
- for (int chi = 0, che = cl.length; chi < che; chi++) {
- System.out.println("Client " + chi + " ("
- + cl[chi].getClientName() + " " + cl[chi].getVersion()
- + " " + cl[chi].getClientUrn() + ")");
- }
- } else {
- System.out.println("Client list is empty.");
- }
- }
-
- }
- break;
- case 5:
- // monitor
- int clpos = cfhand.addClient(ch = new ClientHandle(args[argc],
- args[argc + 1]));
- argc += 2;
- if (clpos != 0)
- System.out.println("Monitor Client added at " + clpos + " as urn:"
- + ch.getClientUrn());
- else {
- System.err.println("Monitor Client was not added.");
- break;
- }
- FileWatcher mon = new FileWatcher(cf);
- while (cf.exists()) {
- // get watcher's lock to ensure state change is fixed for retrieval
- Lock chlock = mon.getChangedState();
- if (chlock != null) {
- ClientHandle[] cl = cfhand.retrieveClientList(chlock);
- System.out.println("-- Monitor " + cf.getName());
- //while (w.hasChanged())
- // ;
- int newpos = -1;
- if (cl != null) {
- for (int chi = 0, che = cl.length; chi < che; chi++) {
- if (ch.equals(cl[chi]))
- newpos = chi + 1;
- }
- }
- if (newpos == -1) {
- // add self again to cleared list.
- newpos = cfhand.addClient(ch);
- mon.setState();
- if (newpos == 0) {
- System.err
- .println("Monitor client could not be re-added to list.");
- break;
- }
- }
- if (newpos != clpos) {
- System.out.println("Monitor client moved from " + clpos + " to "
- + newpos);
- clpos = newpos;
- }
- }
- }
- break;
- default:
- if (com == -1) {
- System.err
- .println("Unknown command : " + args[argc++] + "*Ignored!*");
- } else
- System.err.println("Command " + args[argc++]
- + " *Ignored!* - its not implemented.");
- }
-
- for (int j = 0; j < 900000; j++) {
- Integer i = Integer.getInteger("1");
- Integer q = i;
- }
- }
-
- }
-
- /* Iterator coms = commands.iterator();
- int com=-1;
- while ((coms!=null) && coms.hasNext()) {
- com++;
- if (args[argc].toLowerCase().equals((String) coms.next())) {
- System.out.println("Doing "+args[argc]);
- ClientHandle ch;
- argc++;
- switch (com) {
- case 0:
- // Add
- ClientsFileTest.complainArgs(args.length, argc, "add", 2, "for the Client's 'Name' and 'Version'");
- int pos = cfhand.addClient(ch=new ClientHandle(args[argc],args[argc+1]));
- argc+=2;
- if (pos!=0)
- System.out.println("Client added at "+pos+" as urn:"+ch.getClientUrn());
- else
- System.out.println("Client was not added.");
- break;
- case 1:
- // remove
- ClientsFileTest.complainArgs(args.length, argc, "remove", 3, "for the Client's 'Name', Version and URN");
- ch=new ClientHandle(args[argc], args[argc+1]);
- ch.setClientUrn(args[argc+2]);
- argc+=3;
- cfhand.removeClient(ch, null);
- System.out.println("Client removed (apparently)");
- break;
- case 2:
- // list
- ClientHandle[] chlist = cfhand.retrieveClientList();
- if (chlist!=null) {
- for (int chi=0,che=chlist.length; chi<che; chi++) {
- System.out.println("Client "+chi+" ("+chlist[chi].getClientName()+" "+chlist[chi].getVersion()+" "+chlist[chi].getClientUrn()+")");
- }
- } else {
- System.out.println("Client list is empty.");
- }
- break;
- case 3:
- // clear
- cfhand = null;
- cf.delete();
- try {
- cf.createNewFile();
- cfhand = new ClientsFile(cf);
- }
- catch (Exception e) {
- System.err.println("Failed on new empty clientfile creation!");
- e.printStackTrace(System.err);
- }
- break;
- case 4:
- // watch
- FileWatcher w=new FileWatcher(cf);
- while (cf.exists()) {
- // get watcher's lock to ensure state change is fixed for retrieval
- Lock chlock=w.getChangedState();
- if (chlock!=null) {
- ClientHandle[] cl = cfhand.retrieveClientList(chlock);
- System.out.println("-- Watching "+cf.getName());
- //while (w.hasChanged())
- // ;
- if (cl!=null) {
- for (int chi=0,che=cl.length; chi<che; chi++) {
- System.out.println("Client "+chi+" ("+cl[chi].getClientName()+" "+cl[chi].getVersion()+" "+cl[chi].getClientUrn()+")");
- }
- } else {
- System.out.println("Client list is empty.");
- }
- }
-
- }
- break;
- case 5:
- // monitor
- ClientsFileTest.complainArgs(args.length, argc, "monitor", 2, "for the Client's 'Name' and 'Version'");
- int clpos = cfhand.addClient(ch=new ClientHandle(args[argc],args[argc+1]));
- argc+=2;
- if (clpos!=0)
- System.out.println("Monitor Client added at "+clpos+" as urn:"+ch.getClientUrn());
- else {
- System.err.println("Monitor Client was not added.");
- break;
- }
- FileWatcher mon=new FileWatcher(cf);
- while (cf.exists()) {
- // get watcher's lock to ensure state change is fixed for retrieval
- Lock chlock=mon.getChangedState();
- if (chlock!=null) {
- ClientHandle[] cl = cfhand.retrieveClientList(chlock);
- System.out.println("-- Monitor "+cf.getName());
- //while (w.hasChanged())
- // ;
- int newpos=-1;
- if (cl!=null) {
- for (int chi=0,che=cl.length; chi<che; chi++) {
- if (ch.equals(cl[chi]))
- newpos=chi+1;
- }
- }
- if (newpos==-1) {
- // add self again to cleared list.
- newpos=cfhand.addClient(ch);
- mon.setState();
- if (newpos==0) {
- System.err.println("Monitor client could not be re-added to list.");
- break;
- }
- }
- if (newpos!=clpos) {
- System.out.println("Monitor client moved from "+clpos+" to "+newpos);
- clpos=newpos;
- }
- }
- }
-
- }
- coms = null;
- }
- } */
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.File;\r
+import java.util.Iterator;\r
+import java.util.Vector;\r
+\r
+import uk.ac.vamsas.client.ClientHandle;\r
+import uk.ac.vamsas.client.simpleclient.ClientsFile;\r
+import uk.ac.vamsas.client.simpleclient.FileWatcher;\r
+import uk.ac.vamsas.client.simpleclient.Lock;\r
+\r
+public class ClientsFileTest {\r
+ private static CommandProcessor cproc;\r
+\r
+ private static Vector commands;\r
+ static {\r
+ cproc = new CommandProcessor();\r
+ ClientsFileTest.commands = new Vector();\r
+ ClientsFileTest.commands.add(new String("add"));\r
+ cproc.addCommand("add", 2, "for the Client's 'Name' and 'Version'");\r
+ ClientsFileTest.commands.add(new String("remove"));\r
+ cproc.addCommand("remove", 3, "for the Client's 'Name', Version and URN");\r
+ ClientsFileTest.commands.add(new String("list"));\r
+ cproc.addCommand("list", 0, "no args needed");\r
+ ClientsFileTest.commands.add(new String("clear"));\r
+ cproc.addCommand("clear", 0, "no args needed");\r
+ ClientsFileTest.commands.add(new String("watch"));\r
+ cproc.addCommand("watch", 0, "no args needed");\r
+ ClientsFileTest.commands.add(new String("monitor"));\r
+ cproc.addCommand("monitor", 2, "for the Client's 'Name' and 'Version'");\r
+ }\r
+\r
+ private static void complainArgs(int argl, int argpos, String cmd,\r
+ int argneed, String msg) {\r
+ if (argl - argpos < argneed)\r
+ throw new Error(cmd + " needs " + argneed + " arguments : " + msg);\r
+ }\r
+\r
+ public static void main(String[] args) {\r
+ java.io.File cf = new java.io.File(args[0]);\r
+ System.out.println("Connecting to clientFile " + args[0]);\r
+ ClientsFile cfhand;\r
+ try {\r
+ cfhand = new ClientsFile(cf);\r
+ } catch (Exception e) {\r
+ e.printStackTrace(System.err);\r
+ return;\r
+ }\r
+ int argc = 1;\r
+ while (argc < args.length) {\r
+ // vars needed for operations\r
+ ClientHandle ch;\r
+ int com = cproc.getCommand(args, argc);\r
+ argc++;\r
+ switch (com) {\r
+ case 0:\r
+ // Add\r
+ int pos = cfhand.addClient(ch = new ClientHandle(args[argc],\r
+ args[argc + 1]));\r
+ argc += 2;\r
+ if (pos != 0)\r
+ System.out.println("Client added at " + pos + " as urn:"\r
+ + ch.getClientUrn());\r
+ else\r
+ System.out.println("Client was not added.");\r
+ break;\r
+ case 1:\r
+ // remove\r
+ ch = new ClientHandle(args[argc], args[argc + 1]);\r
+ ch.setClientUrn(args[argc + 2]);\r
+ argc += 3;\r
+ cfhand.removeClient(ch, null);\r
+ System.out.println("Client removed (apparently)");\r
+ break;\r
+ case 2:\r
+ // list\r
+ ClientHandle[] chlist = cfhand.retrieveClientList();\r
+ if (chlist != null) {\r
+ for (int chi = 0, che = chlist.length; chi < che; chi++) {\r
+ System.out.println("Client " + chi + " ("\r
+ + chlist[chi].getClientName() + " " + chlist[chi].getVersion()\r
+ + " " + chlist[chi].getClientUrn() + ")");\r
+ }\r
+ } else {\r
+ System.out.println("Client list is empty.");\r
+ }\r
+ break;\r
+ case 3:\r
+ // clear\r
+ // cfhand.get = null;\r
+ // cf.delete();\r
+ try {\r
+\r
+ cfhand.clearList();\r
+\r
+ } catch (Exception e) {\r
+ System.err.println("Failed on new empty clientfile creation!");\r
+ e.printStackTrace(System.err);\r
+ }\r
+ break;\r
+ case 4:\r
+ // watch\r
+ FileWatcher w = new FileWatcher(cf);\r
+ while (cf.exists()) {\r
+ // get watcher's lock to ensure state change is fixed for retrieval\r
+ Lock chlock = w.getChangedState();\r
+ if (chlock != null) {\r
+ ClientHandle[] cl = cfhand.retrieveClientList(chlock);\r
+ System.out.println("-- Watching " + cf.getName());\r
+ // while (w.hasChanged())\r
+ // ;\r
+ if (cl != null) {\r
+ for (int chi = 0, che = cl.length; chi < che; chi++) {\r
+ System.out.println("Client " + chi + " ("\r
+ + cl[chi].getClientName() + " " + cl[chi].getVersion()\r
+ + " " + cl[chi].getClientUrn() + ")");\r
+ }\r
+ } else {\r
+ System.out.println("Client list is empty.");\r
+ }\r
+ }\r
+\r
+ }\r
+ break;\r
+ case 5:\r
+ // monitor\r
+ int clpos = cfhand.addClient(ch = new ClientHandle(args[argc],\r
+ args[argc + 1]));\r
+ argc += 2;\r
+ if (clpos != 0)\r
+ System.out.println("Monitor Client added at " + clpos + " as urn:"\r
+ + ch.getClientUrn());\r
+ else {\r
+ System.err.println("Monitor Client was not added.");\r
+ break;\r
+ }\r
+ FileWatcher mon = new FileWatcher(cf);\r
+ while (cf.exists()) {\r
+ // get watcher's lock to ensure state change is fixed for retrieval\r
+ Lock chlock = mon.getChangedState();\r
+ if (chlock != null) {\r
+ ClientHandle[] cl = cfhand.retrieveClientList(chlock);\r
+ System.out.println("-- Monitor " + cf.getName());\r
+ // while (w.hasChanged())\r
+ // ;\r
+ int newpos = -1;\r
+ if (cl != null) {\r
+ for (int chi = 0, che = cl.length; chi < che; chi++) {\r
+ if (ch.equals(cl[chi]))\r
+ newpos = chi + 1;\r
+ }\r
+ }\r
+ if (newpos == -1) {\r
+ // add self again to cleared list.\r
+ newpos = cfhand.addClient(ch);\r
+ mon.setState();\r
+ if (newpos == 0) {\r
+ System.err\r
+ .println("Monitor client could not be re-added to list.");\r
+ break;\r
+ }\r
+ }\r
+ if (newpos != clpos) {\r
+ System.out.println("Monitor client moved from " + clpos + " to "\r
+ + newpos);\r
+ clpos = newpos;\r
+ }\r
+ }\r
+ }\r
+ break;\r
+ default:\r
+ if (com == -1) {\r
+ System.err\r
+ .println("Unknown command : " + args[argc++] + "*Ignored!*");\r
+ } else\r
+ System.err.println("Command " + args[argc++]\r
+ + " *Ignored!* - its not implemented.");\r
+ }\r
+\r
+ for (int j = 0; j < 900000; j++) {\r
+ Integer i = Integer.getInteger("1");\r
+ Integer q = i;\r
+ }\r
+ }\r
+\r
+ }\r
+\r
+ /*\r
+ * Iterator coms = commands.iterator(); int com=-1; while ((coms!=null) &&\r
+ * coms.hasNext()) { com++; if (args[argc].toLowerCase().equals((String)\r
+ * coms.next())) { System.out.println("Doing "+args[argc]); ClientHandle ch;\r
+ * argc++; switch (com) { case 0: // Add\r
+ * ClientsFileTest.complainArgs(args.length, argc, "add", 2,\r
+ * "for the Client's 'Name' and 'Version'"); int pos = cfhand.addClient(ch=new\r
+ * ClientHandle(args[argc],args[argc+1])); argc+=2; if (pos!=0)\r
+ * System.out.println("Client added at "+pos+" as urn:"+ch.getClientUrn());\r
+ * else System.out.println("Client was not added."); break; case 1: // remove\r
+ * ClientsFileTest.complainArgs(args.length, argc, "remove", 3,\r
+ * "for the Client's 'Name', Version and URN"); ch=new\r
+ * ClientHandle(args[argc], args[argc+1]); ch.setClientUrn(args[argc+2]);\r
+ * argc+=3; cfhand.removeClient(ch, null);\r
+ * System.out.println("Client removed (apparently)"); break; case 2: // list\r
+ * ClientHandle[] chlist = cfhand.retrieveClientList(); if (chlist!=null) {\r
+ * for (int chi=0,che=chlist.length; chi<che; chi++) {\r
+ * System.out.println("Client "\r
+ * +chi+" ("+chlist[chi].getClientName()+" "+chlist\r
+ * [chi].getVersion()+" "+chlist[chi].getClientUrn()+")"); } } else {\r
+ * System.out.println("Client list is empty."); } break; case 3: // clear\r
+ * cfhand = null; cf.delete(); try { cf.createNewFile(); cfhand = new\r
+ * ClientsFile(cf); } catch (Exception e) {\r
+ * System.err.println("Failed on new empty clientfile creation!");\r
+ * e.printStackTrace(System.err); } break; case 4: // watch FileWatcher w=new\r
+ * FileWatcher(cf); while (cf.exists()) { // get watcher's lock to ensure\r
+ * state change is fixed for retrieval Lock chlock=w.getChangedState(); if\r
+ * (chlock!=null) { ClientHandle[] cl = cfhand.retrieveClientList(chlock);\r
+ * System.out.println("-- Watching "+cf.getName()); //while (w.hasChanged())\r
+ * // ; if (cl!=null) { for (int chi=0,che=cl.length; chi<che; chi++) {\r
+ * System.\r
+ * out.println("Client "+chi+" ("+cl[chi].getClientName()+" "+cl[chi].getVersion\r
+ * ()+" "+cl[chi].getClientUrn()+")"); } } else {\r
+ * System.out.println("Client list is empty."); } }\r
+ * \r
+ * } break; case 5: // monitor ClientsFileTest.complainArgs(args.length, argc,\r
+ * "monitor", 2, "for the Client's 'Name' and 'Version'"); int clpos =\r
+ * cfhand.addClient(ch=new ClientHandle(args[argc],args[argc+1])); argc+=2; if\r
+ * (clpos!=0)\r
+ * System.out.println("Monitor Client added at "+clpos+" as urn:"+ch\r
+ * .getClientUrn()); else {\r
+ * System.err.println("Monitor Client was not added."); break; } FileWatcher\r
+ * mon=new FileWatcher(cf); while (cf.exists()) { // get watcher's lock to\r
+ * ensure state change is fixed for retrieval Lock\r
+ * chlock=mon.getChangedState(); if (chlock!=null) { ClientHandle[] cl =\r
+ * cfhand.retrieveClientList(chlock);\r
+ * System.out.println("-- Monitor "+cf.getName()); //while (w.hasChanged()) //\r
+ * ; int newpos=-1; if (cl!=null) { for (int chi=0,che=cl.length; chi<che;\r
+ * chi++) { if (ch.equals(cl[chi])) newpos=chi+1; } } if (newpos==-1) { // add\r
+ * self again to cleared list. newpos=cfhand.addClient(ch); mon.setState(); if\r
+ * (newpos==0) {\r
+ * System.err.println("Monitor client could not be re-added to list."); break;\r
+ * } } if (newpos!=clpos) {\r
+ * System.out.println("Monitor client moved from "+clpos+" to "+newpos);\r
+ * clpos=newpos; } } }\r
+ * \r
+ * } coms = null; } }\r
+ */\r
+\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-public class CommandProcessor {
- /**
- * this is not getOPT!!!! - processes a *series* of space separated commands - some of which take arguments.
- */
- private Vector commands;
- /* static {
- ClientsFileTest.commands=new Vector();
- ClientsFileTest.commands.add(new String("add"));
- ClientsFileTest.commands.add(new String("remove"));
- ClientsFileTest.commands.add(new String("list"));
- ClientsFileTest.commands.add(new String("clear"));
- ClientsFileTest.commands.add(new String("watch"));
- ClientsFileTest.commands.add(new String("monitor"));
- } */
-
- public int addCommand(String cmd, int argneed, String complainString) {
- int cnum=0;
- if (commands==null)
- commands = new Vector();
- else
- cnum = commands.size();
- Vector cv = new Vector();
- cv.add(new String(cmd));
- cv.add(new Integer(argneed));
- cv.add(new String(complainString));
- commands.add(cv);
- return cnum;
- }
-
- /**
- * Integer argl, Integer argpos, String cmd, Integer argneed, String msg in vector
- */
- public void complainArgs(int argl, int argpos, Vector ca) {
- int argneed = ((Integer) ca.get(1)).intValue();
- if (argl-argpos<argneed)
- throw new Error(((String) ca.get(0))+" at position "+argpos+" needs "+argneed+" arguments : "+(String) ca.get(2));
- }
- /**
- * find and verify a command
- * @param args argstring
- * @param argpos position to check for command
- * @return matching command or -1
- */
- public int getCommand(String[]args, int argpos) {
- Iterator coms = commands.iterator();
- int com=-1, argc;
- argc=argpos;
- while ((coms!=null) && coms.hasNext()) {
- com++;
- Vector comnext = (Vector) coms.next();
- if (args[argc].toLowerCase().equals((String) comnext.get(0))) {
- if (comnext.size()>2)
- complainArgs(args.length, argc+1, comnext);
- return com;
- }
- }
- return -1;
-
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.util.Iterator;\r
+import java.util.Vector;\r
+\r
+public class CommandProcessor {\r
+ /**\r
+ * this is not getOPT!!!! - processes a *series* of space separated commands -\r
+ * some of which take arguments.\r
+ */\r
+ private Vector commands;\r
+\r
+ /*\r
+ * static { ClientsFileTest.commands=new Vector();\r
+ * ClientsFileTest.commands.add(new String("add"));\r
+ * ClientsFileTest.commands.add(new String("remove"));\r
+ * ClientsFileTest.commands.add(new String("list"));\r
+ * ClientsFileTest.commands.add(new String("clear"));\r
+ * ClientsFileTest.commands.add(new String("watch"));\r
+ * ClientsFileTest.commands.add(new String("monitor")); }\r
+ */\r
+\r
+ public int addCommand(String cmd, int argneed, String complainString) {\r
+ int cnum = 0;\r
+ if (commands == null)\r
+ commands = new Vector();\r
+ else\r
+ cnum = commands.size();\r
+ Vector cv = new Vector();\r
+ cv.add(new String(cmd));\r
+ cv.add(new Integer(argneed));\r
+ cv.add(new String(complainString));\r
+ commands.add(cv);\r
+ return cnum;\r
+ }\r
+\r
+ /**\r
+ * Integer argl, Integer argpos, String cmd, Integer argneed, String msg in\r
+ * vector\r
+ */\r
+ public void complainArgs(int argl, int argpos, Vector ca) {\r
+ int argneed = ((Integer) ca.get(1)).intValue();\r
+ if (argl - argpos < argneed)\r
+ throw new Error(((String) ca.get(0)) + " at position " + argpos\r
+ + " needs " + argneed + " arguments : " + (String) ca.get(2));\r
+ }\r
+\r
+ /**\r
+ * find and verify a command\r
+ * \r
+ * @param args\r
+ * argstring\r
+ * @param argpos\r
+ * position to check for command\r
+ * @return matching command or -1\r
+ */\r
+ public int getCommand(String[] args, int argpos) {\r
+ Iterator coms = commands.iterator();\r
+ int com = -1, argc;\r
+ argc = argpos;\r
+ while ((coms != null) && coms.hasNext()) {\r
+ com++;\r
+ Vector comnext = (Vector) coms.next();\r
+ if (args[argc].toLowerCase().equals((String) comnext.get(0))) {\r
+ if (comnext.size() > 2)\r
+ complainArgs(args.length, argc + 1, comnext);\r
+ return com;\r
+ }\r
+ }\r
+ return -1;\r
+\r
+ }\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.File;
-
-import uk.ac.vamsas.client.simpleclient.SessionUrn;
-
-/**
- * Tests simple client sessionURN creation
- *
- *
- */
-public class TestSessionURN {
-
- public static void main (String [] arg) throws Exception
- {
- String file = null;
- if (arg == null || arg.length ==0)
- file = ".";
- else
- file = arg[0];
-
- File f = new File (file);
- SessionUrn urn = new SessionUrn(f);
- System.out.println("urn "+urn.getSessionUrn());
- System.out.println("urn file "+ urn.asFile().getAbsolutePath());
- System.out.println("urn file exists?"+ urn.asFile().exists());
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.File;\r
+\r
+import uk.ac.vamsas.client.simpleclient.SessionUrn;\r
+\r
+/**\r
+ * Tests simple client sessionURN creation\r
+ * \r
+ * \r
+ */\r
+public class TestSessionURN {\r
+\r
+ public static void main(String[] arg) throws Exception {\r
+ String file = null;\r
+ if (arg == null || arg.length == 0)\r
+ file = ".";\r
+ else\r
+ file = arg[0];\r
+\r
+ File f = new File(file);\r
+ SessionUrn urn = new SessionUrn(f);\r
+ System.out.println("urn " + urn.getSessionUrn());\r
+ System.out.println("urn file " + urn.asFile().getAbsolutePath());\r
+ System.out.println("urn file exists?" + urn.asFile().exists());\r
+ }\r
+\r
+}\r
-package uk.ac.vamsas.test.simpleclient;
-
-import java.io.File;
-import java.io.ObjectOutputStream;
-import java.io.RandomAccessFile;
-import java.util.jar.JarFile;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import uk.ac.vamsas.client.simpleclient.Lock;
-import uk.ac.vamsas.client.simpleclient.SessionFile;
-import uk.ac.vamsas.client.simpleclient.SimpleDocument;
-import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;
-import uk.ac.vamsas.client.simpleclient.VamsasFile;
-import uk.ac.vamsas.objects.core.ApplicationData;
-import uk.ac.vamsas.objects.core.User;
-import uk.ac.vamsas.objects.core.VAMSAS;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-import uk.ac.vamsas.test.objects.Core;
-
-public class VamsasArchive {
- /**
- * test the org.vamsas.simpleclient.vamsasArchive class
- */
- static Log log = LogFactory.getLog(VamsasArchive.class);
- public static ApplicationData makeDemoAppdata(uk.ac.vamsas.client.simpleclient.VamsasArchive va, String apname, String userName, String userOrg) {
- if (va==null)
- return null;
- VamsasArchiveReader vread=null;
- try {
- vread = va.getOriginalArchiveReader();
- }
- catch (Exception e) {
- log.error("Failed to get original archive reader!",e);
- return null;
- }
- ApplicationData appdata = new ApplicationData();
- appdata.setName("uk.ac.vamsas.test.simpleclient.VamsasArchive");
- appdata.setData(new String("this is some test data.").getBytes());
- User apuser = new User();
- apuser.setFullname(userName);
- apuser.setOrganization(userOrg);
- String appdata_ref = "vamsas:"+apname+"/"+apuser.getOrganization()+"/"+apuser.getFullname();
- SimpleDocument sdoc = new SimpleDocument("test.simpleclient.VamsasArchive");
- if (vread!=null) {
- VamsasDocument orignalnew;
- try {
- orignalnew = sdoc.getVamsasDocument(vread);
- log.info("*** Dump follows ***");
-
- ArchiveReports.reportDocument(orignalnew, vread, false, System.out);
- log.info("*** Dump precedes ***");
- } catch (Exception e) {
- log.info("makeDemoAppdata: Problems accessing original document");
- }
-
- log.info("Reading (and avoiding references to) original data");
- if (vread.getAppdataStream(appdata_ref)!=null) {
- // transfer over
- try {
- va.transferAppDataEntry(appdata_ref);
- } catch (Exception e) {
- log.warn("Exception when transferring appdata reference : "+appdata_ref, e);
- }
- int i=0;
- while (vread.getAppdataStream(appdata_ref+"/"+Integer.toString(++i))!=null) {
- try {
- // copy over another duplicate.
- va.transferAppDataEntry(appdata_ref+"/"+Integer.toString(i));
- } catch (Exception e) {
- log.warn("Exception when transferring appdata reference : "+appdata_ref, e);
- }
- }
- // this one must be unique!
- appdata_ref+="/"+Integer.toString(i);
- }
- }
-
- log.info("Adding new data stuff.");
- log.info("Writing an apdata reference using AppDataStream interface.");
- apuser.setDataReference(appdata_ref);
- appdata.addUser(apuser);
- appdata.setVersion("noggin");
- //TODO: write instance appdata appdata.setUrn("program:/the.nog/");
- try {
- ObjectOutputStream ost = new ObjectOutputStream(va.getAppDataStream(appdata_ref));
- ost.writeObject(appdata);
- ost.close();
- } catch (Exception e) {
- log.warn("Couldn't write appdata reference "+appdata_ref);
- }
- return appdata;
- }
- public static void main(String args[]) {
-
- try {
- File av;
- if (args.length>0)
- av = new File(args[0]);
- else
- av = new File("test/vamsas.zip");
- try {
- RandomAccessFile raf = new RandomAccessFile(av, "r");
- raf.readByte();
- raf.close();
- } catch (Exception f)
- {
- log.info("Couldn't random access file archive "+av, f);
- }
- try {
- JarFile jf = new JarFile(av, true, JarFile.OPEN_READ);
- if (jf.getEntry("vamsasDocument.xml")!=null)
- {
- log.info("Valid archive (sun) "+av);
- }
- jf.close();
- } catch (Exception f)
- {
- log.warn("Couldn't access jar archive with sun jartools: "+av, f);
- }
- try {
- org.apache.tools.zip.ZipFile jf = new org.apache.tools.zip.ZipFile(av);
- if (jf.getEntry("vamsasDocument.xml")!=null)
- {
- log.info("Valid archive (apache) "+av);
- }
- jf.close();
- } catch (Exception f)
- {
- log.warn("Couldn't access jar archive with apache ziptool: "+av,f);
- }
-
- log.info("Opening archive "+av);
- uk.ac.vamsas.client.simpleclient.VamsasArchive varchive = new uk.ac.vamsas.client.simpleclient.VamsasArchive(av, true);
-
- VAMSAS[] roots = (VAMSAS[]) varchive.getOriginalRoots();
-
- if (roots!=null) {
- log.info("Report on Original roots in archive:");
- ArchiveReports.rootReport(roots, true, System.out);
- }
- log.info("Getting current vamsas document.");
- VamsasDocument doc = varchive.getVamsasDocument();
- ArchiveReports.reportDocument(doc, varchive.getOriginalArchiveReader(), true, System.out); // not modified document so references will still be valid
- // do some stuff
- log.info("Retrieving backup");
- File backup = varchive.backupFile();
- if (backup==null)
- log.info(av+" is a New Archive.");
- else
- log.info(av+" has been backed up as "+backup);
- File newf=new File(av.getAbsolutePath()+"_new.zip");
- VamsasFile sfile = new VamsasFile(newf);
- /* if (newf.exists()) {
- int q=1;
- do {
- newf=new File(av.getAbsolutePath()+"_"+q+++"_new.zip");
- }
- while (newf.exists());
- } */
- if (newf.exists()) {
- log.info("Removing existing "+newf);
- newf.delete();
- }
-
- log.info("Now writing new Archive into "+newf.getAbsolutePath());
- uk.ac.vamsas.client.simpleclient.VamsasArchive va=null;
- { // hold lock over deletion and write of new archive.
- //Lock wlock = sfile.getLock();
- //newf.delete(); // clear out old file.
- sfile.getLock();
- va = new uk.ac.vamsas.client.simpleclient.VamsasArchive(newf, true, true, sfile);
- // open another and...
- ApplicationData appdata = makeDemoAppdata(va,
- "uk.ac.vamsas.test.simpleclient.VamsasArchive", "arnold Bugger esq", "disOrganised");
- log.info("Preparing to write new document.");
- doc.addApplicationData(appdata);
- doc.addVAMSAS(Core.getDemoVamsas());
- va.putVamsasDocument(doc); // gets stream and puts it.
- va.closeArchive();
- sfile.unLock();
- }
- log.info("Dump of new vamsas document :");
- log.info("Testing update: ");
- {
- Lock lock=sfile.getLock();
- if (lock==null)
- while ((lock=sfile.getLock())==null) {
- log.info("Waiting for lock.");
- Thread.sleep(100);
- }
- VamsasArchiveReader vreader = new VamsasArchiveReader(sfile.getVamsasFile());// lock); // cannot do new JarFile on a locked file. // newf);
- SimpleDocument sdoc = new SimpleDocument("testing new vamsas write");
- ArchiveReports.reportDocument(sdoc.getVamsasDocument(vreader), vreader, true, System.out);
- sfile.unLock();
- }
- // backup.delete(); // tidy up
-
- log.info("Now Cancelling write to original archive "+av);
- if (varchive.cancelArchive())
- log.info("Successfully cancelled.");
- else
- log.info("Didn't cancel.");
- long t=System.currentTimeMillis()+200; while (t>System.currentTimeMillis());
- log.info("Now testing archive update.");
- va = new uk.ac.vamsas.client.simpleclient.VamsasArchive(newf, false, true, sfile);
- doc = va.getVamsasDocument();
- doc.addVAMSAS(Core.getDemoVamsas());
- doc.addApplicationData(makeDemoAppdata(va,
- "uk.ac.vamsas.test.simpleclient.VamsasArchive", "another old Bugger esq", "rescinded"));
- if (va.transferRemainingAppDatas())
- log.info("Remain appdatas were transferred.");
- else
- log.warn("No appdatas were transferred. This is wrong.");
- va.putVamsasDocument(doc);
- va.closeArchive();
- sfile.unLock();
- log.info("Testing update: ");
- {
- Lock lock=sfile.getLock();
- if (lock==null)
- while ((lock=sfile.getLock())==null)
- log.info("Waiting for lock.");
- // VamsasArchiveReader vreader = new VamsasArchiveReader(lock);
- VamsasArchiveReader vreader = new VamsasArchiveReader(newf);
-
- SimpleDocument sdoc = new SimpleDocument("testing vamsas update");
- VamsasDocument finaldoc = sdoc.getVamsasDocument(vreader);
- if (finaldoc!=null)
- ArchiveReports.reportDocument(finaldoc, vreader, true, System.out);
- else
- log.error("Null Document Read from "+newf);
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.ObjectOutputStream;\r
+import java.io.RandomAccessFile;\r
+import java.util.jar.JarFile;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+import uk.ac.vamsas.client.simpleclient.Lock;\r
+import uk.ac.vamsas.client.simpleclient.SessionFile;\r
+import uk.ac.vamsas.client.simpleclient.SimpleDocument;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchiveReader;\r
+import uk.ac.vamsas.client.simpleclient.VamsasFile;\r
+import uk.ac.vamsas.objects.core.ApplicationData;\r
+import uk.ac.vamsas.objects.core.User;\r
+import uk.ac.vamsas.objects.core.VAMSAS;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+import uk.ac.vamsas.test.objects.Core;\r
+\r
+public class VamsasArchive {\r
+ /**\r
+ * test the org.vamsas.simpleclient.vamsasArchive class\r
+ */\r
+ static Log log = LogFactory.getLog(VamsasArchive.class);\r
+\r
+ public static ApplicationData makeDemoAppdata(\r
+ uk.ac.vamsas.client.simpleclient.VamsasArchive va, String apname,\r
+ String userName, String userOrg) {\r
+ if (va == null)\r
+ return null;\r
+ VamsasArchiveReader vread = null;\r
+ try {\r
+ vread = va.getOriginalArchiveReader();\r
+ } catch (Exception e) {\r
+ log.error("Failed to get original archive reader!", e);\r
+ return null;\r
+ }\r
+ ApplicationData appdata = new ApplicationData();\r
+ appdata.setName("uk.ac.vamsas.test.simpleclient.VamsasArchive");\r
+ appdata.setData(new String("this is some test data.").getBytes());\r
+ User apuser = new User();\r
+ apuser.setFullname(userName);\r
+ apuser.setOrganization(userOrg);\r
+ String appdata_ref = "vamsas:" + apname + "/" + apuser.getOrganization()\r
+ + "/" + apuser.getFullname();\r
+ SimpleDocument sdoc = new SimpleDocument("test.simpleclient.VamsasArchive");\r
+ if (vread != null) {\r
+ VamsasDocument orignalnew;\r
+ try {\r
+ orignalnew = sdoc.getVamsasDocument(vread);\r
+ log.info("*** Dump follows ***");\r
+\r
+ ArchiveReports.reportDocument(orignalnew, vread, false, System.out);\r
+ log.info("*** Dump precedes ***");\r
+ } catch (Exception e) {\r
+ log.info("makeDemoAppdata: Problems accessing original document");\r
+ }\r
+\r
+ log.info("Reading (and avoiding references to) original data");\r
+ if (vread.getAppdataStream(appdata_ref) != null) {\r
+ // transfer over\r
+ try {\r
+ va.transferAppDataEntry(appdata_ref);\r
+ } catch (Exception e) {\r
+ log.warn("Exception when transferring appdata reference : "\r
+ + appdata_ref, e);\r
+ }\r
+ int i = 0;\r
+ while (vread\r
+ .getAppdataStream(appdata_ref + "/" + Integer.toString(++i)) != null) {\r
+ try {\r
+ // copy over another duplicate.\r
+ va.transferAppDataEntry(appdata_ref + "/" + Integer.toString(i));\r
+ } catch (Exception e) {\r
+ log.warn("Exception when transferring appdata reference : "\r
+ + appdata_ref, e);\r
+ }\r
+ }\r
+ // this one must be unique!\r
+ appdata_ref += "/" + Integer.toString(i);\r
+ }\r
+ }\r
+\r
+ log.info("Adding new data stuff.");\r
+ log.info("Writing an apdata reference using AppDataStream interface.");\r
+ apuser.setDataReference(appdata_ref);\r
+ appdata.addUser(apuser);\r
+ appdata.setVersion("noggin");\r
+ // TODO: write instance appdata appdata.setUrn("program:/the.nog/");\r
+ try {\r
+ ObjectOutputStream ost = new ObjectOutputStream(va\r
+ .getAppDataStream(appdata_ref));\r
+ ost.writeObject(appdata);\r
+ ost.close();\r
+ } catch (Exception e) {\r
+ log.warn("Couldn't write appdata reference " + appdata_ref);\r
+ }\r
+ return appdata;\r
+ }\r
+\r
+ public static void main(String args[]) {\r
+\r
+ try {\r
+ File av;\r
+ if (args.length > 0)\r
+ av = new File(args[0]);\r
+ else\r
+ av = new File("test/vamsas.zip");\r
+ try {\r
+ RandomAccessFile raf = new RandomAccessFile(av, "r");\r
+ raf.readByte();\r
+ raf.close();\r
+ } catch (Exception f) {\r
+ log.info("Couldn't random access file archive " + av, f);\r
+ }\r
+ try {\r
+ JarFile jf = new JarFile(av, true, JarFile.OPEN_READ);\r
+ if (jf.getEntry("vamsasDocument.xml") != null) {\r
+ log.info("Valid archive (sun) " + av);\r
+ }\r
+ jf.close();\r
+ } catch (Exception f) {\r
+ log.warn("Couldn't access jar archive with sun jartools: " + av, f);\r
+ }\r
+ try {\r
+ org.apache.tools.zip.ZipFile jf = new org.apache.tools.zip.ZipFile(av);\r
+ if (jf.getEntry("vamsasDocument.xml") != null) {\r
+ log.info("Valid archive (apache) " + av);\r
+ }\r
+ jf.close();\r
+ } catch (Exception f) {\r
+ log.warn("Couldn't access jar archive with apache ziptool: " + av, f);\r
+ }\r
+\r
+ log.info("Opening archive " + av);\r
+ uk.ac.vamsas.client.simpleclient.VamsasArchive varchive = new uk.ac.vamsas.client.simpleclient.VamsasArchive(\r
+ av, true);\r
+\r
+ VAMSAS[] roots = (VAMSAS[]) varchive.getOriginalRoots();\r
+\r
+ if (roots != null) {\r
+ log.info("Report on Original roots in archive:");\r
+ ArchiveReports.rootReport(roots, true, System.out);\r
+ }\r
+ log.info("Getting current vamsas document.");\r
+ VamsasDocument doc = varchive.getVamsasDocument();\r
+ ArchiveReports.reportDocument(doc, varchive.getOriginalArchiveReader(),\r
+ true, System.out); // not modified document so references will still\r
+ // be valid\r
+ // do some stuff\r
+ log.info("Retrieving backup");\r
+ File backup = varchive.backupFile();\r
+ if (backup == null)\r
+ log.info(av + " is a New Archive.");\r
+ else\r
+ log.info(av + " has been backed up as " + backup);\r
+ File newf = new File(av.getAbsolutePath() + "_new.zip");\r
+ VamsasFile sfile = new VamsasFile(newf);\r
+ /*\r
+ * if (newf.exists()) { int q=1; do { newf=new\r
+ * File(av.getAbsolutePath()+"_"+q+++"_new.zip"); } while (newf.exists());\r
+ * }\r
+ */\r
+ if (newf.exists()) {\r
+ log.info("Removing existing " + newf);\r
+ newf.delete();\r
+ }\r
+\r
+ log.info("Now writing new Archive into " + newf.getAbsolutePath());\r
+ uk.ac.vamsas.client.simpleclient.VamsasArchive va = null;\r
+ { // hold lock over deletion and write of new archive.\r
+ // Lock wlock = sfile.getLock();\r
+ // newf.delete(); // clear out old file.\r
+ sfile.getLock();\r
+ va = new uk.ac.vamsas.client.simpleclient.VamsasArchive(newf, true,\r
+ true, sfile);\r
+ // open another and...\r
+ ApplicationData appdata = makeDemoAppdata(va,\r
+ "uk.ac.vamsas.test.simpleclient.VamsasArchive",\r
+ "arnold Bugger esq", "disOrganised");\r
+ log.info("Preparing to write new document.");\r
+ doc.addApplicationData(appdata);\r
+ doc.addVAMSAS(Core.getDemoVamsas());\r
+ va.putVamsasDocument(doc); // gets stream and puts it.\r
+ va.closeArchive();\r
+ sfile.unLock();\r
+ }\r
+ log.info("Dump of new vamsas document :");\r
+ log.info("Testing update: ");\r
+ {\r
+ Lock lock = sfile.getLock();\r
+ if (lock == null)\r
+ while ((lock = sfile.getLock()) == null) {\r
+ log.info("Waiting for lock.");\r
+ Thread.sleep(100);\r
+ }\r
+ VamsasArchiveReader vreader = new VamsasArchiveReader(sfile\r
+ .getVamsasFile());// lock); // cannot do new JarFile on a locked\r
+ // file. // newf);\r
+ SimpleDocument sdoc = new SimpleDocument("testing new vamsas write");\r
+ ArchiveReports.reportDocument(sdoc.getVamsasDocument(vreader), vreader,\r
+ true, System.out);\r
+ sfile.unLock();\r
+ }\r
+ // backup.delete(); // tidy up\r
+\r
+ log.info("Now Cancelling write to original archive " + av);\r
+ if (varchive.cancelArchive())\r
+ log.info("Successfully cancelled.");\r
+ else\r
+ log.info("Didn't cancel.");\r
+ long t = System.currentTimeMillis() + 200;\r
+ while (t > System.currentTimeMillis())\r
+ ;\r
+ log.info("Now testing archive update.");\r
+ va = new uk.ac.vamsas.client.simpleclient.VamsasArchive(newf, false,\r
+ true, sfile);\r
+ doc = va.getVamsasDocument();\r
+ doc.addVAMSAS(Core.getDemoVamsas());\r
+ doc.addApplicationData(makeDemoAppdata(va,\r
+ "uk.ac.vamsas.test.simpleclient.VamsasArchive",\r
+ "another old Bugger esq", "rescinded"));\r
+ if (va.transferRemainingAppDatas())\r
+ log.info("Remain appdatas were transferred.");\r
+ else\r
+ log.warn("No appdatas were transferred. This is wrong.");\r
+ va.putVamsasDocument(doc);\r
+ va.closeArchive();\r
+ sfile.unLock();\r
+ log.info("Testing update: ");\r
+ {\r
+ Lock lock = sfile.getLock();\r
+ if (lock == null)\r
+ while ((lock = sfile.getLock()) == null)\r
+ log.info("Waiting for lock.");\r
+ // VamsasArchiveReader vreader = new VamsasArchiveReader(lock);\r
+ VamsasArchiveReader vreader = new VamsasArchiveReader(newf);\r
+\r
+ SimpleDocument sdoc = new SimpleDocument("testing vamsas update");\r
+ VamsasDocument finaldoc = sdoc.getVamsasDocument(vreader);\r
+ if (finaldoc != null)\r
+ ArchiveReports.reportDocument(finaldoc, vreader, true, System.out);\r
+ else\r
+ log.error("Null Document Read from " + newf);\r
+ }\r
+ } catch (Exception e) {\r
+ e.printStackTrace(System.err);\r
+ }\r
+ }\r
+}\r
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
package uk.ac.vamsas.test.simpleclient;\r
\r
import java.io.File;\r
import java.util.jar.JarFile;\r
+\r
/**\r
- * really simple test to see if we can open an archive and test for the existence of\r
- * an entry called vamssDocument.xml.\r
+ * really simple test to see if we can open an archive and test for the\r
+ * existence of an entry called vamssDocument.xml.\r
* \r
- * 'Pathological' archives fail this test (due to things like funny characters or lots of '.' in the entry name.\r
+ * 'Pathological' archives fail this test (due to things like funny characters\r
+ * or lots of '.' in the entry name.\r
* \r
* @author JimP\r
- *\r
+ * \r
*/\r
public class ZipTest {\r
\r
/**\r
- * @param args single filename as an argument to open as a Jar file.\r
+ * @param args\r
+ * single filename as an argument to open as a Jar file.\r
*/\r
public static void main(String[] args) {\r
File av = new File(args[0]);\r
- boolean jfailed=false;\r
+ boolean jfailed = false;\r
try {\r
JarFile jf = new JarFile(av, false, JarFile.OPEN_READ);\r
- if (jf.getEntry("vamsasDocument.xml")!=null)\r
- {\r
- System.out.println("Valid archive "+av);\r
+ if (jf.getEntry("vamsasDocument.xml") != null) {\r
+ System.out.println("Valid archive " + av);\r
}\r
jf.close();\r
return;\r
- } catch (Exception f)\r
- {\r
- System.out.println("Couldn't access jar archive "+av);\r
+ } catch (Exception f) {\r
+ System.out.println("Couldn't access jar archive " + av);\r
f.printStackTrace(System.out);\r
}\r
try {\r
System.out.println("Trying the Apache Zip Package:");\r
org.apache.tools.zip.ZipFile jf = new org.apache.tools.zip.ZipFile(av);\r
- if (jf.getEntry("vamsasDocument.xml")!=null)\r
- {\r
- System.out.println("Valid archive "+av);\r
+ if (jf.getEntry("vamsasDocument.xml") != null) {\r
+ System.out.println("Valid archive " + av);\r
}\r
jf.close();\r
- } catch (Exception f)\r
- {\r
- System.out.println("Couldn't access jar archive "+av);\r
+ } catch (Exception f) {\r
+ System.out.println("Couldn't access jar archive " + av);\r
f.printStackTrace(System.out);\r
}\r
}\r
-/**
- *
- */
-package uk.ac.vamsas.test.simpleclient.simpleapp;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.IdentityHashMap;
-import java.util.Vector;
-import java.util.jar.JarOutputStream;
-
-import javax.swing.JInternalFrame;
-
-
-import uk.ac.vamsas.client.UserHandle;
-import uk.ac.vamsas.client.simpleclient.FileWatcher;
-import uk.ac.vamsas.client.simpleclient.VamsasArchive;
-import uk.ac.vamsas.client.simpleclient.VamsasFile;
-import uk.ac.vamsas.objects.core.Entry;
-import uk.ac.vamsas.objects.core.VamsasDocument;
-import uk.ac.vamsas.test.simpleclient.ArchiveClient;
-import uk.ac.vamsas.test.simpleclient.ClientDoc;
-
-/**
- * @author jimp
- *
- */
-public class VamsasClient extends ArchiveClient {
- org.apache.commons.logging.Log log=org.apache.commons.logging.LogFactory.getLog(VamsasClient.class);
- /**
- * create a new vamsas client session from the archive at sessionPath.
- * @param sessionPath
- */
- public VamsasClient(File sessionPath) {
- super(System.getProperty("user.name"),System.getProperty("host.name"), "SimpleVamsasClientApp","0.1",
- sessionPath);
- }
- /**
- * Called by gui to read anything from the vamsas session into the apps datamodel
- * after it has started up.
- *
- */
- public void initial_update() {
- log.info("Jalview loading the Vamsas Session.");
- // load in the vamsas archive for the first time
- ClientDoc cdoc = this.getUpdateable();
- updateJalview(cdoc);
- // TODO: flush any new VorbaIds to the document : updateVamsasClient may actually generate new Vamsas Document data in the form of vamsas element ids - these should be written back to the document.
- //doUpdate(cdoc); // JBPNote: this should flush new VorbaIds but I've not tested it yet.
- cdoc.closeDoc();
- // then tell app to update its display based on the datamodel changes.
- }
- VamsasClientWatcher watcher=null;
- /**
- * Called by app when internal datamodel should exported (syncrhonised outwards) to vamsas document
- *
- */
- public void push_update() {
-
- watchForChange=false; // this makes any watch(long) loops return.
- // we should also wait arount for this.WATCH_SLEEP to really make sure the watcher thread has stopped.
- try {
- Thread.sleep(WATCH_SLEEP);
- } catch (Exception e) {
-
- };
-
- ClientDoc cdoc = getUpdateable();
- updateVamsasDocument(cdoc);
- doUpdate(cdoc);
- cdoc.closeDoc();
- cdoc=null;
- watchForChange=true;
- startWatcher();
- }
- public void end_session() {
- watchForChange=false; // this makes any watch(long) loops return.
- // we should also wait arount for this.WATCH_SLEEP to really make sure the watcher thread has stopped.
- try {
- Thread.sleep(WATCH_SLEEP);
- } catch (Exception e) {
-
- };
-
- // stop any update/watcher thread.
- log.info("VamsasClientApplication disconnecting from the Vamsas Session.");
- }
- public void updateJalview(ClientDoc cdoc) {
- ensureVamsasBindings();
- VamsasDatastore vds = new VamsasDatastore(cdoc, vobj2jv, jv2vobj, baseProvEntry());
- vds.updateToJalview();
- }
- private void ensureVamsasBindings() {
- if (jv2vobj==null) {
- jv2vobj = new IdentityHashMap();
- vobj2jv = new Hashtable();
- }
- }
- /**
- * App's object binding to VorbaIds
- */
- IdentityHashMap jv2vobj = null;
- Hashtable vobj2jv = null;
- /**
- * called with a vamsas document which will be updated with new data from the app
- * @param doc
- */
- public void updateVamsasDocument(ClientDoc doc) {
- ensureVamsasBindings();
- VamsasDatastore vds = new VamsasDatastore(doc, vobj2jv, jv2vobj, baseProvEntry());
- // wander through frames
- vds.storeVAMSAS(new Object()); // Object is the apps datamodel ;)
- }
- /**
- *
- * @return a base provenance entry used by the VamsasDatastore object to get attributes from. this isn't particularly elegant either.
- */
- private Entry baseProvEntry() {
- uk.ac.vamsas.objects.core.Entry pentry = new uk.ac.vamsas.objects.core.Entry();
- pentry.setUser(this.getProvenanceUser());
- pentry.setApp(this.getClientHandle().getClientName());
- pentry.setDate(new java.util.Date());
- pentry.setAction("created");
- return pentry;
- }
- protected class VamsasClientWatcher extends Thread implements Runnable {
- /* (non-Javadoc)
- * @see java.lang.Thread#run()
- */
- VamsasClient client=null;
- VamsasClientWatcher(VamsasClient client) {
- this.client = client;
- }
- boolean running=false;
- public void run() {
- running=true;
- while (client.watchForChange) {
- ClientDoc docio = client.watch(0);
- if (docio!=null) {
- // VamsasClient GUI bits should be disabled whilst an update is in progress so the user doesn't screw anything up.
- client.disableGui(true);
- log.debug("Updating VamsasClient app from changed vamsas document.");
- client.updateJalview(docio);
- log.debug("Finished updating from document change.");
- docio.closeDoc();
- docio=null;
- client.disableGui(false);
- }
- }
- running=false;
-
- }
-
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
- /**
- * disable (if b is true) or enable (if b is true) the VamsasClient's vamsas session gui bits whilst a document change is being updated to the app.
- * @param b
- */
- public void disableGui(boolean b) {
- // in jalview, we turn off the VAMSAS Session menu : Desktop.instance.setVamsasUpdate(b);
- }
- /**
- * spawn a new thread to start the VamsasClientWatcher.
- *
- */
- public void startWatcher() {
- if (watcher==null)
- watcher=new VamsasClientWatcher(this);
- Thread thr = new Thread() {
- public void run() {
- watcher.start();
- }
- };
- thr.start();
- }
-
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.test.simpleclient.simpleapp;\r
+\r
+import java.io.File;\r
+import java.io.FileOutputStream;\r
+import java.io.OutputStreamWriter;\r
+import java.io.PrintWriter;\r
+import java.util.Hashtable;\r
+import java.util.IdentityHashMap;\r
+import java.util.Vector;\r
+import java.util.jar.JarOutputStream;\r
+\r
+import javax.swing.JInternalFrame;\r
+\r
+import uk.ac.vamsas.client.UserHandle;\r
+import uk.ac.vamsas.client.simpleclient.FileWatcher;\r
+import uk.ac.vamsas.client.simpleclient.VamsasArchive;\r
+import uk.ac.vamsas.client.simpleclient.VamsasFile;\r
+import uk.ac.vamsas.objects.core.Entry;\r
+import uk.ac.vamsas.objects.core.VamsasDocument;\r
+import uk.ac.vamsas.test.simpleclient.ArchiveClient;\r
+import uk.ac.vamsas.test.simpleclient.ClientDoc;\r
+\r
+/**\r
+ * @author jimp\r
+ * \r
+ */\r
+public class VamsasClient extends ArchiveClient {\r
+ org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getLog(VamsasClient.class);\r
+\r
+ /**\r
+ * create a new vamsas client session from the archive at sessionPath.\r
+ * \r
+ * @param sessionPath\r
+ */\r
+ public VamsasClient(File sessionPath) {\r
+ super(System.getProperty("user.name"), System.getProperty("host.name"),\r
+ "SimpleVamsasClientApp", "0.1", sessionPath);\r
+ }\r
+\r
+ /**\r
+ * Called by gui to read anything from the vamsas session into the apps\r
+ * datamodel after it has started up.\r
+ * \r
+ */\r
+ public void initial_update() {\r
+ log.info("Jalview loading the Vamsas Session.");\r
+ // load in the vamsas archive for the first time\r
+ ClientDoc cdoc = this.getUpdateable();\r
+ updateJalview(cdoc);\r
+ // TODO: flush any new VorbaIds to the document : updateVamsasClient may\r
+ // actually generate new Vamsas Document data in the form of vamsas element\r
+ // ids - these should be written back to the document.\r
+ // doUpdate(cdoc); // JBPNote: this should flush new VorbaIds but I've not\r
+ // tested it yet.\r
+ cdoc.closeDoc();\r
+ // then tell app to update its display based on the datamodel changes.\r
+ }\r
+\r
+ VamsasClientWatcher watcher = null;\r
+\r
+ /**\r
+ * Called by app when internal datamodel should exported (syncrhonised\r
+ * outwards) to vamsas document\r
+ * \r
+ */\r
+ public void push_update() {\r
+\r
+ watchForChange = false; // this makes any watch(long) loops return.\r
+ // we should also wait arount for this.WATCH_SLEEP to really make sure the\r
+ // watcher thread has stopped.\r
+ try {\r
+ Thread.sleep(WATCH_SLEEP);\r
+ } catch (Exception e) {\r
+\r
+ }\r
+ ;\r
+\r
+ ClientDoc cdoc = getUpdateable();\r
+ updateVamsasDocument(cdoc);\r
+ doUpdate(cdoc);\r
+ cdoc.closeDoc();\r
+ cdoc = null;\r
+ watchForChange = true;\r
+ startWatcher();\r
+ }\r
+\r
+ public void end_session() {\r
+ watchForChange = false; // this makes any watch(long) loops return.\r
+ // we should also wait arount for this.WATCH_SLEEP to really make sure the\r
+ // watcher thread has stopped.\r
+ try {\r
+ Thread.sleep(WATCH_SLEEP);\r
+ } catch (Exception e) {\r
+\r
+ }\r
+ ;\r
+\r
+ // stop any update/watcher thread.\r
+ log.info("VamsasClientApplication disconnecting from the Vamsas Session.");\r
+ }\r
+\r
+ public void updateJalview(ClientDoc cdoc) {\r
+ ensureVamsasBindings();\r
+ VamsasDatastore vds = new VamsasDatastore(cdoc, vobj2jv, jv2vobj,\r
+ baseProvEntry());\r
+ vds.updateToJalview();\r
+ }\r
+\r
+ private void ensureVamsasBindings() {\r
+ if (jv2vobj == null) {\r
+ jv2vobj = new IdentityHashMap();\r
+ vobj2jv = new Hashtable();\r
+ }\r
+ }\r
+\r
+ /**\r
+ * App's object binding to VorbaIds\r
+ */\r
+ IdentityHashMap jv2vobj = null;\r
+\r
+ Hashtable vobj2jv = null;\r
+\r
+ /**\r
+ * called with a vamsas document which will be updated with new data from the\r
+ * app\r
+ * \r
+ * @param doc\r
+ */\r
+ public void updateVamsasDocument(ClientDoc doc) {\r
+ ensureVamsasBindings();\r
+ VamsasDatastore vds = new VamsasDatastore(doc, vobj2jv, jv2vobj,\r
+ baseProvEntry());\r
+ // wander through frames\r
+ vds.storeVAMSAS(new Object()); // Object is the apps datamodel ;)\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return a base provenance entry used by the VamsasDatastore object to get\r
+ * attributes from. this isn't particularly elegant either.\r
+ */\r
+ private Entry baseProvEntry() {\r
+ uk.ac.vamsas.objects.core.Entry pentry = new uk.ac.vamsas.objects.core.Entry();\r
+ pentry.setUser(this.getProvenanceUser());\r
+ pentry.setApp(this.getClientHandle().getClientName());\r
+ pentry.setDate(new java.util.Date());\r
+ pentry.setAction("created");\r
+ return pentry;\r
+ }\r
+\r
+ protected class VamsasClientWatcher extends Thread implements Runnable {\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see java.lang.Thread#run()\r
+ */\r
+ VamsasClient client = null;\r
+\r
+ VamsasClientWatcher(VamsasClient client) {\r
+ this.client = client;\r
+ }\r
+\r
+ boolean running = false;\r
+\r
+ public void run() {\r
+ running = true;\r
+ while (client.watchForChange) {\r
+ ClientDoc docio = client.watch(0);\r
+ if (docio != null) {\r
+ // VamsasClient GUI bits should be disabled whilst an update is in\r
+ // progress so the user doesn't screw anything up.\r
+ client.disableGui(true);\r
+ log.debug("Updating VamsasClient app from changed vamsas document.");\r
+ client.updateJalview(docio);\r
+ log.debug("Finished updating from document change.");\r
+ docio.closeDoc();\r
+ docio = null;\r
+ client.disableGui(false);\r
+ }\r
+ }\r
+ running = false;\r
+\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * @param args\r
+ */\r
+ public static void main(String[] args) {\r
+ // TODO Auto-generated method stub\r
+\r
+ }\r
+\r
+ /**\r
+ * disable (if b is true) or enable (if b is true) the VamsasClient's vamsas\r
+ * session gui bits whilst a document change is being updated to the app.\r
+ * \r
+ * @param b\r
+ */\r
+ public void disableGui(boolean b) {\r
+ // in jalview, we turn off the VAMSAS Session menu :\r
+ // Desktop.instance.setVamsasUpdate(b);\r
+ }\r
+\r
+ /**\r
+ * spawn a new thread to start the VamsasClientWatcher.\r
+ * \r
+ */\r
+ public void startWatcher() {\r
+ if (watcher == null)\r
+ watcher = new VamsasClientWatcher(this);\r
+ Thread thr = new Thread() {\r
+ public void run() {\r
+ watcher.start();\r
+ }\r
+ };\r
+ thr.start();\r
+ }\r
+\r
+}\r
/*\r
- * VamsasClientSimpleApp - A framework for interoparable Sequence analysis\r
- * Copyright (C) 2006 VAMSAS\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
-\r
package uk.ac.vamsas.test.simpleclient.simpleapp;\r
\r
-\r
-\r
import java.io.*;\r
import java.util.HashMap;\r
import java.util.HashSet;\r
*/\r
\r
public class VamsasDatastore {\r
- org.apache.commons.logging.Log log=org.apache.commons.logging.LogFactory.getLog(VamsasDatastore.class);\r
- Entry provEntry = null;\r
+ org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory\r
+ .getLog(VamsasDatastore.class);\r
\r
+ Entry provEntry = null;\r
\r
org.exolab.castor.types.Date date = new org.exolab.castor.types.Date(\r
new java.util.Date());\r
\r
public VamsasDatastore(ClientDoc cdoc, Hashtable vobj2jv,\r
IdentityHashMap jv2vobj, Entry provEntry) {\r
- this.cdoc = cdoc;\r
+ this.cdoc = cdoc;\r
this.vobj2jv = vobj2jv;\r
this.jv2vobj = jv2vobj;\r
this.provEntry = provEntry;\r
* \r
* marshaller.setMapping(map); marshaller.marshal(af); } catch (Exception e) {\r
* e.printStackTrace(); } }\r
- * \r
- * \r
*/\r
/**\r
* @return the Vobject bound to Jalview datamodel object\r
*/\r
protected Object getvObj2jv(uk.ac.vamsas.client.Vobject vobj) {\r
VorbaId id = vobj.getVorbaId();\r
- if (id == null)\r
- {\r
+ if (id == null) {\r
id = cdoc.registerObject(vobj);\r
- log\r
- .debug("Registering new object and returning null for getvObj2jv");\r
+ log.debug("Registering new object and returning null for getvObj2jv");\r
return null;\r
}\r
if (vobj2jv.containsKey(vobj.getVorbaId()))\r
\r
protected void bindjvvobj(Object jvobj, uk.ac.vamsas.client.Vobject vobj) {\r
VorbaId id = vobj.getVorbaId();\r
- if (id == null)\r
- {\r
+ if (id == null) {\r
id = cdoc.registerObject(vobj);\r
- if (id==null || vobj.getVorbaId()==null)\r
- log.error("Failed to get id for "+(vobj.isRegisterable() ? "registerable" : "unregisterable") +" object "+vobj);\r
+ if (id == null || vobj.getVorbaId() == null)\r
+ log.error("Failed to get id for "\r
+ + (vobj.isRegisterable() ? "registerable" : "unregisterable")\r
+ + " object " + vobj);\r
}\r
- if (vobj2jv.containsKey(vobj.getVorbaId()) || jv2vobj.containsKey(jvobj))\r
- {\r
- log.error("Duplicate object binding! "+vobj+" id " +vobj.getVorbaId().getId()+" to "+jvobj);\r
- }\r
- else\r
- {\r
+ if (vobj2jv.containsKey(vobj.getVorbaId()) || jv2vobj.containsKey(jvobj)) {\r
+ log.error("Duplicate object binding! " + vobj + " id "\r
+ + vobj.getVorbaId().getId() + " to " + jvobj);\r
+ } else {\r
vobj2jv.put(vobj.getVorbaId(), jvobj);// JBPNote - better implementing a\r
// hybrid invertible hash.\r
jv2vobj.put(jvobj, vobj.getVorbaId());\r
boolean nw = false;\r
VAMSAS root = null; // will be resolved based on Dataset Parent.\r
DataSet dataset = (DataSet) getjv2vObj(fromAppsDatamodel);\r
- if (dataset == null)\r
- {\r
+ if (dataset == null) {\r
root = cdoc.getVamsasRoots()[0]; // default vamsas root for modifying.\r
dataset = new DataSet();\r
root.addDataSet(dataset);\r
}\r
\r
private Property newProperty(String name, String type, String content) {\r
- Property vProperty=new Property();\r
+ Property vProperty = new Property();\r
vProperty.setName(name);\r
- if (type!=null)\r
+ if (type != null)\r
vProperty.setType(type);\r
vProperty.setContent(content);\r
return vProperty;\r
/**\r
* get start<end range of segment, adjusting for inclusivity flag and\r
* polarity.\r
- * \r
+ * \r
* @param visSeg\r
- * @param ensureDirection when true - always ensure start is less than end.\r
- * @return int[] { start, end, direction} where direction==1 for range running from end to start.\r
+ * @param ensureDirection\r
+ * when true - always ensure start is less than end.\r
+ * @return int[] { start, end, direction} where direction==1 for range running\r
+ * from end to start.\r
*/\r
private int[] getSegRange(Seg visSeg, boolean ensureDirection) {\r
boolean incl = visSeg.getInclusive();\r
// region.\r
int start = visSeg.getStart() + (incl ? 0 : pol);\r
int end = visSeg.getEnd() + (incl ? 0 : -pol);\r
- if (ensureDirection && pol==-1)\r
- {\r
+ if (ensureDirection && pol == -1) {\r
// jalview doesn't deal with inverted ranges, yet.\r
int t = end;\r
end = start;\r
start = t;\r
}\r
- return new int[] { start, end, pol<0 ? 1 : 0 };\r
+ return new int[] { start, end, pol < 0 ? 1 : 0 };\r
}\r
\r
public void updateToJalview() {\r
VAMSAS _roots[] = cdoc.getVamsasRoots();\r
\r
- for (int _root = 0; _root<_roots.length; _root++) {\r
+ for (int _root = 0; _root < _roots.length; _root++) {\r
VAMSAS root = _roots[_root];\r
- boolean newds=false;\r
- for (int _ds=0,_nds=root.getDataSetCount(); _ds<_nds; _ds++) {\r
+ boolean newds = false;\r
+ for (int _ds = 0, _nds = root.getDataSetCount(); _ds < _nds; _ds++) {\r
// ///////////////////////////////////\r
// ///LOAD DATASET\r
DataSet dataset = root.getDataSet(_ds);\r
int i, iSize = dataset.getSequenceCount();\r
Vector dsseqs;\r
Object appsdataset = (Object) getvObj2jv(dataset);\r
- int jremain=0;\r
- if (appsdataset==null) {\r
+ int jremain = 0;\r
+ if (appsdataset == null) {\r
log.debug("Initialising new dataset fields");\r
- newds=true;\r
- dsseqs=new Vector();\r
+ newds = true;\r
+ dsseqs = new Vector();\r
} else {\r
log.debug("Update dataset from vamsas dataset.");\r
}\r
- // etc for annotations, alignments, trees, etc. \r
+ // etc for annotations, alignments, trees, etc.\r
}\r
}\r
}\r
+\r
/**\r
* get real bounds of a RangeType's specification. start and end are an\r
- * inclusive range within which all segments and positions lie.\r
- * TODO: refactor to vamsas utils\r
+ * inclusive range within which all segments and positions lie. TODO: refactor\r
+ * to vamsas utils\r
+ * \r
* @param dseta\r
* @return int[] { start, end}\r
*/\r
private int[] getBounds(RangeType dseta) {\r
- if (dseta != null)\r
- {\r
+ if (dseta != null) {\r
int[] se = null;\r
- if (dseta.getSegCount()>0 && dseta.getPosCount()>0)\r
- throw new Error("Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
- if (dseta.getSegCount() > 0)\r
- {\r
- se = getSegRange(dseta.getSeg(0),true);\r
- for (int s = 1, sSize = dseta.getSegCount(); s < sSize; s++)\r
- {\r
+ if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)\r
+ throw new Error(\r
+ "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
+ if (dseta.getSegCount() > 0) {\r
+ se = getSegRange(dseta.getSeg(0), true);\r
+ for (int s = 1, sSize = dseta.getSegCount(); s < sSize; s++) {\r
int nse[] = getSegRange(dseta.getSeg(s), true);\r
if (se[0] > nse[0])\r
se[0] = nse[0];\r
se[1] = nse[1];\r
}\r
}\r
- if (dseta.getPosCount() > 0)\r
- {\r
- // could do a polarity for pos range too. and pass back indication of discontinuities.\r
+ if (dseta.getPosCount() > 0) {\r
+ // could do a polarity for pos range too. and pass back indication of\r
+ // discontinuities.\r
int pos = dseta.getPos(0).getI();\r
se = new int[] { pos, pos };\r
- for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)\r
- {\r
+ for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++) {\r
pos = dseta.getPos(p).getI();\r
if (se[0] > pos)\r
se[0] = pos;\r
}\r
return null;\r
}\r
+\r
/**\r
- * map from a rangeType's internal frame to the referenced object's coordinate frame.\r
+ * map from a rangeType's internal frame to the referenced object's coordinate\r
+ * frame.\r
+ * \r
* @param dseta\r
* @return int [] { ref(pos)...} for all pos in rangeType's frame.\r
*/\r
private int[] getMapping(RangeType dseta) {\r
- Vector posList=new Vector();\r
- if (dseta != null)\r
- {\r
+ Vector posList = new Vector();\r
+ if (dseta != null) {\r
int[] se = null;\r
- if (dseta.getSegCount()>0 && dseta.getPosCount()>0)\r
- throw new Error("Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
- if (dseta.getSegCount() > 0)\r
- {\r
- for (int s = 0, sSize = dseta.getSegCount(); s < sSize; s++)\r
- {\r
+ if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)\r
+ throw new Error(\r
+ "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
+ if (dseta.getSegCount() > 0) {\r
+ for (int s = 0, sSize = dseta.getSegCount(); s < sSize; s++) {\r
se = getSegRange(dseta.getSeg(s), false);\r
- int se_end=se[1-se[2]]+(se[2]==0 ? 1 : -1);\r
- for (int p=se[se[2]]; p!=se_end; p+=se[2]==0 ? 1 : -1 ) {\r
+ int se_end = se[1 - se[2]] + (se[2] == 0 ? 1 : -1);\r
+ for (int p = se[se[2]]; p != se_end; p += se[2] == 0 ? 1 : -1) {\r
posList.add(new Integer(p));\r
}\r
}\r
- } \r
- else if (dseta.getPosCount() > 0)\r
- {\r
+ } else if (dseta.getPosCount() > 0) {\r
int pos = dseta.getPos(0).getI();\r
\r
- for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)\r
- {\r
+ for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++) {\r
pos = dseta.getPos(p).getI();\r
posList.add(new Integer(pos));\r
}\r
}\r
}\r
- if (posList!=null && posList.size()>0) {\r
- int[] range=new int[posList.size()];\r
- for (int i=0; i<range.length; i++)\r
- range[i] = ((Integer)posList.elementAt(i)).intValue();\r
+ if (posList != null && posList.size() > 0) {\r
+ int[] range = new int[posList.size()];\r
+ for (int i = 0; i < range.length; i++)\r
+ range[i] = ((Integer) posList.elementAt(i)).intValue();\r
posList.clear();\r
return range;\r
}\r
return null;\r
}\r
+\r
/**\r
* \r
- * @return default initial provenance list for a VamsasDatastore created vamsas\r
- * object.\r
+ * @return default initial provenance list for a VamsasDatastore created\r
+ * vamsas object.\r
*/\r
Provenance dummyProvenance() {\r
return dummyProvenance(null);\r