de.cesr.sesamgim.context
Class GMarketCellContext<AgentType extends GimMilieuAgent<AgentType>>

java.lang.Object
  extended by java.util.AbstractCollection<T>
      extended by repast.simphony.context.AbstractContext<T>
          extended by repast.simphony.context.SmallDefaultContext<T>
              extended by repast.simphony.context.DefaultContext<AgentType>
                  extended by de.cesr.sesamgim.context.GMarketCellContext<AgentType>
All Implemented Interfaces:
GimAgentNumberProvidingContext<AgentType>, GimMarketCellContext<AgentType>, GimMilieuContextAwareContext<AgentType>, GimSuperContextAssignable<AgentType>, GimUpdatableContext<AgentType>, Iterable<AgentType>, Collection<AgentType>, repast.simphony.context.Context<AgentType>, repast.simphony.context.ContextListener, repast.simphony.context.RepastElement

public class GMarketCellContext<AgentType extends GimMilieuAgent<AgentType>>
extends repast.simphony.context.DefaultContext<AgentType>
implements GimMarketCellContext<AgentType>

Date:
09.01.2009

Field Summary
protected  GimAreaContext<? super AgentType> area
           
protected  boolean inInhabitedArea
           
protected  com.vividsolutions.jts.geom.Point loc
           
protected  Map<Integer,GimMilieuContext<AgentType>> milieuContextMap
           
protected  String mz_id
           
protected  repast.simphony.engine.schedule.ISchedule schedule
           
protected  GUpdatableContextStructure structure
           
 
Fields inherited from class repast.simphony.context.SmallDefaultContext
allObjs, objectMap
 
Fields inherited from class repast.simphony.context.AbstractContext
subContexts
 
Fields inherited from interface repast.simphony.context.Context
SYN_CONTEXT_PREFIX
 
Constructor Summary
GMarketCellContext(GimAreaContext<? super AgentType> area, String identifier)
          Adds the new market cell to the given GAreaContext.
GMarketCellContext(GimAreaContext<? super AgentType> area, String identifier, com.vividsolutions.jts.geom.Point loc, GUpdatableContextStructure structure)
           
 
Method Summary
 boolean addAgent(AgentType agent)
          Substitutes Collection.add(Object) in order to add agents to GimMilieuContexts.
 void assignSuperContext(repast.simphony.context.Context<? super AgentType> superContext)
          If GBasicPa.ADD_MC_TO_AREA is TRUE, this MC context _was_ added to the GimAreaContext is is contained in during construction (backward compatibility).
 int getAreaIdentifier()
          Returns the area identifier
 String getID()
          Return the context's id.
 GimMilieuContext<AgentType> getMilieu(int milieuId)
          Returns the milieu context of this market cell with the given ID
protected  Map<Integer,GimMilieuContext<AgentType>> getMilieuContextMap()
           
 int getNumHouseholds(Calendar cal, int milieuGroup, int hhSize)
          Returns the number of households within this market cell (usually as defined in Microm (R) data).
 boolean isInInhabitedArea()
          NOTE: The check whether this MC is located in an inhabited area is performed during initialisation of the MC!
 boolean isMcStructureSet()
           
 void setLocation(com.vividsolutions.jts.geom.Point loc)
           
 void setUpdatableContextStructure(GUpdatableContextStructure structure)
           
 int size()
           
 void step()
          The method is used to adapt the data to time developments.
 String toString()
           
 
Methods inherited from class repast.simphony.context.DefaultContext
addInternal, containsInternal, iteratorInternal, removeInternal, sizeInternal
 
Methods inherited from class repast.simphony.context.SmallDefaultContext
getObjects, getRandomObject, getRandomObjects
 
Methods inherited from class repast.simphony.context.AbstractContext
add, addContextListener, addProjection, addSubContext, addValueLayer, clear, contains, eventOccured, findContext, findParent, fireAddContextEvent, fireRemoveEvent, fireSubContextAdded, fireSubContextRemoved, getAgentLayer, getAgentTypes, getContextListeners, getId, getProjection, getProjection, getProjections, getProjections, getSubContext, getSubContexts, getTypeID, getValueLayer, getValueLayers, handleRemove, hasSubContext, iterator, query, remove, removeContextListener, removeProjection, removeSubContext, removeValueLayer, setId, setTypeID
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface repast.simphony.context.Context
addContextListener, addProjection, addSubContext, addValueLayer, findContext, findParent, getAgentLayer, getAgentTypes, getContextListeners, getObjects, getProjection, getProjection, getProjections, getProjections, getRandomObject, getRandomObjects, getSubContext, getSubContexts, getTypeID, getValueLayer, getValueLayers, hasSubContext, query, removeContextListener, removeProjection, removeSubContext, removeValueLayer, setTypeID
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface repast.simphony.context.RepastElement
getId, setId
 

Field Detail

mz_id

protected String mz_id

loc

protected com.vividsolutions.jts.geom.Point loc

area

protected GimAreaContext<? super AgentType extends GimMilieuAgent<AgentType>> area

structure

protected GUpdatableContextStructure structure

schedule

protected repast.simphony.engine.schedule.ISchedule schedule

inInhabitedArea

protected boolean inInhabitedArea

milieuContextMap

protected Map<Integer,GimMilieuContext<AgentType extends GimMilieuAgent<AgentType>>> milieuContextMap
Constructor Detail

GMarketCellContext

public GMarketCellContext(GimAreaContext<? super AgentType> area,
                          String identifier,
                          com.vividsolutions.jts.geom.Point loc,
                          GUpdatableContextStructure structure)

GMarketCellContext

public GMarketCellContext(GimAreaContext<? super AgentType> area,
                          String identifier)
Adds the new market cell to the given GAreaContext. Schedules this#step() to update population. Adds this MC to the geography.

Parameters:
area -
identifier -
loc -
structure -
Method Detail

addAgent

public boolean addAgent(AgentType agent)
Description copied from interface: GimMilieuContextAwareContext
Substitutes Collection.add(Object) in order to add agents to GimMilieuContexts.

Specified by:
addAgent in interface GimMilieuContextAwareContext<AgentType extends GimMilieuAgent<AgentType>>
Returns:
See Also:
AbstractContext.add(java.lang.Object)

getMilieuContextMap

protected Map<Integer,GimMilieuContext<AgentType>> getMilieuContextMap()

step

public void step()
Description copied from interface: GimMarketCellContext
The method is used to adapt the data to time developments. Currently only experimental

Specified by:
step in interface GimMarketCellContext<AgentType extends GimMilieuAgent<AgentType>>
See Also:
GimMarketCellContext.step()

getNumHouseholds

public int getNumHouseholds(Calendar cal,
                            int milieuGroup,
                            int hhSize)
Description copied from interface: GimAgentNumberProvidingContext
Returns the number of households within this market cell (usually as defined in Microm (R) data).

Specified by:
getNumHouseholds in interface GimAgentNumberProvidingContext<AgentType extends GimMilieuAgent<AgentType>>
Returns:
See Also:
de.cesr.sesamgim.context.GimMarketCellContext#getNumHouseholds(int, int, int)

size

public int size()
Specified by:
size in interface Collection<AgentType extends GimMilieuAgent<AgentType>>
Overrides:
size in class repast.simphony.context.AbstractContext<AgentType extends GimMilieuAgent<AgentType>>

getMilieu

public GimMilieuContext<AgentType> getMilieu(int milieuId)
Description copied from interface: GimMilieuContextAwareContext
Returns the milieu context of this market cell with the given ID

Specified by:
getMilieu in interface GimMilieuContextAwareContext<AgentType extends GimMilieuAgent<AgentType>>
Parameters:
milieuId - milieu ID of the Milieu
Returns:
milieu context
See Also:
GimMilieuContextAwareContext.getMilieu(int)

getID

public String getID()
Description copied from interface: GimMilieuContextAwareContext
Return the context's id. This is the MC id for GimMarketCellContexts or the PLZ for GimPlzContexts.

Specified by:
getID in interface GimMilieuContextAwareContext<AgentType extends GimMilieuAgent<AgentType>>
Returns:
id
See Also:
de.cesr.sesamgim.context.GimMarketCellContext#getMZ_ID()

getAreaIdentifier

public int getAreaIdentifier()
Description copied from interface: GimMarketCellContext
Returns the area identifier

Specified by:
getAreaIdentifier in interface GimMarketCellContext<AgentType extends GimMilieuAgent<AgentType>>
Returns:
the area identifier
See Also:
GimMarketCellContext.getAreaIdentifier()

isInInhabitedArea

public boolean isInInhabitedArea()
Description copied from interface: GimMarketCellContext
NOTE: The check whether this MC is located in an inhabited area is performed during initialisation of the MC!

Specified by:
isInInhabitedArea in interface GimMarketCellContext<AgentType extends GimMilieuAgent<AgentType>>
Returns:
true if this MC is located in an inhabited area.
See Also:
GimMarketCellContext.isInInhabitedArea()

toString

public String toString()
Overrides:
toString in class AbstractCollection<AgentType extends GimMilieuAgent<AgentType>>
See Also:
AbstractCollection.toString()

setUpdatableContextStructure

public void setUpdatableContextStructure(GUpdatableContextStructure structure)
Specified by:
setUpdatableContextStructure in interface GimAgentNumberProvidingContext<AgentType extends GimMilieuAgent<AgentType>>
See Also:
GimAgentNumberProvidingContext.setUpdatableContextStructure(de.cesr.sesamgim.util.GUpdatableContextStructure)

assignSuperContext

public void assignSuperContext(repast.simphony.context.Context<? super AgentType> superContext)
If GBasicPa.ADD_MC_TO_AREA is TRUE, this MC context _was_ added to the GimAreaContext is is contained in during construction (backward compatibility). Otherwise, the MC context is assigned to all GimPlzContexts it intersects with. The given super context is ignored. This method is usually called from GShapefileLoader.

Specified by:
assignSuperContext in interface GimSuperContextAssignable<AgentType extends GimMilieuAgent<AgentType>>
See Also:
GimSuperContextAssignable.assignSuperContext(repast.simphony.context.Context)

setLocation

public void setLocation(com.vividsolutions.jts.geom.Point loc)
Specified by:
setLocation in interface GimMarketCellContext<AgentType extends GimMilieuAgent<AgentType>>
See Also:
GimMarketCellContext.setLocation(com.vividsolutions.jts.geom.Point)

isMcStructureSet

public boolean isMcStructureSet()
Specified by:
isMcStructureSet in interface GimMarketCellContext<AgentType extends GimMilieuAgent<AgentType>>
See Also:
GimMarketCellContext.isMcStructureSet()