Node2D.java 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package pathgame.algorithm;
  2. import pathgame.tilemap.TileType;
  3. import java.util.ArrayList;
  4. public class Node2D {
  5. private int weight;
  6. private int costSoFar = Integer.MAX_VALUE;
  7. private char prevOfPath = '\0';
  8. private int prevBoatPath = -1;
  9. private TileType type = TileType.LAND;
  10. private boolean isQAdded = false;
  11. private boolean hasExtraPaths = false;
  12. private boolean isBlocked = false;
  13. private ArrayList<ExtraPath> extraPaths = new ArrayList<>();
  14. public Node2D(int weight) {
  15. this.weight = weight;
  16. }
  17. public int getWeight() {
  18. return weight;
  19. }
  20. public int getCostSoFar() {
  21. return costSoFar;
  22. }
  23. public char getPrevOfPath() {
  24. return prevOfPath;
  25. }
  26. public ArrayList<ExtraPath> getExtraPaths() {
  27. return extraPaths;
  28. }
  29. public boolean hasExtraPaths() {
  30. return hasExtraPaths;
  31. }
  32. public void setCostSoFar(int costSoFar) {
  33. this.costSoFar = costSoFar;
  34. }
  35. public void setPrevOfPath(char prevOfPath) {
  36. this.prevOfPath = prevOfPath;
  37. }
  38. public void addExtraPath(Coord dest, int pathWeight, ArrayList<Coord> pathCoords) {
  39. hasExtraPaths = true;
  40. extraPaths.add(new ExtraPath(dest.getX(), dest.getY(), pathWeight, pathCoords));
  41. }
  42. public boolean isQAdded() {
  43. return isQAdded;
  44. }
  45. public void setQAdded(boolean QAdded) {
  46. isQAdded = QAdded;
  47. }
  48. public boolean isBlocked() {
  49. return isBlocked;
  50. }
  51. public void setBlocked(boolean blocked) {
  52. isBlocked = blocked;
  53. }
  54. public TileType getType() {
  55. return type;
  56. }
  57. public void setType(TileType type) {
  58. this.type = type;
  59. }
  60. public int getPrevBoatPath() {
  61. return prevBoatPath;
  62. }
  63. public void setPrevBoatPath(int prevBoatPath) {
  64. this.prevBoatPath = prevBoatPath;
  65. }
  66. }