Version: 1.1.1

org.biomoby.shared.data
Class MobyDataObjectSetSAI

java.lang.Object
  extended by org.biomoby.shared.MobyData
      extended by org.biomoby.shared.MobyPrimaryData
          extended by org.biomoby.shared.MobyPrimaryDataSet
              extended by org.biomoby.shared.data.MobyDataObjectSet
                  extended by org.biomoby.shared.data.MobyDataObjectSetSAI
All Implemented Interfaces:
Cloneable, Iterable<MobyDataObject>, Collection<MobyDataObject>, MobyDataInstance, MobyDataServiceAssocInstance
Direct Known Subclasses:
MobyDataObjectSetDeferredSAI

public class MobyDataObjectSetSAI
extends MobyDataObjectSet
implements MobyDataServiceAssocInstance

A convenience class that just associates a set of possible services to run with a data collection. It shadows all of the normal MobyDataObjectSet methods, passing them through to the data instance given in the constructor. This is done rather than unnecessarily cloning potentially large objects. NOTA BENE: This object does not clone the MOBY data passed in, therefore any changes you make to the original MOBY data collection later will be reflected here! If you want this object to retain its own copy (e.g. in an intialization loop) call the constructor like this: new MobyDataObjectSetSAI((MobyDataObjectSet) data.clone(), ...)


Field Summary
 
Fields inherited from interface org.biomoby.shared.data.MobyDataInstance
CENTRAL_XML_MODE, SERVICE_XML_MODE
 
Constructor Summary
MobyDataObjectSetSAI(MobyDataObjectSet collection, MobyService[] services)
          Constructor that takes an existing object and associates services with it.
MobyDataObjectSetSAI(String name, MobyService[] services)
          Constructor for base Objects.
MobyDataObjectSetSAI(String name, MobyService[] services, Registry registry)
           
 
Method Summary
 boolean add(MobyDataObject mdsi)
          Add a single MobyDataObject to the collection.
 boolean addAll(Collection<? extends MobyDataObject> c)
          Convenient way to add the input collection of MobyDataObjects (usually a MobyDataObjectSet, or a Vector of MobyDataObjects) to this collection.
 void addNamespace(MobyNamespace ns)
          Add given namespace of all elements of this collection.
 void clear()
          Removes all of the MobyDataObject elements from this collection.
 boolean contains(Object mdsi)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object set)
          Compare two MobyDataObject collections.
 MobyDataType getDataType()
          Return the least upper bound parent class of all items in the collection.
 MobyDataObject[] getElementInstances()
           
 MobyPrimaryDataSimple[] getElements()
           
 String getId()
           
 MobyNamespace[] getNamespaces()
          Return namespaces that occur in all items of the collection.
 Object getObject()
          Each implementer will return the underlying Java object used to store the MOBY value.
 MobyService[] getServices()
           
 Object getUserData()
          Retrieves any application-specific data that may have been stored in association with this Moby object.
 int getXmlMode()
          Report whether toXML will produce Central template or service call instance XML.
 int hashCode()
          Implemented solely because of the general contract that c1.equals(c2) implies that c1.hashCode()==c2.hashCode()
 boolean isEmpty()
          Logically equivalent to size() == 0.
 Iterator<MobyDataObject> iterator()
           
 boolean remove(Object mdsi)
          Removes a single instance of an element from this collection, if it satisfies mdsi.equals().
 boolean removeAll(Collection c)
          Set theory subtraction operator implementation.
 void removeNamespace(String namespaceName)
          Remove given namespace (defined by its name) from all elements of this collection.
 boolean retainAll(Collection c)
          Set theory intersection operator implementation.
 void setElements(MobyDataObject[] values)
          Replace whatever is in the collection right now with the values in the input array.
 void setId(String value)
           
 void setNamespaces(MobyNamespace[] values)
          Set given namespaces of all elements of this collection.
 void setServices(MobyService[] services)
           
 void setUserData(Object data)
          Allows developers to track their application-specific information alongside the Moby functionality.
 void setXmlMode(int mode)
          Determined whether toXML will return a Central template value or a service call instance value.
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] classArray)
          Don't use this method if at all possible.
 String toString()
           
 String toXML()
          Wraps the simple instances' XML in a MOBY Collection tag
 
Methods inherited from class org.biomoby.shared.data.MobyDataObjectSet
clone, getChildren, removeNamespace
 
Methods inherited from class org.biomoby.shared.MobyPrimaryDataSet
addElement, format, setDataType, setElements
 
Methods inherited from class org.biomoby.shared.MobyPrimaryData
isPrimary
 
Methods inherited from class org.biomoby.shared.MobyData
getName, setName
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biomoby.shared.data.MobyDataInstance
getName, setName
 

Constructor Detail

MobyDataObjectSetSAI

public MobyDataObjectSetSAI(String name,
                            MobyService[] services)
Constructor for base Objects.


MobyDataObjectSetSAI

public MobyDataObjectSetSAI(String name,
                            MobyService[] services,
                            Registry registry)

MobyDataObjectSetSAI

public MobyDataObjectSetSAI(MobyDataObjectSet collection,
                            MobyService[] services)
Constructor that takes an existing object and associates services with it.

Method Detail

getServices

public MobyService[] getServices()
Specified by:
getServices in interface MobyDataServiceAssocInstance

getDataType

public MobyDataType getDataType()
Description copied from class: MobyDataObjectSet
Return the least upper bound parent class of all items in the collection.

Overrides:
getDataType in class MobyDataObjectSet

setServices

public void setServices(MobyService[] services)
Specified by:
setServices in interface MobyDataServiceAssocInstance

getXmlMode

public int getXmlMode()
Description copied from class: MobyDataObjectSet
Report whether toXML will produce Central template or service call instance XML.

Specified by:
getXmlMode in interface MobyDataInstance
Overrides:
getXmlMode in class MobyDataObjectSet
Returns:
one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE

setXmlMode

public void setXmlMode(int mode)
                throws IllegalArgumentException
Description copied from class: MobyDataObjectSet
Determined whether toXML will return a Central template value or a service call instance value.

Specified by:
setXmlMode in interface MobyDataInstance
Overrides:
setXmlMode in class MobyDataObjectSet
Parameters:
mode - one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
Throws:
IllegalArgumentException - if the mode is not one of the specified values

setId

public void setId(String value)
Overrides:
setId in class MobyData

getId

public String getId()
Overrides:
getId in class MobyData

addNamespace

public void addNamespace(MobyNamespace ns)
Description copied from class: MobyDataObjectSet
Add given namespace of all elements of this collection.

Overrides:
addNamespace in class MobyDataObjectSet

getNamespaces

public MobyNamespace[] getNamespaces()
Description copied from class: MobyDataObjectSet
Return namespaces that occur in all items of the collection. This method relies on MobyNamespace's equals() method to be properly implemented for proper set intersection functionality.

Overrides:
getNamespaces in class MobyDataObjectSet

setNamespaces

public void setNamespaces(MobyNamespace[] values)
Description copied from class: MobyDataObjectSet
Set given namespaces of all elements of this collection.

Overrides:
setNamespaces in class MobyDataObjectSet

removeNamespace

public void removeNamespace(String namespaceName)
Description copied from class: MobyDataObjectSet
Remove given namespace (defined by its name) from all elements of this collection.

Overrides:
removeNamespace in class MobyDataObjectSet

setElements

public void setElements(MobyDataObject[] values)
                 throws NullPointerException
Description copied from class: MobyDataObjectSet
Replace whatever is in the collection right now with the values in the input array.

Overrides:
setElements in class MobyDataObjectSet
Throws:
NullPointerException - if the input array is null, or contains null elements

getElements

public MobyPrimaryDataSimple[] getElements()
Overrides:
getElements in class MobyDataObjectSet

getUserData

public Object getUserData()
Description copied from class: MobyData
Retrieves any application-specific data that may have been stored in association with this Moby object. The returned object has nothing to do with the Moby protocol itself. See setUserData() for more details.

Specified by:
getUserData in interface MobyDataInstance
Overrides:
getUserData in class MobyData

setUserData

public void setUserData(Object data)
Description copied from class: MobyData
Allows developers to track their application-specific information alongside the Moby functionality. Provided for application developers' convenience: data stored using this routine is completely ignore by the Moby core libraries. If you want to store Moby data, use the routines defined in various subclasses of this class (e.g. MobyDataObject).

Specified by:
setUserData in interface MobyDataInstance
Overrides:
setUserData in class MobyData

getObject

public Object getObject()
Description copied from interface: MobyDataInstance
Each implementer will return the underlying Java object used to store the MOBY value. For example, MOBY Floats are stored internally as BigDecimal objects.

Specified by:
getObject in interface MobyDataInstance
Overrides:
getObject in class MobyDataObjectSet
Returns:
a Vector with the MobyDataObjects

add

public boolean add(MobyDataObject mdsi)
            throws ClassCastException,
                   NullPointerException
Description copied from class: MobyDataObjectSet
Add a single MobyDataObject to the collection.

Specified by:
add in interface Collection<MobyDataObject>
Overrides:
add in class MobyDataObjectSet
Throws:
NullPointerException - if the input is a null object
ClassCastException

addAll

public boolean addAll(Collection<? extends MobyDataObject> c)
               throws ClassCastException,
                      NullPointerException
Description copied from class: MobyDataObjectSet
Convenient way to add the input collection of MobyDataObjects (usually a MobyDataObjectSet, or a Vector of MobyDataObjects) to this collection.

Specified by:
addAll in interface Collection<MobyDataObject>
Overrides:
addAll in class MobyDataObjectSet
Returns:
true if the collection changes as a result of the operation
Throws:
NullPointerException - if the collection or one of its members is a null object
ClassCastException

contains

public boolean contains(Object mdsi)
                 throws ClassCastException,
                        NullPointerException
Specified by:
contains in interface Collection<MobyDataObject>
Overrides:
contains in class MobyDataObjectSet
Returns:
true if this collection contains an element with the exact same value (equivalent in MOBY XML representation, including name)
Throws:
ClassCastException - if the input is not a MobyDataObject
NullPointerException - if the input is a null object

containsAll

public boolean containsAll(Collection c)
                    throws ClassCastException,
                           NullPointerException
Specified by:
containsAll in interface Collection<MobyDataObject>
Overrides:
containsAll in class MobyDataObjectSet
Returns:
true if each element in the input collection returns true when contains(Object o) is called
Throws:
ClassCastException - if a member of the input collection is not a MobyDataObject
NullPointerException - if the collection or one of its members is a null object

equals

public boolean equals(Object set)
               throws ClassCastException,
                      NullPointerException
Description copied from class: MobyDataObjectSet
Compare two MobyDataObject collections. Note that this may be a very expensive operation if the lists are long, the equals() method is complicated, or collection is hard to convert into an array for sorting.

Specified by:
equals in interface Collection<MobyDataObject>
Overrides:
equals in class MobyDataObjectSet
Returns:
true if and only if the input object is a MobyDataObjectSet, and the two collections contain exactly equal elements from a MOBY XML perspective
Throws:
ClassCastException - if the input is not a Collection of MobyDataObjects
NullPointerException - if the input is a null object

hashCode

public int hashCode()
Description copied from class: MobyDataObjectSet
Implemented solely because of the general contract that c1.equals(c2) implies that c1.hashCode()==c2.hashCode()

Specified by:
hashCode in interface Collection<MobyDataObject>
Overrides:
hashCode in class MobyDataObjectSet

clear

public void clear()
Description copied from class: MobyDataObjectSet
Removes all of the MobyDataObject elements from this collection.

Specified by:
clear in interface Collection<MobyDataObject>
Overrides:
clear in class MobyDataObjectSet

isEmpty

public boolean isEmpty()
Description copied from class: MobyDataObjectSet
Logically equivalent to size() == 0.

Specified by:
isEmpty in interface Collection<MobyDataObject>
Overrides:
isEmpty in class MobyDataObjectSet

iterator

public Iterator<MobyDataObject> iterator()
Specified by:
iterator in interface Iterable<MobyDataObject>
Specified by:
iterator in interface Collection<MobyDataObject>
Overrides:
iterator in class MobyDataObjectSet
Returns:
an iterator over the non-null MobyDataObjects in this collection

remove

public boolean remove(Object mdsi)
               throws ClassCastException,
                      NullPointerException
Description copied from class: MobyDataObjectSet
Removes a single instance of an element from this collection, if it satisfies mdsi.equals().

Specified by:
remove in interface Collection<MobyDataObject>
Overrides:
remove in class MobyDataObjectSet
Parameters:
mdsi - the MobyDataObject whose value equivalent (not object reference) is to be removed
Returns:
true if the element was found and removed
Throws:
ClassCastException - if the input is not a MobyDataObject
NullPointerException - if the input is a null object

removeAll

public boolean removeAll(Collection c)
                  throws ClassCastException,
                         NullPointerException
Description copied from class: MobyDataObjectSet
Set theory subtraction operator implementation.

Specified by:
removeAll in interface Collection<MobyDataObject>
Overrides:
removeAll in class MobyDataObjectSet
Returns:
true if this collection changed as a result of the call
Throws:
ClassCastException - if a member of the input collection is not a MobyDataObject
NullPointerException - if the collection or one of its members is a null object

retainAll

public boolean retainAll(Collection c)
Description copied from class: MobyDataObjectSet
Set theory intersection operator implementation.

Specified by:
retainAll in interface Collection<MobyDataObject>
Overrides:
retainAll in class MobyDataObjectSet
Returns:
true if this collection changed as a result of the call

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<MobyDataObject>
Overrides:
toArray in class MobyDataObjectSet
Returns:
a MobyDataObject[] with the collection members

toArray

public <T> T[] toArray(T[] classArray)
            throws ArrayStoreException,
                   NullPointerException
Description copied from class: MobyDataObjectSet
Don't use this method if at all possible. It is only defined because of the Collection interface requirement. Use toArray() instead. This method will only work if the input array is a MobyDataObject[], or MobyDataInt[], MobyDataFloat[], etc. if you know for sure that all of the collection elements are of a particular MOBY primitive subtype. Otherwise an ArrayStoreException will be thrown.

Specified by:
toArray in interface Collection<MobyDataObject>
Overrides:
toArray in class MobyDataObjectSet
Throws:
ArrayStoreException
NullPointerException

getElementInstances

public MobyDataObject[] getElementInstances()
Overrides:
getElementInstances in class MobyDataObjectSet
Returns:
the MobyDataObjects that comprise the collection

size

public int size()
Specified by:
size in interface Collection<MobyDataObject>
Overrides:
size in class MobyDataObjectSet
Returns:
the number of elements in this collection

toString

public String toString()
Overrides:
toString in class MobyPrimaryDataSet

toXML

public String toXML()
Description copied from class: MobyDataObjectSet
Wraps the simple instances' XML in a MOBY Collection tag

Specified by:
toXML in interface MobyDataInstance
Overrides:
toXML in class MobyDataObjectSet

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010