|
Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.talos.impl.AbstractContainer<T>
T - the type of entity the container holdspublic abstract class AbstractContainer<T extends NamedObject>
Provides an implementation of the Container interface. All containers in Talos implement this abstract class and inherit all the basic container functionality.
| Field Summary | |
|---|---|
protected Map<String,T> |
elements
|
| Constructor Summary | |
|---|---|
protected |
AbstractContainer(Collection<T> elements)
Constructor that gets a list of elements and builds a map of elements by name. |
protected |
AbstractContainer(Map<String,T> elements)
Constructor that gets a map of elements by name. |
| Method Summary | |
|---|---|
protected void |
checkCloneAllowed()
Throws an exception if the container is not capable of the cloneAs() operation |
boolean |
contains(String name)
Verifies if the container contains an entity with the given name. |
boolean |
containsAll(String... names)
Verifies if the container contains all the given entities. |
T |
getElement(String name)
Get an especific element from this container. |
protected T |
getFirstElement()
Gets the first element the container can find. |
boolean |
isEmpty()
Check if the container is empty. |
Collection<T> |
list()
Gets all the entities the container holds. |
void |
remove()
Permanently deletes from Talos all the elements of the container. |
protected abstract void |
remove(T element)
Removes an element from the storage permanently. |
int |
size()
Returns the number of elements in this container |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map<String,T extends NamedObject> elements
| Constructor Detail |
|---|
protected AbstractContainer(Map<String,T> elements)
elements - a map of NamedObjects by nameAbstractContainer(Collection)protected AbstractContainer(Collection<T> elements)
elements - a collection of elementsAbstractContainer(Map)| Method Detail |
|---|
protected abstract void remove(T element)
element - the element that must be deletedpublic void remove()
Container
remove in interface Container<T extends NamedObject>public boolean isEmpty()
Container
isEmpty in interface Container<T extends NamedObject>Container.list()public Collection<T> list()
Container
list in interface Container<T extends NamedObject>Container.contains(String),
Container.containsAll(String[])public boolean contains(String name)
Container
contains in interface Container<T extends NamedObject>name - the name of the entity.
Container.list(),
Container.containsAll(String[])public boolean containsAll(String... names)
Container
containsAll in interface Container<T extends NamedObject>names - the name of each entities.
Container.contains(String)public T getElement(String name)
Container
getElement in interface Container<T extends NamedObject>name - the name of the element to get.
Container.list(),
Container.contains(String)public int size()
Container
size in interface Container<T extends NamedObject>Container.list(),
Container.isEmpty()protected T getFirstElement()
protected void checkCloneAllowed()
throws CloneNotAllowedException
CloneNotAllowedException - if the container has too many (or too few) elements.
|
Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||