Version: 1.1.1

org.inb.biomoby.central.model
Class AbstractModel<T>

java.lang.Object
  extended by org.inb.biomoby.central.model.AbstractModel<T>
Direct Known Subclasses:
DatatypesModel, MobyCentralModel, NamespacesModel, ServicesModel

public abstract class AbstractModel<T>
extends Object

An abstract class for all BioMoby Registry models. Any BioMoby Registry model extends this class to provide a basic functionality such as an entity insertion/deletion/modification. The class also provides a basic notification mechanism through event listeners.

Author:
Dmitry Repchevsky

Constructor Summary
AbstractModel()
           
 
Method Summary
abstract  boolean addElement(T element)
          Method to add a model element.
 void addListener(ModelListener<T> listener)
          Method to add a listener to be notified about a model changes.
 T getElement(T element)
          Method returns a model element referenced by a provided one (using equals() method).
abstract  Collection<T> getElements()
           
abstract  boolean removeElement(T element)
          Method to remove a model element
abstract  boolean updateElement(T element1, T element2)
          A method that updates an element referred by element1 with data provided by element2 Note that updated element is not necesary the same object as elemen1, but those located in an underlied collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractModel

public AbstractModel()
Method Detail

getElements

public abstract Collection<T> getElements()

getElement

public T getElement(T element)
Method returns a model element referenced by a provided one (using equals() method).

Parameters:
element - - a reference object to find a model element using an equals() method
Returns:
- found model element or null

addElement

public abstract boolean addElement(T element)
Method to add a model element.

Parameters:
element - - an element to be added to the model
Returns:
- true if element has been added

removeElement

public abstract boolean removeElement(T element)
Method to remove a model element

Parameters:
element - - an element to be removed from the model
Returns:
- true if element has been removed

updateElement

public abstract boolean updateElement(T element1,
                                      T element2)
A method that updates an element referred by element1 with data provided by element2 Note that updated element is not necesary the same object as elemen1, but those located in an underlied collection. The method to find an updated element is a collection (and implementation) specific.

Parameters:
element1 - - an object in a model to be updated
element2 - - an object that used as a data source to updated object
Returns:
- true if element has been updated

addListener

public final void addListener(ModelListener<T> listener)
Method to add a listener to be notified about a model changes.

Parameters:
listener - - a listener to be added to a list of listeners

Version: 1.1.1

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