ru.biosoft.access
Class DataCollectionUnion

java.lang.Object
  extended byru.biosoft.access.DataElementSupport
      extended byru.biosoft.access.AbstractDataCollection
          extended byru.biosoft.access.DataCollectionUnion
All Implemented Interfaces:
CollectionUnion, DataCollection, DataElement

public class DataCollectionUnion
extends AbstractDataCollection
implements CollectionUnion

Collection that is union of several collections. This class has its own agreement of names.

To do:
HIGH if some of data collections in union have data elements with same name then we can access to it only through iterator. get() always return first data element.
Pendung:
high It is supposed that collections have not the objects with the same names.

Field Summary
 
Fields inherited from class ru.biosoft.access.AbstractDataCollection
cat, info, notificationEnabled, path, propagationEnabled, v_cache
 
Fields inherited from interface ru.biosoft.access.DataCollection
CHILDREN_NODE_IMAGE, CHILDREN_NODE_VISIBLE, CLASS_PROPERTY, CLASSPATH_JAR_PROPERTY, COMPARATOR_OBJECT, CONFIG_FILE_PROPERTY, CONFIG_PATH_PROPERTY, DATA_ELEMENT_CLASS_PROPERTY, DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_SUFFIX, DEFAULT_FILTER_CONFIG_SUFFIX, DEFAULT_FORMAT_CONFIG_SUFFIX, DEFAULT_NODE_CONFIG_SUFFIX, DEFAULT_REPOSITORY, DESCRIPTION_PROPERTY, DISPLAY_NAME_PROPERTY, FILE_PATH_PROPERTY, FILE_PROPERTY, FILTER_PROPERTY, ID_FORMAT, IS_ROOT, JOB_CONTROL_PROPERTY, LATE_CHILDREN_INITIALIZATION, MUTABLE, NAME_PROPERTY, NEXT_CONFIG, NODE_IMAGE, NODE_VISIBLE, PRIMARY_COLLECTION, REMOVE_CHILDREN, TRANSFORMER_CLASS
 
Constructor Summary
DataCollectionUnion(DataCollection dc, java.util.Properties properties)
          Make union of all collections contained in specified data collection.
 
Method Summary
 void addCollection(DataCollection dc)
          Add all elements from specified collection to union.
 boolean contains(DataElement element)
          Returns true if this data collection contains the specified data element.
 DataElement get(java.lang.String name)
          Returns the DataElement with the specified composite name.
 java.util.List getNameList()
          Return name list of all data elements in this union.
 int getSize()
          Returns the number of elements in this data collection union.
 java.util.Iterator iterator()
          Returns an iterator over the data elements in this collection.
 void removeCollection(java.lang.String name)
          Removes all elements contained in collection with specified name from union.
 
Methods inherited from class ru.biosoft.access.AbstractDataCollection
addDataCollectionListener, cachePut, checkMutable, close, contains, doAddPostNotify, doAddPreNotify, doGet, doPut, doRemove, doRemovePostNotify, doRemovePreNotify, finalize, fireElementAdded, fireElementChanged, fireElementRemoved, fireElementWillAdd, fireElementWillChange, fireElementWillRemove, getCompleteName, getDataElementType, getDescription, getInfo, initLog, isMutable, isNotificationEnabled, isPropagationEnabled, makeInfo, propagateElementChanged, propagateElementWillChange, put, registerRoot, release, remove, removeDataCollectionListener, setNotificationEnabled, setPropagationEnabled, toString
 
Methods inherited from class ru.biosoft.access.DataElementSupport
getName, getOrigin, registerConstructorWithBadEqual
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ru.biosoft.access.DataCollection
addDataCollectionListener, close, contains, getCompleteName, getDataElementType, getInfo, isMutable, isNotificationEnabled, isPropagationEnabled, propagateElementChanged, propagateElementWillChange, put, release, remove, removeDataCollectionListener, setNotificationEnabled, setPropagationEnabled
 
Methods inherited from interface ru.biosoft.access.DataElement
getName, getOrigin
 

Constructor Detail

DataCollectionUnion

public DataCollectionUnion(DataCollection dc,
                           java.util.Properties properties)
Make union of all collections contained in specified data collection.

Parameters:
dc - Collection which contain data collections for union.
Method Detail

addCollection

public void addCollection(DataCollection dc)
Description copied from interface: CollectionUnion
Add all elements from specified collection to union. If specified collection already contains in union then all it elements readded again.

Specified by:
addCollection in interface CollectionUnion
Parameters:
dc - Collection with data elements which will be added to union.

removeCollection

public void removeCollection(java.lang.String name)
Description copied from interface: CollectionUnion
Removes all elements contained in collection with specified name from union.

Specified by:
removeCollection in interface CollectionUnion
Parameters:
name - Simple name of data collection which contains elements to remove from union.

getSize

public int getSize()
Returns the number of elements in this data collection union.

Specified by:
getSize in interface DataCollection
Overrides:
getSize in class AbstractDataCollection
Returns:
Size of this data collection.

contains

public boolean contains(DataElement element)
Returns true if this data collection contains the specified data element.

Specified by:
contains in interface DataCollection
Overrides:
contains in class AbstractDataCollection
Parameters:
element - tested data element.
Returns:
true if this data collection contains the data element which name equals to specified data element, otherwise return false.
See Also:
AbstractDataCollection.contains(String)

get

public DataElement get(java.lang.String name)
                throws java.lang.Exception
Returns the DataElement with the specified composite name. Returns null if the data collection contains no data element for this name.

Specified by:
get in interface DataCollection
Overrides:
get in class AbstractDataCollection
Parameters:
name - Name in format 'data_collection_name/data_element_name'. data_collection_name - name of collection in which data_element_name element contains.
Returns:
DataElement with specified composite name or null if colection have no data element with specified name.
Throws:
java.lang.IllegalArgumentException - if argument invalid.
java.lang.Exception - if an error occurs.
See Also:
AbstractDataCollection.doGet(String), AbstractDataCollection.v_cache

iterator

public java.util.Iterator iterator()
Returns an iterator over the data elements in this collection. There are no guarantees concerning the order in which the elements are returned. If the data collection is modified while an iteration over it is in progress, the results of the iteration are undefined.

Specified by:
iterator in interface DataCollection

getNameList

public java.util.List getNameList()
Return name list of all data elements in this union. Each name in name list is composite. Format is 'data_collection_name/data_element_name'. // * Returns an unmodifiable view of the data element name list. // * Query operations on the returned list "read through" to the internal name list, // * and attempts to modify the returned list, whether direct or via its iterator, // * result in an UnsupportedOperationException. // * // * The returned list is backed by the data collection, // * so changes to the data collection are reflected in the returned list. // * // * The name list can be sorted or unsorted depending on the DataCollection // * implementing class. // *

Specified by:
getNameList in interface DataCollection
Overrides:
getNameList in class AbstractDataCollection
Returns:
Names of all elements in the data collection.
To do:
HIGH Implement above specification.


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.