Labyrinth
A labyrinth game assignment
|
An Application wide board position implementation holding just the id coordinate. More...
Package Functions | |
Position (int row, int col) | |
Basic constructor from row-column coordinates. More... | |
Position (int tileId) | |
Basic constructor from Id. More... | |
Position (int row, int col, int direction) | |
Constructor from row-column coordinates and a direction. More... | |
non-static API | |
int | getRow () |
Read access to virtual row coordinate. More... | |
int | getCol () |
Read access to virtual column coordinate. More... | |
int | getId () |
Read access to id coordinate. More... | |
Static Package Functions | |
Static convention utilities | |
static int | toID (int row, int col) |
Takes row and column coordinates and return the calculated Id coordinate. More... | |
static int | toRow (int id) |
Takes Id coordinate and return the corresponding row coordinate. More... | |
static int | toCol (int id) |
Takes Id coordinate and return the corresponding column coordinate. More... | |
Private Attributes | |
private data types | |
int | id |
The id coordinate of the constructed Position object. More... | |
An Application wide board position implementation holding just the id coordinate.
Position is a helper class to enable us cope with the redundant position data (id and coordinates). This class provide both static conversion functionalities between id and coordinates and data representation in the coordinates system. For clarity we adopt a tileId convention.
Definition at line 112 of file Common.java.
|
package |
Basic constructor from row-column coordinates.
row | The row coordinate |
col | The column coordinate |
Definition at line 119 of file Common.java.
|
package |
Basic constructor from Id.
tileId | The id of tile |
Definition at line 127 of file Common.java.
|
package |
Constructor from row-column coordinates and a direction.
This constructor creates a position relative to coordinates.
row | The row coordinate |
col | The column coordinate |
direction | The direction |
Definition at line 140 of file Common.java.
|
package |
Read access to virtual column coordinate.
Definition at line 153 of file Common.java.
|
package |
Read access to id coordinate.
Definition at line 154 of file Common.java.
|
package |
Read access to virtual row coordinate.
Definition at line 152 of file Common.java.
|
staticpackage |
Takes Id coordinate and return the corresponding column coordinate.
id | The id coordinate |
Definition at line 182 of file Common.java.
|
staticpackage |
Takes row and column coordinates and return the calculated Id coordinate.
row | The row coordinate |
col | The column coordinate |
Definition at line 165 of file Common.java.
|
staticpackage |
Takes Id coordinate and return the corresponding row coordinate.
id | The id coordinate |
Definition at line 174 of file Common.java.
|
private |
The id coordinate of the constructed Position object.
Definition at line 189 of file Common.java.