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

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

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

Reads agent IDs and positions from Database 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 no GimGroupInitialiser agents are added to the market cell contexts. In case there is no GimMarketCellInitialiser agents are added to the PLZ contexts. Furthermore, if there is no suitable PLZ 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). The DB connection is established using the GMySqlService.


Constructor Summary
GDbAgentInitialiser()
           
 
Method Summary
static
<AgentT> GimAreaContext<AgentT>
identifyAc(AgentT agent)
           
static
<AgentT extends GimMilieuAgent<?>>
GimMarketCellContext<AgentT>
identifyMc(AgentT agent)
           
static
<AgentT extends GimMilieuAgent<AgentT>>
GimPlzContext<AgentT>
identifyPc(AgentT agent)
           
 Collection<AgentT> initAgents(GimModelInitialiser<AgentT> ginit)
           
 void placeGroupContextOnRadius(Collection<GimGroupContext<AgentT>> gcCol, repast.simphony.context.Context<? 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

GDbAgentInitialiser

public GDbAgentInitialiser()
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)

identifyPc

public static <AgentT extends GimMilieuAgent<AgentT>> GimPlzContext<AgentT> identifyPc(AgentT agent)

identifyMc

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

placeGroupContextOnRadius

public void placeGroupContextOnRadius(Collection<GimGroupContext<AgentT>> gcCol,
                                      repast.simphony.context.Context<? 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.