1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package pathgame.algorithm;
- import pathgame.tilemap.TileType;
- import java.util.ArrayList;
- public class Node2D {
- private final int weight;
- private int costSoFar = Integer.MAX_VALUE;
- private char prevOfPath = '\0';
- private int prevBoatPath = -1;
- private TileType type = TileType.LAND;
- private boolean isQAdded = false;
- private boolean hasExtraPaths = false;
- private boolean isBlocked = false;
- private boolean isTown = false;
- private final ArrayList<ExtraPath> extraPaths = new ArrayList<>();
- public Node2D(int weight) {
- this.weight = weight;
- }
- public int getWeight() {
- return weight;
- }
- public int getCostSoFar() {
- return costSoFar;
- }
- public void setCostSoFar(int costSoFar) {
- this.costSoFar = costSoFar;
- }
- public char getPrevOfPath() {
- return prevOfPath;
- }
- public void setPrevOfPath(char prevOfPath) {
- this.prevOfPath = prevOfPath;
- }
- public ArrayList<ExtraPath> getExtraPaths() {
- return extraPaths;
- }
- public void addExtraPath(Coord dest, int pathWeight, ArrayList<Coord> pathCoords) {
- hasExtraPaths = true;
- extraPaths.add(new ExtraPath(dest.getX(), dest.getY(), pathWeight, pathCoords));
- }
- public boolean hasExtraPaths() {
- return hasExtraPaths;
- }
- public boolean isQAdded() {
- return isQAdded;
- }
- public void setQAdded(boolean QAdded) {
- isQAdded = QAdded;
- }
- public boolean isBlocked() {
- return isBlocked;
- }
- public void setBlocked(boolean blocked) {
- isBlocked = blocked;
- }
- public TileType getType() {
- return type;
- }
- public void setType(TileType type) {
- this.type = type;
- }
- public int getPrevBoatPath() {
- return prevBoatPath;
- }
- public void setPrevBoatPath(int prevBoatPath) {
- this.prevBoatPath = prevBoatPath;
- }
- public boolean isTown() {
- return isTown;
- }
- public void setTown(boolean town) {
- isTown = town;
- }
- }
|