"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cast_de_nrw_schule_svws_core_adt_set_AVLSet = exports.AVLSet = void 0;
const JavaObject_1 = require("../../../java/lang/JavaObject");
const SortedSet_1 = require("../../../java/util/SortedSet");
const AVLMap_1 = require("../../../core/adt/map/AVLMap");
const Comparator_1 = require("../../../java/util/Comparator");
class AVLSet extends JavaObject_1.JavaObject {
    _set;
    /**
     * Implementation for method overloads of 'constructor'
     */
    constructor(__param0) {
        super();
        if ((typeof __param0 === "undefined")) {
            let map = new AVLMap_1.AVLMap();
            map.allowKeyAlone(true);
            this._set = map.navigableKeySet();
        }
        else if (((typeof __param0 !== "undefined") && ((typeof __param0 !== 'undefined') && (__param0 instanceof Object) && (__param0 !== null) && ('compare' in __param0) && (typeof __param0.compare === 'function')) || (__param0 === null))) {
            let comparator = (0, Comparator_1.cast_java_util_Comparator)(__param0);
            let map = new AVLMap_1.AVLMap(comparator);
            map.allowKeyAlone(true);
            this._set = map.navigableKeySet();
        }
        else if (((typeof __param0 !== "undefined") && ((__param0 instanceof JavaObject_1.JavaObject) && (__param0.isTranspiledInstanceOf('java.util.SortedSet'))) || (__param0 === null))) {
            let set = (0, SortedSet_1.cast_java_util_SortedSet)(__param0);
            let map = new AVLMap_1.AVLMap();
            map.allowKeyAlone(true);
            this._set = map.navigableKeySet();
            this._set.addAll(set);
        }
        else
            throw new Error('invalid method overload');
    }
    comparator() {
        return this._set.comparator();
    }
    first() {
        return this._set.first();
    }
    last() {
        return this._set.last();
    }
    size() {
        return this._set.size();
    }
    isEmpty() {
        return this._set.isEmpty();
    }
    contains(o) {
        return this._set.contains(o);
    }
    /**
     * Implementation for method overloads of 'toArray'
     */
    toArray(__param0) {
        if ((typeof __param0 === "undefined")) {
            return this._set.toArray();
        }
        else if (((typeof __param0 !== "undefined") && Array.isArray(__param0))) {
            let a = __param0;
            return this._set.toArray(a);
        }
        else
            throw new Error('invalid method overload');
    }
    add(e) {
        return this._set.add(e);
    }
    remove(o) {
        return this._set.remove(o);
    }
    containsAll(c) {
        return this._set.containsAll(c);
    }
    addAll(c) {
        return this._set.addAll(c);
    }
    retainAll(c) {
        return this._set.retainAll(c);
    }
    removeAll(c) {
        return this._set.removeAll(c);
    }
    clear() {
        this._set.clear();
    }
    lower(e) {
        return this._set.lower(e);
    }
    floor(e) {
        return this._set.floor(e);
    }
    ceiling(e) {
        return this._set.ceiling(e);
    }
    higher(e) {
        return this._set.higher(e);
    }
    pollFirst() {
        return this._set.pollFirst();
    }
    pollLast() {
        return this._set.pollLast();
    }
    iterator() {
        return this._set.iterator();
    }
    descendingSet() {
        return this._set.descendingSet();
    }
    descendingIterator() {
        return this._set.descendingIterator();
    }
    /**
     * Implementation for method overloads of 'subSet'
     */
    subSet(__param0, __param1, __param2, __param3) {
        if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean") && ((typeof __param2 !== "undefined") && (typeof __param2 !== "undefined")) && ((typeof __param3 !== "undefined") && typeof __param3 === "boolean")) {
            let fromElement = __param0;
            let fromInclusive = __param1;
            let toElement = __param2;
            let toInclusive = __param3;
            return this._set.subSet(fromElement, fromInclusive, toElement, toInclusive);
        }
        else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && (typeof __param1 !== "undefined")) && (typeof __param2 === "undefined") && (typeof __param3 === "undefined")) {
            let fromElement = __param0;
            let toElement = __param1;
            return this._set.subSet(fromElement, toElement);
        }
        else
            throw new Error('invalid method overload');
    }
    /**
     * Implementation for method overloads of 'headSet'
     */
    headSet(__param0, __param1) {
        if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
            let toElement = __param0;
            let inclusive = __param1;
            return this._set.headSet(toElement, inclusive);
        }
        else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
            let toElement = __param0;
            return this._set.headSet(toElement);
        }
        else
            throw new Error('invalid method overload');
    }
    /**
     * Implementation for method overloads of 'tailSet'
     */
    tailSet(__param0, __param1) {
        if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
            let fromElement = __param0;
            let inclusive = __param1;
            return this._set.tailSet(fromElement, inclusive);
        }
        else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
            let fromElement = __param0;
            return this._set.tailSet(fromElement);
        }
        else
            throw new Error('invalid method overload');
    }
    isTranspiledInstanceOf(name) {
        return ['java.util.SortedSet', 'java.util.Collection', 'de.nrw.schule.svws.core.adt.set.AVLSet', 'java.util.Set', 'java.util.NavigableSet', 'java.lang.Iterable'].includes(name);
    }
    [Symbol.iterator]() {
        let iter = this.iterator();
        const result = {
            next() {
                if (iter.hasNext())
                    return { value: iter.next(), done: false };
                return { value: null, done: true };
            }
        };
        return result;
    }
}
exports.AVLSet = AVLSet;
function cast_de_nrw_schule_svws_core_adt_set_AVLSet(obj) {
    return obj;
}
exports.cast_de_nrw_schule_svws_core_adt_set_AVLSet = cast_de_nrw_schule_svws_core_adt_set_AVLSet;
//# sourceMappingURL=AVLSet.js.map