Package repast.simphony.scenario.data
Class ContextData
- java.lang.Object
-
- repast.simphony.scenario.data.AttributeContainer
-
- repast.simphony.scenario.data.ContextData
-
public class ContextData extends AttributeContainer
Encapsulates the context heirarchy.- Author:
- Nick Collier
-
-
Field Summary
-
Fields inherited from class repast.simphony.scenario.data.AttributeContainer
attributes, id
-
-
Constructor Summary
Constructors Constructor Description ContextData(String id, String contextClassName, Classpath classpath)
ContextData(String id, Classpath classpath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAgent(String agentClass)
Adds the class name of an agent contained by this context to this ContextData.ProjectionData
addProjection(String id, String type)
void
addSubContext(ContextData child)
ContextData
find(String contextId)
Finds and returns the ContextData with the specified id.List<Class<?>>
getAgentClasses(boolean includeSubContexts)
Gets a list of the agent classes specified in this ContextData and optionally those is all its decendent subclasses as well.int
getAgentCount()
List<AgentData>
getAgentData(boolean includeSubContexts)
Gets a list of the agent class names specified in this ContextData and optionally those is all its decendent subclasses as well.AgentData
getAgentData(int index)
List<ContextData>
getAllContexts()
Gets a list which includes this ContextData and all of its decendents.Classpath
getClasspath()
Gets the classpath associated with this ContextData heirarchy.String
getContextClassName()
Gets the name of the class to use a Context, or null if the default should be used.ProjectionData
getProjection(int index)
int
getProjectionCount()
ContextData
getSubContext(int index)
int
getSubContextCount()
Iterable<ProjectionData>
projections()
Gets an iterable over all the ProjectionData-s contained by this ContextData.Iterable<ContextData>
subContexts()
Gets an iterable over the sub-context data of this ContextData.-
Methods inherited from class repast.simphony.scenario.data.AttributeContainer
addAttribute, attributes, getAttributeCount, getId
-
-
-
-
Method Detail
-
getContextClassName
public String getContextClassName()
Gets the name of the class to use a Context, or null if the default should be used.- Returns:
- the name of the class to use a Context, or null if the default should be used.
-
addProjection
public ProjectionData addProjection(String id, String type)
-
addSubContext
public void addSubContext(ContextData child)
-
getClasspath
public Classpath getClasspath()
Gets the classpath associated with this ContextData heirarchy.- Returns:
- the classpath associated with this ContextData heirarchy.
-
find
public ContextData find(String contextId)
Finds and returns the ContextData with the specified id. This attempts to match against this context and all its decendents.- Parameters:
contextId
- the id of ContextData to find.- Returns:
- the ContextData with the specified id.
-
addAgent
public void addAgent(String agentClass)
Adds the class name of an agent contained by this context to this ContextData.- Parameters:
agentClass
- the agent class to add
-
getAgentClasses
public List<Class<?>> getAgentClasses(boolean includeSubContexts)
Gets a list of the agent classes specified in this ContextData and optionally those is all its decendent subclasses as well.- Parameters:
includeSubContexts
- if true then agents classes specified in sub contexts will be included.- Returns:
- a list of the agent classes.
-
getAgentData
public List<AgentData> getAgentData(boolean includeSubContexts)
Gets a list of the agent class names specified in this ContextData and optionally those is all its decendent subclasses as well.- Parameters:
includeSubContexts
- if true then agents class names specified in sub contexts will be included.- Returns:
- a list of the agent class names.
-
getAllContexts
public List<ContextData> getAllContexts()
Gets a list which includes this ContextData and all of its decendents.- Returns:
- a list which includes this ContextData and all of its decendents.
-
subContexts
public Iterable<ContextData> subContexts()
Gets an iterable over the sub-context data of this ContextData.- Returns:
- an iterable over the sub-context data of this ContextData.
-
getAgentCount
public int getAgentCount()
-
getAgentData
public AgentData getAgentData(int index)
-
getSubContextCount
public int getSubContextCount()
-
getProjectionCount
public int getProjectionCount()
-
getSubContext
public ContextData getSubContext(int index)
-
getProjection
public ProjectionData getProjection(int index)
-
projections
public Iterable<ProjectionData> projections()
Gets an iterable over all the ProjectionData-s contained by this ContextData.- Returns:
- an iterable over all the ProjectionData-s contained by this ContextData.
-
-