7b3685eef28e9b846c094746a45f2f6592bf234c139d567ea75ad761af39cec74593a1165ec98d04ba325dd37c6ffa7b0861820eafd0a0159703d206efde9c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. "use strict";
  2. Object.defineProperty(exports, "t", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _Base = _interopRequireDefault(require("./Base"));
  7. var _TreeIterator = _interopRequireDefault(require("./Base/TreeIterator"));
  8. var _throwError = require("../../utils/throwError");
  9. function _interopRequireDefault(r) {
  10. return r && r.t ? r : {
  11. default: r
  12. };
  13. }
  14. class OrderedMapIterator extends _TreeIterator.default {
  15. constructor(r, t, e, s) {
  16. super(r, t, s);
  17. this.container = e;
  18. }
  19. get pointer() {
  20. if (this.o === this.h) {
  21. (0, _throwError.throwIteratorAccessError)();
  22. }
  23. const r = this;
  24. return new Proxy([], {
  25. get(t, e) {
  26. if (e === "0") return r.o.u; else if (e === "1") return r.o.l;
  27. },
  28. set(t, e, s) {
  29. if (e !== "1") {
  30. throw new TypeError("props must be 1");
  31. }
  32. r.o.l = s;
  33. return true;
  34. }
  35. });
  36. }
  37. copy() {
  38. return new OrderedMapIterator(this.o, this.h, this.container, this.iteratorType);
  39. }
  40. }
  41. class OrderedMap extends _Base.default {
  42. constructor(r = [], t, e) {
  43. super(t, e);
  44. const s = this;
  45. r.forEach((function(r) {
  46. s.setElement(r[0], r[1]);
  47. }));
  48. }
  49. * K(r) {
  50. if (r === undefined) return;
  51. yield* this.K(r.U);
  52. yield [ r.u, r.l ];
  53. yield* this.K(r.W);
  54. }
  55. begin() {
  56. return new OrderedMapIterator(this.h.U || this.h, this.h, this);
  57. }
  58. end() {
  59. return new OrderedMapIterator(this.h, this.h, this);
  60. }
  61. rBegin() {
  62. return new OrderedMapIterator(this.h.W || this.h, this.h, this, 1);
  63. }
  64. rEnd() {
  65. return new OrderedMapIterator(this.h, this.h, this, 1);
  66. }
  67. front() {
  68. if (this.i === 0) return;
  69. const r = this.h.U;
  70. return [ r.u, r.l ];
  71. }
  72. back() {
  73. if (this.i === 0) return;
  74. const r = this.h.W;
  75. return [ r.u, r.l ];
  76. }
  77. lowerBound(r) {
  78. const t = this.X(this.Y, r);
  79. return new OrderedMapIterator(t, this.h, this);
  80. }
  81. upperBound(r) {
  82. const t = this.Z(this.Y, r);
  83. return new OrderedMapIterator(t, this.h, this);
  84. }
  85. reverseLowerBound(r) {
  86. const t = this.$(this.Y, r);
  87. return new OrderedMapIterator(t, this.h, this);
  88. }
  89. reverseUpperBound(r) {
  90. const t = this.rr(this.Y, r);
  91. return new OrderedMapIterator(t, this.h, this);
  92. }
  93. setElement(r, t, e) {
  94. return this.M(r, t, e);
  95. }
  96. find(r) {
  97. const t = this.I(this.Y, r);
  98. return new OrderedMapIterator(t, this.h, this);
  99. }
  100. getElementByKey(r) {
  101. const t = this.I(this.Y, r);
  102. return t.l;
  103. }
  104. union(r) {
  105. const t = this;
  106. r.forEach((function(r) {
  107. t.setElement(r[0], r[1]);
  108. }));
  109. return this.i;
  110. }
  111. [Symbol.iterator]() {
  112. return this.K(this.Y);
  113. }
  114. }
  115. var _default = OrderedMap;
  116. exports.default = _default;
  117. //# sourceMappingURL=OrderedMap.js.map