From f046d0f3bf72a74896cd6a3cbda4bab6b077ef57 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 14 Dec 2006 16:21:49 +0000 Subject: [PATCH] quick commit before refactoring git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@259 be28352e-c001-0410-b1a7-c7978e42abec --- src/org/vamsas/client/ClientDocument.java | 4 +- src/org/vamsas/client/IVorbaIdFactory.java | 6 + src/org/vamsas/client/Vobject.java | 56 ++- src/org/vamsas/client/Vobjhash.java | 25 ++ src/org/vamsas/client/VorbaIdFactory.java | 22 + src/org/vamsas/client/VorbaXmlBinder.java | 70 +++- .../vamsas/client/simpleclient/ClientDocument.java | 35 +- src/org/vamsas/client/simpleclient/IdFactory.java | 10 +- .../vamsas/client/simpleclient/SimpleClient.java | 4 + .../vamsas/client/simpleclient/VamsasArchive.java | 10 +- src/org/vamsas/objects/core/Alignment.java | 85 +--- .../vamsas/objects/core/AlignmentAnnotation.java | 44 +- .../vamsas/objects/core/AlignmentDescriptor.java | 17 +- src/org/vamsas/objects/core/AlignmentSequence.java | 39 +- .../objects/core/AlignmentSequenceAnnotation.java | 75 +--- src/org/vamsas/objects/core/AnnotationElement.java | 63 ++- src/org/vamsas/objects/core/ApplicationData.java | 19 +- src/org/vamsas/objects/core/Attachment.java | 47 +-- src/org/vamsas/objects/core/DataSet.java | 9 +- .../vamsas/objects/core/DataSetAnnotations.java | 18 +- src/org/vamsas/objects/core/DbRef.java | 131 +++--- src/org/vamsas/objects/core/Entry.java | 52 +-- src/org/vamsas/objects/core/Glyph.java | 50 +-- src/org/vamsas/objects/core/Input.java | 7 +- src/org/vamsas/objects/core/Map.java | 429 +------------------- src/org/vamsas/objects/core/MapDescriptor.java | 182 +-------- src/org/vamsas/objects/core/MapList.java | 404 ++++++++++++++++++ src/org/vamsas/objects/core/MapListDescriptor.java | 339 ++++++++++++++++ src/org/vamsas/objects/core/Mapping.java | 186 +++++++++ src/org/vamsas/objects/core/MappingDescriptor.java | 210 ++++++++++ src/org/vamsas/objects/core/Newick.java | 79 +--- src/org/vamsas/objects/core/NewickDescriptor.java | 17 +- src/org/vamsas/objects/core/Param.java | 30 +- src/org/vamsas/objects/core/Pos.java | 3 +- src/org/vamsas/objects/core/Property.java | 30 +- src/org/vamsas/objects/core/RangeAnnotation.java | 192 ++++----- .../objects/core/RangeAnnotationDescriptor.java | 17 +- src/org/vamsas/objects/core/RangeType.java | 17 +- src/org/vamsas/objects/core/Score.java | 5 +- src/org/vamsas/objects/core/Seg.java | 23 +- src/org/vamsas/objects/core/Sequence.java | 21 +- src/org/vamsas/objects/core/SequenceType.java | 161 +++++++- .../objects/core/SequenceTypeDescriptor.java | 35 ++ src/org/vamsas/objects/core/Tree.java | 73 +--- src/org/vamsas/objects/core/TreeDescriptor.java | 17 +- src/org/vamsas/objects/core/VAMSAS.java | 76 +--- src/org/vamsas/objects/core/VAMSASDescriptor.java | 17 +- src/org/vamsas/objects/core/VamsasDocument.java | 3 +- 48 files changed, 1975 insertions(+), 1489 deletions(-) create mode 100644 src/org/vamsas/client/Vobjhash.java create mode 100644 src/org/vamsas/objects/core/MapList.java create mode 100644 src/org/vamsas/objects/core/MapListDescriptor.java create mode 100644 src/org/vamsas/objects/core/Mapping.java create mode 100644 src/org/vamsas/objects/core/MappingDescriptor.java diff --git a/src/org/vamsas/client/ClientDocument.java b/src/org/vamsas/client/ClientDocument.java index 0bbdebc..3866a90 100644 --- a/src/org/vamsas/client/ClientDocument.java +++ b/src/org/vamsas/client/ClientDocument.java @@ -44,7 +44,9 @@ public abstract class ClientDocument implements IClientDocument { log.debug("Redundant call to registerObject"); } // TODO: add default provenance. - unregistered.__ensure_instance_ids(); // call cascade method here : TODO: decide if we need to do this. + // 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 : return unregistered.getVorbaId(); } } diff --git a/src/org/vamsas/client/IVorbaIdFactory.java b/src/org/vamsas/client/IVorbaIdFactory.java index f2364f0..ea25e8e 100644 --- a/src/org/vamsas/client/IVorbaIdFactory.java +++ b/src/org/vamsas/client/IVorbaIdFactory.java @@ -28,4 +28,10 @@ public interface IVorbaIdFactory { 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 + * @param vobject + */ + public abstract void updateHashValue(Vobject vobject); } \ No newline at end of file diff --git a/src/org/vamsas/client/Vobject.java b/src/org/vamsas/client/Vobject.java index 589b7ff..d7bd6eb 100644 --- a/src/org/vamsas/client/Vobject.java +++ b/src/org/vamsas/client/Vobject.java @@ -30,15 +30,19 @@ public abstract class Vobject { */ 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. + */ + protected boolean __updated_since_last_read = false; + /** * memory of the last doHash() value computed for the Vobject * @see doHash() */ - protected long __last_hash = 0; + protected int __last_hash = 0; /** * set by testInstanceForIdField() if Vobject should have a VorbaId */ protected boolean registerable = false; - + protected boolean __visited = false; /** * reference to containing object for this Vobject. */ @@ -185,13 +189,24 @@ public abstract class Vobject { VorbaId thisid = vorbaId; IVorbaIdFactory factory = __vorba; boolean stored = __stored_in_document; + boolean updated = __updated_since_last_read; + boolean visited = __visited; + java.lang.reflect.Field idfield = ___id_field; + ___id_field=null; + __updated_since_last_read=false; vorbaId = null; __vorba = null; + __visited=false; + // compute hash __last_hash = this.hashCode(); + // reset houseskeeping variables + ___id_field=idfield; vorbaId = thisid; __vorba = factory; __stored_in_document = stored; + __updated_since_last_read=updated; V_parent=_V_parent; + __visited=visited; return (__old_hash==0) || (__old_hash == __last_hash); } @@ -257,6 +272,21 @@ public abstract class Vobject { } /** + * @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 is__updated_since_last_read() { + return __updated_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 + */ + protected void set__updated_since_last_read(boolean __updated_since_last_read) { + this.__updated_since_last_read = __updated_since_last_read; + } + + /** * for use by Vorba agent to reflect state of vamsas Vobject to client * application. * Setting stored_in_document on a registerable Vobject without a @@ -275,7 +305,7 @@ public abstract class Vobject { * * @return Returns the __last_hash. */ - public long get__last_hash() { + public int get__last_hash() { return __last_hash; } @@ -302,18 +332,26 @@ public abstract class Vobject { * 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. - * The doHash() function is used as the 'visited' flag - + * __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 org.vamsas.client.Vobject - no VorbaFactory given."); log.debug("doing "+this.getClass()+".__ensure_instance_ids()"); if (!__stored_in_document && registerable) setInstanceIdField(); - if (!doHash()) - return; // nothing has changed in this Vobject - probably visited it before. + if (__visited==visited) + return; + __visited=visited; + __vorba.updateHashValue(this); + Class descriptor = null; XMLClassDescriptorImpl descimpl = null; try { @@ -340,7 +378,7 @@ public abstract class Vobject { vals[k].__vorba = __vorba; // propagate IVorbaIdFactory if (vals[k].V_parent==null) vals[k].V_parent=this; // propagate parent reference to this element. - vals[k].__ensure_instance_ids(); + vals[k].__ensure_instance_ids(visited); } } } @@ -365,7 +403,7 @@ public abstract class Vobject { 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(); + vals[k].__ensure_instance_ids(visited); } } catch (Exception e) { @@ -399,7 +437,7 @@ public abstract class Vobject { rf.__vorba = __vorba; // propagate IVorbaIdFactory if (rf.V_parent==null) rf.V_parent=this; // propagate parent reference - rf.__ensure_instance_ids(); + rf.__ensure_instance_ids(visited); } } catch (Exception e) { diff --git a/src/org/vamsas/client/Vobjhash.java b/src/org/vamsas/client/Vobjhash.java new file mode 100644 index 0000000..116e2ff --- /dev/null +++ b/src/org/vamsas/client/Vobjhash.java @@ -0,0 +1,25 @@ +package org.vamsas.client; + +/** + * Holds information about Vobj instances that is held over between different writes to the document. + * @author JimP + * + */ +public class Vobjhash { + int hashvalue; + /** + * creates a record of the hash value for a vamsas document object + * @param tobemarshalled + */ + public Vobjhash(Vobject tobemarshalled) { + hashvalue = tobemarshalled.get__last_hash(); + } + /** + * compares the old hash value with the unmarshalled object's most recently computed hash value. + * @param unmarshalled + * @return true if the hash values differ + */ + public boolean isUpdated(Vobject unmarshalled) { + return hashvalue==unmarshalled.get__last_hash(); + } +} diff --git a/src/org/vamsas/client/VorbaIdFactory.java b/src/org/vamsas/client/VorbaIdFactory.java index d7f3867..b601dba 100644 --- a/src/org/vamsas/client/VorbaIdFactory.java +++ b/src/org/vamsas/client/VorbaIdFactory.java @@ -7,6 +7,7 @@ package org.vamsas.client; import java.util.Hashtable; +import java.util.Vector; /** * A VorbaIdFactory is constructed by an IClient instance. @@ -16,8 +17,20 @@ import java.util.Hashtable; * @author jimp */ public abstract class VorbaIdFactory implements IVorbaIdFactory { + /** + * hash of VorbaIds to Vobject. + */ protected Hashtable extantids=null; /** + * hash of VorbaIds to persisted hash values + */ + protected Hashtable extanthashv=null; + /** + * list of Vobjects added since last Document read. + */ + protected Vector newobj=null; + + /** * construct a new id appropriate for this client in the vamsas session. * * @return valid VorbaId for session, or null if VorbaIdFactory not configured @@ -43,6 +56,15 @@ public abstract class VorbaIdFactory implements IVorbaIdFactory { protected void setNewIdHash(Hashtable idtable) { extantids = idtable; } + + /* (non-Javadoc) + * @see org.vamsas.client.IVorbaIdFactory#updateHashValue(org.vamsas.client.Vobject) + */ + public void updateHashValue(Vobject vobject) { + if (vobject.isRegisterable()) + extanthashv.put(vobject.getVorbaId(), new Vobjhash(vobject)); + } + /** * TODO: decide if these are needed. * diff --git a/src/org/vamsas/client/VorbaXmlBinder.java b/src/org/vamsas/client/VorbaXmlBinder.java index 2cde9d2..556386d 100644 --- a/src/org/vamsas/client/VorbaXmlBinder.java +++ b/src/org/vamsas/client/VorbaXmlBinder.java @@ -12,6 +12,8 @@ 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; @@ -27,20 +29,25 @@ import org.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 avoid validation exceptions when marshalling new objects + * 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; - - public VorbaXmlBinder(IVorbaIdFactory vorbafactory, Vector obj, Hashtable objrefs) { + private final Vector updatedobjs; + + public VorbaXmlBinder(IVorbaIdFactory vorbafactory, Vector obj, Hashtable objrefs, Hashtable oldobjhashes, Vector updatedobjs) { this.vorbafactory = vorbafactory; this.obj = obj; this.objrefs = objrefs; + this.oldobjhashes = oldobjhashes; + this.updatedobjs = updatedobjs; } /* @@ -86,6 +93,7 @@ public class VorbaXmlBinder implements UnmarshalListener { 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. @@ -93,11 +101,11 @@ public class VorbaXmlBinder implements UnmarshalListener { if (idstring!=null) { if (idstring.length() > 0) { nobj.setVorbaId(VorbaId.newId(idstring)); - if (objrefs.containsKey(nobj.getVorbaId()) && !objrefs.get(nobj.getVorbaId()).equals(nobj)) { + if (objrefs.containsKey(nobj_id=nobj.getVorbaId()) && !objrefs.get(nobj.getVorbaId()).equals(nobj)) { System.err.println("Serious problem : duplicate id '"+idstring+"' found! expect badness."); // TODO: HANDLE duplicate XML ids correctly } - objrefs.put(nobj.getVorbaId(), nobj); + objrefs.put(nobj_id, nobj); } else { // add to list of objects without a valid vorbaId obj.add(nobj); @@ -108,6 +116,16 @@ public class VorbaXmlBinder implements UnmarshalListener { } nobj.doHash(); + // check to see if new object was present in old object hash + if (oldobjhashes.containsKey(nobj.getVorbaId())) { + Vobjhash oldhash = (Vobjhash) oldobjhashes.get(nobj.getVorbaId()); + if (oldhash.isUpdated(nobj)) { + // mark the object as updated in this document read. + nobj.set__updated_since_last_read(true); + oldobjhashes.put(nobj_id, new Vobjhash(nobj)); + updatedobjs.addElement(nobj); + } + } } } catch (Exception e) { return; @@ -130,13 +148,19 @@ public class VorbaXmlBinder implements UnmarshalListener { throws IOException, MarshalException, ValidationException { // Ensure references if (vorba==null) - throw new Error("Null VorbaIdVactory Parameter"); + 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 ? doc.marshal(outstream); + } - + /** + * 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) { @@ -165,36 +189,42 @@ public class VorbaXmlBinder implements UnmarshalListener { * 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 org.vamsas.objects.core Vobject. - * @return null or {(Object) VamsasDocument Vobject, (Object) Hashtable of Vobject references, (Object) Boolean(sync) } + * @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); + VorbaIdFactory factory, Vobject root) { + Unmarshaller unmarshaller = new Unmarshaller(root); unmarshaller.setIDResolver(new IDResolver() { public Object resolve(String id) { - System.err.println("Warning - id " + id - + " is not found in the VamsasDocument!"); + VorbaXmlBinder.log.warn("Warning - id " + id + + " is not found in the Vamsas XML!"); return null; } }); - Hashtable refbase = new Hashtable(); - Vector unrefed = new Vector(); - final Hashtable objrefs = refbase; + 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 = unrefed; - unmarshaller.setUnmarshalListener(new VorbaXmlBinder(vorbafactory, unrefedObj, objrefs)); + 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(unrefed, objrefs); + 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)}; + return new Object[] { obj, objrefs, new Boolean(sync),updatedObj}; } } catch (MarshalException e) { // TODO Auto-generated catch block diff --git a/src/org/vamsas/client/simpleclient/ClientDocument.java b/src/org/vamsas/client/simpleclient/ClientDocument.java index 631c068..3b654f8 100644 --- a/src/org/vamsas/client/simpleclient/ClientDocument.java +++ b/src/org/vamsas/client/simpleclient/ClientDocument.java @@ -41,7 +41,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements public boolean isModified() { return isModified; } - private java.util.Hashtable objrefs=null; + private Vector updatedObjects=null; /** * * prepare Application-side dataset from the vamsas Document archive @@ -53,13 +53,14 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements protected ClientDocument(VamsasDocument doc, VamsasArchive docHandler, IdFactory Factory, SimpleClient sclient) { super(Factory.getVorbaIdHash(), Factory); + /** * prepare Application-side dataset from the vamsas Document archive */ this.sclient = sclient; archive = docHandler; this.doc = doc; - objrefs = Factory.getVorbaIdHash(); + updatedObjects=null; /// TODO: correct this line } /* @@ -68,12 +69,12 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements * @see org.vamsas.client.IClientDocument#getObject(org.vamsas.client.VorbaId) */ public Vobject getObject(VorbaId id) { - if (objrefs==null) { + if (vamsasObjects==null) { log.debug("getObject called on null objrefs list."); return null; } - if (objrefs.containsKey(id)) - return (Vobject) objrefs.get(id); + if (vamsasObjects.containsKey(id)) + return (Vobject) vamsasObjects.get(id); log.debug("Returning null Vobject reference for id "+id.getId()); return null; } @@ -84,14 +85,14 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements * @see org.vamsas.client.IClientDocument#getObjects(org.vamsas.client.VorbaId[]) */ public Vobject[] getObjects(VorbaId[] ids) { - if (objrefs==null) { - log.debug("getObject[] called on null objrefs list."); + 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; iCastor 0.9.9M2, using an XML + * Schema. + * $Id$ + */ + +package org.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class MapList. + * + * @version $Revision$ $Date$ + */ +public class MapList extends org.vamsas.client.Vobject +implements java.io.Serializable +{ + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Offset to first position in dataset sequence record that + * start + * position on 'onto' maps to + */ + private int _from = 0; + + /** + * keeps track of state for field: _from + */ + private boolean _has_from; + + /** + * Offset to last position in dataset sequence record that end + * position on 'onto' maps to + */ + private int _to = 0; + + /** + * keeps track of state for field: _to + */ + private boolean _has_to; + + /** + * Offset to first position in database entry that first (or + * offset) + * position in sequence maps to + */ + private int _start; + + /** + * keeps track of state for field: _start + */ + private boolean _has_start; + + /** + * Offset to last position in database entry that last (offset) + * position in sequence maps to + */ + private int _end; + + /** + * keeps track of state for field: _end + */ + private boolean _has_end; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public MapList() + { + super(); + } //-- org.vamsas.objects.core.MapList() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method deleteEnd + * + */ + public void deleteEnd() + { + this._has_end= false; + } //-- void deleteEnd() + + /** + * Method deleteFrom + * + */ + public void deleteFrom() + { + this._has_from= false; + } //-- void deleteFrom() + + /** + * Method deleteStart + * + */ + public void deleteStart() + { + this._has_start= false; + } //-- void deleteStart() + + /** + * Method deleteTo + * + */ + public void deleteTo() + { + this._has_to= false; + } //-- void deleteTo() + + /** + * Note: hashCode() has not been overriden + * + * @param obj + * @return boolean + */ + public boolean equals(java.lang.Object obj) + { + if ( this == obj ) + return true; + + if (super.equals(obj)==false) + return false; + + if (obj instanceof MapList) { + + MapList temp = (MapList)obj; + if (this._from != temp._from) + return false; + if (this._has_from != temp._has_from) + return false; + if (this._to != temp._to) + return false; + if (this._has_to != temp._has_to) + return false; + 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; + return true; + } + return false; + } //-- boolean equals(java.lang.Object) + + /** + * Returns the value of field 'end'. The field 'end' has the + * following description: Offset to last position in database + * entry that last (offset) + * position in sequence maps to + * + * @return int + * @return the value of field 'end'. + */ + public int getEnd() + { + return this._end; + } //-- int getEnd() + + /** + * Returns the value of field 'from'. The field 'from' has the + * following description: Offset to first position in dataset + * sequence record that start + * position on 'onto' maps to + * + * @return int + * @return the value of field 'from'. + */ + public int getFrom() + { + return this._from; + } //-- int getFrom() + + /** + * Returns the value of field 'start'. The field 'start' has + * the following description: Offset to first position in + * database entry that first (or offset) + * position in sequence maps to + * + * @return int + * @return the value of field 'start'. + */ + public int getStart() + { + return this._start; + } //-- int getStart() + + /** + * Returns the value of field 'to'. The field 'to' has the + * following description: Offset to last position in dataset + * sequence record that end + * position on 'onto' maps to + * + * @return int + * @return the value of field 'to'. + */ + public int getTo() + { + return this._to; + } //-- int getTo() + + /** + * Method hasEnd + * + * + * + * @return boolean + */ + public boolean hasEnd() + { + return this._has_end; + } //-- boolean hasEnd() + + /** + * Method hasFrom + * + * + * + * @return boolean + */ + public boolean hasFrom() + { + return this._has_from; + } //-- boolean hasFrom() + + /** + * Method hasStart + * + * + * + * @return boolean + */ + public boolean hasStart() + { + return this._has_start; + } //-- boolean hasStart() + + /** + * Method hasTo + * + * + * + * @return boolean + */ + public boolean hasTo() + { + return this._has_to; + } //-- boolean hasTo() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Sets the value of field 'end'. The field 'end' has the + * following description: Offset to last position in database + * entry that last (offset) + * position in sequence maps to + * + * @param end the value of field 'end'. + */ + public void setEnd(int end) + { + this._end = end; + this._has_end = true; + } //-- void setEnd(int) + + /** + * Sets the value of field 'from'. The field 'from' has the + * following description: Offset to first position in dataset + * sequence record that start + * position on 'onto' maps to + * + * @param from the value of field 'from'. + */ + public void setFrom(int from) + { + this._from = from; + this._has_from = true; + } //-- void setFrom(int) + + /** + * Sets the value of field 'start'. The field 'start' has the + * following description: Offset to first position in database + * entry that first (or offset) + * position in sequence maps to + * + * @param start the value of field 'start'. + */ + public void setStart(int start) + { + this._start = start; + this._has_start = true; + } //-- void setStart(int) + + /** + * Sets the value of field 'to'. The field 'to' has the + * following description: Offset to last position in dataset + * sequence record that end + * position on 'onto' maps to + * + * @param to the value of field 'to'. + */ + public void setTo(int to) + { + this._to = to; + this._has_to = true; + } //-- void setTo(int) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return MapList + */ + public static org.vamsas.objects.core.MapList unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (org.vamsas.objects.core.MapList) Unmarshaller.unmarshal(org.vamsas.objects.core.MapList.class, reader); + } //-- org.vamsas.objects.core.MapList unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/org/vamsas/objects/core/MapListDescriptor.java b/src/org/vamsas/objects/core/MapListDescriptor.java new file mode 100644 index 0000000..4d46e41 --- /dev/null +++ b/src/org/vamsas/objects/core/MapListDescriptor.java @@ -0,0 +1,339 @@ +/* + * This class was automatically generated with + * Castor 0.9.9M2, using an XML + * Schema. + * $Id$ + */ + +package org.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.mapping.AccessMode; +import org.exolab.castor.xml.TypeValidator; +import org.exolab.castor.xml.XMLFieldDescriptor; +import org.exolab.castor.xml.validators.*; + +/** + * Class MapListDescriptor. + * + * @version $Revision$ $Date$ + */ +public class MapListDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field nsPrefix + */ + private java.lang.String nsPrefix; + + /** + * Field nsURI + */ + private java.lang.String nsURI; + + /** + * Field xmlName + */ + private java.lang.String xmlName; + + /** + * Field identity + */ + private org.exolab.castor.xml.XMLFieldDescriptor identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public MapListDescriptor() + { + super(); + nsURI = "http://www.vamsas.org"; + xmlName = "mapList"; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _from + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_from", "from", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + MapList target = (MapList) object; + if(!target.hasFrom()) + return null; + return new java.lang.Integer(target.getFrom()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + MapList target = (MapList) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteFrom(); + return; + } + target.setFrom( ((java.lang.Integer)value).intValue()); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _from + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + IntegerValidator typeValidator = new IntegerValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _to + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_to", "to", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + MapList target = (MapList) object; + if(!target.hasTo()) + return null; + return new java.lang.Integer(target.getTo()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + MapList target = (MapList) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteTo(); + return; + } + target.setTo( ((java.lang.Integer)value).intValue()); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _to + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + IntegerValidator typeValidator = new IntegerValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _start + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + MapList target = (MapList) object; + if(!target.hasStart()) + return null; + return new java.lang.Integer(target.getStart()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + MapList target = (MapList) object; + // ignore null values for non optional primitives + if (value == null) return; + + target.setStart( ((java.lang.Integer)value).intValue()); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _start + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + IntegerValidator typeValidator = new IntegerValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _end + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + MapList target = (MapList) object; + if(!target.hasEnd()) + return null; + return new java.lang.Integer(target.getEnd()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + MapList target = (MapList) object; + // ignore null values for non optional primitives + if (value == null) return; + + target.setEnd( ((java.lang.Integer)value).intValue()); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _end + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + IntegerValidator typeValidator = new IntegerValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + } //-- org.vamsas.objects.core.MapListDescriptor() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode + * + * + * + * @return AccessMode + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } //-- org.exolab.castor.mapping.AccessMode getAccessMode() + + /** + * Method getExtends + * + * + * + * @return ClassDescriptor + */ + public org.exolab.castor.mapping.ClassDescriptor getExtends() + { + return null; + } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() + + /** + * Method getIdentity + * + * + * + * @return FieldDescriptor + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return identity; + } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() + + /** + * Method getJavaClass + * + * + * + * @return Class + */ + public java.lang.Class getJavaClass() + { + return org.vamsas.objects.core.MapList.class; + } //-- java.lang.Class getJavaClass() + + /** + * Method getNameSpacePrefix + * + * + * + * @return String + */ + public java.lang.String getNameSpacePrefix() + { + return nsPrefix; + } //-- java.lang.String getNameSpacePrefix() + + /** + * Method getNameSpaceURI + * + * + * + * @return String + */ + public java.lang.String getNameSpaceURI() + { + return nsURI; + } //-- java.lang.String getNameSpaceURI() + + /** + * Method getValidator + * + * + * + * @return TypeValidator + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } //-- org.exolab.castor.xml.TypeValidator getValidator() + + /** + * Method getXMLName + * + * + * + * @return String + */ + public java.lang.String getXMLName() + { + return xmlName; + } //-- java.lang.String getXMLName() + +} diff --git a/src/org/vamsas/objects/core/Mapping.java b/src/org/vamsas/objects/core/Mapping.java new file mode 100644 index 0000000..e68ad1d --- /dev/null +++ b/src/org/vamsas/objects/core/Mapping.java @@ -0,0 +1,186 @@ +/* + * This class was automatically generated with + * Castor 0.9.9M2, using an XML + * Schema. + * $Id$ + */ + +package org.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class Mapping. + * + * @version $Revision$ $Date$ + */ +public class Mapping extends org.vamsas.objects.core.MapList +implements java.io.Serializable +{ + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * object to which the mapping is being mapped + * + */ + private java.lang.Object _onto; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Mapping() + { + super(); + } //-- org.vamsas.objects.core.Mapping() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Note: hashCode() has not been overriden + * + * @param obj + * @return boolean + */ + public boolean equals(java.lang.Object obj) + { + if ( this == obj ) + return true; + + if (super.equals(obj)==false) + return false; + + if (obj instanceof Mapping) { + + Mapping temp = (Mapping)obj; + if (this._onto != null) { + if (temp._onto == null) return false; + else if (!(this._onto.equals(temp._onto))) + return false; + } + else if (temp._onto != null) + return false; + return true; + } + return false; + } //-- boolean equals(java.lang.Object) + + /** + * Returns the value of field 'onto'. The field 'onto' has the + * following description: object to which the mapping is being + * mapped + * + * + * @return Object + * @return the value of field 'onto'. + */ + public java.lang.Object getOnto() + { + return this._onto; + } //-- java.lang.Object getOnto() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Sets the value of field 'onto'. The field 'onto' has the + * following description: object to which the mapping is being + * mapped + * + * + * @param onto the value of field 'onto'. + */ + public void setOnto(java.lang.Object onto) + { + this._onto = onto; + } //-- void setOnto(java.lang.Object) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return MapList + */ + public static org.vamsas.objects.core.MapList unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (org.vamsas.objects.core.Mapping) Unmarshaller.unmarshal(org.vamsas.objects.core.Mapping.class, reader); + } //-- org.vamsas.objects.core.MapList unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/org/vamsas/objects/core/MappingDescriptor.java b/src/org/vamsas/objects/core/MappingDescriptor.java new file mode 100644 index 0000000..95a6cbb --- /dev/null +++ b/src/org/vamsas/objects/core/MappingDescriptor.java @@ -0,0 +1,210 @@ +/* + * This class was automatically generated with + * Castor 0.9.9M2, using an XML + * Schema. + * $Id$ + */ + +package org.vamsas.objects.core; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.mapping.AccessMode; +import org.exolab.castor.xml.TypeValidator; +import org.exolab.castor.xml.XMLFieldDescriptor; +import org.exolab.castor.xml.validators.*; + +/** + * Class MappingDescriptor. + * + * @version $Revision$ $Date$ + */ +public class MappingDescriptor extends org.vamsas.objects.core.MapListDescriptor { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field nsPrefix + */ + private java.lang.String nsPrefix; + + /** + * Field nsURI + */ + private java.lang.String nsURI; + + /** + * Field xmlName + */ + private java.lang.String xmlName; + + /** + * Field identity + */ + private org.exolab.castor.xml.XMLFieldDescriptor identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public MappingDescriptor() + { + super(); + setExtendsWithoutFlatten(new org.vamsas.objects.core.MapListDescriptor()); + nsURI = "http://www.vamsas.org"; + xmlName = "mapping"; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _onto + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_onto", "onto", org.exolab.castor.xml.NodeType.Attribute); + desc.setReference(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Mapping target = (Mapping) object; + return target.getOnto(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Mapping target = (Mapping) object; + target.setOnto( (java.lang.Object) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return new java.lang.Object(); + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _onto + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + } //-- org.vamsas.objects.core.MappingDescriptor() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode + * + * + * + * @return AccessMode + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } //-- org.exolab.castor.mapping.AccessMode getAccessMode() + + /** + * Method getExtends + * + * + * + * @return ClassDescriptor + */ + public org.exolab.castor.mapping.ClassDescriptor getExtends() + { + return super.getExtends(); + } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() + + /** + * Method getIdentity + * + * + * + * @return FieldDescriptor + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + if (identity == null) + return super.getIdentity(); + return identity; + } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() + + /** + * Method getJavaClass + * + * + * + * @return Class + */ + public java.lang.Class getJavaClass() + { + return org.vamsas.objects.core.Mapping.class; + } //-- java.lang.Class getJavaClass() + + /** + * Method getNameSpacePrefix + * + * + * + * @return String + */ + public java.lang.String getNameSpacePrefix() + { + return nsPrefix; + } //-- java.lang.String getNameSpacePrefix() + + /** + * Method getNameSpaceURI + * + * + * + * @return String + */ + public java.lang.String getNameSpaceURI() + { + return nsURI; + } //-- java.lang.String getNameSpaceURI() + + /** + * Method getValidator + * + * + * + * @return TypeValidator + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } //-- org.exolab.castor.xml.TypeValidator getValidator() + + /** + * Method getXMLName + * + * + * + * @return String + */ + public java.lang.String getXMLName() + { + return xmlName; + } //-- java.lang.String getXMLName() + +} diff --git a/src/org/vamsas/objects/core/Newick.java b/src/org/vamsas/objects/core/Newick.java index 23c6891..2c60f61 100644 --- a/src/org/vamsas/objects/core/Newick.java +++ b/src/org/vamsas/objects/core/Newick.java @@ -46,25 +46,15 @@ implements java.io.Serializable private java.lang.String _title; /** - * Primary Key for vamsas - * object referencing + * Primary Key for vamsas object referencing * */ private java.lang.String _id; /** - * objects with - * modifiable=false will not be - * modified by a vamsas client - * update - * - */ - private boolean _modifiable = true; - - /** - * keeps track of state for field: _modifiable + * Field _modifiable */ - private boolean _has_modifiable; + private java.lang.String _modifiable; //----------------/ @@ -83,15 +73,6 @@ implements java.io.Serializable //-----------/ /** - * Method deleteModifiable - * - */ - public void deleteModifiable() - { - this._has_modifiable= false; - } //-- void deleteModifiable() - - /** * Note: hashCode() has not been overriden * * @param obj @@ -129,9 +110,12 @@ implements java.io.Serializable } else if (temp._id != null) return false; - if (this._modifiable != temp._modifiable) - return false; - if (this._has_modifiable != temp._has_modifiable) + if (this._modifiable != null) { + if (temp._modifiable == null) return false; + else if (!(this._modifiable.equals(temp._modifiable))) + return false; + } + else if (temp._modifiable != null) return false; return true; } @@ -152,8 +136,8 @@ implements java.io.Serializable /** * Returns the value of field 'id'. The field 'id' has the - * following description: Primary Key for vamsas - * object referencing + * following description: Primary Key for vamsas object + * referencing * * * @return String @@ -165,20 +149,15 @@ implements java.io.Serializable } //-- java.lang.String getId() /** - * Returns the value of field 'modifiable'. The field - * 'modifiable' has the following description: objects with - * modifiable=false will not be - * modified by a vamsas client - * update - * + * Returns the value of field 'modifiable'. * - * @return boolean + * @return String * @return the value of field 'modifiable'. */ - public boolean getModifiable() + public java.lang.String getModifiable() { return this._modifiable; - } //-- boolean getModifiable() + } //-- java.lang.String getModifiable() /** * Returns the value of field 'title'. @@ -192,18 +171,6 @@ implements java.io.Serializable } //-- java.lang.String getTitle() /** - * Method hasModifiable - * - * - * - * @return boolean - */ - public boolean hasModifiable() - { - return this._has_modifiable; - } //-- boolean hasModifiable() - - /** * Method isValid * * @@ -262,8 +229,8 @@ implements java.io.Serializable /** * Sets the value of field 'id'. The field 'id' has the - * following description: Primary Key for vamsas - * object referencing + * following description: Primary Key for vamsas object + * referencing * * * @param id the value of field 'id'. @@ -274,20 +241,14 @@ implements java.io.Serializable } //-- void setId(java.lang.String) /** - * Sets the value of field 'modifiable'. The field 'modifiable' - * has the following description: objects with - * modifiable=false will not be - * modified by a vamsas client - * update - * + * Sets the value of field 'modifiable'. * * @param modifiable the value of field 'modifiable'. */ - public void setModifiable(boolean modifiable) + public void setModifiable(java.lang.String modifiable) { this._modifiable = modifiable; - this._has_modifiable = true; - } //-- void setModifiable(boolean) + } //-- void setModifiable(java.lang.String) /** * Sets the value of field 'title'. diff --git a/src/org/vamsas/objects/core/NewickDescriptor.java b/src/org/vamsas/objects/core/NewickDescriptor.java index 2882b82..d56a141 100644 --- a/src/org/vamsas/objects/core/NewickDescriptor.java +++ b/src/org/vamsas/objects/core/NewickDescriptor.java @@ -171,27 +171,21 @@ public class NewickDescriptor extends org.exolab.castor.xml.util.XMLClassDescrip } desc.setValidator(fieldValidator); //-- _modifiable - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { Newick target = (Newick) object; - if(!target.hasModifiable()) - return null; - return (target.getModifiable() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + return target.getModifiable(); } public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { Newick target = (Newick) object; - // if null, use delete method for optional primitives - if (value == null) { - target.deleteModifiable(); - return; - } - target.setModifiable( ((java.lang.Boolean)value).booleanValue()); + target.setModifiable( (java.lang.String) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -208,7 +202,8 @@ public class NewickDescriptor extends org.exolab.castor.xml.util.XMLClassDescrip //-- validation code for: _modifiable fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + StringValidator typeValidator = new StringValidator(); + typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); diff --git a/src/org/vamsas/objects/core/Param.java b/src/org/vamsas/objects/core/Param.java index 5e001db..b7c2ab5 100644 --- a/src/org/vamsas/objects/core/Param.java +++ b/src/org/vamsas/objects/core/Param.java @@ -46,12 +46,10 @@ implements java.io.Serializable private java.lang.String _name; /** - * The type specifies how the property will - * be parsed. Empty property strings are - * allowed, and can be used to prototype - * the input to a document. TODO: specify - * allowed types - * + * The type specifies how the property will be parsed. + * Empty property strings are allowed, and can be used to + * prototype the + * input to a document. TODO: specify allowed types */ private java.lang.String _type; @@ -140,12 +138,10 @@ implements java.io.Serializable /** * Returns the value of field 'type'. The field 'type' has the * following description: The type specifies how the property - * will - * be parsed. Empty property strings are - * allowed, and can be used to prototype - * the input to a document. TODO: specify - * allowed types - * + * will be parsed. + * Empty property strings are allowed, and can be used to + * prototype the + * input to a document. TODO: specify allowed types * * @return String * @return the value of field 'type'. @@ -225,12 +221,10 @@ implements java.io.Serializable /** * Sets the value of field 'type'. The field 'type' has the * following description: The type specifies how the property - * will - * be parsed. Empty property strings are - * allowed, and can be used to prototype - * the input to a document. TODO: specify - * allowed types - * + * will be parsed. + * Empty property strings are allowed, and can be used to + * prototype the + * input to a document. TODO: specify allowed types * * @param type the value of field 'type'. */ diff --git a/src/org/vamsas/objects/core/Pos.java b/src/org/vamsas/objects/core/Pos.java index 51a5410..5053f98 100644 --- a/src/org/vamsas/objects/core/Pos.java +++ b/src/org/vamsas/objects/core/Pos.java @@ -22,8 +22,7 @@ import org.exolab.castor.xml.ValidationException; import org.xml.sax.ContentHandler; /** - * a position within the associated object's - * coordinate system + * a position within the associated object's coordinate system * * * @version $Revision$ $Date$ diff --git a/src/org/vamsas/objects/core/Property.java b/src/org/vamsas/objects/core/Property.java index 261a52b..fb4aacc 100644 --- a/src/org/vamsas/objects/core/Property.java +++ b/src/org/vamsas/objects/core/Property.java @@ -46,12 +46,10 @@ implements java.io.Serializable private java.lang.String _name; /** - * The type specifies how the property will - * be parsed. Empty property strings are - * allowed, and can be used to prototype - * the input to a document. TODO: specify - * allowed types - * + * The type specifies how the property will be parsed. + * Empty property strings are allowed, and can be used to + * prototype the + * input to a document. TODO: specify allowed types */ private java.lang.String _type; @@ -140,12 +138,10 @@ implements java.io.Serializable /** * Returns the value of field 'type'. The field 'type' has the * following description: The type specifies how the property - * will - * be parsed. Empty property strings are - * allowed, and can be used to prototype - * the input to a document. TODO: specify - * allowed types - * + * will be parsed. + * Empty property strings are allowed, and can be used to + * prototype the + * input to a document. TODO: specify allowed types * * @return String * @return the value of field 'type'. @@ -225,12 +221,10 @@ implements java.io.Serializable /** * Sets the value of field 'type'. The field 'type' has the * following description: The type specifies how the property - * will - * be parsed. Empty property strings are - * allowed, and can be used to prototype - * the input to a document. TODO: specify - * allowed types - * + * will be parsed. + * Empty property strings are allowed, and can be used to + * prototype the + * input to a document. TODO: specify allowed types * * @param type the value of field 'type'. */ diff --git a/src/org/vamsas/objects/core/RangeAnnotation.java b/src/org/vamsas/objects/core/RangeAnnotation.java index df5cb2e..0dda140 100644 --- a/src/org/vamsas/objects/core/RangeAnnotation.java +++ b/src/org/vamsas/objects/core/RangeAnnotation.java @@ -25,10 +25,10 @@ import org.xml.sax.ContentHandler; /** * Annotation for a rangeSpec - values can be attached for the - * whole specification, and to each position within the spec. - * following the orientation specified by the ordered set of - * rangeSpec (pos, seg) elements. - * + * whole + * specification, and to each position within the spec. following + * the orientation + * specified by the ordered set of rangeSpec (pos, seg) elements. * * @version $Revision$ $Date$ */ @@ -48,40 +48,32 @@ implements java.io.Serializable private java.lang.String _id; /** - * objects with modifiable=false will not be - * modified by a vamsas client update - * + * Field _modifiable */ - private boolean _modifiable = true; + private java.lang.String _modifiable; /** - * keeps track of state for field: _modifiable - */ - private boolean _has_modifiable; - - /** - * Annotation with the same non-empty group - * name are grouped together - * + * Annotation with the same non-empty group name are grouped + * together */ private java.lang.String _group = ""; /** - * A Das Feature has both a type and a Type ID. - * We go the route of requiring the type string - * to be taken from a controlled vocabulary if - * an application expects others to make sense - * of it. - * The type may qualified - so uniprot:CHAIN is a valid type - * name, - * and considered distinct from someotherDB:CHAIN - * + * A Das Feature has both a type and a Type ID. We go the + * route of requiring the type string to be taken from a + * controlled + * vocabulary if an application expects others to make sense + * of it. The + * type may qualified - so uniprot:CHAIN is a valid type name, + * and + * considered distinct from someotherDB:CHAIN */ private java.lang.String _type; /** - * Short, meaningful name for the annotation - if this is - * absent, then the type string should be used in its place. + * Short, meaningful name for the annotation - if this + * is absent, then the type string should be used in its + * place. * */ private java.lang.String _label; @@ -94,25 +86,23 @@ implements java.io.Serializable /** * TODO: specify this - we have considered taking the GO - * evidence codes as a model for assessing a measure of quality - * to an annotation. - * + * evidence codes as a model for assessing a measure of + * quality to an + * annotation. */ private java.lang.String _status; /** - * Annotation Element position maps to - * ordered positions defined by the - * sequence of rangeType pos positions or - * concatenated seg start/end segments. - * + * Annotation Element position maps to ordered positions + * defined by the sequence of rangeType pos positions or + * concatenated + * seg start/end segments. */ private java.util.Vector _annotationElementList; /** - * Ordered set of optionally named float - * values for the whole annotation - * + * Ordered set of optionally named float values for the + * whole annotation */ private java.util.Vector _scoreList; @@ -122,9 +112,8 @@ implements java.io.Serializable private java.util.Vector _linkList; /** - * Note:These are mutable so an application - * should check them each time. - * + * Note:These are mutable so an application should check + * them each time. */ private java.util.Vector _propertyList; @@ -257,15 +246,6 @@ implements java.io.Serializable } //-- void addScore(int, org.vamsas.objects.core.Score) /** - * Method deleteModifiable - * - */ - public void deleteModifiable() - { - this._has_modifiable= false; - } //-- void deleteModifiable() - - /** * Method enumerateAnnotationElement * * @@ -337,9 +317,12 @@ implements java.io.Serializable } else if (temp._id != null) return false; - if (this._modifiable != temp._modifiable) - return false; - if (this._has_modifiable != temp._has_modifiable) + if (this._modifiable != null) { + if (temp._modifiable == null) return false; + else if (!(this._modifiable.equals(temp._modifiable))) + return false; + } + else if (temp._modifiable != null) return false; if (this._group != null) { if (temp._group == null) return false; @@ -474,9 +457,8 @@ implements java.io.Serializable /** * Returns the value of field 'group'. The field 'group' has * the following description: Annotation with the same - * non-empty group - * name are grouped together - * + * non-empty group name are grouped + * together * * @return String * @return the value of field 'group'. @@ -503,8 +485,9 @@ implements java.io.Serializable /** * Returns the value of field 'label'. The field 'label' has * the following description: Short, meaningful name for the - * annotation - if this is absent, then the type string should - * be used in its place. + * annotation - if this + * is absent, then the type string should be used in its + * place. * * * @return String @@ -564,19 +547,15 @@ implements java.io.Serializable } //-- int getLinkCount() /** - * Returns the value of field 'modifiable'. The field - * 'modifiable' has the following description: objects with - * modifiable=false will not be - * modified by a vamsas client update - * + * Returns the value of field 'modifiable'. * - * @return boolean + * @return String * @return the value of field 'modifiable'. */ - public boolean getModifiable() + public java.lang.String getModifiable() { return this._modifiable; - } //-- boolean getModifiable() + } //-- java.lang.String getModifiable() /** * Method getProperty @@ -677,9 +656,10 @@ implements java.io.Serializable /** * Returns the value of field 'status'. The field 'status' has * the following description: TODO: specify this - we have - * considered taking the GO evidence codes as a model for - * assessing a measure of quality to an annotation. - * + * considered taking the GO + * evidence codes as a model for assessing a measure of + * quality to an + * annotation. * * @return String * @return the value of field 'status'. @@ -692,15 +672,14 @@ implements java.io.Serializable /** * Returns the value of field 'type'. The field 'type' has the * following description: A Das Feature has both a type and a - * Type ID. - * We go the route of requiring the type string - * to be taken from a controlled vocabulary if - * an application expects others to make sense - * of it. - * The type may qualified - so uniprot:CHAIN is a valid type - * name, - * and considered distinct from someotherDB:CHAIN - * + * Type ID. We go the + * route of requiring the type string to be taken from a + * controlled + * vocabulary if an application expects others to make sense + * of it. The + * type may qualified - so uniprot:CHAIN is a valid type name, + * and + * considered distinct from someotherDB:CHAIN * * @return String * @return the value of field 'type'. @@ -711,18 +690,6 @@ implements java.io.Serializable } //-- java.lang.String getType() /** - * Method hasModifiable - * - * - * - * @return boolean - */ - public boolean hasModifiable() - { - return this._has_modifiable; - } //-- boolean hasModifiable() - - /** * Method isValid * * @@ -914,9 +881,8 @@ implements java.io.Serializable /** * Sets the value of field 'group'. The field 'group' has the * following description: Annotation with the same non-empty - * group - * name are grouped together - * + * group name are grouped + * together * * @param group the value of field 'group'. */ @@ -941,8 +907,9 @@ implements java.io.Serializable /** * Sets the value of field 'label'. The field 'label' has the * following description: Short, meaningful name for the - * annotation - if this is absent, then the type string should - * be used in its place. + * annotation - if this + * is absent, then the type string should be used in its + * place. * * * @param label the value of field 'label'. @@ -987,19 +954,14 @@ implements java.io.Serializable } //-- void setLink(org.vamsas.objects.core.Link) /** - * Sets the value of field 'modifiable'. The field 'modifiable' - * has the following description: objects with modifiable=false - * will not be - * modified by a vamsas client update - * + * Sets the value of field 'modifiable'. * * @param modifiable the value of field 'modifiable'. */ - public void setModifiable(boolean modifiable) + public void setModifiable(java.lang.String modifiable) { this._modifiable = modifiable; - this._has_modifiable = true; - } //-- void setModifiable(boolean) + } //-- void setModifiable(java.lang.String) /** * Method setProperty @@ -1072,9 +1034,10 @@ implements java.io.Serializable /** * Sets the value of field 'status'. The field 'status' has the * following description: TODO: specify this - we have - * considered taking the GO evidence codes as a model for - * assessing a measure of quality to an annotation. - * + * considered taking the GO + * evidence codes as a model for assessing a measure of + * quality to an + * annotation. * * @param status the value of field 'status'. */ @@ -1086,15 +1049,14 @@ implements java.io.Serializable /** * Sets the value of field 'type'. The field 'type' has the * following description: A Das Feature has both a type and a - * Type ID. - * We go the route of requiring the type string - * to be taken from a controlled vocabulary if - * an application expects others to make sense - * of it. - * The type may qualified - so uniprot:CHAIN is a valid type - * name, - * and considered distinct from someotherDB:CHAIN - * + * Type ID. We go the + * route of requiring the type string to be taken from a + * controlled + * vocabulary if an application expects others to make sense + * of it. The + * type may qualified - so uniprot:CHAIN is a valid type name, + * and + * considered distinct from someotherDB:CHAIN * * @param type the value of field 'type'. */ diff --git a/src/org/vamsas/objects/core/RangeAnnotationDescriptor.java b/src/org/vamsas/objects/core/RangeAnnotationDescriptor.java index b26661a..39bb29a 100644 --- a/src/org/vamsas/objects/core/RangeAnnotationDescriptor.java +++ b/src/org/vamsas/objects/core/RangeAnnotationDescriptor.java @@ -102,27 +102,21 @@ public class RangeAnnotationDescriptor extends org.vamsas.objects.core.RangeType } desc.setValidator(fieldValidator); //-- _modifiable - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { RangeAnnotation target = (RangeAnnotation) object; - if(!target.hasModifiable()) - return null; - return (target.getModifiable() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + return target.getModifiable(); } public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { RangeAnnotation target = (RangeAnnotation) object; - // if null, use delete method for optional primitives - if (value == null) { - target.deleteModifiable(); - return; - } - target.setModifiable( ((java.lang.Boolean)value).booleanValue()); + target.setModifiable( (java.lang.String) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -139,7 +133,8 @@ public class RangeAnnotationDescriptor extends org.vamsas.objects.core.RangeType //-- validation code for: _modifiable fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + StringValidator typeValidator = new StringValidator(); + typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); diff --git a/src/org/vamsas/objects/core/RangeType.java b/src/org/vamsas/objects/core/RangeType.java index 070af2a..c0d6571 100644 --- a/src/org/vamsas/objects/core/RangeType.java +++ b/src/org/vamsas/objects/core/RangeType.java @@ -23,11 +23,10 @@ import org.exolab.castor.xml.ValidationException; /** * Specify an ordered set of positions and/or regions on the * principle - * dimension of some associated vamsas object - * - * Keeping to jaxb-1.0 specification for the moment - this - * choice should become a substitution group when we use - * jaxb-2.0 capable bindings + * dimension of some associated vamsas object Keeping to jaxb-1.0 + * specification for the moment - this choice should + * become a substitution group when we use jaxb-2.0 capable + * bindings * * * @version $Revision$ $Date$ @@ -47,16 +46,14 @@ implements java.io.Serializable private java.lang.Object _choiceValue; /** - * a position within the associated object's - * coordinate system + * a position within the associated object's coordinate system * */ private java.util.Vector _posList; /** - * a region from start to end, with flag for - * inclusivity of terminii - * + * a region from start to end, with flag for inclusivity of + * terminii */ private java.util.Vector _segList; diff --git a/src/org/vamsas/objects/core/Score.java b/src/org/vamsas/objects/core/Score.java index bb4c568..cb294f3 100644 --- a/src/org/vamsas/objects/core/Score.java +++ b/src/org/vamsas/objects/core/Score.java @@ -22,9 +22,8 @@ import org.exolab.castor.xml.ValidationException; import org.xml.sax.ContentHandler; /** - * Ordered set of optionally named float - * values for the whole annotation - * + * Ordered set of optionally named float values for the + * whole annotation * * @version $Revision$ $Date$ */ diff --git a/src/org/vamsas/objects/core/Seg.java b/src/org/vamsas/objects/core/Seg.java index 980fc8e..5e36703 100644 --- a/src/org/vamsas/objects/core/Seg.java +++ b/src/org/vamsas/objects/core/Seg.java @@ -22,9 +22,8 @@ import org.exolab.castor.xml.ValidationException; import org.xml.sax.ContentHandler; /** - * a region from start to end, with flag for - * inclusivity of terminii - * + * a region from start to end, with flag for inclusivity of + * terminii * * @version $Revision$ $Date$ */ @@ -58,9 +57,9 @@ implements java.io.Serializable private boolean _has_end; /** - * when false, a consecutive range like - * 'start=1, end=2' means the region lying - * after position 1 and before position 2 + * when false, a consecutive range like 'start=1, end=2' + * means the region lying after position 1 and before position + * 2 * */ private boolean _inclusive; @@ -160,9 +159,9 @@ implements java.io.Serializable /** * Returns the value of field 'inclusive'. The field * 'inclusive' has the following description: when false, a - * consecutive range like - * 'start=1, end=2' means the region lying - * after position 1 and before position 2 + * consecutive range like 'start=1, end=2' + * means the region lying after position 1 and before position + * 2 * * * @return boolean @@ -280,9 +279,9 @@ implements java.io.Serializable /** * Sets the value of field 'inclusive'. The field 'inclusive' * has the following description: when false, a consecutive - * range like - * 'start=1, end=2' means the region lying - * after position 1 and before position 2 + * range like 'start=1, end=2' + * means the region lying after position 1 and before position + * 2 * * * @param inclusive the value of field 'inclusive'. diff --git a/src/org/vamsas/objects/core/Sequence.java b/src/org/vamsas/objects/core/Sequence.java index d0787bd..66dc569 100644 --- a/src/org/vamsas/objects/core/Sequence.java +++ b/src/org/vamsas/objects/core/Sequence.java @@ -38,8 +38,7 @@ implements java.io.Serializable //--------------------------/ /** - * Primary Key for vamsas - * object referencing + * Primary Key for vamsas object referencing * */ private java.lang.String _id; @@ -51,13 +50,9 @@ implements java.io.Serializable 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 - * + * 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; @@ -223,8 +218,8 @@ implements java.io.Serializable /** * Returns the value of field 'id'. The field 'id' has the - * following description: Primary Key for vamsas - * object referencing + * following description: Primary Key for vamsas object + * referencing * * * @return String @@ -353,8 +348,8 @@ implements java.io.Serializable /** * Sets the value of field 'id'. The field 'id' has the - * following description: Primary Key for vamsas - * object referencing + * following description: Primary Key for vamsas object + * referencing * * * @param id the value of field 'id'. diff --git a/src/org/vamsas/objects/core/SequenceType.java b/src/org/vamsas/objects/core/SequenceType.java index ecf91db..96fba5b 100644 --- a/src/org/vamsas/objects/core/SequenceType.java +++ b/src/org/vamsas/objects/core/SequenceType.java @@ -73,11 +73,15 @@ implements java.io.Serializable private java.lang.String _description; /** - * additional typed properties - * + * additional typed properties */ private java.util.Vector _propertyList; + /** + * Field _mappingList + */ + private java.util.Vector _mappingList; + //----------------/ //- Constructors -/ @@ -87,6 +91,7 @@ implements java.io.Serializable { super(); _propertyList = new Vector(); + _mappingList = new Vector(); } //-- org.vamsas.objects.core.SequenceType() @@ -95,6 +100,33 @@ implements java.io.Serializable //-----------/ /** + * Method addMapping + * + * + * + * @param vMapping + */ + public void addMapping(org.vamsas.objects.core.Mapping vMapping) + throws java.lang.IndexOutOfBoundsException + { + _mappingList.addElement(vMapping); + } //-- void addMapping(org.vamsas.objects.core.Mapping) + + /** + * Method addMapping + * + * + * + * @param index + * @param vMapping + */ + public void addMapping(int index, org.vamsas.objects.core.Mapping vMapping) + throws java.lang.IndexOutOfBoundsException + { + _mappingList.insertElementAt(vMapping, index); + } //-- void addMapping(int, org.vamsas.objects.core.Mapping) + + /** * Method addProperty * * @@ -140,6 +172,18 @@ implements java.io.Serializable } //-- void deleteStart() /** + * Method enumerateMapping + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateMapping() + { + return _mappingList.elements(); + } //-- java.util.Enumeration enumerateMapping() + + /** * Method enumerateProperty * * @@ -204,6 +248,13 @@ implements java.io.Serializable } else if (temp._propertyList != null) return false; + if (this._mappingList != null) { + if (temp._mappingList == null) return false; + else if (!(this._mappingList.equals(temp._mappingList))) + return false; + } + else if (temp._mappingList != null) + return false; return true; } return false; @@ -232,6 +283,54 @@ implements java.io.Serializable } //-- int getEnd() /** + * Method getMapping + * + * + * + * @param index + * @return Mapping + */ + public org.vamsas.objects.core.Mapping getMapping(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _mappingList.size())) { + throw new IndexOutOfBoundsException("getMapping: Index value '"+index+"' not in range [0.."+_mappingList.size()+ "]"); + } + + return (org.vamsas.objects.core.Mapping) _mappingList.elementAt(index); + } //-- org.vamsas.objects.core.Mapping getMapping(int) + + /** + * Method getMapping + * + * + * + * @return Mapping + */ + public org.vamsas.objects.core.Mapping[] getMapping() + { + int size = _mappingList.size(); + org.vamsas.objects.core.Mapping[] mArray = new org.vamsas.objects.core.Mapping[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (org.vamsas.objects.core.Mapping) _mappingList.elementAt(index); + } + return mArray; + } //-- org.vamsas.objects.core.Mapping[] getMapping() + + /** + * Method getMappingCount + * + * + * + * @return int + */ + public int getMappingCount() + { + return _mappingList.size(); + } //-- int getMappingCount() + + /** * Returns the value of field 'name'. * * @return String @@ -383,6 +482,15 @@ implements java.io.Serializable } //-- void marshal(org.xml.sax.ContentHandler) /** + * Method removeAllMapping + * + */ + public void removeAllMapping() + { + _mappingList.removeAllElements(); + } //-- void removeAllMapping() + + /** * Method removeAllProperty * */ @@ -392,6 +500,21 @@ implements java.io.Serializable } //-- void removeAllProperty() /** + * Method removeMapping + * + * + * + * @param index + * @return Mapping + */ + public org.vamsas.objects.core.Mapping removeMapping(int index) + { + java.lang.Object obj = _mappingList.elementAt(index); + _mappingList.removeElementAt(index); + return (org.vamsas.objects.core.Mapping) obj; + } //-- org.vamsas.objects.core.Mapping removeMapping(int) + + /** * Method removeProperty * * @@ -428,6 +551,40 @@ implements java.io.Serializable } //-- void setEnd(int) /** + * Method setMapping + * + * + * + * @param index + * @param vMapping + */ + public void setMapping(int index, org.vamsas.objects.core.Mapping vMapping) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _mappingList.size())) { + throw new IndexOutOfBoundsException("setMapping: Index value '"+index+"' not in range [0.."+_mappingList.size()+ "]"); + } + _mappingList.setElementAt(vMapping, index); + } //-- void setMapping(int, org.vamsas.objects.core.Mapping) + + /** + * Method setMapping + * + * + * + * @param mappingArray + */ + public void setMapping(org.vamsas.objects.core.Mapping[] mappingArray) + { + //-- copy array + _mappingList.removeAllElements(); + for (int i = 0; i < mappingArray.length; i++) { + _mappingList.addElement(mappingArray[i]); + } + } //-- void setMapping(org.vamsas.objects.core.Mapping) + + /** * Sets the value of field 'name'. * * @param name the value of field 'name'. diff --git a/src/org/vamsas/objects/core/SequenceTypeDescriptor.java b/src/org/vamsas/objects/core/SequenceTypeDescriptor.java index 240a9d7..0cb00aa 100644 --- a/src/org/vamsas/objects/core/SequenceTypeDescriptor.java +++ b/src/org/vamsas/objects/core/SequenceTypeDescriptor.java @@ -305,6 +305,41 @@ public class SequenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassD { //-- local scope } desc.setValidator(fieldValidator); + //-- _mappingList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Mapping.class, "_mappingList", "mapping", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + SequenceType target = (SequenceType) object; + return target.getMapping(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + SequenceType target = (SequenceType) object; + target.addMapping( (org.vamsas.objects.core.Mapping) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return new org.vamsas.objects.core.Mapping(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://www.vamsas.org"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _mappingList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); } //-- org.vamsas.objects.core.SequenceTypeDescriptor() diff --git a/src/org/vamsas/objects/core/Tree.java b/src/org/vamsas/objects/core/Tree.java index 4ce66e5..5b9ea99 100644 --- a/src/org/vamsas/objects/core/Tree.java +++ b/src/org/vamsas/objects/core/Tree.java @@ -38,22 +38,14 @@ implements java.io.Serializable //--------------------------/ /** - * Primary Key for vamsas object referencing - * + * Primary Key for vamsas object referencing */ private java.lang.String _id; /** - * objects with modifiable=false will not be - * modified by a vamsas client update - * + * Field _modifiable */ - private boolean _modifiable = true; - - /** - * keeps track of state for field: _modifiable - */ - private boolean _has_modifiable; + private java.lang.String _modifiable; /** * Field _title @@ -147,15 +139,6 @@ implements java.io.Serializable } //-- void addProperty(int, org.vamsas.objects.core.Property) /** - * Method deleteModifiable - * - */ - public void deleteModifiable() - { - this._has_modifiable= false; - } //-- void deleteModifiable() - - /** * Method enumerateNewick * * @@ -203,9 +186,12 @@ implements java.io.Serializable } else if (temp._id != null) return false; - if (this._modifiable != temp._modifiable) - return false; - if (this._has_modifiable != temp._has_modifiable) + if (this._modifiable != null) { + if (temp._modifiable == null) return false; + else if (!(this._modifiable.equals(temp._modifiable))) + return false; + } + else if (temp._modifiable != null) return false; if (this._title != null) { if (temp._title == null) return false; @@ -243,8 +229,7 @@ implements java.io.Serializable /** * Returns the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object - * referencing - * + * referencing * * @return String * @return the value of field 'id'. @@ -255,19 +240,15 @@ implements java.io.Serializable } //-- java.lang.String getId() /** - * Returns the value of field 'modifiable'. The field - * 'modifiable' has the following description: objects with - * modifiable=false will not be - * modified by a vamsas client update - * + * Returns the value of field 'modifiable'. * - * @return boolean + * @return String * @return the value of field 'modifiable'. */ - public boolean getModifiable() + public java.lang.String getModifiable() { return this._modifiable; - } //-- boolean getModifiable() + } //-- java.lang.String getModifiable() /** * Method getNewick @@ -388,18 +369,6 @@ implements java.io.Serializable } //-- java.lang.String getTitle() /** - * Method hasModifiable - * - * - * - * @return boolean - */ - public boolean hasModifiable() - { - return this._has_modifiable; - } //-- boolean hasModifiable() - - /** * Method isValid * * @@ -496,8 +465,7 @@ implements java.io.Serializable /** * Sets the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object - * referencing - * + * referencing * * @param id the value of field 'id'. */ @@ -507,19 +475,14 @@ implements java.io.Serializable } //-- void setId(java.lang.String) /** - * Sets the value of field 'modifiable'. The field 'modifiable' - * has the following description: objects with modifiable=false - * will not be - * modified by a vamsas client update - * + * Sets the value of field 'modifiable'. * * @param modifiable the value of field 'modifiable'. */ - public void setModifiable(boolean modifiable) + public void setModifiable(java.lang.String modifiable) { this._modifiable = modifiable; - this._has_modifiable = true; - } //-- void setModifiable(boolean) + } //-- void setModifiable(java.lang.String) /** * Method setNewick diff --git a/src/org/vamsas/objects/core/TreeDescriptor.java b/src/org/vamsas/objects/core/TreeDescriptor.java index 3779ab5..1ca69de 100644 --- a/src/org/vamsas/objects/core/TreeDescriptor.java +++ b/src/org/vamsas/objects/core/TreeDescriptor.java @@ -101,27 +101,21 @@ public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescripto } desc.setValidator(fieldValidator); //-- _modifiable - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { Tree target = (Tree) object; - if(!target.hasModifiable()) - return null; - return (target.getModifiable() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + return target.getModifiable(); } public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { Tree target = (Tree) object; - // if null, use delete method for optional primitives - if (value == null) { - target.deleteModifiable(); - return; - } - target.setModifiable( ((java.lang.Boolean)value).booleanValue()); + target.setModifiable( (java.lang.String) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -138,7 +132,8 @@ public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescripto //-- validation code for: _modifiable fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + StringValidator typeValidator = new StringValidator(); + typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); diff --git a/src/org/vamsas/objects/core/VAMSAS.java b/src/org/vamsas/objects/core/VAMSAS.java index e5f615d..c359593 100644 --- a/src/org/vamsas/objects/core/VAMSAS.java +++ b/src/org/vamsas/objects/core/VAMSAS.java @@ -24,8 +24,7 @@ import org.exolab.castor.xml.ValidationException; import org.xml.sax.ContentHandler; /** - * contains unassociated trees and a number of analysis - * sets + * contains unassociated trees and a number of analysis sets * * * @version $Revision$ $Date$ @@ -40,22 +39,14 @@ implements java.io.Serializable //--------------------------/ /** - * Primary Key for vamsas object referencing - * + * Primary Key for vamsas object referencing */ private java.lang.String _id; /** - * objects with modifiable=false will not be - * modified by a vamsas client update - * + * Field _modifiable */ - private boolean _modifiable = true; - - /** - * keeps track of state for field: _modifiable - */ - private boolean _has_modifiable; + private java.lang.String _modifiable; /** * Field _treeList @@ -139,15 +130,6 @@ implements java.io.Serializable } //-- void addTree(int, org.vamsas.objects.core.Tree) /** - * Method deleteModifiable - * - */ - public void deleteModifiable() - { - this._has_modifiable= false; - } //-- void deleteModifiable() - - /** * Method enumerateDataSet * * @@ -195,9 +177,12 @@ implements java.io.Serializable } else if (temp._id != null) return false; - if (this._modifiable != temp._modifiable) - return false; - if (this._has_modifiable != temp._has_modifiable) + if (this._modifiable != null) { + if (temp._modifiable == null) return false; + else if (!(this._modifiable.equals(temp._modifiable))) + return false; + } + else if (temp._modifiable != null) return false; if (this._treeList != null) { if (temp._treeList == null) return false; @@ -269,8 +254,7 @@ implements java.io.Serializable /** * Returns the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object - * referencing - * + * referencing * * @return String * @return the value of field 'id'. @@ -281,19 +265,15 @@ implements java.io.Serializable } //-- java.lang.String getId() /** - * Returns the value of field 'modifiable'. The field - * 'modifiable' has the following description: objects with - * modifiable=false will not be - * modified by a vamsas client update - * + * Returns the value of field 'modifiable'. * - * @return boolean + * @return String * @return the value of field 'modifiable'. */ - public boolean getModifiable() + public java.lang.String getModifiable() { return this._modifiable; - } //-- boolean getModifiable() + } //-- java.lang.String getModifiable() /** * Method getTree @@ -344,18 +324,6 @@ implements java.io.Serializable } //-- int getTreeCount() /** - * Method hasModifiable - * - * - * - * @return boolean - */ - public boolean hasModifiable() - { - return this._has_modifiable; - } //-- boolean hasModifiable() - - /** * Method isValid * * @@ -486,8 +454,7 @@ implements java.io.Serializable /** * Sets the value of field 'id'. The field 'id' has the * following description: Primary Key for vamsas object - * referencing - * + * referencing * * @param id the value of field 'id'. */ @@ -497,19 +464,14 @@ implements java.io.Serializable } //-- void setId(java.lang.String) /** - * Sets the value of field 'modifiable'. The field 'modifiable' - * has the following description: objects with modifiable=false - * will not be - * modified by a vamsas client update - * + * Sets the value of field 'modifiable'. * * @param modifiable the value of field 'modifiable'. */ - public void setModifiable(boolean modifiable) + public void setModifiable(java.lang.String modifiable) { this._modifiable = modifiable; - this._has_modifiable = true; - } //-- void setModifiable(boolean) + } //-- void setModifiable(java.lang.String) /** * Method setTree diff --git a/src/org/vamsas/objects/core/VAMSASDescriptor.java b/src/org/vamsas/objects/core/VAMSASDescriptor.java index 7ec2896..9eb4e29 100644 --- a/src/org/vamsas/objects/core/VAMSASDescriptor.java +++ b/src/org/vamsas/objects/core/VAMSASDescriptor.java @@ -101,27 +101,21 @@ public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescrip } desc.setValidator(fieldValidator); //-- _modifiable - desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); handler = new org.exolab.castor.xml.XMLFieldHandler() { public java.lang.Object getValue( java.lang.Object object ) throws IllegalStateException { VAMSAS target = (VAMSAS) object; - if(!target.hasModifiable()) - return null; - return (target.getModifiable() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + return target.getModifiable(); } public void setValue( java.lang.Object object, java.lang.Object value) throws IllegalStateException, IllegalArgumentException { try { VAMSAS target = (VAMSAS) object; - // if null, use delete method for optional primitives - if (value == null) { - target.deleteModifiable(); - return; - } - target.setModifiable( ((java.lang.Boolean)value).booleanValue()); + target.setModifiable( (java.lang.String) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -138,7 +132,8 @@ public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescrip //-- validation code for: _modifiable fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + StringValidator typeValidator = new StringValidator(); + typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); diff --git a/src/org/vamsas/objects/core/VamsasDocument.java b/src/org/vamsas/objects/core/VamsasDocument.java index fd4eef1..f8df822 100644 --- a/src/org/vamsas/objects/core/VamsasDocument.java +++ b/src/org/vamsas/objects/core/VamsasDocument.java @@ -53,8 +53,7 @@ implements java.io.Serializable private Provenance _provenance; /** - * contains unassociated trees and a number of analysis - * sets + * contains unassociated trees and a number of analysis sets * */ private java.util.Vector _VAMSASList; -- 1.7.10.2