de.cesr.lara.houseplant
Class Environment
java.lang.Object
de.cesr.lara.components.environment.impl.LEnvironment
de.cesr.lara.houseplant.Environment
- All Implemented Interfaces:
- LaraEnvironment, LaraSuperEnvironment, LaraAbstractEventSubscriber, LaraEventSubscriber
public class Environment
- extends LEnvironment
- implements LaraEventSubscriber
the agents environment. wraps his social and geo-physical environment into
one place. environmental properties are stored key-value based.
Methods inherited from class de.cesr.lara.components.environment.impl.LEnvironment |
addEnvListener, addEnvListener, addProperty, containsProperty, containsProperty, getAllListeners, getEnvProperties, getPropertyByName, getSubEnvironments, getSubEnvironments, getTypedPropertyByName, inform, registerEnvironment, removeEnvironment, removeEnvironment, removeEnvListener, removeEnvListener, removeProperty, removeProperty, removePropertySubenv, toString, updateProperty |
ENVIRONMENT_CATEGORY_SOCIAL
public static final String ENVIRONMENT_CATEGORY_SOCIAL
- See Also:
- Constant Field Values
ENVIRONMENT_CATEGORY_HABITATION
public static final String ENVIRONMENT_CATEGORY_HABITATION
- See Also:
- Constant Field Values
ENVIRONMENT_CATEGORY_WEATHER
public static final String ENVIRONMENT_CATEGORY_WEATHER
- See Also:
- Constant Field Values
Environment
public Environment(SimulationConfig simulationConfig)
onEvent
public <T extends LaraEvent> void onEvent(T event)
- Description copied from interface:
LaraEventSubscriber
- Will be called with an event as a parameter when an event the subscriber
subscribed to occurs. Implement this to react on events. Typically you
would start doing something like if (event instanceof
VeryInterestingEvent) { //do something smart }
- Specified by:
onEvent
in interface LaraEventSubscriber
getHabitationIds
public Set<String> getHabitationIds()
- Returns:
- all ids of habitations currently in the simulation
placeAgentInEnvironment
public void placeAgentInEnvironment(String agentId,
String habitationId,
List<String> collaboratorIds)
- Places the agent into the environment. The agent id, collaborators and
habitation will be stored. If the habitation he belongs to does not
exist, a new habitation will be created.
- Parameters:
agentId
- habitationId
- collaboratorIds
-
getAgentIds
public Set<String> getAgentIds()
- Returns:
- all ids of the available agents
behaveByHabit
public void behaveByHabit(String agentId,
boolean hasBehavedByHabit)
- save information if agent behaved by habit
- Parameters:
agentId
-
irrigateHouseplant
public void irrigateHouseplant(String agentId,
String habitationId)
- save information that agent irrigated houseplant
- Parameters:
agentId
- habitationId
-
doNotIrrigateHouseplant
public void doNotIrrigateHouseplant(String agentId,
String habitationId)
- save information that agent did not irrigate houseplant
- Parameters:
agentId
- habitationId
-
getSunshineDuration
public int getSunshineDuration()
- Returns:
- sunshine duration for current timestep
getPercentageOfCollaboratorsWhoIrrigatedLastTimestep
public double getPercentageOfCollaboratorsWhoIrrigatedLastTimestep(String agentId)
- Parameters:
agentId
-
- Returns:
- the percentage of collaborators of the given agent who irrigated
the houseplant in the last timestep
hasAgentBehavedByHabit
public boolean hasAgentBehavedByHabit(String agentId)
- Parameters:
agentId
-
- Returns:
- true if the given agent has behaved by habit in the last timestep
otherwise false
hasAgentIrrigatedLastTimestep
public boolean hasAgentIrrigatedLastTimestep(String agentId)
- Parameters:
agentId
-
- Returns:
- true if the given agent has irrigated the houseplant in the last
timestep
getAmountOfWaterForHouseplant
public Double getAmountOfWaterForHouseplant(String habitationId)
- Parameters:
habitationId
-
- Returns:
- the amount of water for the houseplant in the given habitation
getSizeOfHouseplant
public int getSizeOfHouseplant(String habitationId)
- Parameters:
habitationId
-
- Returns:
- the size of the houseplant in the given habitation