com.rubecula.darwin.core
Interface Environment

All Superinterfaces:
StringMap
All Known Implementing Classes:
Environment_Abstract, Environment_Default, Environment_PepperedMoth

public interface Environment
extends StringMap

Defines the concept of an Environment, modeled as a map of EcoFactor objects. A Population of Organisms exist in an Environment, whose properties (the EcoFactor objects) can vary over time.

Author:
Robin Hillyard

Method Summary
 void addListener(EnvironmentListener listener)
          Mutating method to add a listener to changes in this Environment.
 double getDoubleValue(String name)
          Method to retrieve the value of the eco factor defined by name.
 EcoFactor getFactor(String name)
          Method to retrieve the eco factor defined by name.
 Collection<String> keySet()
           
 Object put(EcoFactor factor)
          Add an eco factor to this environment.
 
Methods inherited from interface com.rubecula.util.StringMap
get, put
 

Method Detail

addListener

void addListener(EnvironmentListener listener)
Mutating method to add a listener to changes in this Environment.

Parameters:
listener - the listener.

getDoubleValue

double getDoubleValue(String name)
Method to retrieve the value of the eco factor defined by name.

Parameters:
name - the name (identifier, key) of the eco factor.
Returns:
the eco factor value, as a double. If the value cannot be rendered as double, the result is undefined.

getFactor

EcoFactor getFactor(String name)
Method to retrieve the eco factor defined by name.

Parameters:
name - the name (identifier, key) of the eco factor.
Returns:
the eco factor value itself.

keySet

Collection<String> keySet()
Returns:
the set of eco factor identifiers

put

Object put(EcoFactor factor)
Add an eco factor to this environment.

Parameters:
factor - the eco factor, whose identifier will be used as the key.
Returns:
the previous eco factor with the same identifier (if any), otherwise null.