Overview | Package | Class | Use | Tree | Help
| HEADER
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ru.biosoft.access
Class AbstractDataCollection

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

Direct Known Subclasses:
  MglDataCollection, DummyRelationDataCollection, DataCollectionUnion, DerivedDataCollection, EntryCollection, SQLDataCollection, VectorDataCollection

public abstract class AbstractDataCollection
extends DataElementSupport
implements DataCollection

This abstract class provides default implementations for most of the methods in the `DataCollection` interface. It takes care of the management of listeners and provides some conveniences for generating DataCollectionEvents and dispatching them to the listeners.

To create a concrete DataCollection as a sublcass of AbstractDataCollection you need only provide implementations for the following methods:
DataCollection.iterator()
if concrete DataColection mutable, then next methods should be implemented
doPut(ru.biosoft.access.DataElement)
doRemove(ru.biosoft.access.DataElement)

Version: 1.0

Constructor Summary
`AbstractDataCollection(DataCollection parent, Properties properties)` Constructs data collection with parent.

Method Summary
`void` | `addDataCollectionListener(DataCollectionListener listener)` Adds listener to this data collection.
`void` | `close()` Do nothing.
`boolean` | `contains(DataElement element)` Check if this data collection contains the specified data element.
`boolean` | `contains(String name)` Returns `true` if this data collection contains the element with specified name.
`DataElement` | `get(String name)` Gets data element with specified name.
`String` | `getCompleteName()` Gets complete name of data collection.
`Class` | `getDataElementType()` Gets the type of DataElements stored in the data collection.
`DataCollectionInfo` | `getInfo()` Gets data collection info.
`List` | `getNameList()` Gets list of all names in data collection.
`int` | `getSize()` Gets size of data collection.
`void` | `init()` Do nothing.
`boolean` | `isMutable()` Returns false.
`void` | `propagateElementChanged(DataCollection source, DataCollectionEvent primaryEvent)`
`void` | `propagateElementWillChange(DataCollection source, DataCollectionEvent primaryEvent)`
`DataElement` | `put(DataElement element)` Adds the specified data element to the collection.
`DataElement` | `remove(String name)` Removes the specified data element from the collection, if present.
`void` | `removeDataCollectionListener(DataCollectionListener listener)` Removes listener from this data collection.
`String` | `toString()` Returns a String representation of the data collection.

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

Constructor Detail

### AbstractDataCollection

    public AbstractDataCollection(DataCollection parent, Properties properties)

  Constructs data collection with parent. Makes info for this data collection.
  Required properties
  - DataCollection.NAME_PROPERTY
  Optional properties
  - ru.biosoft.access.DataCollection#PATH_PROPERTY
  - DataCollection.NODE_IMAGE
  - DataCollection.CHILDREN_NODE_IMAGE
  - DataCollection.NODE_VISIBLE
  - DataCollection.CHILDREN_NODE_VISIBLE
  Parameters:
    parent - Parent data collection.
    properties - Properties for creating data collection (may be changed).
  todo low makeInfo(Properties) should be moved to collection that only appears in repository.

Method Detail

### addDataCollectionListener

    public void addDataCollectionListener(DataCollectionListener listener)

  Adds listener to this data collection.
  Parameters:
    listener - Listener of this data collection.

### close

    public void close()
                throws java.lang.Exception

  Do nothing.

### contains

    public boolean contains(DataElement element)

  Check if this data collection contains the specified data element.
  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:
    contains(java.lang.String)
  todo Check type of data element.

### contains

    public boolean contains(String name)

  Returns `true` if this data collection contains the element with specified name.
  Parameters:
    name - name of element whose presence in this data collection is to be tested.
  Returns: `true` if this data collection contains the element with specified name.
  See Also:
    contains(ru.biosoft.access.DataElement)

### get

    public DataElement get(String name)
                     throws java.lang.Exception

  Gets data element with specified name. This implementation supports cache and for actual access use doGet(java.lang.String).
  Parameters:
    name - Name of the data element (cannot be null).
  Returns: DataElement or null if data element not found in the data collection.
  Throws:
    java.lang.Exception - If error raised in doGet(java.lang.String)
  See Also:
    doGet(java.lang.String), v_cache
  todo Check type of data element.

### getCompleteName

    public String getCompleteName()

  Gets complete name of data collection.
  Returns: full name of DataCollection in the tree hierarchy.

### getDataElementType

    public Class getDataElementType()

  Gets the type of DataElements stored in the data collection. Should be overrided in derived collection.
  Returns: Type of DataElements stored in the data collection.

### getInfo

    public DataCollectionInfo getInfo()

  Gets data collection info.
  Returns: Data collection info.
  See Also:
    DataCollectionInfo

### getNameList

    public List getNameList()

  Gets list of all names in data collection.
  Returns: Names of all elements in the data collection.

### getSize

    public int getSize()

  Gets size of data collection. This method must be overrided for perfomance improving.
  Returns: Number of data element in this data collection.

### init

    public void init()

  Do nothing.

### isMutable

    public boolean isMutable()

  Returns false. Override this method for return correct value.
  Returns: Always return false.

### propagateElementChanged

    public void propagateElementChanged(DataCollection source, DataCollectionEvent primaryEvent)

  todo comment

### propagateElementWillChange

    public void propagateElementWillChange(DataCollection source, DataCollectionEvent primaryEvent)

  todo comment

### put

    public DataElement put(DataElement element)
                     throws java.lang.Exception

  Adds the specified data element to the collection. Notifies all listeners if the data element was added or changed. `doPut(ru.biosoft.access.DataElement)` method is used to put the data element. If the data collection previously contained the specified element, the old value is replaced.
  Note that this implementation slow enough!!!
  Parameters:
    element - Data element that will be putted in the data collection (Cannt be null).
  Returns: previous version of the data element, or null if there was no one.
  Throws:
    java.util.UnsupportedOperationException - if the data collection is unmutable.
    java.lang.Exception - If error occured.
  See Also:
    doPut(ru.biosoft.access.DataElement), isMutable()
  todo should check DataElement type

### remove

    public DataElement remove(String name)
                        throws java.lang.Exception,
                               java.lang.UnsupportedOperationException

  Removes the specified data element from the collection, if present. Notifies all listeners if the data element was removed. `doRemove(ru.biosoft.access.DataElement)` method is used to remove the data element.
  Parameters:
    name
  Returns: the removed data element.
  Throws:
    UnsupportedOperationException - If the data collection is unmutable.
    Exception - If any error.
  See Also:
    doRemove(ru.biosoft.access.DataElement), isMutable()

### removeDataCollectionListener

    public void removeDataCollectionListener(DataCollectionListener listener)

  Removes listener from this data collection.
  Parameters:
    listener - Listener of this data collection.

### toString

    public String toString()

  Returns a String representation of the data collection.
  Returns: String representation of the data collection.

Association Links

to Class ru.biosoft.util.HashMapSoftValues

  Cache for already accessed data elements.

to Class org.apache.log4j.Category

  Log category

to Class java.lang.String

  todo Document

to Class ru.biosoft.access.DataCollectionInfo

  Data collection info for this data collection.

to Class javax.swing.event.EventListenerList

  List of listeners.

Overview | Package | Class | Use | Tree | Help
| FOOTER
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

BOTTOM