dc4da32c6fd3ceff225fbe11031676380f162eee5da9712fb82c724f7e29d282c9990cd4fd7f4e378123fd6efe6abe997543a97ae680b03ba8d8c5ea7e24b2 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. "use strict";
  2. Object.defineProperty(exports, "t", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _ContainerBase = require("../../ContainerBase");
  7. var _throwError = require("../../../utils/throwError");
  8. class TreeIterator extends _ContainerBase.ContainerIterator {
  9. constructor(t, r, i) {
  10. super(i);
  11. this.o = t;
  12. this.h = r;
  13. if (this.iteratorType === 0) {
  14. this.pre = function() {
  15. if (this.o === this.h.U) {
  16. (0, _throwError.throwIteratorAccessError)();
  17. }
  18. this.o = this.o.L();
  19. return this;
  20. };
  21. this.next = function() {
  22. if (this.o === this.h) {
  23. (0, _throwError.throwIteratorAccessError)();
  24. }
  25. this.o = this.o.B();
  26. return this;
  27. };
  28. } else {
  29. this.pre = function() {
  30. if (this.o === this.h.W) {
  31. (0, _throwError.throwIteratorAccessError)();
  32. }
  33. this.o = this.o.B();
  34. return this;
  35. };
  36. this.next = function() {
  37. if (this.o === this.h) {
  38. (0, _throwError.throwIteratorAccessError)();
  39. }
  40. this.o = this.o.L();
  41. return this;
  42. };
  43. }
  44. }
  45. get index() {
  46. let t = this.o;
  47. const r = this.h.tt;
  48. if (t === this.h) {
  49. if (r) {
  50. return r.rt - 1;
  51. }
  52. return 0;
  53. }
  54. let i = 0;
  55. if (t.U) {
  56. i += t.U.rt;
  57. }
  58. while (t !== r) {
  59. const r = t.tt;
  60. if (t === r.W) {
  61. i += 1;
  62. if (r.U) {
  63. i += r.U.rt;
  64. }
  65. }
  66. t = r;
  67. }
  68. return i;
  69. }
  70. }
  71. var _default = TreeIterator;
  72. exports.default = _default;
  73. //# sourceMappingURL=TreeIterator.js.map