AnyLogic
Expand
Font size
All Superinterfaces:
AgentExtension, ExtEnvironmentInteractive, ExtEnvironmentWithLayout, ExtWithSpaceType, 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

Method Summary

Modifier and TypeMethodDescription
doublecToX_xjal(int c)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
AgentgetAgentAtCell(int r, int c)
Returns the agent located in the cell with a given row and column, or null.
NeighborhoodTypegetNeighborhoodType()
Returns the type of neighbourhood (Euclidean, Moore)
booleanisCellInsideSpace(int r, int c) 
voidputAgent_xjal(Agent a, int r, int c) 
CellPositionrandomEmptyCell()
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.
doublerToY_xjal(int r)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
voidsetupSpace(double width, double height, int rows, int columns, NeighborhoodType neighborhoodType)
Sets the space type to discrete with the given dimensions and neighbourhood type.
doublespaceCellHeight()
Returns the height of the cell in discrete space.
doublespaceCellWidth()
Returns the width of the cell in discrete space.
intspaceColumns()
Returns the number of columns in the space.
doublespaceHeight()
Returns the height of environment space.
intspaceRows()
Returns the number of rows in the space.
doublespaceWidth()
Returns the width of environment space.
voidswapAgents_xjal(int r, int c, int r2, int c2) 

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.ExtEnvironmentWithLayout

applyLayout, getLayoutType, setLayoutType

Method Details

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)