b579bd795b00ddb7761c14f5de39b9ddc6bdd01ed099997033c8ff8545cc1e5e829531af5cba8b77ae3322fe6fd4afc96fee884d021a4a47c4003a7e83127f 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. var __extends = this && this.t || function() {
  2. var extendStatics = function(r, t) {
  3. extendStatics = Object.setPrototypeOf || {
  4. __proto__: []
  5. } instanceof Array && function(r, t) {
  6. r.__proto__ = t;
  7. } || function(r, t) {
  8. for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) r[e] = t[e];
  9. };
  10. return extendStatics(r, t);
  11. };
  12. return function(r, t) {
  13. if (typeof t !== "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
  14. extendStatics(r, t);
  15. function __() {
  16. this.constructor = r;
  17. }
  18. r.prototype = t === null ? Object.create(t) : (__.prototype = t.prototype, new __);
  19. };
  20. }();
  21. import { ContainerIterator } from "../../ContainerBase";
  22. import { throwIteratorAccessError } from "../../../utils/throwError";
  23. var TreeIterator = function(r) {
  24. __extends(TreeIterator, r);
  25. function TreeIterator(t, e, i) {
  26. var n = r.call(this, i) || this;
  27. n.o = t;
  28. n.h = e;
  29. if (n.iteratorType === 0) {
  30. n.pre = function() {
  31. if (this.o === this.h.K) {
  32. throwIteratorAccessError();
  33. }
  34. this.o = this.o.L();
  35. return this;
  36. };
  37. n.next = function() {
  38. if (this.o === this.h) {
  39. throwIteratorAccessError();
  40. }
  41. this.o = this.o.m();
  42. return this;
  43. };
  44. } else {
  45. n.pre = function() {
  46. if (this.o === this.h.N) {
  47. throwIteratorAccessError();
  48. }
  49. this.o = this.o.m();
  50. return this;
  51. };
  52. n.next = function() {
  53. if (this.o === this.h) {
  54. throwIteratorAccessError();
  55. }
  56. this.o = this.o.L();
  57. return this;
  58. };
  59. }
  60. return n;
  61. }
  62. Object.defineProperty(TreeIterator.prototype, "index", {
  63. get: function() {
  64. var r = this.o;
  65. var t = this.h.rr;
  66. if (r === this.h) {
  67. if (t) {
  68. return t.tr - 1;
  69. }
  70. return 0;
  71. }
  72. var e = 0;
  73. if (r.K) {
  74. e += r.K.tr;
  75. }
  76. while (r !== t) {
  77. var i = r.rr;
  78. if (r === i.N) {
  79. e += 1;
  80. if (i.K) {
  81. e += i.K.tr;
  82. }
  83. }
  84. r = i;
  85. }
  86. return e;
  87. },
  88. enumerable: false,
  89. configurable: true
  90. });
  91. return TreeIterator;
  92. }(ContainerIterator);
  93. export default TreeIterator;
  94. //# sourceMappingURL=TreeIterator.js.map