semantic-typescript 0.5.0 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collector.d.ts +1 -10
- package/dist/collector.js +1 -20
- package/dist/factory.d.ts +72 -28
- package/dist/factory.js +362 -150
- package/dist/guard.d.ts +1 -14
- package/dist/guard.js +1 -61
- package/dist/hook.d.ts +5 -1
- package/dist/hook.js +72 -19
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +4 -0
- package/dist/map.js +0 -8
- package/dist/optional.d.ts +3 -3
- package/dist/optional.js +14 -10
- package/dist/semantic.d.ts +204 -2
- package/dist/semantic.js +1134 -10
- package/dist/symbol.d.ts +1 -14
- package/dist/symbol.js +1 -14
- package/dist/utility.d.ts +1 -1
- package/package.json +1 -1
- package/readme.md +492 -282
- package/dist/collectable.d.ts +0 -202
- package/dist/collectable.js +0 -1123
- package/dist/statistics.d.ts +0 -97
- package/dist/statistics.js +0 -483
- package/dist/window.d.ts +0 -12
- package/dist/window.js +0 -72
package/dist/guard.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { Collectable, OrderedCollectable, Statistics, UnorderedCollectable, WindowCollectable } from "./
|
|
1
|
+
import type { Collectable, OrderedCollectable, Statistics, UnorderedCollectable, WindowCollectable } from "./semantic";
|
|
2
2
|
import type { Collector } from "./collector";
|
|
3
|
-
import type { HashMap, SemanticMap } from "./map";
|
|
4
|
-
import type { BinaryNode, LinearNode, Node } from "./node";
|
|
5
3
|
import type { Optional } from "./optional";
|
|
6
4
|
import type { Semantic } from "./semantic";
|
|
7
|
-
import type { HashSet } from "./set";
|
|
8
5
|
import type { AsyncFunction, MaybePrimitive, Primitive } from "./utility";
|
|
9
6
|
export declare let isBoolean: (target: unknown) => target is boolean;
|
|
10
7
|
export declare let isString: (target: unknown) => target is string;
|
|
@@ -25,16 +22,6 @@ export declare let isUnorderedCollectable: (target: unknown) => target is Unorde
|
|
|
25
22
|
export declare let isStatistics: (target: unknown) => target is Statistics<unknown, number | bigint>;
|
|
26
23
|
export declare let isNumericStatistics: (target: unknown) => target is Statistics<unknown, number | bigint>;
|
|
27
24
|
export declare let isBigIntStatistics: (target: unknown) => target is Statistics<unknown, number | bigint>;
|
|
28
|
-
export declare let isSemanticMap: (target: unknown) => target is SemanticMap<unknown, unknown>;
|
|
29
|
-
export declare let isHashMap: (target: unknown) => target is HashMap<unknown, unknown>;
|
|
30
|
-
export declare let isHashSet: (target: unknown) => target is HashSet<unknown>;
|
|
31
|
-
export declare let isNode: (target: unknown) => target is Node<unknown, any>;
|
|
32
|
-
export declare let isLinearNode: (target: unknown) => target is LinearNode<unknown>;
|
|
33
|
-
export declare let isBinaryNode: (target: unknown) => target is BinaryNode<unknown, any>;
|
|
34
|
-
export declare let isRedBlackNode: (target: unknown) => target is BinaryNode<unknown, any>;
|
|
35
|
-
export declare let isTree: (target: unknown) => target is Node<unknown, any>;
|
|
36
|
-
export declare let isBinaryTree: (target: unknown) => target is Node<unknown, any>;
|
|
37
|
-
export declare let isRedBlackTree: (target: unknown) => target is Node<unknown, any>;
|
|
38
25
|
export declare let isOptional: <T>(target: unknown) => target is Optional<T>;
|
|
39
26
|
export declare let isPromise: (target: unknown) => target is Promise<unknown>;
|
|
40
27
|
export declare let isAsyncFunction: (target: unknown) => target is AsyncFunction;
|
package/dist/guard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigIntStatisticsSymbol,
|
|
1
|
+
import { BigIntStatisticsSymbol, CollectableSymbol, CollectorsSymbol, NumericStatisticsSymbol, OptionalSymbol, OrderedCollectableSymbol, SemanticSymbol, StatisticsSymbol, UnorderedCollectableSymbol, WindowCollectableSymbol } from "./symbol";
|
|
2
2
|
export let isBoolean = (target) => {
|
|
3
3
|
return typeof target === "boolean";
|
|
4
4
|
};
|
|
@@ -89,66 +89,6 @@ export let isBigIntStatistics = (target) => {
|
|
|
89
89
|
}
|
|
90
90
|
return false;
|
|
91
91
|
};
|
|
92
|
-
export let isSemanticMap = (target) => {
|
|
93
|
-
if (isObject(target)) {
|
|
94
|
-
return Reflect.get(target, "SemanticMap") === SemanticMapSymbol;
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
};
|
|
98
|
-
export let isHashMap = (target) => {
|
|
99
|
-
if (isObject(target)) {
|
|
100
|
-
return Reflect.get(target, "HashMap") === SemanticMapSymbol;
|
|
101
|
-
}
|
|
102
|
-
return false;
|
|
103
|
-
};
|
|
104
|
-
export let isHashSet = (target) => {
|
|
105
|
-
if (isObject(target)) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
return false;
|
|
109
|
-
};
|
|
110
|
-
export let isNode = (target) => {
|
|
111
|
-
if (isObject(target)) {
|
|
112
|
-
return Reflect.get(target, "Node") === NodeSymbol;
|
|
113
|
-
}
|
|
114
|
-
return false;
|
|
115
|
-
};
|
|
116
|
-
export let isLinearNode = (target) => {
|
|
117
|
-
if (isObject(target)) {
|
|
118
|
-
return isNode(target) && Reflect.get(target, "LinearNode") === LinearNodeSymbol;
|
|
119
|
-
}
|
|
120
|
-
return false;
|
|
121
|
-
};
|
|
122
|
-
export let isBinaryNode = (target) => {
|
|
123
|
-
if (isObject(target)) {
|
|
124
|
-
return isNode(target) && Reflect.get(target, "BinaryNode") === BinaryNodeSymbol;
|
|
125
|
-
}
|
|
126
|
-
return false;
|
|
127
|
-
};
|
|
128
|
-
export let isRedBlackNode = (target) => {
|
|
129
|
-
if (isObject(target)) {
|
|
130
|
-
return isBinaryNode(target) && Reflect.get(target, "RedBlackNode") === RedBlackNodeSymbol;
|
|
131
|
-
}
|
|
132
|
-
return false;
|
|
133
|
-
};
|
|
134
|
-
export let isTree = (target) => {
|
|
135
|
-
if (isObject(target)) {
|
|
136
|
-
return isNode(target) && (isLinearNode(target) || isBinaryNode(target));
|
|
137
|
-
}
|
|
138
|
-
return false;
|
|
139
|
-
};
|
|
140
|
-
export let isBinaryTree = (target) => {
|
|
141
|
-
if (isObject(target)) {
|
|
142
|
-
return isNode(target) && isBinaryNode(target);
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
};
|
|
146
|
-
export let isRedBlackTree = (target) => {
|
|
147
|
-
if (isObject(target)) {
|
|
148
|
-
return isNode(target) && isRedBlackNode(target);
|
|
149
|
-
}
|
|
150
|
-
return false;
|
|
151
|
-
};
|
|
152
92
|
export let isOptional = (target) => {
|
|
153
93
|
if (isObject(target)) {
|
|
154
94
|
return Reflect.get(target, "Optional") === OptionalSymbol;
|
package/dist/hook.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type DeepPropertyKey, type DeepPropertyValue } from "./utility";
|
|
2
2
|
import type { Comparator, Generator } from "./utility";
|
|
3
3
|
export declare let useCompare: <T>(t1: T, t2: T) => number;
|
|
4
|
-
|
|
4
|
+
interface UseRandom {
|
|
5
|
+
<N extends number | bigint>(start: N): N extends number ? number : (N extends bigint ? bigint : never);
|
|
6
|
+
<N extends number | bigint>(start: N, end: N): N;
|
|
7
|
+
}
|
|
8
|
+
export declare let useRandom: UseRandom;
|
|
5
9
|
export type UseTraverseKey<T extends object> = DeepPropertyKey<T> & (symbol | string | number);
|
|
6
10
|
export type UseTraverseValue<T extends object> = DeepPropertyValue<T>;
|
|
7
11
|
export type UseTraversePath<T extends object> = Array<UseTraverseKey<T> & (symbol | string | number)>;
|
package/dist/hook.js
CHANGED
|
@@ -44,28 +44,81 @@ export let useCompare = (t1, t2) => {
|
|
|
44
44
|
}
|
|
45
45
|
throw new TypeError("Cannot compare values of different types.");
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
;
|
|
48
|
+
export let useRandom = (start, end) => {
|
|
49
|
+
let getRandomBits = () => {
|
|
50
|
+
let random = Math.random();
|
|
51
|
+
let full = random * 0x10000000000000;
|
|
52
|
+
let high = Math.floor(full / 0x100000000);
|
|
53
|
+
let low = Math.floor(full) & 0xFFFFFFFF;
|
|
54
|
+
return [high, low];
|
|
55
|
+
};
|
|
56
|
+
let getRandomBigInt = () => {
|
|
57
|
+
let [h1, l1] = getRandomBits();
|
|
58
|
+
let [h2, l2] = getRandomBits();
|
|
59
|
+
let [h3, l3] = getRandomBits();
|
|
60
|
+
return ((BigInt(h1) << 84n) | (BigInt(l1) << 52n) | (BigInt(h2) << 32n) | (BigInt(l2) << 3n) | (BigInt(h3) << 116n)) | (BigInt(l3) << 80n);
|
|
61
|
+
};
|
|
62
|
+
if (isNumber(start)) {
|
|
63
|
+
let seed = Math.random();
|
|
64
|
+
if (isNumber(end)) {
|
|
65
|
+
let minimum = Math.min(start, end);
|
|
66
|
+
let maximum = Math.max(start, end);
|
|
67
|
+
let range = maximum - minimum;
|
|
68
|
+
return (minimum + seed * range);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return Math.exp(-seed);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (isBigInt(start)) {
|
|
75
|
+
let randomBigInt = getRandomBigInt();
|
|
76
|
+
if (isBigInt(end)) {
|
|
77
|
+
let minimum = start < end ? start : end;
|
|
78
|
+
let maximum = start < end ? end : start;
|
|
79
|
+
let range = maximum - minimum;
|
|
80
|
+
if (range === 0n) {
|
|
81
|
+
return minimum;
|
|
82
|
+
}
|
|
83
|
+
let mask = range;
|
|
84
|
+
mask |= mask >> 1n;
|
|
85
|
+
mask |= mask >> 2n;
|
|
86
|
+
mask |= mask >> 4n;
|
|
87
|
+
mask |= mask >> 8n;
|
|
88
|
+
mask |= mask >> 16n;
|
|
89
|
+
mask |= mask >> 32n;
|
|
90
|
+
mask |= mask >> 64n;
|
|
91
|
+
let result;
|
|
92
|
+
do {
|
|
93
|
+
let raw = randomBigInt & mask;
|
|
94
|
+
result = raw;
|
|
95
|
+
result ^= result >> 17n;
|
|
96
|
+
result *= 0xed5ad4bbn;
|
|
97
|
+
result ^= result >> 11n;
|
|
98
|
+
result *= 0xac4c1b51n;
|
|
99
|
+
result ^= result >> 15n;
|
|
100
|
+
result *= 0x31848babn;
|
|
101
|
+
result ^= result >> 14n;
|
|
102
|
+
} while (result >= range);
|
|
103
|
+
return (minimum + result);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
let seed = Math.random();
|
|
107
|
+
let expValue = Math.exp(-seed);
|
|
108
|
+
let normalized = expValue / Math.E;
|
|
109
|
+
let [high, low] = getRandomBits();
|
|
110
|
+
let adjusted = BigInt(Math.floor(normalized * 0xFFFFFFFF)) << 32n;
|
|
111
|
+
let result = (adjusted | BigInt(low)) ^ BigInt(high);
|
|
112
|
+
if (start <= 0n) {
|
|
113
|
+
return 0n;
|
|
114
|
+
}
|
|
115
|
+
if (result >= start) {
|
|
116
|
+
result = result % start;
|
|
59
117
|
}
|
|
60
118
|
return result;
|
|
61
|
-
}
|
|
62
|
-
let h = vanDerCorput(2, x) + vanDerCorput(3, x);
|
|
63
|
-
let golden = (x * phi) % 1;
|
|
64
|
-
let lcg = (1103515245 * x + 12345) % 2147483648;
|
|
65
|
-
let mixed = (h * 0.5 + golden * 0.3 + lcg / 2147483648 * 0.2);
|
|
66
|
-
return (mixed * 1000000);
|
|
119
|
+
}
|
|
67
120
|
}
|
|
68
|
-
throw new TypeError("Invalid
|
|
121
|
+
throw new TypeError("Invalid arguments.");
|
|
69
122
|
};
|
|
70
123
|
;
|
|
71
124
|
;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/main.js
ADDED
package/dist/map.js
CHANGED
|
@@ -16,7 +16,6 @@ export class AbstractSemanticMap {
|
|
|
16
16
|
writable: false,
|
|
17
17
|
configurable: false
|
|
18
18
|
});
|
|
19
|
-
Object.freeze(this);
|
|
20
19
|
}
|
|
21
20
|
compute(key, remapping) {
|
|
22
21
|
let value = this.get(key);
|
|
@@ -84,9 +83,6 @@ export class AbstractSemanticMap {
|
|
|
84
83
|
[Symbol.toStringTag] = "SemanticMap";
|
|
85
84
|
}
|
|
86
85
|
;
|
|
87
|
-
Object.freeze(AbstractSemanticMap);
|
|
88
|
-
Object.freeze(AbstractSemanticMap.prototype);
|
|
89
|
-
Object.freeze(Object.getPrototypeOf(AbstractSemanticMap));
|
|
90
86
|
export class HashMap extends AbstractSemanticMap {
|
|
91
87
|
buckets = new Map();
|
|
92
88
|
threashold;
|
|
@@ -128,7 +124,6 @@ export class HashMap extends AbstractSemanticMap {
|
|
|
128
124
|
writable: false,
|
|
129
125
|
configurable: false
|
|
130
126
|
});
|
|
131
|
-
Object.freeze(this);
|
|
132
127
|
}
|
|
133
128
|
clear() {
|
|
134
129
|
this.buckets.clear();
|
|
@@ -244,9 +239,6 @@ export class HashMap extends AbstractSemanticMap {
|
|
|
244
239
|
}
|
|
245
240
|
}
|
|
246
241
|
;
|
|
247
|
-
Object.freeze(HashMap);
|
|
248
|
-
Object.freeze(HashMap.prototype);
|
|
249
|
-
Object.freeze(Object.getPrototypeOf(HashMap));
|
|
250
242
|
export class TreeMap {
|
|
251
243
|
key = (void 0);
|
|
252
244
|
value = (void 0);
|
package/dist/optional.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Semantic } from "./semantic";
|
|
2
|
-
import { type Consumer, type Functional, type MaybeInvalid, type Predicate, type Runnable } from "./utility";
|
|
2
|
+
import { type Consumer, type Functional, type MaybeInvalid, type Predicate, type Runnable, type Valid } from "./utility";
|
|
3
3
|
export declare class Optional<T> {
|
|
4
4
|
protected value: MaybeInvalid<T>;
|
|
5
5
|
protected readonly Optional: Symbol;
|
|
6
6
|
protected constructor(value: MaybeInvalid<T>);
|
|
7
7
|
filter(predicate: Predicate<T>): Optional<T>;
|
|
8
|
-
get(): T
|
|
9
|
-
get(defaultValue: T): T
|
|
8
|
+
get(): Valid<T>;
|
|
9
|
+
get(defaultValue: T): Valid<T>;
|
|
10
10
|
ifPresent(action: Consumer<T>): void;
|
|
11
11
|
ifPresent(action: Consumer<T>, elseAction: Runnable): void;
|
|
12
12
|
isEmpty(): boolean;
|
package/dist/optional.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isFunction } from "./guard";
|
|
1
|
+
import { useEmpty, useOf } from "./factory";
|
|
2
|
+
import { isFunction, isOptional } from "./guard";
|
|
3
3
|
import { OptionalSymbol } from "./symbol";
|
|
4
4
|
import { invalidate, validate } from "./utility";
|
|
5
5
|
export class Optional {
|
|
@@ -64,13 +64,21 @@ export class Optional {
|
|
|
64
64
|
}
|
|
65
65
|
flat(mapper) {
|
|
66
66
|
if (this.isPresent() && isFunction(mapper)) {
|
|
67
|
-
|
|
67
|
+
let result = mapper(this.value);
|
|
68
|
+
if (isOptional(result)) {
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
throw new TypeError("Must return an Optional.");
|
|
68
72
|
}
|
|
69
73
|
return new Optional(null);
|
|
70
74
|
}
|
|
71
75
|
flatMap(mapper) {
|
|
72
76
|
if (this.isPresent() && isFunction(mapper)) {
|
|
73
|
-
|
|
77
|
+
let result = mapper(this.value);
|
|
78
|
+
if (isOptional(result)) {
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
throw new TypeError("Must return an Optional.");
|
|
74
82
|
}
|
|
75
83
|
return new Optional(null);
|
|
76
84
|
}
|
|
@@ -82,13 +90,9 @@ export class Optional {
|
|
|
82
90
|
}
|
|
83
91
|
semantic() {
|
|
84
92
|
if (this.isPresent()) {
|
|
85
|
-
return
|
|
86
|
-
return this.value;
|
|
87
|
-
}, () => {
|
|
88
|
-
return this.isEmpty();
|
|
89
|
-
});
|
|
93
|
+
return useOf(this.value);
|
|
90
94
|
}
|
|
91
|
-
return
|
|
95
|
+
return useEmpty();
|
|
92
96
|
}
|
|
93
97
|
static empty() {
|
|
94
98
|
return new Optional(null);
|
package/dist/semantic.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Collector } from "./collector";
|
|
2
|
+
import type { Optional } from "./optional";
|
|
2
3
|
import { type Predicate } from "./utility";
|
|
3
|
-
import type { Generator, Functional, BiFunctional, Consumer, BiConsumer, Comparator, BiPredicate } from "./utility";
|
|
4
|
+
import type { Generator, Functional, BiFunctional, Consumer, BiConsumer, Comparator, BiPredicate, Indexed, Supplier, TriFunctional, TriPredicate } from "./utility";
|
|
4
5
|
export declare class Semantic<E> {
|
|
5
6
|
protected generator: Generator<E>;
|
|
6
7
|
protected readonly Semantic: Symbol;
|
|
@@ -42,6 +43,7 @@ export declare class Semantic<E> {
|
|
|
42
43
|
toCollectable(): Collectable<E>;
|
|
43
44
|
toCollectable<C extends Collectable<E>>(mapper: Functional<Generator<E>, C>): C;
|
|
44
45
|
toBigintStatistics(): BigIntStatistics<E>;
|
|
46
|
+
toEvent(): EventCollectable<E>;
|
|
45
47
|
toNumericStatistics(): NumericStatistics<E>;
|
|
46
48
|
toOrdered(): OrderedCollectable<E>;
|
|
47
49
|
toUnordered(): UnorderedCollectable<E>;
|
|
@@ -50,3 +52,203 @@ export declare class Semantic<E> {
|
|
|
50
52
|
translate(offset: bigint): Semantic<E>;
|
|
51
53
|
translate(translator: BiFunctional<E, bigint, bigint>): Semantic<E>;
|
|
52
54
|
}
|
|
55
|
+
export declare abstract class Collectable<E> implements Iterable<E>, AsyncIterable<E> {
|
|
56
|
+
protected readonly Collectable: symbol;
|
|
57
|
+
constructor();
|
|
58
|
+
abstract [Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
59
|
+
abstract [Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
60
|
+
anyMatch(predicate: Predicate<E>): boolean;
|
|
61
|
+
allMatch(predicate: Predicate<E>): boolean;
|
|
62
|
+
collect<A, R>(collector: Collector<E, A, R>): R;
|
|
63
|
+
collect<A, R>(identity: Supplier<A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R;
|
|
64
|
+
collect<A, R>(identity: Supplier<A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R;
|
|
65
|
+
collect<A, R>(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R;
|
|
66
|
+
collect<A, R>(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R;
|
|
67
|
+
collect<A, R>(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: BiFunctional<A, E, A>, finisher: Functional<A, R>): R;
|
|
68
|
+
collect<A, R>(identity: Supplier<A>, interruptor: Predicate<E>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R;
|
|
69
|
+
collect<A, R>(identity: Supplier<A>, interruptor: BiPredicate<E, bigint>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R;
|
|
70
|
+
collect<A, R>(identity: Supplier<A>, interruptor: TriPredicate<E, bigint, A>, accumulator: TriFunctional<A, E, bigint, A>, finisher: Functional<A, R>): R;
|
|
71
|
+
count(): bigint;
|
|
72
|
+
error(): void;
|
|
73
|
+
error(accumulator: BiFunctional<string, E, string>): void;
|
|
74
|
+
error(accumulator: TriFunctional<string, E, bigint, string>): void;
|
|
75
|
+
error(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): void;
|
|
76
|
+
error(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): void;
|
|
77
|
+
isEmpty(): boolean;
|
|
78
|
+
findAny(): Optional<E>;
|
|
79
|
+
findAt(index: number): Optional<E>;
|
|
80
|
+
findAt(index: bigint): Optional<E>;
|
|
81
|
+
findFirst(): Optional<E>;
|
|
82
|
+
findLast(): Optional<E>;
|
|
83
|
+
findMaximum(): Optional<E>;
|
|
84
|
+
findMaximum(comparator: Comparator<E>): Optional<E>;
|
|
85
|
+
findMinimum(): Optional<E>;
|
|
86
|
+
findMinimum(comparator: Comparator<E>): Optional<E>;
|
|
87
|
+
forEach(action: Consumer<E>): void;
|
|
88
|
+
forEach(action: BiConsumer<E, bigint>): void;
|
|
89
|
+
group<K>(classifier: Functional<E, K>): Map<K, Array<E>>;
|
|
90
|
+
group<K>(classifier: BiFunctional<E, bigint, K>): Map<K, Array<E>>;
|
|
91
|
+
groupBy<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, Array<V>>;
|
|
92
|
+
groupBy<K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, K>): Map<K, Array<V>>;
|
|
93
|
+
join(): string;
|
|
94
|
+
join(delimiter: string): string;
|
|
95
|
+
join(prefix: string, delimiter: string, suffix: string): string;
|
|
96
|
+
join(prefiex: string, accumulator: BiFunctional<string, E, string>, suffix: string): string;
|
|
97
|
+
join(prefiex: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): string;
|
|
98
|
+
log(): void;
|
|
99
|
+
log(accumulator: BiFunctional<string, E, string>): void;
|
|
100
|
+
log(accumulator: TriFunctional<string, E, bigint, string>): void;
|
|
101
|
+
log(prefix: string, accumulator: BiFunctional<string, E, string>, suffix: string): void;
|
|
102
|
+
log(prefix: string, accumulator: TriFunctional<string, E, bigint, string>, suffix: string): void;
|
|
103
|
+
nonMatch(predicate: Predicate<E>): boolean;
|
|
104
|
+
nonMatch(predicate: BiPredicate<E, bigint>): boolean;
|
|
105
|
+
partition(count: bigint): Array<Array<E>>;
|
|
106
|
+
partitionBy(classifier: Functional<E, bigint>): Array<Array<E>>;
|
|
107
|
+
partitionBy(classifier: BiFunctional<E, bigint, bigint>): Array<Array<E>>;
|
|
108
|
+
reduce(accumulator: BiFunctional<E, E, E>): Optional<E>;
|
|
109
|
+
reduce(accumulator: TriFunctional<E, E, bigint, E>): Optional<E>;
|
|
110
|
+
reduce(identity: E, accumulator: BiFunctional<E, E, E>): E;
|
|
111
|
+
reduce(identity: E, accumulator: TriFunctional<E, E, bigint, E>): E;
|
|
112
|
+
reduce<R>(identity: R, accumulator: BiFunctional<R, E, R>, finisher: Functional<R, R>): R;
|
|
113
|
+
reduce<R>(identity: R, accumulator: TriFunctional<R, E, bigint, R>, finisher: Functional<R, R>): R;
|
|
114
|
+
semantic(): Semantic<E>;
|
|
115
|
+
abstract source(): Generator<E>;
|
|
116
|
+
toArray(): Array<E>;
|
|
117
|
+
toMap<K, E>(keyExtractor: Functional<E, K>): Map<K, E>;
|
|
118
|
+
toMap<K, V>(keyExtractor: Functional<E, K>, valueExtractor: Functional<E, V>): Map<K, V>;
|
|
119
|
+
toMap<K, V>(keyExtractor: BiFunctional<E, bigint, K>, valueExtractor: BiFunctional<E, bigint, V>): Map<K, V>;
|
|
120
|
+
toSet(): Set<E>;
|
|
121
|
+
write<S = string>(stream: WritableStream<S>): Promise<WritableStream<S>>;
|
|
122
|
+
write<S = string>(stream: WritableStream<S>, accumulator: BiFunctional<WritableStream<S>, E, WritableStream<S>>): Promise<WritableStream<S>>;
|
|
123
|
+
write<S = string>(stream: WritableStream<S>, accumulator: TriFunctional<WritableStream<S>, E, bigint, WritableStream<S>>): Promise<WritableStream<S>>;
|
|
124
|
+
}
|
|
125
|
+
export declare class EventCollectable<E> extends Collectable<E> {
|
|
126
|
+
protected readonly AsyncCollectable: symbol;
|
|
127
|
+
protected generator: Generator<E>;
|
|
128
|
+
constructor(generator: Generator<E>);
|
|
129
|
+
source(): Generator<E>;
|
|
130
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
131
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
132
|
+
}
|
|
133
|
+
export declare class UnorderedCollectable<E> extends Collectable<E> {
|
|
134
|
+
protected readonly UnorderedCollectable: symbol;
|
|
135
|
+
protected buffer: Map<bigint, E>;
|
|
136
|
+
constructor(generator: Generator<E>);
|
|
137
|
+
source(): Generator<E>;
|
|
138
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
139
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
140
|
+
}
|
|
141
|
+
export declare class OrderedCollectable<E> extends Collectable<E> {
|
|
142
|
+
protected readonly OrderedCollectable: symbol;
|
|
143
|
+
protected buffer: Array<Indexed<E>>;
|
|
144
|
+
constructor(generator: Generator<E>);
|
|
145
|
+
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
146
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
147
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
148
|
+
source(): Generator<E>;
|
|
149
|
+
isEmpty(): boolean;
|
|
150
|
+
}
|
|
151
|
+
export declare abstract class Statistics<E, D extends number | bigint> extends OrderedCollectable<E> {
|
|
152
|
+
protected readonly Statistics: symbol;
|
|
153
|
+
constructor(generator: Generator<E>);
|
|
154
|
+
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
155
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
156
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
157
|
+
count(): bigint;
|
|
158
|
+
abstract average(): D;
|
|
159
|
+
abstract average(mapper: Functional<E, D>): D;
|
|
160
|
+
abstract range(): D;
|
|
161
|
+
abstract range(mapper: Functional<E, D>): D;
|
|
162
|
+
abstract variance(): D;
|
|
163
|
+
abstract variance(mapper: Functional<E, D>): D;
|
|
164
|
+
abstract standardDeviation(): D;
|
|
165
|
+
abstract standardDeviation(mapper: Functional<E, D>): D;
|
|
166
|
+
abstract mean(): D;
|
|
167
|
+
abstract mean(mapper: Functional<E, D>): D;
|
|
168
|
+
abstract median(): D;
|
|
169
|
+
abstract median(mapper: Functional<E, D>): D;
|
|
170
|
+
abstract mode(): D;
|
|
171
|
+
abstract mode(mapper: Functional<E, D>): D;
|
|
172
|
+
frequency(): Map<E, bigint>;
|
|
173
|
+
abstract summate(): D;
|
|
174
|
+
abstract summate(mapper: Functional<E, D>): D;
|
|
175
|
+
abstract quantile(quantile: number): D;
|
|
176
|
+
abstract quantile(quantile: number, mapper: Functional<E, D>): D;
|
|
177
|
+
abstract interquartileRange(): D;
|
|
178
|
+
abstract interquartileRange(mapper: Functional<E, D>): D;
|
|
179
|
+
abstract skewness(): D;
|
|
180
|
+
abstract skewness(mapper: Functional<E, D>): D;
|
|
181
|
+
abstract kurtosis(): D;
|
|
182
|
+
abstract kurtosis(mapper: Functional<E, D>): D;
|
|
183
|
+
}
|
|
184
|
+
export declare class NumericStatistics<E> extends Statistics<E, number> {
|
|
185
|
+
protected readonly NumericStatistics: symbol;
|
|
186
|
+
constructor(generator: Generator<E>);
|
|
187
|
+
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
188
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
189
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
190
|
+
average(): number;
|
|
191
|
+
average(mapper: Functional<E, number>): number;
|
|
192
|
+
range(): number;
|
|
193
|
+
range(mapper: Functional<E, number>): number;
|
|
194
|
+
variance(): number;
|
|
195
|
+
variance(mapper: Functional<E, number>): number;
|
|
196
|
+
standardDeviation(): number;
|
|
197
|
+
standardDeviation(mapper: Functional<E, number>): number;
|
|
198
|
+
mean(): number;
|
|
199
|
+
mean(mapper: Functional<E, number>): number;
|
|
200
|
+
median(): number;
|
|
201
|
+
median(mapper: Functional<E, number>): number;
|
|
202
|
+
mode(): number;
|
|
203
|
+
mode(mapper: Functional<E, number>): number;
|
|
204
|
+
summate(): number;
|
|
205
|
+
summate(mapper: Functional<E, number>): number;
|
|
206
|
+
quantile(quantile: number): number;
|
|
207
|
+
quantile(quantile: number, mapper: Functional<E, number>): number;
|
|
208
|
+
interquartileRange(): number;
|
|
209
|
+
interquartileRange(mapper: Functional<E, number>): number;
|
|
210
|
+
skewness(): number;
|
|
211
|
+
skewness(mapper: Functional<E, number>): number;
|
|
212
|
+
kurtosis(): number;
|
|
213
|
+
kurtosis(mapper: Functional<E, number>): number;
|
|
214
|
+
}
|
|
215
|
+
export declare class BigIntStatistics<E> extends Statistics<E, bigint> {
|
|
216
|
+
protected readonly BigIntStatistics: symbol;
|
|
217
|
+
constructor(generator: Generator<E>);
|
|
218
|
+
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
219
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
220
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
221
|
+
average(): bigint;
|
|
222
|
+
average(mapper: Functional<E, bigint>): bigint;
|
|
223
|
+
range(): bigint;
|
|
224
|
+
range(mapper: Functional<E, bigint>): bigint;
|
|
225
|
+
variance(): bigint;
|
|
226
|
+
variance(mapper: Functional<E, bigint>): bigint;
|
|
227
|
+
standardDeviation(): bigint;
|
|
228
|
+
standardDeviation(mapper: Functional<E, bigint>): bigint;
|
|
229
|
+
mean(): bigint;
|
|
230
|
+
mean(mapper: Functional<E, bigint>): bigint;
|
|
231
|
+
median(): bigint;
|
|
232
|
+
median(mapper: Functional<E, bigint>): bigint;
|
|
233
|
+
mode(): bigint;
|
|
234
|
+
mode(mapper: Functional<E, bigint>): bigint;
|
|
235
|
+
summate(): bigint;
|
|
236
|
+
summate(mapper: Functional<E, bigint>): bigint;
|
|
237
|
+
quantile(quantile: number): bigint;
|
|
238
|
+
quantile(quantile: number, mapper: Functional<E, bigint>): bigint;
|
|
239
|
+
interquartileRange(): bigint;
|
|
240
|
+
interquartileRange(mapper: Functional<E, bigint>): bigint;
|
|
241
|
+
skewness(): bigint;
|
|
242
|
+
skewness(mapper: Functional<E, bigint>): bigint;
|
|
243
|
+
kurtosis(): bigint;
|
|
244
|
+
kurtosis(mapper: Functional<E, bigint>): bigint;
|
|
245
|
+
}
|
|
246
|
+
export declare class WindowCollectable<E> extends OrderedCollectable<E> {
|
|
247
|
+
protected readonly WindowCollectable: symbol;
|
|
248
|
+
constructor(generator: Generator<E>);
|
|
249
|
+
constructor(generator: Generator<E>, comparator: Comparator<E>);
|
|
250
|
+
[Symbol.iterator](): globalThis.Generator<E, void, undefined>;
|
|
251
|
+
[Symbol.asyncIterator](): globalThis.AsyncGenerator<E, void, undefined>;
|
|
252
|
+
slide(size: bigint, step?: bigint): Semantic<Semantic<E>>;
|
|
253
|
+
tumble(size: bigint): Semantic<Semantic<E>>;
|
|
254
|
+
}
|