AnyLogic AnyLogic
Expand
Font size
All Superinterfaces:
AgentExtension, ExtEnvironmentInteractive, ExtEnvironmentWithLayout, ExtWithSpaceType, java.io.Serializable

public interface ExtEnvironmentDiscrete
extends ExtEnvironmentInteractive, ExtEnvironmentWithLayout, ExtWithSpaceType
Agent environment extension for discrete 2D space
Author:
AnyLogic North America, LLC https://anylogic.com

Field Summary

Fields inherited from interface com.anylogic.engine.AgentExtension

P_AGENT_INTERACTIVE_DELEGATE, P_AGENT_WITH_SPATIAL_METRICS_DELEGATE, P_AGENT_WITH_SPECIFIC_SPACE, P_AGENT_WITH_SPECIFIC_SPACE_DELEGATE, P_ENTITY_DELEGATE, P_ENV_WITH_SPECIFIC_SPACE, P_ROOT, P_SPACE, P_USER_EXT

Method Summary

All Methods Instance Methods Abstract Methods 
double cToX_xjal​(int c)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Agent getAgentAtCell​(int r, int c)
Returns the agent located in the cell with a given row and column, or null.
NeighborhoodType getNeighborhoodType()
Returns the type of neighbourhood (Euclidean, Moore)
boolean isCellInsideSpace​(int r, int c)  
void putAgent_xjal​(Agent a, int r, int c)  
CellPosition randomEmptyCell()
Tries to find a pseudo-randomly located empty cell and return its row and column in the array with two elements.
The current implementation is 100% fairly random.
double rToY_xjal​(int r)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
void setupSpace​(double width, double height, int rows, int columns, NeighborhoodType neighborhoodType)
Sets the space type to discrete with the given dimensions and neighbourhood type.
double spaceCellHeight()
Returns the height of the cell in discrete space.
double spaceCellWidth()
Returns the width of the cell in discrete space.
int spaceColumns()
Returns the number of columns in the space.
double spaceHeight()
Returns the height of environment space.
int spaceRows()
Returns the number of rows in the space.
double spaceWidth()
Returns the width of environment space.
void swapAgents_xjal​(int r, int c, int r2, int c2)  
Modifier and Type Method Description

Methods inherited from interface com.anylogic.engine.AgentExtension

getAgent, next_xjal, onDestroy, onExtensionRemoved, priority, setNext_xjal, supportsInterface_xjal

Methods inherited from interface com.anylogic.engine.ExtEnvironmentInteractive

agents, applyNetwork, applyNetwork, areStepsEnabled, deliverToAllAgentsInside, deliverToRandomAgentInside, disableSteps, enableSteps, getNetworkConnectionsPerAgent, getNetworkNeighborLinkProbability, getNetworkScaleFreeM, getNetworkType, getSpaceType, randomAgentExcept, randomAgentExcept, randomAgentInside, randomAgentInside, register_xjal, register_xjal, setNetworkRandom, setNetworkRingLattice, setNetworkScaleFree, setNetworkSmallWorld, setNetworkType_xjal, setNetworkUserDefined, size, toStringNetwork_xjal, toStringSpace_xjal, unregister_xjal

Methods inherited from interface com.anylogic.engine.ExtEnvironmentWithLayout

applyLayout, getLayoutType, setLayoutType

Method Detail

setupSpace

void setupSpace​(double width,
                double height,
                int rows,
                int columns,
                NeighborhoodType neighborhoodType)
Sets the space type to discrete with the given dimensions and neighbourhood type. A cell in such environment will have a size of (width/columns) by (height/rows).
This method should only be called when the environment is empty.
Parameters:
width - the width of the space
height - the height of the space
rows - the number of rows in the space
columns - the number of columns in the space
neighborhoodType - the type of neighbourhood (Euclidean, Moore)

spaceWidth

double spaceWidth()
Returns the width of environment space.
Returns:
the width of environment space

spaceHeight

double spaceHeight()
Returns the height of environment space.
Returns:
the height of environment space

spaceCellWidth

double spaceCellWidth()
Returns the width of the cell in discrete space.
Returns:
the width of the cell in discrete space

spaceCellHeight

double spaceCellHeight()
Returns the height of the cell in discrete space.
Returns:
the height of the cell in discrete space

spaceRows

int spaceRows()
Returns the number of rows in the space.
Returns:
the number of rows in the space

spaceColumns

int spaceColumns()
Returns the number of columns in the space.
Returns:
the number of columns in the space

getNeighborhoodType

NeighborhoodType getNeighborhoodType()
Returns the type of neighbourhood (Euclidean, Moore)
Returns:
the type of neighbourhood (Euclidean, Moore)

randomEmptyCell

CellPosition randomEmptyCell()
Tries to find a pseudo-randomly located empty cell and return its row and column in the array with two elements.
The current implementation is 100% fairly random.
Returns:
the cell position (row and column) of the empty cell, or null

getAgentAtCell

Agent getAgentAtCell​(int r,
                     int c)
Returns the agent located in the cell with a given row and column, or null.
Parameters:
r - the row of the cell
c - the column of the cell
Returns:
the agent at (r,c) or null

swapAgents_xjal

@AnyLogicInternalAPI
void swapAgents_xjal​(int r,
                     int c,
                     int r2,
                     int c2)

isCellInsideSpace

boolean isCellInsideSpace​(int r,
                          int c)

cToX_xjal

@AnyLogicInternalAPI
double cToX_xjal​(int c)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

rToY_xjal

@AnyLogicInternalAPI
double rToY_xjal​(int r)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

putAgent_xjal

@AnyLogicInternalAPI
void putAgent_xjal​(Agent a,
                   int r,
                   int c)
How can we improve this article?