chenyc
2025-12-09 545c24c6a711d71b65f3d4e8122fee3837fb1edc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var __extends = this && this.t || function() {
    var extendStatics = function(t, r) {
        extendStatics = Object.setPrototypeOf || {
            __proto__: []
        } instanceof Array && function(t, r) {
            t.__proto__ = r;
        } || function(t, r) {
            for (var n in r) if (Object.prototype.hasOwnProperty.call(r, n)) t[n] = r[n];
        };
        return extendStatics(t, r);
    };
    return function(t, r) {
        if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
        extendStatics(t, r);
        function __() {
            this.constructor = t;
        }
        t.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
    };
}();
 
import { ContainerIterator } from "../../ContainerBase";
 
import { throwIteratorAccessError } from "../../../utils/throwError";
 
var RandomIterator = function(t) {
    __extends(RandomIterator, t);
    function RandomIterator(r, n) {
        var o = t.call(this, n) || this;
        o.o = r;
        if (o.iteratorType === 0) {
            o.pre = function() {
                if (this.o === 0) {
                    throwIteratorAccessError();
                }
                this.o -= 1;
                return this;
            };
            o.next = function() {
                if (this.o === this.container.size()) {
                    throwIteratorAccessError();
                }
                this.o += 1;
                return this;
            };
        } else {
            o.pre = function() {
                if (this.o === this.container.size() - 1) {
                    throwIteratorAccessError();
                }
                this.o += 1;
                return this;
            };
            o.next = function() {
                if (this.o === -1) {
                    throwIteratorAccessError();
                }
                this.o -= 1;
                return this;
            };
        }
        return o;
    }
    Object.defineProperty(RandomIterator.prototype, "pointer", {
        get: function() {
            return this.container.getElementByPos(this.o);
        },
        set: function(t) {
            this.container.setElementByPos(this.o, t);
        },
        enumerable: false,
        configurable: true
    });
    return RandomIterator;
}(ContainerIterator);
 
export { RandomIterator };
//# sourceMappingURL=RandomIterator.js.map