public final class Environment
extends java.lang.Object
Environment passed to the step function.
Modifier and Type | Field and Description |
---|---|
private long |
id |
private static org.slf4j.Logger |
logger |
private Manager |
manager |
Constructor and Description |
---|
Environment(long id,
Manager manager) |
Modifier and Type | Method and Description |
---|---|
void |
logPopulation(java.lang.String type,
io.vavr.collection.List<? extends Agent> population)
Logs provided population fragment.
|
void |
migrate(Agent agent,
long targetWorkplaceId)
Migrates an agent to a workplace with the given id in neighbourhood.
|
void |
migrate(Agent agent,
java.lang.String targetWorkplaceAnnotation)
Migrates an agent to a workplace with the given annotation in neighbourhood.
|
io.vavr.collection.Map<java.lang.Long,io.vavr.collection.Set<java.lang.String>> |
neighbours()
Returns workplaces in the neighbourhood.
|
io.vavr.collection.Map<java.lang.Long,io.vavr.collection.Map<java.lang.Object,java.lang.Object>> |
neighboursStatistics()
Returns a read-only view of statistics map generated by
AfterStepAction only for neighbours. |
long |
workplaceId() |
long |
workplacesCount()
Returns the count of all workplaces (global, distributed).
|
io.vavr.collection.Map<java.lang.Long,io.vavr.collection.Map<java.lang.Object,java.lang.Object>> |
workplaceStatistics()
Returns a read-only view of statistics map generated by
AfterStepAction . |
private static final org.slf4j.Logger logger
private final long id
private final Manager manager
Environment(long id, Manager manager)
public long workplaceId()
public long workplacesCount()
Returns the count of all workplaces (global, distributed).
public io.vavr.collection.Map<java.lang.Long,io.vavr.collection.Set<java.lang.String>> neighbours()
Returns workplaces in the neighbourhood.
Neighbourhood is defined by the configured topology.
Topology
public io.vavr.collection.Map<java.lang.Long,io.vavr.collection.Map<java.lang.Object,java.lang.Object>> workplaceStatistics()
Returns a read-only view of statistics map generated by AfterStepAction
.
public io.vavr.collection.Map<java.lang.Long,io.vavr.collection.Map<java.lang.Object,java.lang.Object>> neighboursStatistics()
Returns a read-only view of statistics map generated by AfterStepAction
only for neighbours.
public void migrate(Agent agent, long targetWorkplaceId)
Migrates an agent to a workplace with the given id in neighbourhood.
public void migrate(Agent agent, java.lang.String targetWorkplaceAnnotation)
Migrates an agent to a workplace with the given annotation in neighbourhood.
public void logPopulation(java.lang.String type, io.vavr.collection.List<? extends Agent> population)
Logs provided population fragment.
type
- name of the population fragment (e.g. “dead”)population
- population to log.