|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjasi.sim.basic.element.Elements
public class Elements
Simulation elements factory and management class. The hash table based implementation of the collection of elements provides constant-time performance for the basic operations (get and put), assuming the hash function disperses the elements properly among the buckets. Iteration over collection views requires time proportional to the "capacity" of the HashMap instance (the number of buckets) plus its size (the number of key-value mappings).
Constructor Summary | |
---|---|
Elements(SimController controller)
Constructor for an element manager. |
Method Summary | ||
---|---|---|
void |
addElementsListener(ElementsListener listener)
Add an listener for state changes of elements. |
|
java.util.List<Element> |
asList(Id[] ids)
Transform an array of element IDs into a list of simulation elements. |
|
|
change(Element element,
java.lang.String name,
T value)
Request the change of the value of a simulation element's attribute/property. |
|
void |
clear()
Remove all elements from this manager. |
|
boolean |
contains(Id id)
Check, if that ID already exists. |
|
|
get(java.lang.Class<T> c,
Id id)
Retrieve simulation element of a certain type from list of simulation elements. |
|
Element |
get(Id id)
Retrieve element from list. |
|
java.util.List<Element> |
getElements()
Returns a unmodifiable collection view of the values contained in the map of all currently existing simulation elements. |
|
|
readElementProperty(Element element,
java.lang.String property,
T value)
An element property was requested. |
|
Element |
register(Element element)
Register a simulation element and insert it into the list of elements. |
|
void |
removeElementsListener(ElementsListener listener)
Remove an listener for state changes of this calendar. |
|
|
request(Element element,
java.lang.String name,
T value)
The value of a simulation element's attribute/property is requested for reading. |
|
|
selectElementsOfClass(java.lang.Class<T> c)
Retrieve a selected unmodifiable list of all simulation elements for that given class type. |
|
void |
setElements(java.util.List<Element> elements)
Register a collection of simulation elements. |
|
int |
size()
Get the number of managed simulation elements. |
|
java.lang.String |
toString()
Returns a string representation of this object. |
|
|
writeElementProperty(Element element,
java.lang.String property,
T value)
An element property has changed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Elements(SimController controller)
controller
- The simulation controller.Method Detail |
---|
public final java.util.List<Element> getElements()
public final void setElements(java.util.List<Element> elements)
elements
- The collection of simulation elements.public final <T extends Element> java.util.List<T> selectElementsOfClass(java.lang.Class<T> c)
T
- The subclass-type of Element.c
- The class type of the simulation elements to be selected.
public final java.util.List<Element> asList(Id[] ids)
ids
- The array of element IDs.
public final boolean contains(Id id)
id
- That ID.
public final Element get(Id id)
id
- The element's ID.
public final <T extends Element> T get(java.lang.Class<T> c, Id id)
T
- The subclass-type of Element.c
- The class type of the simulation elements to be selected.id
- The element's ID.
public final int size()
public final void clear()
public final Element register(Element element)
element
- That simulation element.
public java.lang.String toString()
toString
in class java.lang.Object
public final <T> boolean change(Element element, java.lang.String name, T value)
T
- The value type.element
- The simulation element.name
- The attribute's name.value
- The new value of the attribute.
public final <T> T request(Element element, java.lang.String name, T value)
T
- The value type.element
- The simulation element.name
- The attribute's name.value
- The current value of the attribute.
public final <T> void writeElementProperty(Element element, java.lang.String property, T value)
T
- The value type.element
- The changed element.property
- The property that has changed.value
- The new value of that property.public final <T> void readElementProperty(Element element, java.lang.String property, T value)
T
- The element property type.element
- The requested element.property
- The property that was requested.value
- The value of that property.public final void addElementsListener(ElementsListener listener)
listener
- The listener.public final void removeElementsListener(ElementsListener listener)
listener
- The listener.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |