Class RepastEssentials


  • public class RepastEssentials
    extends Object
    • Constructor Detail

      • RepastEssentials

        public RepastEssentials()
    • Method Detail

      • FindAgentsInContext

        public static List FindAgentsInContext​(String contextPath,
                                               String sqlQuery)
      • FindAgentsInContext

        public static List FindAgentsInContext​(String contextPath,
                                               String sqlQuery,
                                               Object functionHandler)
      • FindAgentsInNetwork

        public static List FindAgentsInNetwork​(String contextPath,
                                               String sqlQuery)
      • FindAgentsInNetwork

        public static List FindAgentsInNetwork​(String networkPath,
                                               String sqlQuery,
                                               Object functionHandler)
      • FindContext

        public static Context FindContext​(String contextPath)
      • GetRandomObjects

        public static Iterable GetRandomObjects​(String contextPath,
                                                String className,
                                                long num)
      • FindParentContext

        public static Context FindParentContext​(String contextPath)
      • 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 context
        layer - the value layer to add
      • 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,
                                                                      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
      • CreateContext

        public static Context CreateContext​(String parentContextPath,
                                            String newContextName)
      • RemoveContext

        public static Context RemoveContext​(String contextPath)
      • 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)
      • CreateGrid

        public static Grid CreateGrid​(String parentContextPath,
                                      String newProjectionName,
                                      String borders,
                                      int... 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,
                                                  int... 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. occupancy
        optionalBorders -
        optionalDimensions -
        Returns:
      • CreateAgent

        public static Object CreateAgent​(String parentContextPath,
                                         String newAgentType)
      • CreateAgents

        public static Object CreateAgents​(String parentContextPath,
                                          String newAgentType,
                                          int agentCount)
      • CreateEdge

        public static RepastEdge<?> CreateEdge​(String networkProjectionPath,
                                               Object agentSource,
                                               Object agentTarget,
                                               double optionalWeight)
      • GetEdgeWeight

        public static double GetEdgeWeight​(String networkProjectionPath,
                                           Object agentSource,
                                           Object agentTarget)
      • SetEdgeWeight

        public static RepastEdge SetEdgeWeight​(String networkProjectionPath,
                                               Object agentSource,
                                               Object agentTarget,
                                               double newWeight)
      • 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 network
        agent - 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 network
        agent - 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 network
        agent - 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 network
        agent - 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 network
        agent - 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 network
        agent - the agent whose in edges we want
        Returns:
        the edges connected to the specified agent in the specified network.
      • AddAgentToContext

        public static Context AddAgentToContext​(String parentContextPath,
                                                Object agent)
      • RemoveAgentFromContext

        public static Context RemoveAgentFromContext​(String parentContextPath,
                                                     Object agent)
      • RemoveAgentFromModel

        public static Context RemoveAgentFromModel​(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,
                                                        double optionalStartTime,
                                                        double optionalRepeatInterval,
                                                        String methodName,
                                                        Object... parameters)
      • 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)
      • ExecuteProgram

        public static int ExecuteProgram​(String directory,
                                         String commandLine)
      • bigDecimalArrayToIntArray

        public static int[] bigDecimalArrayToIntArray​(BigDecimal[] bigDecimalArray)
      • bigDecimalArrayToDoubleArray

        public static double[] bigDecimalArrayToDoubleArray​(BigDecimal[] bigDecimalArray)