Package repast.simphony.space.grid
Class GridBuilderParameters<T>
java.lang.Object
repast.simphony.space.grid.GridBuilderParameters<T>
Parameters for creating grids. This class includes static convenience methods for
creating some common types of grids.
- Author:
- Nick Collier
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionGridBuilderParameters
(GridPointTranslator borderRule, GridAdder<T> adder, boolean multi, int... dims) Creates parameters with the specified border rule, adder, multi occupancy and dimensions.GridBuilderParameters
(GridPointTranslator borderRule, GridAdder<T> adder, boolean multi, int[] dims, int[] origin) Creates parameters with the specified border rule, adder, multi occupancy, dimensions and origin. -
Method Summary
Modifier and TypeMethodDescriptiongetAdder()
Gets the adder used to add objects entered into the context automatically to the grid.int[]
Gets the dimensions of the grid.Gets the grid point translator used to calculate points when moving by displacement.int[]
Gets the origin of the grid.boolean
static <T> GridBuilderParameters<T>
multiOccupancy1D
(GridAdder<T> adder, GridPointTranslator borderRule, int size) Returns GridBuilderParameters suitable for creating a multi-occupancy 1 dimensional grid.static <T> GridBuilderParameters<T>
multiOccupancy1DTorus
(GridAdder<T> adder, int size) Returns GridBuilderParameters suitable for creating a multi occupancy 1 dimensional periodic wrapped grid.static <T> GridBuilderParameters<T>
multiOccupancy2D
(GridAdder<T> adder, GridPointTranslator borderRule, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a multi occupancy 2 dimensional grid.static <T> GridBuilderParameters<T>
multiOccupancy2DTorus
(GridAdder<T> adder, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a multi occupancy 2 dimensional torus.static <T> GridBuilderParameters<T>
multiOccupancyND
(GridAdder<T> adder, GridPointTranslator borderRule, int... dimensions) Returns GridBuilderParameters suitable for creating a multi occupancy n-dimensional grid.static <T> GridBuilderParameters<T>
multiOccupancyNDTorus
(GridAdder<T> adder, int... dimensions) Returns GridBuilderParameters suitable for creating a multi occupancy n-dimensional torus.static <T> GridBuilderParameters<T>
singleOccupancy1D
(GridAdder<T> adder, GridPointTranslator borderRule, int size) Returns GridBuilderParameters suitable for creating a single occupancy 1 dimensional grid.static <T> GridBuilderParameters<T>
singleOccupancy1DTorus
(GridAdder<T> adder, int size) Returns GridBuilderParameters suitable for creating a single occupancy 1 dimensional periodic wrapped grid.static <T> GridBuilderParameters<T>
singleOccupancy2D
(GridAdder<T> adder, GridPointTranslator borderRule, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a single occupancy 2 dimensional grid.static <T> GridBuilderParameters<T>
singleOccupancy2DTorus
(GridAdder<T> adder, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a single occupancy 2 dimensional torus.static <T> GridBuilderParameters<T>
singleOccupancyND
(GridAdder<T> adder, GridPointTranslator borderRule, int... dimensions) Returns GridBuilderParameters suitable for creating a single occupancy n-dimensional grid.static <T> GridBuilderParameters<T>
singleOccupancyNDTorus
(GridAdder<T> adder, int... dimensions) Returns GridBuilderParameters suitable for creating a single occupancy n-dimensional torus.
-
Field Details
-
adder
-
trans
-
dims
protected int[] dims -
origin
protected int[] origin -
isMulti
protected boolean isMulti
-
-
Constructor Details
-
GridBuilderParameters
public GridBuilderParameters(GridPointTranslator borderRule, GridAdder<T> adder, boolean multi, int... dims) Creates parameters with the specified border rule, adder, multi occupancy and dimensions.- Parameters:
borderRule
- the rule used to determine border behavioradder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionmulti
- whether or not each cell in the grid is multi-occupancydims
- the dimensions of the grid- See Also:
-
GridBuilderParameters
public GridBuilderParameters(GridPointTranslator borderRule, GridAdder<T> adder, boolean multi, int[] dims, int[] origin) Creates parameters with the specified border rule, adder, multi occupancy, dimensions and origin.- Parameters:
borderRule
- the rule used to determine border behavioradder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionmulti
- whether or not each cell in the grid is multi-occupancydims
- the dimensions of the gridorigin
- the origin of the grid- See Also:
-
-
Method Details
-
getGridPointTranslator
Gets the grid point translator used to calculate points when moving by displacement. This can be used to set the translator so that the new point is the result of a bounce off a boundary.- Returns:
- the
-
getAdder
Gets the adder used to add objects entered into the context automatically to the grid.- Returns:
- the adder used to add objects entered into the context automatically to the grid.
-
getDimensions
public int[] getDimensions()Gets the dimensions of the grid.- Returns:
- the dimensions of the grid.
-
getOrigin
public int[] getOrigin()Gets the origin of the grid.- Returns:
- the origin of the grid.
-
isMultOccupancy
public boolean isMultOccupancy()- Returns:
- true if each grid cell can hold more than one object
-
singleOccupancy1D
public static <T> GridBuilderParameters<T> singleOccupancy1D(GridAdder<T> adder, GridPointTranslator borderRule, int size) Returns GridBuilderParameters suitable for creating a single occupancy 1 dimensional grid.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionborderRule
- the rule used to determine border behaviorsize
- the size of the single dimension- Returns:
- GridBuilderParameters suitable for creating a single occupancy 1 dimensional grid.
-
singleOccupancy1DTorus
Returns GridBuilderParameters suitable for creating a single occupancy 1 dimensional periodic wrapped grid. That is, the ends of the grid are joined.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionsize
- the size of the single dimension- Returns:
- GridBuilderParameters suitable for creating a single occupancy 1 dimensional periodic wrapped grid.
-
singleOccupancy2D
public static <T> GridBuilderParameters<T> singleOccupancy2D(GridAdder<T> adder, GridPointTranslator borderRule, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a single occupancy 2 dimensional grid.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionborderRule
- the rule used to determine border behaviorxSize
- the size of the x dimensionySize
- the size of the y dimension- Returns:
- GridBuilderParameters suitable for creating a single occupancy 2 dimensional grid.
-
singleOccupancy2DTorus
public static <T> GridBuilderParameters<T> singleOccupancy2DTorus(GridAdder<T> adder, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a single occupancy 2 dimensional torus.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionxSize
- the size of the x dimensionySize
- the size of the y dimension- Returns:
- GridBuilderParameters suitable for creating a single occupancy 2 dimensional torus.
-
singleOccupancyND
public static <T> GridBuilderParameters<T> singleOccupancyND(GridAdder<T> adder, GridPointTranslator borderRule, int... dimensions) Returns GridBuilderParameters suitable for creating a single occupancy n-dimensional grid.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionborderRule
- the rule used to determine border behaviordimensions
- the dimensions of the grid- Returns:
- GridBuilderParameters suitable for creating a single occupancy n-dimensional grid.
-
singleOccupancyNDTorus
public static <T> GridBuilderParameters<T> singleOccupancyNDTorus(GridAdder<T> adder, int... dimensions) Returns GridBuilderParameters suitable for creating a single occupancy n-dimensional torus.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectiondimensions
- the dimensions of the grid- Returns:
- GridBuilderParameters suitable for creating a single occupancy n-dimensional torus.
-
multiOccupancy1D
public static <T> GridBuilderParameters<T> multiOccupancy1D(GridAdder<T> adder, GridPointTranslator borderRule, int size) Returns GridBuilderParameters suitable for creating a multi-occupancy 1 dimensional grid.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionborderRule
- the rule used to determine border behaviorsize
- the size of the single dimension- Returns:
- GridBuilderParameters suitable for creating a single occupancy 1 dimensional grid.
-
multiOccupancy1DTorus
Returns GridBuilderParameters suitable for creating a multi occupancy 1 dimensional periodic wrapped grid. That is, the ends of the grid are joined.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionsize
- the size of the single dimension- Returns:
- GridBuilderParameters suitable for creating a multi occupancy 1 dimensional periodic wrapped grid.
-
multiOccupancy2D
public static <T> GridBuilderParameters<T> multiOccupancy2D(GridAdder<T> adder, GridPointTranslator borderRule, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a multi occupancy 2 dimensional grid.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionborderRule
- the rule used to determine border behaviorxSize
- the size of the x dimensionySize
- the size of the y dimension- Returns:
- GridBuilderParameters suitable for creating a multi occupancy 2 dimensional grid.
-
multiOccupancy2DTorus
public static <T> GridBuilderParameters<T> multiOccupancy2DTorus(GridAdder<T> adder, int xSize, int ySize) Returns GridBuilderParameters suitable for creating a multi occupancy 2 dimensional torus.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionxSize
- the size of the x dimensionySize
- the size of the y dimension- Returns:
- GridBuilderParameters suitable for creating a multi occupancy 2 dimensional torus.
-
multiOccupancyND
public static <T> GridBuilderParameters<T> multiOccupancyND(GridAdder<T> adder, GridPointTranslator borderRule, int... dimensions) Returns GridBuilderParameters suitable for creating a multi occupancy n-dimensional grid.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectionborderRule
- the rule used to determine border behaviordimensions
- the dimensions of the grid- Returns:
- GridBuilderParameters suitable for creating a multi occupancy n-dimensional grid.
-
multiOccupancyNDTorus
public static <T> GridBuilderParameters<T> multiOccupancyNDTorus(GridAdder<T> adder, int... dimensions) Returns GridBuilderParameters suitable for creating a multi occupancy n-dimensional torus.- Parameters:
adder
- the adder used to add objects to the grid when those objects are added to the context for which the grid is a projectiondimensions
- the dimensions of the grid- Returns:
- GridBuilderParameters suitable for creating a multi occupancy n-dimensional torus.
-