HEADER

ru.biosoft.access
Class DataCollectionUnion

ru.biosoft.access.DataElementSupport
  |
  +--ru.biosoft.access.AbstractDataCollection
        |
        +--ru.biosoft.access.DataCollectionUnion

public class DataCollectionUnion
extends AbstractDataCollection
implements CollectionUnion

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

todo 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.
pending high It is supposed that collections have not the objects with the same names.

Constructor Summary
DataCollectionUnion(DataCollection dc, Properties properties)
          Make union of all collections contained in specified data collection.

Method Summary
 voidaddCollection(DataCollection dc)
           
 booleancontains(DataElement element)
          Returns true if this data collection contains the specified data element.
 DataElementget(String name)
          Returns the DataElement with the specified composite name.
 ListgetNameList()
          Return name list of all data elements in this union.
 intgetSize()
          Returns the number of elements in this data collection union.
 Iteratoriterator()
          Returns an iterator over the data elements in this collection.
 voidremoveCollection(String name)
           

Methods inherited from class ru.biosoft.access.AbstractDataCollection
addDataCollectionListener, close, contains, getCompleteName, getDataElementType, getInfo, init, isMutable, propagateElementChanged, propagateElementWillChange, put, remove, removeDataCollectionListener, toString

Methods inherited from class ru.biosoft.access.DataElementSupport
getName, getOrigin, registerConstructorWithBadEqual

Constructor Detail

DataCollectionUnion

public DataCollectionUnion(DataCollection dc, 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)

contains

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

get

public DataElement get(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.
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:
IllegalArgumentException - if argument invalid.
Exception - if an error occurs.

getNameList

public 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. // *
todo HIGH Implement above specification.

getSize

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

iterator

public 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.

removeCollection

public void removeCollection(String name)

FOOTER

BOTTOM