Class BoundedGrid
java.lang.Object
application.model.simulation.bounds.BoundedGrid
public abstract class BoundedGrid
extends java.lang.Object
The base class for all bounded grid types
-
Field Summary
Fields Modifier and Type Field Description protected int
height
protected Coordinate
initialCoordinate
protected java.lang.String
specifier
protected int
width
-
Constructor Summary
Constructors Constructor Description BoundedGrid(java.lang.String specifier, Coordinate initialCoordinate)
Constructs a bounded grid -
Method Summary
Modifier and Type Method Description boolean
atEdge(Coordinate coordinate)
Checks if a coordinate is at the edge of the bounded gridabstract java.lang.String
canonise()
Canonises the bounded grid specifierabstract java.lang.Object
clone()
int
getHeight()
Gets the height of the bounded gridCoordinate
getInitialCoordinate()
Gets the initial coordinate of the bounded gridabstract java.lang.String[]
getRegex()
Gets the regex for the identifier string of the bounded gridjava.lang.String
getSpecifier()
Gets the bounded grid specifierint
getWidth()
Gets the width of the bounded gridabstract Coordinate
map(Coordinate coordinate)
Maps a coordinate to its new positionabstract void
parse(java.lang.String string)
Parses the identifier string of the bounded grid (e.g.void
setInitialCoordinate(Coordinate initialCoordinate)
Sets the initial coordinate of the bounded gridvoid
setSpecifier(java.lang.String specifier)
Sets the bounded grid specifier
-
Field Details
-
specifier
protected java.lang.String specifier -
initialCoordinate
-
width
protected int width -
height
protected int height
-
-
Constructor Details
-
BoundedGrid
Constructs a bounded grid- Parameters:
specifier
- The bounded grid specifierinitialCoordinate
- The initial coordinate of the bounded grid
-
-
Method Details
-
parse
public abstract void parse(java.lang.String string)Parses the identifier string of the bounded grid (e.g. T100,50)- Parameters:
string
- The string to parse
-
canonise
public abstract java.lang.String canonise()Canonises the bounded grid specifier- Returns:
- Returns the canonised string
-
getRegex
public abstract java.lang.String[] getRegex()Gets the regex for the identifier string of the bounded grid- Returns:
- Returns the regexes for identifying the bounded grid
-
map
Maps a coordinate to its new position- Parameters:
coordinate
- The coordinate to map- Returns:
- Returns the new mapped coordinate
-
atEdge
Checks if a coordinate is at the edge of the bounded grid- Parameters:
coordinate
- Coordinate to check- Returns:
- Returns true if the coordinate is at the edge of the bounded grid, false otherwise
-
getSpecifier
public java.lang.String getSpecifier()Gets the bounded grid specifier- Returns:
- Returns the bounded grid specifier
-
getInitialCoordinate
Gets the initial coordinate of the bounded grid- Returns:
- Returns the initial coordinate of the bounded grid
-
setSpecifier
public void setSpecifier(java.lang.String specifier)Sets the bounded grid specifier- Parameters:
specifier
- The bounded grid specifier
-
setInitialCoordinate
Sets the initial coordinate of the bounded grid- Parameters:
initialCoordinate
- The initial coordinate of the bounded grid
-
getWidth
public int getWidth()Gets the width of the bounded grid- Returns:
- Returns the width of the bounded grid
-
getHeight
public int getHeight()Gets the height of the bounded grid- Returns:
- Returns the height of the bounded grid
-
clone
public abstract java.lang.Object clone()- Overrides:
clone
in classjava.lang.Object
-