Node2D.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package pathgame.algorithm;
  2. import java.util.ArrayList;
  3. public class Node2D {
  4. private int weight;
  5. private int costSoFar = Integer.MAX_VALUE;
  6. private char prevOfPath = '\0';
  7. private boolean isQAdded = false;
  8. private boolean hasExtraPaths = false;
  9. private ArrayList<ExtraPath> extraPaths = new ArrayList<>();
  10. public Node2D(int weight) {
  11. this.weight = weight;
  12. }
  13. public int getWeight() {
  14. return weight;
  15. }
  16. public int getCostSoFar() {
  17. return costSoFar;
  18. }
  19. public char getPrevOfPath() {
  20. return prevOfPath;
  21. }
  22. public ArrayList<ExtraPath> getExtraPaths() {
  23. return extraPaths;
  24. }
  25. public boolean hasExtraPaths() {
  26. return hasExtraPaths;
  27. }
  28. public void setCostSoFar(int costSoFar) {
  29. this.costSoFar = costSoFar;
  30. }
  31. public void setPrevOfPath(char prevOfPath) {
  32. this.prevOfPath = prevOfPath;
  33. }
  34. public void addExtraPath(ExtraPath path) {
  35. hasExtraPaths = true;
  36. extraPaths.add(path);
  37. }
  38. public boolean isQAdded() {
  39. return isQAdded;
  40. }
  41. public void setQAdded(boolean QAdded) {
  42. isQAdded = QAdded;
  43. }
  44. }