Interval.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 IntermediaryCode;
  7. /**
  8. *
  9. * @author EUGENIO CARVALHO
  10. */
  11. public class Interval {
  12. public int Start;
  13. public int End;
  14. public String Register = "";
  15. protected boolean persist;
  16. Interval(int start, int end) {
  17. Start = start;
  18. End = end;
  19. persist = false;
  20. }
  21. public int getStart() {
  22. return Start;
  23. }
  24. public void setStart(int Start) {
  25. this.Start = Start;
  26. }
  27. public int getEnd() {
  28. return End;
  29. }
  30. public void setEnd(int End) {
  31. this.End = End;
  32. }
  33. public String getRegister() {
  34. return Register;
  35. }
  36. public void setRegister(String Register) {
  37. this.Register = Register;
  38. }
  39. boolean Alive(int position) {
  40. return position <= End;
  41. }
  42. void Close(int position) {
  43. End = position;
  44. }
  45. @Override
  46. public String toString() {
  47. return "[" + Start + ", " + End + ", " + Register + "]";
  48. }
  49. public boolean Inside(int i) {
  50. return Start <= i && i <= End;
  51. }
  52. public boolean RegisterDefined() {
  53. return !Register.equals("");
  54. }
  55. public boolean Perisist() {
  56. return this.persist;
  57. }
  58. public boolean Perisist(boolean p) {
  59. return this.persist = p;
  60. }
  61. }