Node2D.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 boolean isTown = false;
  14. private ArrayList<ExtraPath> extraPaths = new ArrayList<>();
  15. public Node2D(int weight) {
  16. this.weight = weight;
  17. }
  18. public int getWeight() {
  19. return weight;
  20. }
  21. public int getCostSoFar() {
  22. return costSoFar;
  23. }
  24. public char getPrevOfPath() {
  25. return prevOfPath;
  26. }
  27. public ArrayList<ExtraPath> getExtraPaths() {
  28. return extraPaths;
  29. }
  30. public boolean hasExtraPaths() {
  31. return hasExtraPaths;
  32. }
  33. public void setCostSoFar(int costSoFar) {
  34. this.costSoFar = costSoFar;
  35. }
  36. public void setPrevOfPath(char prevOfPath) {
  37. this.prevOfPath = prevOfPath;
  38. }
  39. public void addExtraPath(Coord dest, int pathWeight, ArrayList<Coord> pathCoords) {
  40. hasExtraPaths = true;
  41. extraPaths.add(new ExtraPath(dest.getX(), dest.getY(), pathWeight, pathCoords));
  42. }
  43. public boolean isQAdded() {
  44. return isQAdded;
  45. }
  46. public void setQAdded(boolean QAdded) {
  47. isQAdded = QAdded;
  48. }
  49. public boolean isBlocked() {
  50. return isBlocked;
  51. }
  52. public void setBlocked(boolean blocked) {
  53. isBlocked = blocked;
  54. }
  55. public TileType getType() {
  56. return type;
  57. }
  58. public void setType(TileType type) {
  59. this.type = type;
  60. }
  61. public int getPrevBoatPath() {
  62. return prevBoatPath;
  63. }
  64. public void setPrevBoatPath(int prevBoatPath) {
  65. this.prevBoatPath = prevBoatPath;
  66. }
  67. public boolean isTown() {
  68. return isTown;
  69. }
  70. public void setTown(boolean town) {
  71. isTown = town;
  72. }
  73. }