AVLMapSubMap.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. import { JavaMapEntry, cast_java_util_Map_Entry } from '../../../java/util/JavaMapEntry';
  2. import { NavigableSet, cast_java_util_NavigableSet } from '../../../java/util/NavigableSet';
  3. import { JavaSet, cast_java_util_Set } from '../../../java/util/JavaSet';
  4. import { NavigableMap, cast_java_util_NavigableMap } from '../../../java/util/NavigableMap';
  5. import { AVLMapSubCollection, cast_de_nrw_schule_svws_core_adt_map_AVLMapSubCollection } from '../../../core/adt/map/AVLMapSubCollection';
  6. import { AVLMapIntervall, cast_de_nrw_schule_svws_core_adt_map_AVLMapIntervall } from '../../../core/adt/map/AVLMapIntervall';
  7. import { AVLMapSubEntrySetIterator, cast_de_nrw_schule_svws_core_adt_map_AVLMapSubEntrySetIterator } from '../../../core/adt/map/AVLMapSubEntrySetIterator';
  8. import { AVLMapSubKeySet, cast_de_nrw_schule_svws_core_adt_map_AVLMapSubKeySet } from '../../../core/adt/map/AVLMapSubKeySet';
  9. import { JavaString, cast_java_lang_String } from '../../../java/lang/JavaString';
  10. import { SortedSet, cast_java_util_SortedSet } from '../../../java/util/SortedSet';
  11. import { AVLMap, cast_de_nrw_schule_svws_core_adt_map_AVLMap } from '../../../core/adt/map/AVLMap';
  12. import { Comparator, cast_java_util_Comparator } from '../../../java/util/Comparator';
  13. import { AVLMapNode, cast_de_nrw_schule_svws_core_adt_map_AVLMapNode } from '../../../core/adt/map/AVLMapNode';
  14. import { SortedMap, cast_java_util_SortedMap } from '../../../java/util/SortedMap';
  15. import { JavaIterator, cast_java_util_Iterator } from '../../../java/util/JavaIterator';
  16. import { AVLMapSubKeySetIterator, cast_de_nrw_schule_svws_core_adt_map_AVLMapSubKeySetIterator } from '../../../core/adt/map/AVLMapSubKeySetIterator';
  17. import { Collection, cast_java_util_Collection } from '../../../java/util/Collection';
  18. import { JavaObject, cast_java_lang_Object } from '../../../java/lang/JavaObject';
  19. import { AVLMapSubEntrySet, cast_de_nrw_schule_svws_core_adt_map_AVLMapSubEntrySet } from '../../../core/adt/map/AVLMapSubEntrySet';
  20. import { JavaMap, cast_java_util_Map } from '../../../java/util/JavaMap';
  21. import { Vector, cast_java_util_Vector } from '../../../java/util/Vector';
  22. import { AVLMapSubCollectionIterator, cast_de_nrw_schule_svws_core_adt_map_AVLMapSubCollectionIterator } from '../../../core/adt/map/AVLMapSubCollectionIterator';
  23. import { IllegalArgumentException, cast_java_lang_IllegalArgumentException } from '../../../java/lang/IllegalArgumentException';
  24. export class AVLMapSubMap<K, V> extends JavaObject implements NavigableMap<K, V> {
  25. private readonly _par : AVLMap<K, V>;
  26. private readonly _iv : AVLMapIntervall<K>;
  27. private _asc : boolean = false;
  28. /**
  29. * Erstellt eine neue Sub-Map relativ zur übergebenen {@link AVLMap}.
  30. *
  31. * @param parent Die {@link AVLMap} auf der diese Sup-Map operiert.
  32. * @param intervall Das {@link AVLMapIntervall} auf das sich diese Sub-Map bezieht.
  33. */
  34. constructor(parent : AVLMap<K, V>, intervall : AVLMapIntervall<K>, asc : boolean) {
  35. super();
  36. this._par = parent;
  37. this._iv = intervall;
  38. this._asc = asc;
  39. }
  40. public toString() : String {
  41. let s : String | null = "";
  42. for (let e of this.entrySet())
  43. s += (s.length === 0 ? "" : ", ") + e;
  44. return "Entries = [" + s.valueOf() + "], iv = " + this._iv + ", asc = " + this._asc;
  45. }
  46. public equals(o : unknown) : boolean {
  47. if (o as unknown === this as unknown)
  48. return true;
  49. if (((o instanceof JavaObject) && (o.isTranspiledInstanceOf('java.util.Map'))) === false)
  50. return false;
  51. let mapO : JavaMap<unknown, unknown> | null = cast_java_util_Map(o);
  52. if (mapO.size() !== this.size())
  53. return false;
  54. for (let e of this.entrySet())
  55. if (JavaObject.equalsTranspiler(e.getValue(), (mapO.get(e.getKey()))) === false)
  56. return false;
  57. return true;
  58. }
  59. public hashCode() : number {
  60. let h : number = 0;
  61. for (let entry of this.entrySet())
  62. h += JavaObject.getTranspilerHashCode(entry);
  63. return h;
  64. }
  65. public comparator() : Comparator<K> {
  66. return this._par.bcGetComparator(this._iv);
  67. }
  68. public firstKey() : K {
  69. return this._asc ? this._par.bcGetFirstKeyOrException(this._iv) : this._par.bcGetLastKeyOrException(this._iv);
  70. }
  71. public lastKey() : K {
  72. return this._asc ? this._par.bcGetLastKeyOrException(this._iv) : this._par.bcGetFirstKeyOrException(this._iv);
  73. }
  74. public keySet() : JavaSet<K> {
  75. return new AVLMapSubKeySet<K, V>(this);
  76. }
  77. public values() : Collection<V> {
  78. return new AVLMapSubCollection(this);
  79. }
  80. public entrySet() : JavaSet<JavaMapEntry<K, V>> {
  81. return new AVLMapSubEntrySet(this);
  82. }
  83. public size() : number {
  84. return this._par.bcGetSize(this._iv);
  85. }
  86. public isEmpty() : boolean {
  87. return this._par.bcIsEmpty(this._iv);
  88. }
  89. public containsKey(key : unknown) : boolean {
  90. return this._par.bcContainsKey(key, this._iv);
  91. }
  92. public containsValue(value : unknown) : boolean {
  93. return this._par.bcContainsValue(value, this._iv);
  94. }
  95. public get(key : unknown) : V | null {
  96. return this._par.bcGetValueOfKeyOrNull(key, this._iv);
  97. }
  98. public put(key : K, value : V) : V | null {
  99. return this._par.bcAddEntryReturnOldValueOrNull(key, value, this._iv);
  100. }
  101. public remove(key : unknown) : V | null {
  102. return this._par.bcRemoveKeyReturnOldValueOrNull(key, this._iv);
  103. }
  104. public putAll(map : JavaMap<K, V>) : void {
  105. this._par.bcAddAllEntriesOfMap(map, this._iv);
  106. }
  107. public clear() : void {
  108. let iter : JavaIterator<JavaMapEntry<K | null, V | null> | null> | null = this.bcGetSubEntrySetIterator();
  109. while (iter.hasNext()) {
  110. iter.next();
  111. iter.remove();
  112. }
  113. }
  114. public lowerEntry(key : K) : JavaMapEntry<K, V> | null {
  115. return this._asc ? this._par.bcGetLowerEntryOrNull(key, this._iv) : this._par.bcGetHigherEntryOrNull(key, this._iv);
  116. }
  117. public lowerKey(key : K) : K | null {
  118. return this._asc ? this._par.bcGetLowerKeyOrNull(key, this._iv) : this._par.bcGetHigherKeyOrNull(key, this._iv);
  119. }
  120. public floorEntry(key : K) : JavaMapEntry<K, V> | null {
  121. return this._asc ? this._par.bcGetFloorEntryOrNull(key, this._iv) : this._par.bcGetCeilingEntryOrNull(key, this._iv);
  122. }
  123. public floorKey(key : K) : K | null {
  124. return this._asc ? this._par.bcGetFloorKeyOrNull(key, this._iv) : this._par.bcGetCeilingKeyOrNull(key, this._iv);
  125. }
  126. public ceilingEntry(key : K) : JavaMapEntry<K, V> | null {
  127. return this._asc ? this._par.bcGetCeilingEntryOrNull(key, this._iv) : this._par.bcGetFloorEntryOrNull(key, this._iv);
  128. }
  129. public ceilingKey(key : K) : K | null {
  130. return this._asc ? this._par.bcGetCeilingKeyOrNull(key, this._iv) : this._par.bcGetFloorKeyOrNull(key, this._iv);
  131. }
  132. public higherEntry(key : K) : JavaMapEntry<K, V> | null {
  133. return this._asc ? this._par.bcGetHigherEntryOrNull(key, this._iv) : this._par.bcGetLowerEntryOrNull(key, this._iv);
  134. }
  135. public higherKey(key : K) : K | null {
  136. return this._asc ? this._par.bcGetHigherKeyOrNull(key, this._iv) : this._par.bcGetLowerKeyOrNull(key, this._iv);
  137. }
  138. public firstEntry() : JavaMapEntry<K, V> | null {
  139. return this._asc ? this._par.bcGetFirstEntryOrNull(this._iv) : this._par.bcGetLastEntryOrNull(this._iv);
  140. }
  141. public lastEntry() : JavaMapEntry<K, V> | null {
  142. return this._asc ? this._par.bcGetLastEntryOrNull(this._iv) : this._par.bcGetFirstEntryOrNull(this._iv);
  143. }
  144. public pollFirstEntry() : JavaMapEntry<K, V> | null {
  145. return this._asc ? this._par.bcPollFirstEntryOrNull(this._iv) : this._par.bcPollLastEntryOrNull(this._iv);
  146. }
  147. public pollLastEntry() : JavaMapEntry<K, V> | null {
  148. return this._asc ? this._par.bcPollLastEntryOrNull(this._iv) : this._par.bcPollFirstEntryOrNull(this._iv);
  149. }
  150. public descendingMap() : NavigableMap<K, V> {
  151. return new AVLMapSubMap<K, V>(this._par, this._iv, !this._asc);
  152. }
  153. public navigableKeySet() : NavigableSet<K> {
  154. return new AVLMapSubKeySet(this);
  155. }
  156. public descendingKeySet() : NavigableSet<K> {
  157. return new AVLMapSubKeySet(new AVLMapSubMap<K, V>(this._par, this._iv, !this._asc));
  158. }
  159. public subMap(fromKey : K, fromInclusive : boolean, toKey : K, toInclusive : boolean) : NavigableMap<K, V>;
  160. public subMap(fromKey : K, toKey : K) : SortedMap<K, V>;
  161. /**
  162. * Implementation for method overloads of 'subMap'
  163. */
  164. public subMap(__param0 : K, __param1 : K | boolean, __param2? : K, __param3? : boolean) : NavigableMap<K, V> | SortedMap<K, V> {
  165. 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")) {
  166. let fromKey : K = __param0 as unknown as K;
  167. let fromInclusive : boolean = __param1 as boolean;
  168. let toKey : K = __param2 as unknown as K;
  169. let toInclusive : boolean = __param3 as boolean;
  170. return this._createMap(fromKey, fromInclusive, toKey, toInclusive, this._asc);
  171. } else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && (typeof __param1 !== "undefined")) && (typeof __param2 === "undefined") && (typeof __param3 === "undefined")) {
  172. let fromKey : K = __param0 as unknown as K;
  173. let toKey : K = __param1 as unknown as K;
  174. return this._createMap(fromKey, true, toKey, false, this._asc);
  175. } else throw new Error('invalid method overload');
  176. }
  177. public headMap(toKey : K, inclusive : boolean) : NavigableMap<K, V>;
  178. public headMap(toKey : K) : SortedMap<K, V>;
  179. /**
  180. * Implementation for method overloads of 'headMap'
  181. */
  182. public headMap(__param0 : K, __param1? : boolean) : NavigableMap<K, V> | SortedMap<K, V> {
  183. if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
  184. let toKey : K = __param0 as unknown as K;
  185. let inclusive : boolean = __param1 as boolean;
  186. return this._createMap(this._iv.from, this._iv.fromInc, toKey, inclusive, this._asc);
  187. } else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
  188. let toKey : K = __param0 as unknown as K;
  189. return this._createMap(this._iv.from, this._iv.fromInc, toKey, false, this._asc);
  190. } else throw new Error('invalid method overload');
  191. }
  192. public tailMap(fromKey : K, inclusive : boolean) : NavigableMap<K, V>;
  193. public tailMap(fromKey : K) : SortedMap<K, V>;
  194. /**
  195. * Implementation for method overloads of 'tailMap'
  196. */
  197. public tailMap(__param0 : K, __param1? : boolean) : NavigableMap<K, V> | SortedMap<K, V> {
  198. if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
  199. let fromKey : K = __param0 as unknown as K;
  200. let inclusive : boolean = __param1 as boolean;
  201. return this._createMap(fromKey, inclusive, this._iv.to, this._iv.toInc, this._asc);
  202. } else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
  203. let fromKey : K = __param0 as unknown as K;
  204. return this._createMap(fromKey, true, this._iv.to, this._iv.toInc, this._asc);
  205. } else throw new Error('invalid method overload');
  206. }
  207. bcAddKey(e : K) : boolean {
  208. return this._par.bcAddKey(e, this._iv);
  209. }
  210. bcAddAllEntries(c : Collection<JavaMapEntry<K, V>>) : boolean {
  211. return this._par.bcAddAllEntries(c, this._iv);
  212. }
  213. bcAddEntryReturnBool(e : JavaMapEntry<K, V>) : boolean {
  214. return this._par.bcAddEntryReturnBool(e, this._iv);
  215. }
  216. bcContainsAllKeys(c : Collection<unknown>) : boolean {
  217. return this._par.bcContainsAllKeys(c, this._iv);
  218. }
  219. bcContainsAllEntries(c : Collection<unknown>) : boolean {
  220. return this._par.bcContainsAllEntries(c, this._iv);
  221. }
  222. bcContainsEntry(o : unknown) : boolean {
  223. return this._par.bcContainsEntry(o, this._iv);
  224. }
  225. bcRemoveKeyReturnBool(o : unknown) : boolean {
  226. return this._par.bcRemoveKeyReturnBool(o, this._iv);
  227. }
  228. bcRemoveEntry(o : unknown) : boolean {
  229. return this._par.bcRemoveEntry(o, this._iv);
  230. }
  231. bcRemoveAllKeys(c : Collection<unknown>) : boolean {
  232. return this._par.bcRemoveAllKeys(c, this._iv);
  233. }
  234. bcRemoveAllEntries(c : Collection<unknown>) : boolean {
  235. return this._par.bcRemoveAllEntries(c, this._iv);
  236. }
  237. bcRetainAllKeys(c : Collection<unknown>) : boolean {
  238. let mapRetain : AVLMap<K, K> = new AVLMap();
  239. for (let obj of c) {
  240. let key : K = obj as unknown as K;
  241. mapRetain.put(key, key);
  242. }
  243. let changed : boolean = false;
  244. let iterOfKeys : JavaIterator<K | null> | null = this.bcGetSubKeySetIterator();
  245. while (iterOfKeys.hasNext()) {
  246. let key : K | null = iterOfKeys.next();
  247. if (mapRetain.containsKey(key) === false) {
  248. iterOfKeys.remove();
  249. changed = true;
  250. }
  251. }
  252. return changed;
  253. }
  254. bcRetainAllEntries(c : Collection<unknown>) : boolean {
  255. let mapSave : AVLMap<K, V> = new AVLMap();
  256. let setSave : JavaSet<JavaMapEntry<K, V>> = mapSave.entrySet();
  257. for (let o of c)
  258. if (this.bcContainsEntry(o))
  259. setSave.add(cast_java_util_Map_Entry(o));
  260. let changed : boolean = false;
  261. let iterOfEntries : JavaIterator<JavaMapEntry<K | null, V | null> | null> | null = this.bcGetSubEntrySetIterator();
  262. while (iterOfEntries.hasNext())
  263. if (setSave.contains(iterOfEntries.next()) === false) {
  264. iterOfEntries.remove();
  265. changed = true;
  266. }
  267. return changed;
  268. }
  269. firstEntryAsNode() : AVLMapNode<K, V> | null {
  270. return this._asc ? this._par.bcGetFirstEntryOrNull(this._iv) : this._par.bcGetLastEntryOrNull(this._iv);
  271. }
  272. nextEntryOrNull(node : AVLMapNode<K, V>) : AVLMapNode<K, V> | null {
  273. return this._asc ? this._par.bcGetNextEntryOrNull(node, this._iv) : this._par.bcGetPrevEntryOrNull(node, this._iv);
  274. }
  275. bcAddAllKeys(c : Collection<K>) : boolean {
  276. return this._par.bcAddAllKeys(c, this._iv);
  277. }
  278. bcGetLowerKeyOrNull(e : K) : K | null {
  279. return this._asc ? this._par.bcGetLowerKeyOrNull(e, this._iv) : this._par.bcGetHigherKeyOrNull(e, this._iv);
  280. }
  281. bcGetFloorKeyOrNull(e : K) : K | null {
  282. return this._asc ? this._par.bcGetFloorKeyOrNull(e, this._iv) : this._par.bcGetCeilingKeyOrNull(e, this._iv);
  283. }
  284. bcGetCeilingKeyOrNull(e : K) : K | null {
  285. return this._asc ? this._par.bcGetCeilingKeyOrNull(e, this._iv) : this._par.bcGetFloorKeyOrNull(e, this._iv);
  286. }
  287. bcGetHigherKeyOrNull(e : K) : K | null {
  288. return this._asc ? this._par.bcGetHigherKeyOrNull(e, this._iv) : this._par.bcGetLowerKeyOrNull(e, this._iv);
  289. }
  290. bcPollFirstKeyOrNull() : K | null {
  291. return this._asc ? this._par.bcPollFirstKeyOrNull(this._iv) : this._par.bcPollLastKeyOrNull(this._iv);
  292. }
  293. bcPollLastKeyOrNull() : K | null {
  294. return this._asc ? this._par.bcPollLastKeyOrNull(this._iv) : this._par.bcPollFirstKeyOrNull(this._iv);
  295. }
  296. bcGetArrayListOfKeys() : Vector<K | null> {
  297. let v : Vector<K | null> | null = new Vector();
  298. let iter : JavaIterator<K | null> | null = this.navigableKeySet().iterator();
  299. while (iter.hasNext())
  300. v.add(iter.next());
  301. return v;
  302. }
  303. bcGetArrayListOfValues() : Vector<V | null> {
  304. let v : Vector<V | null> | null = new Vector();
  305. let iter : JavaIterator<V | null> | null = this.values().iterator();
  306. while (iter.hasNext())
  307. v.add(iter.next());
  308. return v;
  309. }
  310. bcGetArrayListOfEntries() : Vector<JavaMapEntry<K | null, V | null> | null> {
  311. let v : Vector<JavaMapEntry<K | null, V | null> | null> | null = new Vector();
  312. let iter : JavaIterator<JavaMapEntry<K | null, V | null> | null> | null = this.entrySet().iterator();
  313. while (iter.hasNext())
  314. v.add(iter.next());
  315. return v;
  316. }
  317. bcGetSubKeySetIterator() : JavaIterator<K> {
  318. return new AVLMapSubKeySetIterator(this);
  319. }
  320. bcGetSubKeySetDescending() : NavigableSet<K> {
  321. return new AVLMapSubKeySet(new AVLMapSubMap(this._par, this._iv, !this._asc));
  322. }
  323. bcGetSubKeySetDescendingIterator() : JavaIterator<K> {
  324. return new AVLMapSubKeySetIterator(new AVLMapSubMap(this._par, this._iv, !this._asc));
  325. }
  326. public bcGetSubKeySet(fromElement : K, fromInclusive : boolean, toElement : K, toInclusive : boolean) : NavigableSet<K>;
  327. public bcGetSubKeySet(fromElement : K, toElement : K) : SortedSet<K>;
  328. /**
  329. * Implementation for method overloads of 'bcGetSubKeySet'
  330. */
  331. public bcGetSubKeySet(__param0 : K, __param1 : K | boolean, __param2? : K, __param3? : boolean) : NavigableSet<K> | SortedSet<K> {
  332. 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")) {
  333. let fromElement : K = __param0 as unknown as K;
  334. let fromInclusive : boolean = __param1 as boolean;
  335. let toElement : K = __param2 as unknown as K;
  336. let toInclusive : boolean = __param3 as boolean;
  337. return this._createSet(fromElement, fromInclusive, toElement, toInclusive, this._asc);
  338. } else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && (typeof __param1 !== "undefined")) && (typeof __param2 === "undefined") && (typeof __param3 === "undefined")) {
  339. let fromElement : K = __param0 as unknown as K;
  340. let toElement : K = __param1 as unknown as K;
  341. return this._createSet(fromElement, true, toElement, false, this._asc);
  342. } else throw new Error('invalid method overload');
  343. }
  344. public bcGetSubKeyHeadSet(toElement : K, inclusive : boolean) : NavigableSet<K>;
  345. public bcGetSubKeyHeadSet(toElement : K) : SortedSet<K>;
  346. /**
  347. * Implementation for method overloads of 'bcGetSubKeyHeadSet'
  348. */
  349. public bcGetSubKeyHeadSet(__param0 : K, __param1? : boolean) : NavigableSet<K> | SortedSet<K> {
  350. if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
  351. let toElement : K = __param0 as unknown as K;
  352. let inclusive : boolean = __param1 as boolean;
  353. return this._createSet(this._iv.from, this._iv.fromInc, toElement, inclusive, this._asc);
  354. } else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
  355. let toElement : K = __param0 as unknown as K;
  356. return this._createSet(this._iv.from, this._iv.fromInc, toElement, false, this._asc);
  357. } else throw new Error('invalid method overload');
  358. }
  359. public bcGetSubKeyTailSet(fromElement : K, inclusive : boolean) : NavigableSet<K>;
  360. public bcGetSubKeyTailSet(fromElement : K) : SortedSet<K>;
  361. /**
  362. * Implementation for method overloads of 'bcGetSubKeyTailSet'
  363. */
  364. public bcGetSubKeyTailSet(__param0 : K, __param1? : boolean) : NavigableSet<K> | SortedSet<K> {
  365. if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && ((typeof __param1 !== "undefined") && typeof __param1 === "boolean")) {
  366. let fromElement : K = __param0 as unknown as K;
  367. let inclusive : boolean = __param1 as boolean;
  368. return this._createSet(fromElement, inclusive, this._iv.to, this._iv.toInc, this._asc);
  369. } else if (((typeof __param0 !== "undefined") && (typeof __param0 !== "undefined")) && (typeof __param1 === "undefined")) {
  370. let fromElement : K = __param0 as unknown as K;
  371. return this._createSet(fromElement, true, this._iv.to, this._iv.toInc, this._asc);
  372. } else throw new Error('invalid method overload');
  373. }
  374. bcGetSubCollectionIterator() : JavaIterator<V> {
  375. return new AVLMapSubCollectionIterator(this);
  376. }
  377. bcContainsAllValues(c : Collection<unknown>) : boolean {
  378. return this._par.bcContainsAllValues(c, this._iv);
  379. }
  380. bcGetSubEntrySetIterator() : JavaIterator<JavaMapEntry<K, V>> {
  381. return new AVLMapSubEntrySetIterator(this);
  382. }
  383. private _createMap(from : K, fromInc : boolean, to : K, toInc : boolean, asc : boolean) : AVLMapSubMap<K, V> {
  384. if (this._par.bcCheckOutOfIntervall(from, fromInc, this._iv))
  385. throw new IllegalArgumentException("FROM-KEY " + from + "/" + fromInc + " nicht in " + this._iv)
  386. if (this._par.bcCheckOutOfIntervall(to, toInc, this._iv))
  387. throw new IllegalArgumentException("TO-KEY " + to + "/" + toInc + " nicht in " + this._iv)
  388. return new AVLMapSubMap<K, V>(this._par, new AVLMapIntervall<K>(from, fromInc, to, toInc), asc);
  389. }
  390. private _createSet(from : K, fromInc : boolean, to : K, toInc : boolean, asc : boolean) : AVLMapSubKeySet<K, V> {
  391. return new AVLMapSubKeySet<K, V>(this._createMap(from, fromInc, to, toInc, asc));
  392. }
  393. isTranspiledInstanceOf(name : string): boolean {
  394. return ['java.util.Map', 'java.util.NavigableMap', 'de.nrw.schule.svws.core.adt.map.AVLMapSubMap', 'java.util.SortedMap'].includes(name);
  395. }
  396. }
  397. export function cast_de_nrw_schule_svws_core_adt_map_AVLMapSubMap<K, V>(obj : unknown) : AVLMapSubMap<K, V> {
  398. return obj as AVLMapSubMap<K, V>;
  399. }