1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- package pathgame.algorithm;
- /** Simple class for storing 2D x and y coordinates
- *
- */
- public class Coord {
- private int x, y;
- private boolean isBoatTile = false;
- /** Create new coordinate with given x and y value
- *
- * @param x position of Coord
- * @param y position of Coord
- */
- Coord(int x, int y) {
- this.x = x;
- this.y = y;
- }
- /** Creates new cooridnate with given x and y value and sets isBoatTile to given value
- *
- * @param x position of Coord
- * @param y position of Coord
- * @param isBoatTile set to true if part of a boat path; used for debug purposes
- */
- Coord(int x, int y, boolean isBoatTile) {
- this.x = x;
- this.y = y;
- this.isBoatTile = isBoatTile;
- }
- /** Returns x position of Coord
- *
- * @return x position
- */
- public int getX() {
- return x;
- }
- /** Returns y position of Coord
- *
- * @return y position
- */
- public int getY() {
- return y;
- }
- /** Adds given value to x position of Coord
- *
- * @param x value to be added to x position
- */
- public void changeX(int x) {
- this.x += x;
- }
- /** Adds given value to y position of Coord
- *
- * @param y value to be added to y position
- */
- public void changeY(int y) {
- this.y += y;
- }
- /** Sets x and y position of Coord to given values
- *
- * @param x new x position of Coord
- * @param y new y position of Coord
- */
- public void setCoord(int x, int y) {
- this.x = x;
- this.y = y;
- }
- /** Returns isBoatTile, which is true if Coord is part of a boat path
- *
- * @return isBoatTile of Coord
- */
- public boolean isBoatTile() {
- return isBoatTile;
- }
- /** Sets isBoatTile to given value
- *
- * @param isBoatTile value isBoatTile gets set to
- */
- public void setBoatTile(boolean isBoatTile) {
- this.isBoatTile = isBoatTile;
- }
- }
|