de.cesr.sesamgim.init.agent
Class GFileAgentInitialiser<AgentT extends GimMilieuAgent<AgentT>>

java.lang.Object
  extended by de.cesr.sesamgim.init.agent.GFileAgentInitialiser<AgentT>
All Implemented Interfaces:
GimAgentInitialiser<AgentT>

public class GFileAgentInitialiser<AgentT extends GimMilieuAgent<AgentT>>
extends Object
implements GimAgentInitialiser<AgentT>

Reads agent positions and milieu id from a CSV file and initialises agents using a GimAgentInitialiseService: If the given context contains GMarketCellContexts and the geography contains polygones for these market cells, agents are assigned to market cells based on their geographical position. If the given GimGroupInitialiser is not null agents are assigned to groups calling the initialiser. If market cells are initialised groups are assigned within market cells. Otherwise, groups are assigned within areas. In case there is not GimGroupInitialiser agents are added to the market cell contexts. Furthermore, if there is no suitable market cell context agents are added to the area context. The implementation of Coordinate that is used to initialise the point by which agents are registered at the geography is dynamically requested from GBasicPa.COORDINATE_CLASS. Therefore, it is possible to use torus coordinates (e.g. GTorusCoordinate).


Constructor Summary
GFileAgentInitialiser()
           
 
Method Summary
static
<AgentT> GimAreaContext<AgentT>
identifyAc(AgentT agent)
           
static
<AgentT extends GimMilieuAgent<?>>
GimMarketCellContext<AgentT>
identifyMc(AgentT agent)
           
 Collection<AgentT> initAgents(GimModelInitialiser<AgentT> ginit)
           
 void placeGroupContextOnRadius(Collection<GimGroupContext<AgentT>> gcCol, GimAreaContext<? super AgentT> area)
          Determines a geographical center for the given GGroupContext on a radius around the center of the given GimAreaContext using GBasicPa.PLACE_GROUP_ON_RADIUS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GFileAgentInitialiser

public GFileAgentInitialiser()
Method Detail

initAgents

public Collection<AgentT> initAgents(GimModelInitialiser<AgentT> ginit)
Specified by:
initAgents in interface GimAgentInitialiser<AgentT extends GimMilieuAgent<AgentT>>
Returns:
See Also:
GimAgentInitialiser.initAgents(de.cesr.sesamgim.init.GimModelInitialiser)

identifyAc

public static <AgentT> GimAreaContext<AgentT> identifyAc(AgentT agent)

identifyMc

public static <AgentT extends GimMilieuAgent<?>> GimMarketCellContext<AgentT> identifyMc(AgentT agent)
Parameters:
agent -
Returns:

placeGroupContextOnRadius

public void placeGroupContextOnRadius(Collection<GimGroupContext<AgentT>> gcCol,
                                      GimAreaContext<? super AgentT> area)
Determines a geographical center for the given GGroupContext on a radius around the center of the given GimAreaContext using GBasicPa.PLACE_GROUP_ON_RADIUS. Ensures that the neighourhood's center is located within the area.

Parameters:
gcCol - the collection of group contexts to place
area - the area the GC shall be placed within.