|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.cesr.lara.components.environment.impl.LEnvironment
public class LEnvironment
This default implementation of LaraSuperEnvironment does not delegate
to sub-environments for containsProperty(String),
removeProperty(LAbstractEnvironmentalProperty), etc.
TODO integrate LaraStorage
TODO implement getters for filter properties
TODO parameterise LaraEnvironment
TODO add property functions that deal with sub-envs (like
removePopertySubenv)
TODO Test sub-environments
| Field Summary | |
|---|---|
protected Map<String,LAbstractEnvironmentalProperty<?>> |
abstractProperties
|
protected Set<LaraEnvironmentListener> |
allObserver
Contains listeners that observe all properties of this environment. |
protected Map<String,Set<LaraEnvironmentListener>> |
propertyObserver
Contains listeners that observe certain properties. |
protected |
subEnvironments
Container for sub-environments |
| Fields inherited from interface de.cesr.lara.components.environment.LaraSuperEnvironment |
|---|
ALL_CATEGORIES |
| Constructor Summary | |
|---|---|
LEnvironment()
constructor |
|
| Method Summary | ||
|---|---|---|
void |
addEnvListener(LaraEnvironmentListener listener)
Adds an LaraEnvironmentListener to the entire
LaraEnvironment. |
|
void |
addEnvListener(LaraEnvironmentListener listener,
String name)
Registers a LaraEnvironmentListener at this environment to
observe only a certain property. |
|
void |
addProperty(LAbstractEnvironmentalProperty<?> property)
Calls update. |
|
boolean |
containsProperty(LAbstractEnvironmentalProperty<?> property)
Checks whether a property is in the list or not. |
|
boolean |
containsProperty(String name)
Checks whether a property name is in the environment or not. |
|
Set<LaraEnvironmentListener> |
getAllListeners()
Returns a set of all listeners - those that are registered at all properties and those registered at certain properties. |
|
Collection<LAbstractEnvironmentalProperty<?>> |
getEnvProperties()
Returns a shallow copy of all LAbstractEnvironmentalPropertys
registered at this environment. |
|
LAbstractEnvironmentalProperty<?> |
getPropertyByName(String name)
|
|
Set<LaraEnvironment> |
getSubEnvironments()
Returns a shallow copy of all registered sub-environments. |
|
Set<LaraEnvironment> |
getSubEnvironments(Object category)
Returns all registered sub-environments of the given category. |
|
|
getTypedPropertyByName(String name)
|
|
protected void |
inform(LAbstractEnvironmentalProperty<?> property)
Informs all listeners that are either registered for the all properties or the specifically for the given one. |
|
void |
registerEnvironment(Object cat,
LaraEnvironment environment)
Registers a new LaraEnvironment at this super environment. |
|
void |
removeEnvironment(LaraEnvironment environment)
Removes a LaraEnvironment from this super environment. |
|
void |
removeEnvironment(Object cat)
Removes all LaraEnvironment from this super environment that
belong to the given category. |
|
boolean |
removeEnvListener(LaraEnvironmentListener listener)
Remove a LaraEnvironmentListener from the entire
LaraEnvironment. |
|
void |
removeEnvListener(LaraEnvironmentListener listener,
String name)
Removes a LaraEnvironmentListener at this environment from the
given property. |
|
boolean |
removeProperty(LAbstractEnvironmentalProperty<?> property)
Removes a property if it is contained in the environment's list. |
|
boolean |
removeProperty(String name)
Removes a property if it is contained in the environment's list. |
|
boolean |
removePropertySubenv(Object category,
String name)
Removes properties with the given name also in sub-environments of the given category. |
|
String |
toString()
|
|
void |
updateProperty(LAbstractEnvironmentalProperty<?> property)
Informs listeners every time a value changed (should listeners be informed of an update even if the value has not changed implement a new registration function addEnvUpdateListeners()!) |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Map<String,LAbstractEnvironmentalProperty<?>> abstractProperties
protected Set<LaraEnvironmentListener> allObserver
protected Map<String,Set<LaraEnvironmentListener>> propertyObserver
protectedsubEnvironments
| Constructor Detail |
|---|
public LEnvironment()
| Method Detail |
|---|
public void addEnvListener(LaraEnvironmentListener listener)
LaraEnvironmentLaraEnvironmentListener to the entire
LaraEnvironment.
addEnvListener in interface LaraEnvironmentlistener - listener to add.LaraEnvironment.addEnvListener(de.cesr.lara.components.environment.LaraEnvironmentListener)
public void addEnvListener(LaraEnvironmentListener listener,
String name)
LaraEnvironmentLaraEnvironmentListener at this environment to
observe only a certain property.
addEnvListener in interface LaraEnvironmentlistener - the observer to registername - name of property to observeLaraEnvironment.addEnvListener(de.cesr.lara.components.environment.LaraEnvironmentListener,
java.lang.String)public void addProperty(LAbstractEnvironmentalProperty<?> property)
addProperty in interface LaraEnvironmentproperty - property to addLaraEnvironment.addProperty(de.cesr.lara.components.environment.impl.LAbstractEnvironmentalProperty)public boolean containsProperty(LAbstractEnvironmentalProperty<?> property)
LaraEnvironment
containsProperty in interface LaraEnvironmentproperty - property to check
LaraEnvironment.containsProperty(de.cesr.lara.components.environment.impl.LAbstractEnvironmentalProperty)public boolean containsProperty(String name)
LaraEnvironment
containsProperty in interface LaraEnvironmentname - name of property to check
LaraEnvironment.containsProperty(java.lang.String)public Set<LaraEnvironmentListener> getAllListeners()
LaraEnvironment
getAllListeners in interface LaraEnvironmentLaraEnvironment.getAllListeners()public Collection<LAbstractEnvironmentalProperty<?>> getEnvProperties()
LAbstractEnvironmentalPropertys
registered at this environment.
getEnvProperties in interface LaraEnvironmentLAbstractEnvironmentalPropertys stored
by this LaraEnvironmentLaraEnvironment.getEnvProperties()public LAbstractEnvironmentalProperty<?> getPropertyByName(String name)
getPropertyByName in interface LaraEnvironmentname - the LAbstractEnvironmentalProperty's name
LaraEnvironment.getPropertyByName(java.lang.String)public Set<LaraEnvironment> getSubEnvironments()
getSubEnvironments in interface LaraSuperEnvironmentLaraSuperEnvironment.getSubEnvironments()public Set<LaraEnvironment> getSubEnvironments(Object category)
LaraSuperEnvironment
getSubEnvironments in interface LaraSuperEnvironmentLaraSuperEnvironment.getSubEnvironments(java.lang.Object)public <V> LAbstractEnvironmentalProperty<V> getTypedPropertyByName(String name)
getTypedPropertyByName in interface LaraEnvironmentV - type of requested propertyname - the LAbstractEnvironmentalProperty's name
LaraEnvironment.getTypedPropertyByName(java.lang.String)
public void registerEnvironment(Object cat,
LaraEnvironment environment)
LaraSuperEnvironmentLaraEnvironment at this super environment. The
category object allows the modeler to define categories of environment
and to look up environments by this category. For instance, there are
agent classes that are embedded in environments that are specialised but
belong to a certain category. The category may be used for methods across
agent classes. Furthermore, several environments may be grouped by
category. Examples for categories are social and bio-physical
environments.
registerEnvironment in interface LaraSuperEnvironmentcat - category object to identify the (type of) environment. Null is
allowed.environment - environment to registerLaraSuperEnvironment.registerEnvironment(Object,
de.cesr.lara.components.environment.LaraEnvironment)public void removeEnvironment(LaraEnvironment environment)
LaraSuperEnvironmentLaraEnvironment from this super environment.
removeEnvironment in interface LaraSuperEnvironmentenvironment - environment to removeLaraSuperEnvironment.removeEnvironment(de.cesr.lara.components.environment.LaraEnvironment)public void removeEnvironment(Object cat)
LaraSuperEnvironmentLaraEnvironment from this super environment that
belong to the given category.
removeEnvironment in interface LaraSuperEnvironmentcat - category object to identify the (type of) environmentLaraSuperEnvironment.removeEnvironment(Object)public boolean removeEnvListener(LaraEnvironmentListener listener)
LaraEnvironmentLaraEnvironmentListener from the entire
LaraEnvironment. This does not impact listeners that are
registered at certain properties!
removeEnvListener in interface LaraEnvironmentlistener - listener to remove.
LaraEnvironment.removeEnvListener(de.cesr.lara.components.environment.LaraEnvironmentListener)
public void removeEnvListener(LaraEnvironmentListener listener,
String name)
LaraEnvironmentLaraEnvironmentListener at this environment from the
given property. This does not impact possibly same listeners that are
registered at the whole Environment.
removeEnvListener in interface LaraEnvironmentlistener - the observer to registername - name of observed propertyLaraEnvironment.removeEnvListener(de.cesr.lara.components.environment.LaraEnvironmentListener,
java.lang.String)public boolean removeProperty(LAbstractEnvironmentalProperty<?> property)
LaraEnvironment
removeProperty in interface LaraEnvironmentproperty - property to remove
LaraEnvironment.removeProperty(de.cesr.lara.components.environment.impl.LAbstractEnvironmentalProperty)public boolean removeProperty(String name)
LaraEnvironment
removeProperty in interface LaraEnvironmentname - name of property to remove
LaraEnvironment.removeProperty(java.lang.String)
public boolean removePropertySubenv(Object category,
String name)
LaraSuperEnvironment
removePropertySubenv in interface LaraSuperEnvironmentname - of the properties to remove
de.cesr.lara.components.environment.LaraSuperEnvironment#removePropertySubenv(java.lang.String)public String toString()
toString in class ObjectObject.toString()public void updateProperty(LAbstractEnvironmentalProperty<?> property)
addEnvUpdateListeners()!)
updateProperty in interface LaraEnvironmentproperty - property to update or addLaraEnvironment.updateProperty(de.cesr.lara.components.environment.impl.LAbstractEnvironmentalProperty)protected void inform(LAbstractEnvironmentalProperty<?> property)
property - new property
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||