de.cesr.lara.toolbox.adapter.rs.context
Class LEnvironmentContext<T>

java.lang.Object
  extended by java.util.AbstractCollection<T>
      extended by repast.simphony.context.AbstractContext<T>
          extended by repast.simphony.context.SmallDefaultContext<T>
              extended by repast.simphony.context.DefaultContext<T>
                  extended by de.cesr.lara.toolbox.adapter.rs.context.LEnvironmentContext<T>
All Implemented Interfaces:
LaraEnvironment, LaraEnvironmentContext<T>, Iterable<T>, Collection<T>, repast.simphony.context.Context<T>, repast.simphony.context.ContextListener, repast.simphony.context.RepastElement

public class LEnvironmentContext<T>
extends repast.simphony.context.DefaultContext<T>
implements LaraEnvironmentContext<T>


Field Summary
 
Fields inherited from class repast.simphony.context.SmallDefaultContext
allObjs, objectMap
 
Fields inherited from class repast.simphony.context.AbstractContext
subContexts
 
Fields inherited from interface repast.simphony.context.Context
SYN_CONTEXT_PREFIX
 
Constructor Summary
LEnvironmentContext()
           
LEnvironmentContext(String id)
           
 
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)
          Adds a property in case it does not yet exist or updates it otherwise.
 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 Collection of all LAbstractEnvironmentalPropertys of this environment.
 LAbstractEnvironmentalProperty<?> getPropertyByName(String name)
           
<V> LAbstractEnvironmentalProperty<V>
getTypedPropertyByName(String name)
           
 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.
 void updateProperty(LAbstractEnvironmentalProperty<?> property)
          Changes an existing property or adds it in case it does not yet exist.
 
Methods inherited from class repast.simphony.context.DefaultContext
addInternal, containsInternal, iteratorInternal, removeInternal, sizeInternal
 
Methods inherited from class repast.simphony.context.SmallDefaultContext
getObjects, getRandomObject, getRandomObjects
 
Methods inherited from class repast.simphony.context.AbstractContext
add, addContextListener, addProjection, addSubContext, addValueLayer, clear, contains, eventOccured, findContext, findParent, fireAddContextEvent, fireRemoveEvent, fireSubContextAdded, fireSubContextRemoved, getAgentLayer, getAgentTypes, getContextListeners, getId, getProjection, getProjection, getProjections, getProjections, getSubContext, getSubContexts, getTypeID, getValueLayer, getValueLayers, handleRemove, iterator, query, remove, removeContextListener, removeProjection, removeSubContext, removeValueLayer, setId, setTypeID, size
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface repast.simphony.context.Context
addContextListener, addProjection, addSubContext, addValueLayer, findContext, findParent, getAgentLayer, getAgentTypes, getContextListeners, getObjects, getProjection, getProjection, getProjections, getProjections, getRandomObject, getRandomObjects, getSubContext, getSubContexts, getTypeID, getValueLayer, getValueLayers, query, removeContextListener, removeProjection, removeSubContext, removeValueLayer, setTypeID
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface repast.simphony.context.RepastElement
getId, setId
 

Constructor Detail

LEnvironmentContext

public LEnvironmentContext()

LEnvironmentContext

public LEnvironmentContext(String id)
Method Detail

addEnvListener

public void addEnvListener(LaraEnvironmentListener listener)
Description copied from interface: LaraEnvironment
Adds an LaraEnvironmentListener to the entire LaraEnvironment.

Specified by:
addEnvListener in interface LaraEnvironment
Parameters:
listener - listener to add.

addEnvListener

public void addEnvListener(LaraEnvironmentListener listener,
                           String name)
Description copied from interface: LaraEnvironment
Registers a LaraEnvironmentListener at this environment to observe only a certain property.

Specified by:
addEnvListener in interface LaraEnvironment
Parameters:
listener - the observer to register
name - name of property to observe

addProperty

public void addProperty(LAbstractEnvironmentalProperty<?> property)
Description copied from interface: LaraEnvironment
Adds a property in case it does not yet exist or updates it otherwise.

Specified by:
addProperty in interface LaraEnvironment
Parameters:
property - property to add

containsProperty

public boolean containsProperty(LAbstractEnvironmentalProperty<?> property)
Description copied from interface: LaraEnvironment
Checks whether a property is in the list or not.

Specified by:
containsProperty in interface LaraEnvironment
Parameters:
property - property to check
Returns:
true if the property is within the list, false otherwise

containsProperty

public boolean containsProperty(String name)
Description copied from interface: LaraEnvironment
Checks whether a property name is in the environment or not.

Specified by:
containsProperty in interface LaraEnvironment
Parameters:
name - name of property to check
Returns:
true if the name is within the list, false otherwise

getAllListeners

public Set<LaraEnvironmentListener> getAllListeners()
Description copied from interface: LaraEnvironment
Returns a set of all listeners - those that are registered at all properties and those registered at certain properties.

Specified by:
getAllListeners in interface LaraEnvironment
Returns:
listeners set of all listeners

getEnvProperties

public Collection<LAbstractEnvironmentalProperty<?>> getEnvProperties()
Description copied from interface: LaraEnvironment
Returns a Collection of all LAbstractEnvironmentalPropertys of this environment.

Specified by:
getEnvProperties in interface LaraEnvironment
Returns:
envProperties all LAbstractEnvironmentalPropertys stored by this LaraEnvironment

getPropertyByName

public LAbstractEnvironmentalProperty<?> getPropertyByName(String name)
Specified by:
getPropertyByName in interface LaraEnvironment
Parameters:
name - the LAbstractEnvironmentalProperty's name
Returns:
property of environment

getTypedPropertyByName

public <V> LAbstractEnvironmentalProperty<V> getTypedPropertyByName(String name)
Specified by:
getTypedPropertyByName in interface LaraEnvironment
Type Parameters:
V - type of requested property
Parameters:
name - the LAbstractEnvironmentalProperty's name
Returns:
property of environment

removeEnvListener

public boolean removeEnvListener(LaraEnvironmentListener listener)
Description copied from interface: LaraEnvironment
Remove a LaraEnvironmentListener from the entire LaraEnvironment. This does not impact listeners that are registered at certain properties!

Specified by:
removeEnvListener in interface LaraEnvironment
Parameters:
listener - listener to remove.
Returns:
boolean true if the listener was contained and could be removed

removeEnvListener

public void removeEnvListener(LaraEnvironmentListener listener,
                              String name)
Description copied from interface: LaraEnvironment
Removes a LaraEnvironmentListener at this environment from the given property. This does not impact possibly same listeners that are registered at the whole Environment.

Specified by:
removeEnvListener in interface LaraEnvironment
Parameters:
listener - the observer to register
name - name of observed property

removeProperty

public boolean removeProperty(LAbstractEnvironmentalProperty<?> property)
Description copied from interface: LaraEnvironment
Removes a property if it is contained in the environment's list.

Specified by:
removeProperty in interface LaraEnvironment
Parameters:
property - property to remove
Returns:
true if the property was in the list and could be removed

removeProperty

public boolean removeProperty(String name)
Description copied from interface: LaraEnvironment
Removes a property if it is contained in the environment's list.

Specified by:
removeProperty in interface LaraEnvironment
Parameters:
name - name of property to remove
Returns:
true if the property was in the list and could be removed

updateProperty

public void updateProperty(LAbstractEnvironmentalProperty<?> property)
Description copied from interface: LaraEnvironment
Changes an existing property or adds it in case it does not yet exist.

Specified by:
updateProperty in interface LaraEnvironment
Parameters:
property - property to update or add