123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.cast_de_nrw_schule_svws_core_adt_map_AVLMapSubMap = exports.AVLMapSubMap = void 0;
- const JavaMapEntry_1 = require("../../../java/util/JavaMapEntry");
- const AVLMapSubCollection_1 = require("../../../core/adt/map/AVLMapSubCollection");
- const AVLMapIntervall_1 = require("../../../core/adt/map/AVLMapIntervall");
- const AVLMapSubEntrySetIterator_1 = require("../../../core/adt/map/AVLMapSubEntrySetIterator");
- const AVLMapSubKeySet_1 = require("../../../core/adt/map/AVLMapSubKeySet");
- const AVLMap_1 = require("../../../core/adt/map/AVLMap");
- const AVLMapSubKeySetIterator_1 = require("../../../core/adt/map/AVLMapSubKeySetIterator");
- const JavaObject_1 = require("../../../java/lang/JavaObject");
- const AVLMapSubEntrySet_1 = require("../../../core/adt/map/AVLMapSubEntrySet");
- const JavaMap_1 = require("../../../java/util/JavaMap");
- const Vector_1 = require("../../../java/util/Vector");
- const AVLMapSubCollectionIterator_1 = require("../../../core/adt/map/AVLMapSubCollectionIterator");
- const IllegalArgumentException_1 = require("../../../java/lang/IllegalArgumentException");
- class AVLMapSubMap extends JavaObject_1.JavaObject {
- _par;
- _iv;
- _asc = false;
- /**
- * Erstellt eine neue Sub-Map relativ zur übergebenen {@link AVLMap}.
- *
- * @param parent Die {@link AVLMap} auf der diese Sup-Map operiert.
- * @param intervall Das {@link AVLMapIntervall} auf das sich diese Sub-Map bezieht.
- */
- constructor(parent, intervall, asc) {
- super();
- this._par = parent;
- this._iv = intervall;
- this._asc = asc;
- }
- toString() {
- let s = "";
- for (let e of this.entrySet())
- s += (s.length === 0 ? "" : ", ") + e;
- return "Entries = [" + s.valueOf() + "], iv = " + this._iv + ", asc = " + this._asc;
- }
- equals(o) {
- if (o === this)
- return true;
- if (((o instanceof JavaObject_1.JavaObject) && (o.isTranspiledInstanceOf('java.util.Map'))) === false)
- return false;
- let mapO = (0, JavaMap_1.cast_java_util_Map)(o);
- if (mapO.size() !== this.size())
- return false;
- for (let e of this.entrySet())
- if (JavaObject_1.JavaObject.equalsTranspiler(e.getValue(), (mapO.get(e.getKey()))) === false)
- return false;
- return true;
- }
- hashCode() {
- let h = 0;
- for (let entry of this.entrySet())
- h += JavaObject_1.JavaObject.getTranspilerHashCode(entry);
- return h;
- }
- comparator() {
- return this._par.bcGetComparator(this._iv);
- }
- firstKey() {
- return this._asc ? this._par.bcGetFirstKeyOrException(this._iv) : this._par.bcGetLastKeyOrException(this._iv);
- }
- lastKey() {
- return this._asc ? this._par.bcGetLastKeyOrException(this._iv) : this._par.bcGetFirstKeyOrException(this._iv);
- }
- keySet() {
- return new AVLMapSubKeySet_1.AVLMapSubKeySet(this);
- }
- values() {
- return new AVLMapSubCollection_1.AVLMapSubCollection(this);
- }
- entrySet() {
- return new AVLMapSubEntrySet_1.AVLMapSubEntrySet(this);
- }
- size() {
- return this._par.bcGetSize(this._iv);
- }
- isEmpty() {
- return this._par.bcIsEmpty(this._iv);
- }
- containsKey(key) {
- return this._par.bcContainsKey(key, this._iv);
- }
- containsValue(value) {
- return this._par.bcContainsValue(value, this._iv);
- }
- get(key) {
- return this._par.bcGetValueOfKeyOrNull(key, this._iv);
- }
- put(key, value) {
- return this._par.bcAddEntryReturnOldValueOrNull(key, value, this._iv);
- }
- remove(key) {
- return this._par.bcRemoveKeyReturnOldValueOrNull(key, this._iv);
- }
- putAll(map) {
- this._par.bcAddAllEntriesOfMap(map, this._iv);
- }
- clear() {
- let iter = this.bcGetSubEntrySetIterator();
- while (iter.hasNext()) {
- iter.next();
- iter.remove();
- }
- }
- lowerEntry(key) {
- return this._asc ? this._par.bcGetLowerEntryOrNull(key, this._iv) : this._par.bcGetHigherEntryOrNull(key, this._iv);
- }
- lowerKey(key) {
- return this._asc ? this._par.bcGetLowerKeyOrNull(key, this._iv) : this._par.bcGetHigherKeyOrNull(key, this._iv);
- }
- floorEntry(key) {
- return this._asc ? this._par.bcGetFloorEntryOrNull(key, this._iv) : this._par.bcGetCeilingEntryOrNull(key, this._iv);
- }
- floorKey(key) {
- return this._asc ? this._par.bcGetFloorKeyOrNull(key, this._iv) : this._par.bcGetCeilingKeyOrNull(key, this._iv);
- }
- ceilingEntry(key) {
- return this._asc ? this._par.bcGetCeilingEntryOrNull(key, this._iv) : this._par.bcGetFloorEntryOrNull(key, this._iv);
- }
- ceilingKey(key) {
- return this._asc ? this._par.bcGetCeilingKeyOrNull(key, this._iv) : this._par.bcGetFloorKeyOrNull(key, this._iv);
- }
- higherEntry(key) {
- return this._asc ? this._par.bcGetHigherEntryOrNull(key, this._iv) : this._par.bcGetLowerEntryOrNull(key, this._iv);
- }
- higherKey(key) {
- return this._asc ? this._par.bcGetHigherKeyOrNull(key, this._iv) : this._par.bcGetLowerKeyOrNull(key, this._iv);
- }
- firstEntry() {
- return this._asc ? this._par.bcGetFirstEntryOrNull(this._iv) : this._par.bcGetLastEntryOrNull(this._iv);
- }
- lastEntry() {
- return this._asc ? this._par.bcGetLastEntryOrNull(this._iv) : this._par.bcGetFirstEntryOrNull(this._iv);
- }
- pollFirstEntry() {
- return this._asc ? this._par.bcPollFirstEntryOrNull(this._iv) : this._par.bcPollLastEntryOrNull(this._iv);
- }
- pollLastEntry() {
- return this._asc ? this._par.bcPollLastEntryOrNull(this._iv) : this._par.bcPollFirstEntryOrNull(this._iv);
- }
- descendingMap() {
- return new AVLMapSubMap(this._par, this._iv, !this._asc);
- }
- navigableKeySet() {
- return new AVLMapSubKeySet_1.AVLMapSubKeySet(this);
- }
- descendingKeySet() {
- return new AVLMapSubKeySet_1.AVLMapSubKeySet(new AVLMapSubMap(this._par, this._iv, !this._asc));
- }
- /**
- * Implementation for method overloads of 'subMap'
- */
- subMap(__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 fromKey = __param0;
- let fromInclusive = __param1;
- let toKey = __param2;
- let toInclusive = __param3;
- return this._createMap(fromKey, fromInclusive, toKey, toInclusive, this._asc);
- }
- else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && (typeof __param1 !== "undefined")) && (typeof __param2 === "undefined") && (typeof __param3 === "undefined")) {
- let fromKey = __param0;
- let toKey = __param1;
- return this._createMap(fromKey, true, toKey, false, this._asc);
- }
- else
- throw new Error('invalid method overload');
- }
- /**
- * Implementation for method overloads of 'headMap'
- */
- headMap(__param0, __param1) {
- if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
- let toKey = __param0;
- let inclusive = __param1;
- return this._createMap(this._iv.from, this._iv.fromInc, toKey, inclusive, this._asc);
- }
- else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
- let toKey = __param0;
- return this._createMap(this._iv.from, this._iv.fromInc, toKey, false, this._asc);
- }
- else
- throw new Error('invalid method overload');
- }
- /**
- * Implementation for method overloads of 'tailMap'
- */
- tailMap(__param0, __param1) {
- if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
- let fromKey = __param0;
- let inclusive = __param1;
- return this._createMap(fromKey, inclusive, this._iv.to, this._iv.toInc, this._asc);
- }
- else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
- let fromKey = __param0;
- return this._createMap(fromKey, true, this._iv.to, this._iv.toInc, this._asc);
- }
- else
- throw new Error('invalid method overload');
- }
- bcAddKey(e) {
- return this._par.bcAddKey(e, this._iv);
- }
- bcAddAllEntries(c) {
- return this._par.bcAddAllEntries(c, this._iv);
- }
- bcAddEntryReturnBool(e) {
- return this._par.bcAddEntryReturnBool(e, this._iv);
- }
- bcContainsAllKeys(c) {
- return this._par.bcContainsAllKeys(c, this._iv);
- }
- bcContainsAllEntries(c) {
- return this._par.bcContainsAllEntries(c, this._iv);
- }
- bcContainsEntry(o) {
- return this._par.bcContainsEntry(o, this._iv);
- }
- bcRemoveKeyReturnBool(o) {
- return this._par.bcRemoveKeyReturnBool(o, this._iv);
- }
- bcRemoveEntry(o) {
- return this._par.bcRemoveEntry(o, this._iv);
- }
- bcRemoveAllKeys(c) {
- return this._par.bcRemoveAllKeys(c, this._iv);
- }
- bcRemoveAllEntries(c) {
- return this._par.bcRemoveAllEntries(c, this._iv);
- }
- bcRetainAllKeys(c) {
- let mapRetain = new AVLMap_1.AVLMap();
- for (let obj of c) {
- let key = obj;
- mapRetain.put(key, key);
- }
- let changed = false;
- let iterOfKeys = this.bcGetSubKeySetIterator();
- while (iterOfKeys.hasNext()) {
- let key = iterOfKeys.next();
- if (mapRetain.containsKey(key) === false) {
- iterOfKeys.remove();
- changed = true;
- }
- }
- return changed;
- }
- bcRetainAllEntries(c) {
- let mapSave = new AVLMap_1.AVLMap();
- let setSave = mapSave.entrySet();
- for (let o of c)
- if (this.bcContainsEntry(o))
- setSave.add((0, JavaMapEntry_1.cast_java_util_Map_Entry)(o));
- let changed = false;
- let iterOfEntries = this.bcGetSubEntrySetIterator();
- while (iterOfEntries.hasNext())
- if (setSave.contains(iterOfEntries.next()) === false) {
- iterOfEntries.remove();
- changed = true;
- }
- return changed;
- }
- firstEntryAsNode() {
- return this._asc ? this._par.bcGetFirstEntryOrNull(this._iv) : this._par.bcGetLastEntryOrNull(this._iv);
- }
- nextEntryOrNull(node) {
- return this._asc ? this._par.bcGetNextEntryOrNull(node, this._iv) : this._par.bcGetPrevEntryOrNull(node, this._iv);
- }
- bcAddAllKeys(c) {
- return this._par.bcAddAllKeys(c, this._iv);
- }
- bcGetLowerKeyOrNull(e) {
- return this._asc ? this._par.bcGetLowerKeyOrNull(e, this._iv) : this._par.bcGetHigherKeyOrNull(e, this._iv);
- }
- bcGetFloorKeyOrNull(e) {
- return this._asc ? this._par.bcGetFloorKeyOrNull(e, this._iv) : this._par.bcGetCeilingKeyOrNull(e, this._iv);
- }
- bcGetCeilingKeyOrNull(e) {
- return this._asc ? this._par.bcGetCeilingKeyOrNull(e, this._iv) : this._par.bcGetFloorKeyOrNull(e, this._iv);
- }
- bcGetHigherKeyOrNull(e) {
- return this._asc ? this._par.bcGetHigherKeyOrNull(e, this._iv) : this._par.bcGetLowerKeyOrNull(e, this._iv);
- }
- bcPollFirstKeyOrNull() {
- return this._asc ? this._par.bcPollFirstKeyOrNull(this._iv) : this._par.bcPollLastKeyOrNull(this._iv);
- }
- bcPollLastKeyOrNull() {
- return this._asc ? this._par.bcPollLastKeyOrNull(this._iv) : this._par.bcPollFirstKeyOrNull(this._iv);
- }
- bcGetArrayListOfKeys() {
- let v = new Vector_1.Vector();
- let iter = this.navigableKeySet().iterator();
- while (iter.hasNext())
- v.add(iter.next());
- return v;
- }
- bcGetArrayListOfValues() {
- let v = new Vector_1.Vector();
- let iter = this.values().iterator();
- while (iter.hasNext())
- v.add(iter.next());
- return v;
- }
- bcGetArrayListOfEntries() {
- let v = new Vector_1.Vector();
- let iter = this.entrySet().iterator();
- while (iter.hasNext())
- v.add(iter.next());
- return v;
- }
- bcGetSubKeySetIterator() {
- return new AVLMapSubKeySetIterator_1.AVLMapSubKeySetIterator(this);
- }
- bcGetSubKeySetDescending() {
- return new AVLMapSubKeySet_1.AVLMapSubKeySet(new AVLMapSubMap(this._par, this._iv, !this._asc));
- }
- bcGetSubKeySetDescendingIterator() {
- return new AVLMapSubKeySetIterator_1.AVLMapSubKeySetIterator(new AVLMapSubMap(this._par, this._iv, !this._asc));
- }
- /**
- * Implementation for method overloads of 'bcGetSubKeySet'
- */
- bcGetSubKeySet(__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._createSet(fromElement, fromInclusive, toElement, toInclusive, this._asc);
- }
- 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._createSet(fromElement, true, toElement, false, this._asc);
- }
- else
- throw new Error('invalid method overload');
- }
- /**
- * Implementation for method overloads of 'bcGetSubKeyHeadSet'
- */
- bcGetSubKeyHeadSet(__param0, __param1) {
- if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
- let toElement = __param0;
- let inclusive = __param1;
- return this._createSet(this._iv.from, this._iv.fromInc, toElement, inclusive, this._asc);
- }
- else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
- let toElement = __param0;
- return this._createSet(this._iv.from, this._iv.fromInc, toElement, false, this._asc);
- }
- else
- throw new Error('invalid method overload');
- }
- /**
- * Implementation for method overloads of 'bcGetSubKeyTailSet'
- */
- bcGetSubKeyTailSet(__param0, __param1) {
- if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
- let fromElement = __param0;
- let inclusive = __param1;
- return this._createSet(fromElement, inclusive, this._iv.to, this._iv.toInc, this._asc);
- }
- else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
- let fromElement = __param0;
- return this._createSet(fromElement, true, this._iv.to, this._iv.toInc, this._asc);
- }
- else
- throw new Error('invalid method overload');
- }
- bcGetSubCollectionIterator() {
- return new AVLMapSubCollectionIterator_1.AVLMapSubCollectionIterator(this);
- }
- bcContainsAllValues(c) {
- return this._par.bcContainsAllValues(c, this._iv);
- }
- bcGetSubEntrySetIterator() {
- return new AVLMapSubEntrySetIterator_1.AVLMapSubEntrySetIterator(this);
- }
- _createMap(from, fromInc, to, toInc, asc) {
- if (this._par.bcCheckOutOfIntervall(from, fromInc, this._iv))
- throw new IllegalArgumentException_1.IllegalArgumentException("FROM-KEY " + from + "/" + fromInc + " nicht in " + this._iv);
- if (this._par.bcCheckOutOfIntervall(to, toInc, this._iv))
- throw new IllegalArgumentException_1.IllegalArgumentException("TO-KEY " + to + "/" + toInc + " nicht in " + this._iv);
- return new AVLMapSubMap(this._par, new AVLMapIntervall_1.AVLMapIntervall(from, fromInc, to, toInc), asc);
- }
- _createSet(from, fromInc, to, toInc, asc) {
- return new AVLMapSubKeySet_1.AVLMapSubKeySet(this._createMap(from, fromInc, to, toInc, asc));
- }
- isTranspiledInstanceOf(name) {
- return ['java.util.Map', 'java.util.NavigableMap', 'de.nrw.schule.svws.core.adt.map.AVLMapSubMap', 'java.util.SortedMap'].includes(name);
- }
- }
- exports.AVLMapSubMap = AVLMapSubMap;
- function cast_de_nrw_schule_svws_core_adt_map_AVLMapSubMap(obj) {
- return obj;
- }
- exports.cast_de_nrw_schule_svws_core_adt_map_AVLMapSubMap = cast_de_nrw_schule_svws_core_adt_map_AVLMapSubMap;
- //# sourceMappingURL=AVLMapSubMap.js.map
|