UNPKG

@cute-dw/core

Version:

This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need

1 lines 1.06 MB
{"version":3,"file":"cute-dw-core.mjs","sources":["../../../projects/cute-core/src/lib/cute-core.module.ts","../../../projects/cute-core/src/lib/util/exception/RunTimeException.ts","../../../projects/cute-core/src/lib/util/exception/IllegalArgumentException.ts","../../../projects/cute-core/src/lib/collections/AbstractCollection.ts","../../../projects/cute-core/src/lib/collections/AbstractList.ts","../../../projects/cute-core/src/lib/collections/AbstractMap.ts","../../../projects/cute-core/src/lib/collections/AbstractQueue.ts","../../../projects/cute-core/src/lib/collections/AbstractSet.ts","../../../projects/cute-core/src/lib/util/exception/UnsupportedOperationException.ts","../../../projects/cute-core/src/lib/util/exception/IndexOutOfBoundsException.ts","../../../projects/cute-core/src/lib/util/exception/ConcurrentModificationException.ts","../../../projects/cute-core/src/lib/collections/view/ListView.ts","../../../projects/cute-core/src/lib/util/exception/NullPointerException.ts","../../../projects/cute-core/src/lib/util/Strings.ts","../../../projects/cute-core/src/lib/util/Objects.ts","../../../projects/cute-core/src/lib/collections/ArrayList.ts","../../../projects/cute-core/src/lib/collections/HashMap.ts","../../../projects/cute-core/src/lib/collections/HashSet.ts","../../../projects/cute-core/src/lib/util/exception/IllegalStateException.ts","../../../projects/cute-core/src/lib/util/Ciphers.ts","../../../projects/cute-core/src/lib/collections/HashTable.ts","../../../projects/cute-core/src/lib/util/Comparator.ts","../../../projects/cute-core/src/lib/collections/LinkedList.ts","../../../projects/cute-core/src/lib/collections/heap/Heap.ts","../../../projects/cute-core/src/lib/collections/heap/MinHeap.ts","../../../projects/cute-core/src/lib/collections/PriorityQueue.ts","../../../projects/cute-core/src/lib/collections/Properties.ts","../../../projects/cute-core/src/lib/collections/Vector.ts","../../../projects/cute-core/src/lib/collections/Stack.ts","../../../projects/cute-core/src/lib/collections/tree/BinaryTreeNode.ts","../../../projects/cute-core/src/lib/collections/tree/BinarySearchTree.ts","../../../projects/cute-core/src/lib/collections/tree/AvlTree.ts","../../../projects/cute-core/src/lib/collections/TreeMap.ts","../../../projects/cute-core/src/lib/collections/TreeSet.ts","../../../projects/cute-core/src/lib/services/http.service.ts","../../../projects/cute-core/src/lib/util/i18n/text/Format.ts","../../../projects/cute-core/src/lib/util/i18n/text/DateFormat.ts","../../../projects/cute-core/src/lib/util/Arrays.ts","../../../projects/cute-core/src/lib/util/i18n/Locale.ts","../../../projects/cute-core/src/lib/util/Dates.ts","../../../projects/cute-core/src/lib/util/type/Time.ts","../../../projects/cute-core/src/lib/util/i18n/text/SimpleDateFormat.ts","../../../projects/cute-core/src/lib/services/log.service.ts","../../../projects/cute-core/src/lib/controllers/AbstractController.ts","../../../projects/cute-core/src/lib/controllers/DwController.ts","../../../projects/cute-core/src/lib/util/Collections.ts","../../../projects/cute-core/src/lib/util/type/NumericTypedArray.ts","../../../projects/cute-core/src/lib/util/type/Byte.ts","../../../projects/cute-core/src/lib/util/type/DateISO.ts","../../../projects/cute-core/src/lib/util/type/DateTime.ts","../../../projects/cute-core/src/lib/util/type/Decimal.ts","../../../projects/cute-core/src/lib/util/type/Double.ts","../../../projects/cute-core/src/lib/util/type/Float.ts","../../../projects/cute-core/src/lib/util/type/Integer.ts","../../../projects/cute-core/src/lib/util/type/Long.ts","../../../projects/cute-core/src/lib/util/type/UByte.ts","../../../projects/cute-core/src/lib/util/type/UInt.ts","../../../projects/cute-core/src/lib/util/type/ULong.ts","../../../projects/cute-core/src/lib/util/XmlDocs.ts","../../../projects/cute-core/src/lib/util/Types.ts","../../../projects/cute-core/src/lib/util/Helpers.ts","../../../projects/cute-core/src/lib/util/Numbers.ts","../../../projects/cute-core/src/lib/util/i18n/text/NumberSpellerDictionary.ts","../../../projects/cute-core/src/lib/util/i18n/text/NumberSpeller.ts","../../../projects/cute-core/src/lib/util/i18n/text/NumberFormat.ts","../../../projects/cute-core/src/lib/util/i18n/text/DecimalFormat.ts","../../../projects/cute-core/src/lib/util/i18n/text/StringFormat.ts","../../../projects/cute-core/src/lib/util/type/Interval.ts","../../../projects/cute-core/src/lib/util/enum/ResultCode.ts","../../../projects/cute-core/src/lib/util/evaluator/t.ts","../../../projects/cute-core/src/lib/util/evaluator/Functions.ts","../../../projects/cute-core/src/lib/util/evaluator/CodeBlock.ts","../../../projects/cute-core/src/lib/util/exception/ClassCastException.ts","../../../projects/cute-core/src/lib/util/exception/IllegalJsonException.ts","../../../projects/cute-core/src/lib/util/exception/NoSuchElementException.ts","../../../projects/cute-core/src/lib/util/exception/ParseException.ts","../../../projects/cute-core/src/lib/util/net/JsonRpc.ts","../../../projects/cute-core/src/lib/util/rxjs/EventProducer.ts","../../../projects/cute-core/src/lib/util/rxjs/operators.ts","../../../projects/cute-core/src/lib/datastore/DataStoreOptions.ts","../../../projects/cute-core/src/lib/datastore/DSCodeBlock.ts","../../../projects/cute-core/src/lib/datastore/events.ts","../../../projects/cute-core/src/lib/datastore/DataStoreService.ts","../../../projects/cute-core/src/lib/util/exception/JsonRpcException.ts","../../../projects/cute-core/src/lib/datastore/DataStore.ts","../../../projects/cute-core/src/lib/datastore/TableParam.ts","../../../projects/cute-core/src/lib/datawindow/datawindow.component.ts","../../../projects/cute-core/src/public-api.ts","../../../projects/cute-core/src/cute-dw-core.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\n\n@NgModule({\n declarations: [\n ],\n imports: [\n ],\n exports: [\n ],\n providers: [\n ]\n})\nexport class CuteCoreModule { }\n","//import {Objects} from \"../Objects\";\r\n\r\n/**\r\n * Superclass of exceptions that can be thrown during the normal operation flow\r\n */\r\nexport class RunTimeException extends Error {\r\n private readonly _cause: Error | undefined;\r\n\r\n constructor(message?: string, cause?: Error) {\r\n super(message);\r\n this._cause = cause;\r\n //this.name = Objects.getClassName(this);\r\n }\r\n\r\n get cause(): Error | undefined {return this._cause;}\r\n}\r\n","import { RunTimeException } from \"./RunTimeException\";\r\n\r\nexport class IllegalArgumentException extends RunTimeException {\r\n\r\n}\r\n","import {from, Observable, Subject} from \"rxjs\";\r\nimport { IllegalArgumentException } from \"../util/exception/IllegalArgumentException\";\r\nimport { Consumer } from \"../util/function/Consumer\";\r\nimport { Predicate } from \"../util/function/Predicate\";\r\nimport { Collection, Element } from \"./Collection\";\r\n\r\n/**\r\n * This class provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface.\r\n */\r\nexport abstract class AbstractCollection<T> implements Collection<T> {\r\n public readonly contentChanged$ = new Subject<void>();\r\n\r\n abstract [Symbol.iterator](): IterableIterator<Element<T>>;\r\n abstract [Symbol.toStringTag]: string;\r\n\r\n /**\r\n * Returns an observable object of the collection changes\r\n */\r\n get contentChanged(): Observable<void> {return this.contentChanged$.asObservable()};\r\n /**\r\n * Returns an iterator over the elements contained in this collection\r\n */\r\n get iterator(): Iterator<Element<T>> {return this[Symbol.iterator]()}\r\n /**\r\n * Returns the number of elements in this collection.\r\n */\r\n get length(): number {return this.size;}\r\n /**\r\n * Returns the number of elements in this collection\r\n */\r\n get size(): number {\r\n return this.toArray().length;\r\n }\r\n /**\r\n * Ensures that this collection contains the specified element.\r\n * @param value Element whose presence in this collection is to be ensured\r\n * @returns `this` Object reference\r\n * @throws `IllegalArgumentException` if the argument's value is _undefined_\r\n * @description This method was defined for JavaScript's `Set` interface compatibility.\r\n */\r\n add(value: Element<T>): this {\r\n if ( value === undefined ) {\r\n throw new IllegalArgumentException(`Method add(): Illegal argument value '${value}'`);\r\n }\r\n this.append(value);\r\n return this;\r\n }\r\n /**\r\n * Ensures that this collection contains the specified element\r\n * @param value Element whose presence in this collection is to be ensured\r\n * @returns _true_ if this collection changed as a result of the call, _false_ otherwise\r\n */\r\n abstract append(value: Element<T>): boolean;\r\n /**\r\n * Appends all the elements in the specified collection to this collection\r\n * @param collection Collection containing elements to be added to this collection\r\n * @returns _true_ if this collection changed as a result of the call\r\n */\r\n appendAll<E extends T>(collection: Collection<E>|Array<E>): boolean {\r\n let count = 0;\r\n if (collection) {\r\n for (const elem of collection) {\r\n if (this.append(elem)) {\r\n count++;\r\n }\r\n }\r\n }\r\n return count > 0;\r\n }\r\n /**\r\n * Removes all the elements from this collection\r\n */\r\n abstract clear(): void;\r\n /**\r\n * Returns _true_ if this collection contains the specified element\r\n */\r\n abstract contains(value: Element<T>): boolean;\r\n /**\r\n * Returns _true_ if this collection contains all the elements in the specified collection\r\n * @param coll Collection to be checked for containment in this collection\r\n * @returns _true_ if this collection contains all the elements in the specified collection\r\n */\r\n containsAll<E extends T>(coll: Collection<E>|Array<T>): boolean {\r\n if (coll && coll.length > 0) {\r\n for (const elem of coll) {\r\n if (!this.contains(elem)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Compares the specified object with this collection for equality\r\n * @param value Object to be compared for equality with this collection\r\n * @returns _true_ if the specified `value` is equal to this collection\r\n */\r\n equals(value: any): boolean {\r\n return (value && value === this);\r\n }\r\n /**\r\n * Returns the first element in the provided array that satisfies the provided testing function.\r\n * If no values satisfy the testing function, _undefined_ is returned.\r\n * @param test The testing function\r\n * @returns The first element in the collection that satisfies the provided testing function. Otherwise, _undefined_ is returned.\r\n */\r\n find(test: Predicate<Element<T>>): Element<T> | undefined {\r\n let resultElem = undefined;\r\n for (const elem of this) {\r\n if (test(elem)) {\r\n resultElem = elem;\r\n break;\r\n }\r\n }\r\n return resultElem;\r\n }\r\n /**\r\n * Performs the specified action for each element in the collection\r\n * @param action {Consumer} The action to be performed for each element\r\n * @throws `IllegalArgumentException`, if the specified `action` is null\r\n */\r\n forEach(action: Consumer<Element<T>>): void {\r\n if (!action) {\r\n throw new IllegalArgumentException(\"action is required parameter\");\r\n }\r\n for (let elem of this) {\r\n action(elem);\r\n }\r\n }\r\n /**\r\n * Returns _true_ if this collection contains no elements\r\n */\r\n isEmpty(): boolean {\r\n return this.size == 0;\r\n }\r\n /**\r\n * Removes a single instance of the specified element from this collection, if it is present\r\n * @param value Element to be removed from this collection, if present\r\n * @returns _true_ if an element was removed as a result of this call\r\n */\r\n abstract remove(value: Element<T>): boolean;\r\n /**\r\n * Removes all of this collection's elements that are also contained in the specified collection\r\n * @param collection Collection containing elements to be removed from this collection\r\n * @returns _true_ if this collection changed as a result of the call\r\n */\r\n removeAll(collection: Collection<T>|Array<T>): boolean {\r\n let nCount = 0;\r\n if (collection) {\r\n for (const elem of collection) {\r\n if (this.remove(elem)) {\r\n nCount++;\r\n }\r\n }\r\n }\r\n return nCount > 0;\r\n }\r\n /**\r\n * Retains only the elements in this collection that are contained in the specified collection\r\n * @param collection Collection containing elements to be retained in this collection\r\n * @returns _true_ if this collection changed as a result of the call\r\n */\r\n retainAll(collection: Collection<T>|Array<T>): boolean {\r\n let count = 0;\r\n if (collection) {\r\n if (Array.isArray(collection)) {\r\n for (const elem of this) {\r\n if (collection.indexOf(elem!)==0 && this.remove(elem)) {\r\n count++;\r\n }\r\n }\r\n } else {\r\n for (const elem of this) {\r\n if (!collection.contains(elem) && this.remove(elem)) {\r\n count++;\r\n }\r\n }\r\n }\r\n }\r\n return count > 0;\r\n }\r\n /**\r\n * Removes all the elements of this collection that satisfy the given predicate\r\n * @param p A predicate which returns true for elements to be removed\r\n * @returns _true_ if any elements were removed, _false_ otherwise\r\n */\r\n removeIf(p: Predicate<Element<T>>): boolean {\r\n let nCount = 0;\r\n for (const elem of this) {\r\n if (p(elem) && this.remove(elem)) {\r\n nCount++;\r\n }\r\n }\r\n return nCount > 0;\r\n }\r\n /**\r\n * Returns a sequential `Observable` object with this collection as its source\r\n * @since 0.5.0\r\n */\r\n stream(): Observable<Element<T>> {\r\n return from(this);\r\n }\r\n /**\r\n * Returns an array containing all the elements in this collection\r\n */\r\n abstract toArray(): Array<Element<T>>;\r\n /**\r\n * Returns a JSON representation of this collection\r\n */\r\n toJSON(): Array<Element<T>> {\r\n return this.toArray();\r\n }\r\n /**\r\n * Returns a string representation of this collection\r\n */\r\n toString(): string {\r\n return this.toArray().toString();\r\n }\r\n\r\n}\r\n","import { Compare } from \"../util/function/Compare\";\r\nimport { Predicate } from \"../util/function/Predicate\";\r\nimport { AbstractCollection} from \"./AbstractCollection\";\r\nimport { Element } from \"./Collection\";\r\nimport { LinkedListNode } from \"./LinkedList\";\r\nimport { List } from \"./List\";\r\n\r\n/**\r\n * This class provides a skeletal implementation of the `List` interface to minimize the effort required to implement this interface backed by a \"random access\" data store (such as an _array_).\r\n */\r\nexport abstract class AbstractList<T> extends AbstractCollection<T> implements List<T> {\r\n protected _modCount: number = 0;\r\n\r\n /** Modification counter. Must be overridden in the subclasses that implement `subList` method */\r\n get modCount(): number { return this._modCount; }\r\n /**\r\n * Tests whether all elements in the list pass the test implemented by the provided function\r\n * @param callbackFn The function is called\r\n * @returns {boolean} _true_ if the `callbackFn` function returns a _truthy_ value for every list element. Otherwise, _false_.\r\n */\r\n every(callbackFn: (value: Element<T>, index: number, list: List<T>) => boolean): boolean {\r\n if (this.size > 0) {\r\n let i: number = -1;\r\n for (const elem of this) {\r\n if (!callbackFn(elem, ++i, this)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Creates an array as a shallow copy of a portion of the current list, filtered down to just the elements from the current list that pass the test implemented by the provided function\r\n * @param predicate A predicate function, to test each element of the list. Return a value that coerces to _true_ to keep the element, or to _false_ otherwise.\r\n * @returns An array of a portion of the given list, filtered down to just the elements from the given list that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.\r\n */\r\n filter(predicate: Predicate<Element<T>>): Array<Element<T>> {\r\n let arr: Element<T>[] = [];\r\n if (this.size > 0) {\r\n for (const elem of this) {\r\n if (predicate(elem)) {\r\n arr.push(elem);\r\n }\r\n }\r\n }\r\n return arr;\r\n }\r\n /**\r\n * Returns the element at the specified position in this list\r\n * @param index\r\n */\r\n abstract get(index: number): Element<T> | undefined;\r\n /**\r\n * Gets read only node's object by its index\r\n * @param index\r\n * @private\r\n */\r\n abstract getNode(index: number): Readonly<LinkedListNode<T>> | null;\r\n /**\r\n * Gets the parent list of the current list `view` object\r\n */\r\n getParent(): AbstractList<T> | null { return null }\r\n /**\r\n * Gets the range of the `from` and `to` indexes related to the `view`'s parent list (if any)\r\n * @returns\r\n */\r\n getParentRange(): [number, number] { return [0, 0]; }\r\n /**\r\n * Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element\r\n * @param value\r\n * @param fromIndex\r\n */\r\n abstract indexOf(value: Element<T>, fromIndex?: number): number;\r\n /**\r\n * Inserts the specified element at the specified position in this list\r\n * @param index\r\n * @param value\r\n */\r\n abstract insert(index: number, value: Element<T>): boolean;\r\n /**\r\n * Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element\r\n * @param value\r\n * @param fromIndex\r\n */\r\n abstract lastIndexOf(value: Element<T>, fromIndex?: number): number;\r\n /**\r\n * Removes the element at the specified position in this list\r\n * @param index The index of the element to be removed\r\n * @returns The element previously at the specified position\r\n */\r\n abstract removeAt(index: number): Element<T> | undefined;\r\n /**\r\n * Removes from this list all of the elements whose index is between `fromIndex`, inclusive, and `toIndex`, exclusive\r\n * @param fromIndex Index of first element to be removed\r\n * @param toIndex Index after last element to be removed\r\n * @returns _true_ if the list is changed, else _false_\r\n */\r\n abstract removeRange(fromIndex: number, toIndex?: number): boolean;\r\n /**\r\n * Replaces the element at the specified position in this list with the specified element\r\n * @param index Index of the element to replace\r\n * @param value Element to be stored at the specified position\r\n * @returns The element previously at the specified position\r\n */\r\n abstract set(index: number, value: Element<T>): Element<T> | undefined;\r\n /**\r\n * Tests whether all elements in the list pass the test implemented by the provided function\r\n * @param callbackFn A function to test for each element\r\n * @returns {boolean} _true_ if the `callbackFn` function returns a _truthy_ value for at least one element in the list. Otherwise, _false_.\r\n */\r\n some(callbackFn: (value: Element<T>, index: number, list: List<T>) => boolean): boolean {\r\n let i: number = -1;\r\n for (const elem of this) {\r\n if (callbackFn(elem, ++i, this)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * Sorts this list according to the order induced by the specified `Compare` function\r\n * @param compare The `Compare` function used to compare list elements. A _undefined_ value indicates that the elements' natural ordering should be used\r\n */\r\n sort(compare?: Compare<Element<T>>): void {\r\n const arr = this.toArray();\r\n const nLen = arr.length;\r\n arr.sort(compare);\r\n for (let i = 0; i < nLen; i++) {\r\n this.set(i, arr[i]);\r\n }\r\n }\r\n /**\r\n * Returns a view of the portion of this list between the specified `fromIndex`, inclusive, and `toIndex`, exclusive.\r\n * @param fromIndex Low endpoint (inclusive) of the subList\r\n * @param toIndex High endpoint (exclusive) of the subList\r\n * @returns A view of the specified range within this list\r\n */\r\n abstract subList(fromIndex: number, toIndex: number): List<T>;\r\n\r\n}\r\n","import { Observable } from 'rxjs';\r\nimport { Element } from './Collection';\r\nimport { Dictionary } from './Dictionary';\r\n\r\nexport type Entry<K, V> = { key: K, value: Element<V> };\r\n/**\r\n * The root immutable `Map` interface\r\n */\r\nexport interface ImmutableMap<K,V> extends ReadonlyMap<K,V> {\r\n /** Returns an observable object to look after the changes in this collection */\r\n get contentChanged(): Observable<void>;\r\n /** Returns the number of key-value mappings in this map */\r\n get size(): number;\r\n /** +Returns true if this map contains a mapping for the specified `key` */\r\n containsKey(key: K): boolean;\r\n /** +Returns _true_ if this map maps one or more keys to the specified `value` */\r\n containsValue(value: V): boolean;\r\n /** Returns an iterable iterator of the key/value pair contained in this map */\r\n entries(): IterableIterator<[K, V]>;\r\n /** Calls the callback function `callbackfn` for each key/value entry in the map */\r\n forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;\r\n /** Returns the value to which the specified `key` is mapped, or `undefined` if this map contains no mapping for the key */\r\n get(key: K): V | undefined;\r\n /** Returns true if this map contains a mapping for the specified `key` */\r\n has(key: K): boolean;\r\n /** +Returns _true_ if this map contains no key-value mappings */\r\n isEmpty(): boolean;\r\n /** Returns an iterable iterator of the keys contained in this map */\r\n keys(): IterableIterator<K>;\r\n /** +Gets the keys of this tree as a `Set` collection */\r\n keySet(): Set<K>;\r\n toString(): string;\r\n /** Returns an iterable iterator of the values contained in this map */\r\n values(): IterableIterator<V>;\r\n /** Returns an iterable iterator of the key/value pair contained in this map */\r\n [Symbol.iterator](): IterableIterator<[K, V]>;\r\n /** Returns the name (classname) of the map */\r\n [Symbol.toStringTag]: string;\r\n\r\n}\r\n\r\n/**\r\n * This class provides a skeletal implementation of the mutable `Map` interface, to minimize the effort required to implement this interface.\r\n */\r\nexport abstract class AbstractMap<K,V> implements ImmutableMap<K,V>, Map<K,V> {\r\n /** Returns an observable object to look after the changes in this collection */\r\n abstract get contentChanged(): Observable<void>;\r\n /** Returns the number of key-value mappings in this map */\r\n abstract get size(): number;\r\n /** Removes all of the mappings from this map */\r\n abstract clear(): void;\r\n /** +Returns true if this map contains a mapping for the specified `key` */\r\n abstract containsKey(key: K): boolean;\r\n /** +Returns _true_ if this map maps one or more keys to the specified `value` */\r\n abstract containsValue(value: V): boolean;\r\n /** Removes the mapping for a key from this map if it is present */\r\n delete(key: K): boolean { return (this.remove(key) !== undefined); }\r\n /** Returns an iterable iterator of the key/value pair contained in this map */\r\n abstract entries(): IterableIterator<[K, V]>;\r\n /** Calls the callback function `callbackfn` for each key/value entry in the map */\r\n abstract forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;\r\n /** Returns the value to which the specified `key` is mapped, or `undefined` if this map contains no mapping for the key */\r\n abstract get(key: K): V | undefined;\r\n /** Returns true if this map contains a mapping for the specified `key` */\r\n abstract has(key: K): boolean;\r\n /** +Returns _true_ if this map contains no key-value mappings */\r\n isEmpty(): boolean {return this.size == 0};\r\n /** Returns an iterable iterator of the keys contained in this map */\r\n abstract keys(): IterableIterator<K>;\r\n /** +Gets the keys of this tree as a `Set` collection */\r\n abstract keySet(): Set<K>;\r\n /** +Associates the specified `value` with the specified `key` in this map and returns the previous value of the key if it was mapped */\r\n abstract put(key: K, value: V): Element<V> | undefined;\r\n /** +Copies all of the mappings from the specified map to this map */\r\n abstract putAll<Key extends K, Value extends V>(map: Dictionary<Key,Value> | Map<Key,Value>): void;\r\n /** +Removes the mapping for a `key` from this map and returns the previous value of the mapping if it is present */\r\n abstract remove(key: K): Element<V> | undefined;\r\n /** Associates the specified `value` with the specified `key` in this map and returns the map object reference */\r\n abstract set(key: K, value: V): this;\r\n /** +Gets the string representation of the map */\r\n abstract toString(): string;\r\n /** Returns an iterable iterator of the values contained in this map */\r\n abstract values(): IterableIterator<V>;\r\n /** Returns an iterable iterator of the key/value pair contained in this map */\r\n abstract [Symbol.iterator](): IterableIterator<[K, V]>;\r\n /** Returns the name (classname) of the map */\r\n abstract [Symbol.toStringTag]: string;\r\n}\r\n","import { AbstractCollection} from \"./AbstractCollection\";\r\nimport { Element } from \"./Collection\";\r\nimport { Queue } from \"./Queue\";\r\n\r\n/**\r\n * This class provides skeletal implementations of some `Queue` operations.\r\n */\r\nexport abstract class AbstractQueue<T> extends AbstractCollection<T> implements Queue<T> {\r\n\r\n abstract element(): Element<T> | undefined;\r\n abstract offer(value: Element<T>): boolean;\r\n abstract peek(): Element<T>|undefined;\r\n abstract poll(): Element<T>|undefined;\r\n abstract removeFirst(): Element<T>|undefined;\r\n\r\n}\r\n","import { AbstractCollection } from \"./AbstractCollection\";\r\nimport { ImmutableCollection } from \"./Collection\";\r\n\r\n/**\r\n * This immutable interface places additional stipulations, beyond those inherited from the `ImmutableCollection` interface\r\n */\r\nexport interface ImmutableSet<E> extends ImmutableCollection<E>, ReadonlySet<E> {\r\n /** Returns a boolean asserting whether an element is present with the given value in the `Set` object or not */\r\n has(value: E): boolean;\r\n /** Returns a new iterator object that contains an array of `[value, value]` for each element in the `Set` object, in insertion order */\r\n entries(): IterableIterator<[E,E]>;\r\n /** An alias for `values` */\r\n keys(): IterableIterator<E>;\r\n /** Returns a new iterator object that yields the values for each element in the `Set` object in insertion order */\r\n values(): IterableIterator<E>;\r\n /** Calls `callbackFn` once for each value present in the `Set` object, in insertion orders */\r\n forEach(callbackfn: (value: E, value2:E, set: Set<E>) => void, thisArg?: any): void;\r\n /** Returns a new iterator object that yields the values for each element in the `Set` object in insertion order */\r\n [Symbol.iterator](): IterableIterator<E>;\r\n}\r\n/**\r\n * This class provides a skeletal implementation of the mutable `Set` interface to minimize the effort required to implement this interface\r\n */\r\nexport abstract class AbstractSet<E> extends AbstractCollection<E> implements ImmutableSet<E>, Set<E> {\r\n\r\n /** Removes the element associated to the value and returns a boolean asserting whether an element was successfully removed or not */\r\n abstract delete(value: E): boolean;\r\n /** Returns a boolean asserting whether an element is present with the given value in the `Set` object or not */\r\n abstract has(value: E): boolean;\r\n /** Returns a new iterator object that contains an array of `[value, value]` for each element in the `Set` object, in insertion order */\r\n abstract entries(): IterableIterator<[E,E]>;\r\n /** An alias for `values` */\r\n abstract keys(): IterableIterator<E>;\r\n /** Returns a new iterator object that yields the values for each element in the `Set` object in insertion order */\r\n abstract values(): IterableIterator<E>;\r\n /** Calls `callbackFn` once for each value present in the `Set` object, in insertion orders */\r\n abstract forEach(callbackfn: (value: E, value2:E, set: Set<E>) => void, thisArg?: any): void;\r\n /** Returns a new iterator object that yields the values for each element in the `Set` object in insertion order */\r\n abstract [Symbol.iterator](): IterableIterator<E>;\r\n\r\n}\r\n","import { RunTimeException } from \"./RunTimeException\";\r\n\r\nexport class UnsupportedOperationException extends RunTimeException {\r\n\r\n}\r\n","import { RunTimeException } from \"./RunTimeException\";\r\n\r\nexport class IndexOutOfBoundsException extends RunTimeException {\r\n\r\n}\r\n","import { RunTimeException } from \"./RunTimeException\";\r\n\r\nexport class ConcurrentModificationException extends RunTimeException {\r\n\r\n}\r\n","import { ConcurrentModificationException } from \"../../util/exception/ConcurrentModificationException\";\r\nimport { Cloneable } from \"../../util/interface/Cloneable\";\r\nimport { AbstractList } from \"../AbstractList\";\r\nimport { Element } from \"../Collection\";\r\nimport { LinkedListNode } from \"../LinkedList\";\r\nimport { List } from \"../List\";\r\n/**\r\n * This class is denoted to work with a sub set of items in the parent collection\r\n */\r\nexport class ListView<T> extends AbstractList<T> implements Cloneable {\r\n private _owner: AbstractList<T>;\r\n private _parent: AbstractList<T>;\r\n private _head: LinkedListNode<T> | null = null;\r\n private _tail: LinkedListNode<T> | null = null;\r\n private _savedModCount: number;\r\n private _parentFromIndex: number;\r\n private _parentToIndex: number;\r\n private _ownerFromIndex: number = 0;\r\n private _ownerToIndex: number = 0;\r\n private _size: number = 0;\r\n\r\n constructor(parent: AbstractList<T>, fromIndex: number, toIndex: number) {\r\n super();\r\n this._parentFromIndex = Math.max(fromIndex, 0);\r\n this._parentToIndex = Math.min(toIndex, parent.size);\r\n this._ownerFromIndex = this._parentFromIndex;\r\n this._ownerToIndex = this._parentToIndex;\r\n this._parent = parent;\r\n this._owner = parent;\r\n\r\n let range: [number, number];\r\n let p: AbstractList<T> | null = parent;\r\n while (p) {\r\n this._owner = p;\r\n range = p.getParentRange();\r\n this._ownerFromIndex += range[0];\r\n p = p.getParent();\r\n }\r\n\r\n this._ownerToIndex = this._ownerFromIndex + (toIndex - fromIndex);\r\n\r\n this._savedModCount = this._owner.modCount;\r\n\r\n if (this._parentFromIndex >= 0 && this._parentToIndex > 0 && this._parentFromIndex <= this._parentToIndex) {\r\n this._head = parent.getNode(this._parentFromIndex);\r\n this._tail = parent.getNode(this._parentToIndex - 1);\r\n\r\n if (this._head && this._tail) {\r\n this._size = 1;\r\n let node: LinkedListNode<T>|null = this._head;\r\n while(node != this._tail) {\r\n this._size++;\r\n node = node!.next;\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * @override\r\n */\r\n get size(): number {return this._size}\r\n /**\r\n * @private\r\n */\r\n private _checkModCount() {\r\n if (this._savedModCount != this._owner.modCount) {\r\n throw new ConcurrentModificationException();\r\n }\r\n }\r\n\r\n *[Symbol.iterator](): IterableIterator<Element<T>> {\r\n let nextNode;\r\n let isTail;\r\n let node = this._head;\r\n while (node) {\r\n nextNode = node.next;\r\n isTail = (node == this._tail);\r\n\r\n yield node.value;\r\n\r\n if (isTail)\r\n break;\r\n else\r\n node = nextNode;\r\n }\r\n }\r\n\r\n [Symbol.toStringTag] = \"ListView\";\r\n\r\n clone(): ListView<T> {\r\n return new ListView<T>(this._parent, this._parentFromIndex, this._parentToIndex);\r\n }\r\n /**\r\n * @override\r\n */\r\n getNode(index: number): LinkedListNode<T> | null {\r\n return this._owner.getNode(this._ownerFromIndex + index);\r\n }\r\n /**\r\n * @override\r\n */\r\n getParentRange(): [number, number] {\r\n return [this._parentFromIndex, this._parentToIndex];\r\n }\r\n /**\r\n * @override\r\n */\r\n getParent(): AbstractList<T> | null {\r\n return this._parent;\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n clear(): void {\r\n this._checkModCount();\r\n\r\n if (this._owner.removeRange(this._ownerFromIndex, this._ownerToIndex)) {\r\n this._ownerToIndex = this._ownerFromIndex;\r\n this._head = this._tail = null;\r\n this._size = 0;\r\n this._savedModCount = this._owner.modCount;\r\n }\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n get(index: number): Element<T> | undefined {\r\n this._checkModCount();\r\n return this._owner.get(this._ownerFromIndex + index);\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n indexOf(value: Element<T>, fromIndex?: number | undefined): number {\r\n this._checkModCount();\r\n return this._owner.indexOf(value, this._ownerFromIndex + (fromIndex ?? 0));\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n insert(index: number, value: Element<T>): boolean {\r\n this._checkModCount();\r\n if (this._owner.insert(this._ownerFromIndex + index, value)) {\r\n if (index == 0) {\r\n this._head = this._owner.getNode(this._ownerFromIndex);\r\n if (!this._tail) {\r\n this._tail = this._head;\r\n }\r\n } else if ((this._ownerFromIndex + index) > this._ownerToIndex) {\r\n this._tail = this._owner.getNode(this._ownerToIndex + 1);\r\n if (!this._head) {\r\n this._head = this._tail;\r\n }\r\n }\r\n this._size++;\r\n this._ownerToIndex++;\r\n this._savedModCount = this._owner.modCount;\r\n\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n lastIndexOf(value: Element<T>, fromIndex?: number | undefined): number {\r\n this._checkModCount();\r\n return this._owner.lastIndexOf(value, this._ownerFromIndex + (fromIndex ?? 0));\r\n }\r\n /**\r\n * @override\r\n */\r\n removeRange(fromIndex: number, toIndex?: number | undefined): boolean {\r\n this._checkModCount();\r\n return this._owner.removeRange(this._ownerFromIndex+fromIndex, this._ownerToIndex+(toIndex ?? this.size) );\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n set(index: number, value: Element<T>): Element<T> | undefined {\r\n this._checkModCount();\r\n return this._owner.set(this._ownerFromIndex + index, value);\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n subList(fromIndex: number, toIndex: number): List<T> {\r\n this._checkModCount();\r\n return new ListView(this, fromIndex, toIndex);\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n append(value: Element<T>): boolean {\r\n this._checkModCount();\r\n if (this._owner.insert(this._ownerToIndex, value)) {\r\n this._tail = this._owner.getNode(this._ownerToIndex);\r\n if (!this._head) this._head = this._tail;\r\n this._size++;\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * @override\r\n */\r\n contains(value: Element<T>): boolean {\r\n let node = this._head;\r\n while (node) {\r\n if (node.value === value) {\r\n return true;\r\n }\r\n if (node == this._tail)\r\n break;\r\n else\r\n node = node.next;\r\n }\r\n return false;\r\n }\r\n /**\r\n * @override\r\n */\r\n toArray(): Element<T>[] {\r\n const vals: Array<Element<T>> = [];\r\n\r\n let currentNode = this._head;\r\n while (currentNode) {\r\n vals.push(currentNode.value);\r\n if (currentNode == this._tail) break;\r\n currentNode = currentNode.next;\r\n }\r\n return vals;\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n remove(value: Element<T>): boolean {\r\n const index = this.indexOf(value);\r\n if (index >= 0) {\r\n return (this.removeAt(index)!==undefined);\r\n }\r\n return false;\r\n }\r\n /**\r\n * @override\r\n * @throws ConcurrentModificationException\r\n */\r\n removeAt(index: number): Element<T> | undefined {\r\n this._checkModCount();\r\n const node = this._owner.getNode(this._ownerFromIndex+index);\r\n let item: Element<T>|undefined = this._owner.removeAt(this._ownerFromIndex+index);\r\n if (!(item === undefined)) {\r\n if (this._head==this._tail && node==this._head) {\r\n this._head = this._tail = null;\r\n } else if (this._head && node == this._head) {\r\n this._head = this._head.next;\r\n } else if (this._tail && node == this._tail) {\r\n this._tail = this._tail.prev;\r\n }\r\n this._size--;\r\n this._ownerToIndex--;\r\n this._savedModCount = this._owner.modCount;\r\n\r\n return item;\r\n }\r\n return undefined;\r\n }\r\n\r\n}\r\n","import { RunTimeException } from \"./RunTimeException\";\r\n\r\nexport class NullPointerException extends RunTimeException {\r\n\r\n}\r\n","\r\nexport type StringLike = string | null | undefined;\r\n\r\nconst LIKE_RE = /([\\\\.\\\\\\\\\\\\+\\\\*\\\\?\\\\[\\\\^\\\\]\\\\$\\\\(\\\\)\\\\{\\\\}\\\\=\\\\!\\\\<\\\\>\\\\|\\\\:\\\\-])/g;\r\n\r\nconst eLBR = encodeURI('{');\r\nconst eRBR = encodeURI('}');\r\n\r\n/**\r\n * This class consists exclusively of the static methods that operate on or return string values\r\n */\r\nexport class Strings {\r\n /**\r\n * Checks for string emptiness. String is empty if it doesn't contain any characters or equals to null/undefined.\r\n * @param str String value to check\r\n * @returns true/false\r\n */\r\n static isEmpty(str: StringLike): boolean {\r\n return (Strings.trimAll(str)) ? false : true;\r\n }\r\n /**\r\n * Returns a new string if the specified string is empty, i.e. has only blank characters, _null_ or _undefined_\r\n * @param str String value to check\r\n * @param def String value to return if `str` is empty\r\n * @returns `str` or `def` string if `str` is empty\r\n */\r\n static ifEmpty(str: StringLike, def: string): string {\r\n return Strings.isEmpty(str) ? def : str!;\r\n }\r\n /* https://stackoverflow.com/questions/1314045/emulating-sql-like-in-javascript */\r\n /**\r\n * SQL Like testing function\r\n *\r\n * @param str Source string for testing\r\n * @param search Search pattern that may has wildcards of sql **LIKE** operator.\r\n * The percent sign (%) represents zero, one, or multiple characters\r\n * The underscore sign (_) represents one, single character\r\n * @returns _true_ if check matches, _false_ if not\r\n */\r\n static like(str: StringLike, search: StringLike): boolean {\r\n if (typeof str !== 'string') { return false; }\r\n if (typeof search !== 'string') { return false; }\r\n // Remove special chars\r\n search = search.replace(LIKE_RE, \"\\\\$1\");\r\n // Replace % and _ with equivalent regex\r\n search = search.replace(/%/g, '.*').replace(/_/g, '.');\r\n // Check matches?\r\n return RegExp('^' + search + '$', 'gi').test(str);\r\n }\r\n /**\r\n * Obtains a specified number of characters from the beginning of a string.\r\n * @param str The string you want to search\r\n * @param len A long specifying the number of characters you want to return\r\n * @returns {string} Returns the leftmost `len` characters in string if it succeeds and the empty string (\"\") if an error occurs.\r\n * If any argument's value is null, *left* returns null. If `len` is greater than or equal to the length of the string, function returns the entire string. It does not add spaces to make the return value's length equal to `len`.\r\n * @see {@link right}\r\n */\r\n static left(str: StringLike, len: number): StringLike {\r\n if (typeof (str) == \"string\" && typeof (len) == \"number\") {\r\n return str.substring(0, len);\r\n }\r\n return null;\r\n }\r\n /**\r\n * Obtains a specified number of characters from the end of a string.\r\n * @param str The string from which you want characters returned\r\n * @param len A long whose value is the number of characters you want returned from the right end of string\r\n * @returns Returns the rightmost `len` characters in string if it succeeds and the empty string (\"\") if an error occurs. If any argument's value is null, function returns null. If `len` is greater than or equal to the length of the string, *right* returns the entire string. It does not add spaces to make the return value's length equal to `len`.\r\n * @see {@link left}\r\n */\r\n static right(str: StringLike, len: number): StringLike {\r\n if (typeof (str) == \"string\" && typeof (len) == \"number\") {\r\n return str.substring(str.length - len);\r\n }\r\n return null;\r\n }\r\n /**\r\n * Removes leading and trailing specified characters from a string.\r\n * @param str The string you want returned with leading and trailing `chars` deleted\r\n * @param chars Characters to delete from the start and the end of a string. Default is all types of spaces.\r\n * @returns Returns a copy of string with all leading and trailing `chars` deleted if it succeeds.\r\n * If string is null, _trimAll_ returns null.\r\n * @see {@link trimLeft}\r\n * @see {@link trimRight}\r\n */\r\n static trimAll(str: StringLike, chars?: string | string[]): StringLike {\r\n return Strings.trimRight(Strings.trimLeft(str, chars), chars);\r\n }\r\n /**\r\n * Removes trailing specified characters from a string.\r\n * @param str The string you want returned with trailing `chars` deleted\r\n * @param chars Characters to delete from the end of a string. Default is all types of spaces.\r\n * @returns Returns a copy of string with all trailing `chars` deleted if it succeeds.\r\n * If string is null, _trimRight_ returns null.\r\n * @see {@link trimLeft}\r\n * @see {@link trimAll}\r\n */\r\n static trimRight(str: StringLike, chars?: string | string[]): StringLike {\r\n if (!(typeof (str) === \"string\")) return null;\r\n\r\n if (!chars)\r\n return str.trimEnd();\r\n\r\n let start = 0,\r\n end = str.length;\r\n\r\n while (end > start && chars.indexOf(str[end - 1]) >= 0)\r\n --end;\r\n\r\n return (end < str.length) ? str.substring(start, end) : str;\r\n }\r\n /**\r\n * Removes leading specified characters from a string.\r\n * @param str The string you want returned with leading `chars` deleted\r\n * @param chars Characters to delete from the start of a string. Default is all types of spaces.\r\n * @returns Returns a copy of string with all leading `chars` deleted if it succeeds.\r\n * If `str` is null, _trimLeft_ returns null.\r\n * @see {@link trimAll}\r\n * @see {@link trimRight}\r\n */\r\n static trimLeft(str: StringLike, chars?: string | string[]): StringLike {\r\n if (!(typeof (str) === \"string\")) return null;\r\n\r\n if (!chars)\r\n return str.trimStart();\r\n\r\n let start = 0,\r\n end = str.length;\r\n\r\n while (start < end && chars.indexOf(str[start]) >= 0)\r\n ++start;\r\n\r\n return (start > 0) ? str.substring(start, end) : str;\r\n }\r\n /**\r\n * Bites out the _first_ element of the splitted string `str` on the base of the `separator` value. If the `separator` is undefined, returns a whole string\r\n * @param str Source string\r\n * @param separator String-delimitor\r\n * @returns Tuple of two elements: Token string and the Remaining part of the `str` after the bitting token\r\n */\r\n static getToken(str: StringLike, separator: StringLike): [string | undefined, string | undefined] {\r\n if (!(typeof str === \"string\" && typeof separator === \"string\")) return [undefined, undefined];\r\n const sep = str.indexOf(separator);\r\n let token = \"\";\r\n let rest = \"\";\r\n if (sep >= 0) {\r\n token = str.substring(0, sep);\r\n rest = str.substring(sep + separator.length);\r\n } else {\r\n token = str;\r\n }\r\n return [token, rest];\r\n }\r\n /**\r\n * Bites out the _last_ element of the splitted string `str` on the base of the `separator` value. If the `separator` is undefined, returns a whole string\r\n * @param str Source string\r\n * @param separator String-delimitor\r\n * @returns Tuple of two elements: Token string and the Remaining part of the `str` after the bitting token\r\n */\r\n static getLastToken(str: StringLike, separator: StringLike): [string | undefined, string | undefined] {\r\n if (!(typeof str === \"string\" && typeof separator === \"string\")) return [undefined, undefined];\r\n const sep = str.lastIndexOf(separator as string);\r\n let token = \"\";\r\n let rest = \"\";\r\n if (sep >= 0) {\r\n token = str.substring(sep + separator.length);\r\n rest = str.substring(0, sep);\r\n } else {\r\n token = str;\r\n }\r\n return [token, rest];\r\n }\r\n /**\r\n * Bites out _all_ elements of the splitted string `str` on the base of the `separator` value(s).\r\n * @param str Source string\r\n * @param separator String or array of the delimiter characters. Default are whitespace characters.\r\n * @returns Array of string tokens\r\n * @since 0.5.0\r\n */\r\n static getTokens(str: StringLike, separator: string | string[] = \" \\t\\r\\n\"): string[] {\r\n let output: string[] = [];\r\n if (!(typeof str === \"string\") || str === \"\") return output;\r\n if (!separator) return [str];\r\n\r\n let issep = false;\r\n for (const char of str) {\r\n if (separator.indexOf(char) >= 0) {\r\n if (!issep || separator.length == 1) {\r\n output.push(\"\");\r\n }\r\n issep = true;\r\n } else {\r\n issep = false;\r\n if (output.length == 0) {\r\n output.push(\"\");\r\n }\r\n output[output.length - 1] += char;\r\n }\r\n }\r\n return output;\r\n }\r\n /**\r\n * Gets the value portion of a keyword=value pair from a string\r\n * @param source The string to be searched\r\n * @param keyword The keyword to be searched for\r\n * @param separator The separator character used in the source string\r\n * @returns The value found for the `keyword`. If no matching keyword is found, _undefined_ is returned.\r\n *\t\t\t\t\tIf any argument's value is _null_, the function returns _null_.\r\n * @since 0.5.0\r\n * @example\r\n * let valB = Strings.getKeyValue(\"a=123; b=foo; c=true\", \"b\", \";\"); // foo\r\n * let valM = Strings.getKeyValue(\"a=123; b=foo; c=true\", \"missing\", \";\"); // undefined\r\n */\r\n static getKeyValue(source: StringLike, keyword: StringLike, separator: StringLike): StringLike {\r\n if (!(typeof(source) == \"string\" && typeof(keyword) == \"string\" && typeof(separator) == \"string\")) return null;\r\n\r\n let done = false;\r\n let iKeyWord, iSeparator, iEqual, iKeyLen, iSepLen;\r\n let sValue=undefined, sSaved, sLeftPart;\r\n\r\n keyword = keyword.toLowerCase();\r\n iKeyLen = keyword.length;\r\n iSepLen = separator.length;\r\n while (!done) {\r\n iKeyWord = source!.toLowerCase().indexOf(keyword);\r\n if (iKeyWord >= 0) {\r\n sSaved = source;\r\n source = Strings.trimLeft(Strings.right(source, source!.length - (iKeyWord + iKeyLen)));\r\n\r\n\t\t\t // See if this is an exact match. Either the match will be at the start of the string or\r\n\t\t\t // after a separator character. So check for both cases\r\n if (separator.endsWith(\" \")) {\r\n\t\t\t iEqual = iKeyWord - iSepLen;\r\n\t\t\t if (iEqual > 0) {\r\n if (source!.substring(iEqual, iEqual+iSepLen) != separator) {\r\n // not the separator string so continue looking\r\n continue;\r\n }\r\n }\r\n } else {\r\n sLeftPart = Strings.trimRight( Strings.left(sSaved, iKeyWord - 1));\r\n if (sLeftPart) {\r\n if (Strings.right(sLeftPart, iSepLen) != separator) {\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n if ( source?.startsWith('=') ) {\r\n iSeparator = source!.indexOf(separator, 1);\r\n if (iSeparator >= 0) {\r\n sValue = source!.substring(1, iSeparator);\r\n } else {\r\n sValue = source!.substring(1);\r\n }\r\n sValue = Strings.trimAll(sValue) || \"\";\r\n done = true;\r\n }\r\n\r\n } else {\r\n done = true