No.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package analise;
  7. import common.Instruction;
  8. import java.util.ArrayList;
  9. /**
  10. *
  11. * @author lucas
  12. */
  13. public class No {
  14. public Instruction instruction;
  15. public ArrayList<No> deps = new ArrayList<>();
  16. public boolean root;
  17. public Integer index = 0;
  18. No(Instruction instruction, boolean root) {
  19. this.instruction = instruction;
  20. this.root = root;
  21. }
  22. @Override
  23. public String toString() {
  24. return Dump("");
  25. }
  26. protected String Dump(String space) {
  27. StringBuilder sb = new StringBuilder();
  28. sb.append("(")
  29. .append(instruction.Get("global.position"))
  30. .append(")[")
  31. .append(deps.size())
  32. .append("| ")
  33. .append(root)
  34. .append("]");
  35. if (instruction.eq("global.position", "168")) {
  36. // System.out.println("DUMP: " + instruction);
  37. // System.out.println("DUMP: " + deps.size());
  38. }
  39. deps.forEach((dep) -> {
  40. sb.append("\n")
  41. .append(space)
  42. .append(dep.Dump(space + " "));
  43. });
  44. return sb.toString(); //To change body of generated methods, choose Tools | Templates.
  45. }
  46. }