Package repast.simphony.essentials
Class RepastEssentials
- java.lang.Object
-
- repast.simphony.essentials.RepastEssentials
-
public class RepastEssentials extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description RepastEssentials()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Context
AddAgentToContext(String parentContextPath, Object agent)
static void
AddValueLayer(String contextPath, ValueLayer layer)
Adds the specified value layer to the context on the specified path.static double[]
bigDecimalArrayToDoubleArray(BigDecimal[] bigDecimalArray)
static int[]
bigDecimalArrayToIntArray(BigDecimal[] bigDecimalArray)
static IAction
CancelAction(ISchedulableAction actionToCancel)
static Network
Create1DLatticeNetwork(String parentContextPath, String networkName, boolean directed, boolean toroidal, boolean symmetrical)
static Network
Create2DLatticeNetwork(String parentContextPath, String networkName, boolean directed, boolean toroidal)
static Object
CreateAgent(String parentContextPath, String newAgentType)
static Object
CreateAgents(String parentContextPath, String newAgentType, int agentCount)
static Context
CreateContext(String parentContextPath, String newContextName)
static ContinuousSpace
CreateContinuousSpace(String parentContextPath, String newProjectionName, String borders, int... dimensions)
static ContinuousSpace
CreateContinuousSpace(String parentContextPath, String newProjectionName, String borders, BigDecimal... dimensions)
static ContinuousValueLayer
CreateContinuousValueLayer(String contextPath, String name, double... dimensions)
Creates a ContinousValueLayer and adds it to the specified context.static ContinuousValueLayer
CreateContinuousValueLayer(String contextPath, String name, BigDecimal... dimensions)
static RepastEdge<?>
CreateEdge(String networkProjectionPath, Object agentSource, Object agentTarget)
static RepastEdge<?>
CreateEdge(String networkProjectionPath, Object agentSource, Object agentTarget, double optionalWeight)
static Grid
CreateGrid(String parentContextPath, String newProjectionName, String borders, int... dimensions)
static Grid
CreateGrid(String parentContextPath, String newProjectionName, String borders, BigDecimal... dimensions)
static GridValueLayer
CreateGridValueLayer(String contextPath, String name, int... dimensions)
Creates a GridValueLayer and adds it to the specified context.static GridValueLayer
CreateGridValueLayer(String contextPath, String name, BigDecimal... dimensions)
static Network
CreateNetwork(String parentContextPath, String netName, boolean isDirected)
static Network
CreateNetwork(String parentContextPath, String netName, boolean isDirected, String agentClassName, String fileName, NetworkFileFormat format)
static Network
CreateNetwork(String parentContextPath, String networkName, boolean directed, NetworkGenerator gen)
static Projection
CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType)
static Projection
CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, boolean optionalProjectionKind)
static Projection
CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, boolean optionalProjectionKind, String optionalBorders, int... optionalDimensions)
static Projection
CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, int... optionalDimensions)
static Projection
CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, String optionalBorders, int... optionalDimensions)
static Projection
CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, String optionalBorders, BigDecimal... optionalDimensions)
static Projection
CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, BigDecimal... optionalDimensions)
static Network
CreateRandomDensityNetwork(String parentContextPath, String networkName, boolean directed, double density, boolean allowSelfLoops, boolean symmetric)
static Network
CreateWattsBetaSmallWorldNetwork(String parentContextPath, String networkName, boolean directed, double beta, int nghSize, boolean symmetrical)
static Network
CreateWattsBetaSmallWorldNetwork(String parentContextPath, String networkName, boolean directed, double beta, BigDecimal nghSize, boolean symmetrical)
static boolean
DeleteExternalFile(String fileName)
static void
EndSimulationRun()
static void
EndSimulationRunAt(double tick)
static int
ExecuteProgram(String directory, String commandLine)
static List
FindAgentsInContext(String contextPath, String sqlQuery)
static List
FindAgentsInContext(String contextPath, String sqlQuery, Object functionHandler)
static List
FindAgentsInNetwork(String contextPath, String sqlQuery)
static List
FindAgentsInNetwork(String networkPath, String sqlQuery, Object functionHandler)
static Context
FindContext(String contextPath)
static ContinuousSpace
FindContinuousSpace(String spacePath)
Finds the Continuous Space projection from the given path.static RepastEdge
FindEdge(String networkProjectionPath, Object agentSource, Object agentTarget)
static Grid
FindGrid(String gridPath)
Finds the Grid projection from the given path.static Network
FindNetwork(String networkPath)
Finds the Network projection from the given path.static Context
FindParentContext(String contextPath)
static Projection
FindProjection(String projectionPath)
static ValueLayer
FindValueLayer(String valueLayerPath)
Finds the ValueLayer that matches the specified path.static List
GetAdjacent(String networkPath, Object agent)
Gets the agents adjacent to the specified agent in the specified network.static List<RepastEdge>
GetEdges(String networkPath, Object agent)
Gets the edges connected to the specified agent in the specified network.static double
GetEdgeWeight(String networkProjectionPath, Object agentSource, Object agentTarget)
static List<RepastEdge>
GetInEdges(String networkPath, Object agent)
Gets the edges for which the specified agent is the target in the specified network.static IndexedIterable
GetObjects(String contextPath, String className)
static List<RepastEdge>
GetOutEdges(String networkPath, Object agent)
Gets the edges for which the specified agent is the source in the specified network.static Object
GetParameter(String name)
Gets the named parameter's value.static List
GetPredecessors(String networkPath, Object agent)
Gets the predecessors of the specified agent in the specified network.static Iterable
GetRandomObjects(String contextPath, String className, long num)
static List
GetSuccessors(String networkPath, Object agent)
Gets the successors of the specified agent in the specified network.static double
GetTickCount()
static javax.measure.Quantity<?>
GetTickCountInTimeUnits()
static boolean
MoveAgent(String projectionPath, Object agent, Number... newAgentLocation)
static void
MoveAgentByDisplacement(String projectionPath, Object agent, Number... displacement)
static void
MoveAgentByVector(String projectionPath, Object agent, Number distance, Number... anglesInRadians)
static Query
OrQuery(Query query1, Query query2)
static void
PauseSimulationRun()
static void
PauseSimulationRunAt(double tick)
static double
RandomDraw()
static double
RandomDraw(double lowerBound, double upperBound)
static double
RandomDraw(BigDecimal lowerBound, BigDecimal upperBound)
static boolean
RandomDrawAgainstThreshold(double threshold)
static boolean
RandomDrawAgainstThreshold(BigDecimal threshold)
static boolean
ReadExternalFile(Object target, String xmlDataFileDescriptionFileName, String sourceFileName)
static Context
RemoveAgentFromContext(String parentContextPath, Object agent)
static Context
RemoveAgentFromModel(Object agent)
static Context
RemoveContext(String contextPath)
static RepastEdge
RemoveEdge(String networkProjectionPath, Object agentSource, Object agentTarget)
static Projection
RemoveProjection(String path)
static ISchedulableAction
ScheduleAction(Object agent, double optionalStartTime, double optionalRepeatInterval, String methodName, Object... parameters)
static ISchedulableAction
ScheduleAction(Object agent, double optionalStartTime, String methodName, Object... parameters)
static ISchedulableAction
ScheduleAction(Object agent, String methodName, Object... parameters)
static RepastEdge
SetEdgeWeight(String networkProjectionPath, Object agentSource, Object agentTarget, double newWeight)
static boolean
WriteExternalFile(Object source, String xmlDataFileDescriptionFileName, String targetFileName)
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
FindAgentsInContext
public static List FindAgentsInContext(String contextPath, String sqlQuery, Object functionHandler)
-
FindAgentsInNetwork
public static List FindAgentsInNetwork(String networkPath, String sqlQuery, Object functionHandler)
-
GetObjects
public static IndexedIterable GetObjects(String contextPath, String className)
-
GetRandomObjects
public static Iterable GetRandomObjects(String contextPath, String className, long num)
-
FindValueLayer
public static ValueLayer FindValueLayer(String valueLayerPath)
Finds the ValueLayer that matches the specified path. The first part of the path is the context heirarchy and the last element is the value layer name.- Parameters:
valueLayerPath
- the path to the value layer- Returns:
- the found value layer.
-
AddValueLayer
public static void AddValueLayer(String contextPath, ValueLayer layer)
Adds the specified value layer to the context on the specified path.- Parameters:
contextPath
- the path to the contextlayer
- the value layer to add
-
CreateGridValueLayer
public static GridValueLayer CreateGridValueLayer(String contextPath, String name, BigDecimal... dimensions)
-
CreateGridValueLayer
public static GridValueLayer CreateGridValueLayer(String contextPath, String name, int... dimensions)
Creates a GridValueLayer and adds it to the specified context.- Parameters:
contextPath
-name
-dimensions
-- Returns:
- the created GridValueLayer.
-
CreateContinuousValueLayer
public static ContinuousValueLayer CreateContinuousValueLayer(String contextPath, String name, BigDecimal... dimensions)
-
CreateContinuousValueLayer
public static ContinuousValueLayer CreateContinuousValueLayer(String contextPath, String name, double... dimensions)
Creates a ContinousValueLayer and adds it to the specified context.- Parameters:
contextPath
-name
-dimensions
-- Returns:
- the created ContinuousValueLayer.
-
FindProjection
public static Projection FindProjection(String projectionPath)
-
FindNetwork
public static Network FindNetwork(String networkPath)
Finds the Network projection from the given path.- Parameters:
networkPath
- the path of the Network- Returns:
- the Network
-
FindGrid
public static Grid FindGrid(String gridPath)
Finds the Grid projection from the given path.- Parameters:
gridPath
- the path of the Grid- Returns:
- the Grid
-
FindContinuousSpace
public static ContinuousSpace FindContinuousSpace(String spacePath)
Finds the Continuous Space projection from the given path.- Parameters:
spacePath
- the path of the Space- Returns:
- the Continuous Space
-
CreateRandomDensityNetwork
public static Network CreateRandomDensityNetwork(String parentContextPath, String networkName, boolean directed, double density, boolean allowSelfLoops, boolean symmetric)
-
Create1DLatticeNetwork
public static Network Create1DLatticeNetwork(String parentContextPath, String networkName, boolean directed, boolean toroidal, boolean symmetrical)
-
Create2DLatticeNetwork
public static Network Create2DLatticeNetwork(String parentContextPath, String networkName, boolean directed, boolean toroidal)
-
CreateWattsBetaSmallWorldNetwork
public static Network CreateWattsBetaSmallWorldNetwork(String parentContextPath, String networkName, boolean directed, double beta, BigDecimal nghSize, boolean symmetrical)
-
CreateWattsBetaSmallWorldNetwork
public static Network CreateWattsBetaSmallWorldNetwork(String parentContextPath, String networkName, boolean directed, double beta, int nghSize, boolean symmetrical)
-
CreateNetwork
public static Network CreateNetwork(String parentContextPath, String netName, boolean isDirected, String agentClassName, String fileName, NetworkFileFormat format)
-
CreateNetwork
public static Network CreateNetwork(String parentContextPath, String networkName, boolean directed, NetworkGenerator gen)
-
CreateNetwork
public static Network CreateNetwork(String parentContextPath, String netName, boolean isDirected)
-
CreateGrid
public static Grid CreateGrid(String parentContextPath, String newProjectionName, String borders, BigDecimal... dimensions)
-
CreateGrid
public static Grid CreateGrid(String parentContextPath, String newProjectionName, String borders, int... dimensions)
-
CreateContinuousSpace
public static ContinuousSpace CreateContinuousSpace(String parentContextPath, String newProjectionName, String borders, BigDecimal... dimensions)
-
CreateContinuousSpace
public static ContinuousSpace CreateContinuousSpace(String parentContextPath, String newProjectionName, String borders, int... dimensions)
-
CreateProjection
public static Projection CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType)
-
CreateProjection
public static Projection CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, boolean optionalProjectionKind)
-
CreateProjection
public static Projection CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, BigDecimal... optionalDimensions)
-
CreateProjection
public static Projection CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, int... optionalDimensions)
-
CreateProjection
public static Projection CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, String optionalBorders, BigDecimal... optionalDimensions)
-
CreateProjection
public static Projection CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, String optionalBorders, int... optionalDimensions)
-
CreateProjection
public static Projection CreateProjection(String parentContextPath, String newProjectionName, String newProjectionType, boolean optionalProjectionKind, String optionalBorders, int... optionalDimensions)
- Parameters:
parentContextPath
-newProjectionName
-newProjectionType
-optionalProjectionKind
- if net then specified isDirected, if grid then specified is mult. occupancyoptionalBorders
-optionalDimensions
-- Returns:
-
RemoveProjection
public static Projection RemoveProjection(String path)
-
CreateAgents
public static Object CreateAgents(String parentContextPath, String newAgentType, int agentCount)
-
CreateEdge
public static RepastEdge<?> CreateEdge(String networkProjectionPath, Object agentSource, Object agentTarget)
-
CreateEdge
public static RepastEdge<?> CreateEdge(String networkProjectionPath, Object agentSource, Object agentTarget, double optionalWeight)
-
FindEdge
public static RepastEdge FindEdge(String networkProjectionPath, Object agentSource, Object agentTarget)
-
GetEdgeWeight
public static double GetEdgeWeight(String networkProjectionPath, Object agentSource, Object agentTarget)
-
SetEdgeWeight
public static RepastEdge SetEdgeWeight(String networkProjectionPath, Object agentSource, Object agentTarget, double newWeight)
-
RemoveEdge
public static RepastEdge RemoveEdge(String networkProjectionPath, Object agentSource, Object agentTarget)
-
GetPredecessors
public static List GetPredecessors(String networkPath, Object agent)
Gets the predecessors of the specified agent in the specified network.- Parameters:
networkPath
- the path to the networkagent
- the agent whose predecessors we want- Returns:
- the predecessors of the specified agent in the specified network.
-
GetSuccessors
public static List GetSuccessors(String networkPath, Object agent)
Gets the successors of the specified agent in the specified network.- Parameters:
networkPath
- the path to the networkagent
- the agent whose successors we want- Returns:
- the successors of the specified agent in the specified network.
-
GetAdjacent
public static List GetAdjacent(String networkPath, Object agent)
Gets the agents adjacent to the specified agent in the specified network.- Parameters:
networkPath
- the path to the networkagent
- the agent whose adjacents we want- Returns:
- the agents adjacent to the specified agent in the specified network.
-
GetInEdges
public static List<RepastEdge> GetInEdges(String networkPath, Object agent)
Gets the edges for which the specified agent is the target in the specified network. For a undirected net this is all the edges connected to the agent.- Parameters:
networkPath
- the path to the networkagent
- the agent whose in edges we want- Returns:
- the edges for which the specified agent is the target in the specified network
-
GetOutEdges
public static List<RepastEdge> GetOutEdges(String networkPath, Object agent)
Gets the edges for which the specified agent is the source in the specified network. For a undirected net this is all the edges connected to the agent.- Parameters:
networkPath
- the path to the networkagent
- the agent whose in edges we want- Returns:
- the edges for which the specified agent is the source in the specified network
-
GetEdges
public static List<RepastEdge> GetEdges(String networkPath, Object agent)
Gets the edges connected to the specified agent in the specified network.- Parameters:
networkPath
- the path to the networkagent
- the agent whose in edges we want- Returns:
- the edges connected to the specified agent in the specified network.
-
RemoveAgentFromContext
public static Context RemoveAgentFromContext(String parentContextPath, Object agent)
-
MoveAgent
public static boolean MoveAgent(String projectionPath, Object agent, Number... newAgentLocation)
-
MoveAgentByDisplacement
public static void MoveAgentByDisplacement(String projectionPath, Object agent, Number... displacement)
-
MoveAgentByVector
public static void MoveAgentByVector(String projectionPath, Object agent, Number distance, Number... anglesInRadians)
-
GetTickCount
public static double GetTickCount()
-
GetTickCountInTimeUnits
public static javax.measure.Quantity<?> GetTickCountInTimeUnits()
-
ScheduleAction
public static ISchedulableAction ScheduleAction(Object agent, String methodName, Object... parameters)
-
ScheduleAction
public static ISchedulableAction ScheduleAction(Object agent, double optionalStartTime, String methodName, Object... parameters)
-
ScheduleAction
public static ISchedulableAction ScheduleAction(Object agent, double optionalStartTime, double optionalRepeatInterval, String methodName, Object... parameters)
-
CancelAction
public static IAction CancelAction(ISchedulableAction actionToCancel)
-
EndSimulationRun
public static void EndSimulationRun()
-
EndSimulationRunAt
public static void EndSimulationRunAt(double tick)
-
PauseSimulationRun
public static void PauseSimulationRun()
-
PauseSimulationRunAt
public static void PauseSimulationRunAt(double tick)
-
DeleteExternalFile
public static boolean DeleteExternalFile(String fileName)
-
WriteExternalFile
public static boolean WriteExternalFile(Object source, String xmlDataFileDescriptionFileName, String targetFileName)
-
ReadExternalFile
public static boolean ReadExternalFile(Object target, String xmlDataFileDescriptionFileName, String sourceFileName)
-
GetParameter
public static Object GetParameter(String name)
Gets the named parameter's value.- Parameters:
name
- the name of the parameter- Returns:
- the named parameter's value
-
RandomDrawAgainstThreshold
public static boolean RandomDrawAgainstThreshold(BigDecimal threshold)
-
RandomDrawAgainstThreshold
public static boolean RandomDrawAgainstThreshold(double threshold)
-
RandomDraw
public static double RandomDraw()
-
RandomDraw
public static double RandomDraw(double lowerBound, double upperBound)
-
RandomDraw
public static double RandomDraw(BigDecimal lowerBound, BigDecimal upperBound)
-
bigDecimalArrayToIntArray
public static int[] bigDecimalArrayToIntArray(BigDecimal[] bigDecimalArray)
-
bigDecimalArrayToDoubleArray
public static double[] bigDecimalArrayToDoubleArray(BigDecimal[] bigDecimalArray)
-
-