2aac3b62e29f7566f5764a10b4538c2fb8f20041f5142991a6d30ca83ffb223abf9515112d26bc6fc89c513e1e97331575e4cd18319055361651b4ccf34ef7 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. Object.defineProperty(exports, "t", {
  3. value: true
  4. });
  5. exports.RandomIterator = void 0;
  6. var _ContainerBase = require("../../ContainerBase");
  7. var _throwError = require("../../../utils/throwError");
  8. class RandomIterator extends _ContainerBase.ContainerIterator {
  9. constructor(t, r) {
  10. super(r);
  11. this.o = t;
  12. if (this.iteratorType === 0) {
  13. this.pre = function() {
  14. if (this.o === 0) {
  15. (0, _throwError.throwIteratorAccessError)();
  16. }
  17. this.o -= 1;
  18. return this;
  19. };
  20. this.next = function() {
  21. if (this.o === this.container.size()) {
  22. (0, _throwError.throwIteratorAccessError)();
  23. }
  24. this.o += 1;
  25. return this;
  26. };
  27. } else {
  28. this.pre = function() {
  29. if (this.o === this.container.size() - 1) {
  30. (0, _throwError.throwIteratorAccessError)();
  31. }
  32. this.o += 1;
  33. return this;
  34. };
  35. this.next = function() {
  36. if (this.o === -1) {
  37. (0, _throwError.throwIteratorAccessError)();
  38. }
  39. this.o -= 1;
  40. return this;
  41. };
  42. }
  43. }
  44. get pointer() {
  45. return this.container.getElementByPos(this.o);
  46. }
  47. set pointer(t) {
  48. this.container.setElementByPos(this.o, t);
  49. }
  50. }
  51. exports.RandomIterator = RandomIterator;
  52. //# sourceMappingURL=RandomIterator.js.map