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; } }