strata.foundation.core 0.0.1 → 0.0.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/Concurrent/CompletableObservable.js +141 -0
- package/{src/Concurrent → Concurrent}/CompletableObservable.ts +5 -6
- package/{dist/Concurrent → Concurrent}/CompletionContext.js +68 -68
- package/Concurrent/CompletionError.js +31 -0
- package/{src/Concurrent → Concurrent}/CompletionError.ts +0 -2
- package/{src/Utility/IMultiMap.js → Concurrent/ICompletionStage.js} +2 -3
- package/{dist/Utility → Container}/IMultiMap.js +0 -1
- package/{dist/Utility → Container}/MultiMap.js +54 -54
- package/{dist/index.js → index.js} +11 -11
- package/{src/index.ts → index.ts} +2 -2
- package/package.json +9 -6
- package/strata.foundation.core-0.0.3.tgz +0 -0
- package/tsconfig.json +5 -5
- package/Strata.Foundation.Core.iml +0 -10
- package/dist/Concurrent/CompletableObservable.d.ts +0 -24
- package/dist/Concurrent/CompletableObservable.js +0 -129
- package/dist/Concurrent/CompletableObservable.js.map +0 -1
- package/dist/Concurrent/CompletionContext.d.ts +0 -19
- package/dist/Concurrent/CompletionContext.js.map +0 -1
- package/dist/Concurrent/CompletionError.d.ts +0 -5
- package/dist/Concurrent/CompletionError.js +0 -14
- package/dist/Concurrent/CompletionError.js.map +0 -1
- package/dist/Concurrent/ICompletionStage.d.ts +0 -7
- package/dist/Concurrent/ICompletionStage.js +0 -3
- package/dist/Concurrent/ICompletionStage.js.map +0 -1
- package/dist/Utility/IMultiMap.d.ts +0 -12
- package/dist/Utility/IMultiMap.js.map +0 -1
- package/dist/Utility/MultiMap.d.ts +0 -15
- package/dist/Utility/MultiMap.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js.map +0 -1
- package/src/Utility/MultiMap.js +0 -60
- package/strata.foundation.core-0.0.1.tgz +0 -0
- /package/{src/Concurrent → Concurrent}/CompletionContext.ts +0 -0
- /package/{src/Concurrent → Concurrent}/ICompletionStage.ts +0 -0
- /package/{src/Utility → Container}/IMultiMap.js.map +0 -0
- /package/{src/Utility → Container}/IMultiMap.ts +0 -0
- /package/{src/Utility → Container}/MultiMap.js.map +0 -0
- /package/{src/Utility → Container}/MultiMap.ts +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompletableObservable = void 0;
|
|
4
|
+
var rxjs_1 = require("rxjs");
|
|
5
|
+
var operators_1 = require("rxjs/operators");
|
|
6
|
+
var CompletionContext_1 = require("./CompletionContext");
|
|
7
|
+
var CompletionError_1 = require("./CompletionError");
|
|
8
|
+
var CompletableObservable = /** @class */ (function () {
|
|
9
|
+
function CompletableObservable(observable, hasContext) {
|
|
10
|
+
if (hasContext === void 0) { hasContext = false; }
|
|
11
|
+
if (hasContext)
|
|
12
|
+
this.observable = observable;
|
|
13
|
+
else
|
|
14
|
+
this.observable = this.initializeObservable(observable);
|
|
15
|
+
}
|
|
16
|
+
CompletableObservable.prototype.thenApply = function (func) {
|
|
17
|
+
var _this = this;
|
|
18
|
+
return new CompletableObservable(this
|
|
19
|
+
.observable
|
|
20
|
+
.pipe((0, operators_1.map)(function (context) { return _this.doApply(context, func); })), true);
|
|
21
|
+
};
|
|
22
|
+
CompletableObservable.prototype.thenCompose = function (func) {
|
|
23
|
+
var _this = this;
|
|
24
|
+
return new CompletableObservable(this
|
|
25
|
+
.observable
|
|
26
|
+
.pipe(
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
(0, operators_1.mergeMap)(function (context, i) {
|
|
29
|
+
return _this.toObservable(_this.doCompose(func, context))
|
|
30
|
+
.pipe((0, operators_1.map)(function (context) { return context; }));
|
|
31
|
+
})), true);
|
|
32
|
+
};
|
|
33
|
+
CompletableObservable.prototype.thenAccept = function (consumer, handler) {
|
|
34
|
+
var _this = this;
|
|
35
|
+
return new CompletableObservable(this
|
|
36
|
+
.observable
|
|
37
|
+
.pipe((0, operators_1.map)(function (context) { return _this.doAccept(context, consumer, handler); })), true);
|
|
38
|
+
};
|
|
39
|
+
CompletableObservable.prototype.exceptionally = function (func) {
|
|
40
|
+
var _this = this;
|
|
41
|
+
return new CompletableObservable(this
|
|
42
|
+
.observable
|
|
43
|
+
.pipe((0, operators_1.map)(function (context) { return _this.doExceptionally(context, func); })), true);
|
|
44
|
+
};
|
|
45
|
+
CompletableObservable.prototype.subscribe = function (consumer, handler) {
|
|
46
|
+
if (consumer == null)
|
|
47
|
+
consumer = function (result) { };
|
|
48
|
+
if (handler == null)
|
|
49
|
+
handler = function (error) { };
|
|
50
|
+
this
|
|
51
|
+
.observable
|
|
52
|
+
.subscribe(function (context) {
|
|
53
|
+
if (context.hasError())
|
|
54
|
+
handler(context.getError());
|
|
55
|
+
else
|
|
56
|
+
consumer(context.getResult());
|
|
57
|
+
}, function (error) { return handler(error); });
|
|
58
|
+
};
|
|
59
|
+
CompletableObservable.fromResult = function (result) {
|
|
60
|
+
return new CompletableObservable((0, rxjs_1.of)(result), false);
|
|
61
|
+
};
|
|
62
|
+
CompletableObservable.fromObservable = function (observable) {
|
|
63
|
+
return new CompletableObservable(observable, false);
|
|
64
|
+
};
|
|
65
|
+
CompletableObservable.fromPromise = function (promise) {
|
|
66
|
+
return new CompletableObservable((0, rxjs_1.from)(promise), false);
|
|
67
|
+
};
|
|
68
|
+
CompletableObservable.fromError = function (error) {
|
|
69
|
+
return new CompletableObservable(new rxjs_1.Observable(function (observer) {
|
|
70
|
+
return observer.next(CompletionContext_1.CompletionContext.ofError(new CompletionError_1.CompletionError(error)));
|
|
71
|
+
}), true);
|
|
72
|
+
};
|
|
73
|
+
CompletableObservable.supplyAsync = function (supplier) {
|
|
74
|
+
return new CompletableObservable(new rxjs_1.Observable(function (observer) { return observer.next(supplier()); }), false);
|
|
75
|
+
};
|
|
76
|
+
CompletableObservable.prototype.initializeObservable = function (input) {
|
|
77
|
+
return input.pipe((0, operators_1.map)(function (value) { return CompletionContext_1.CompletionContext.ofResult(value); }));
|
|
78
|
+
};
|
|
79
|
+
CompletableObservable.prototype.doApply = function (context, func) {
|
|
80
|
+
console.log("doApply");
|
|
81
|
+
if (context.hasError())
|
|
82
|
+
return CompletionContext_1.CompletionContext.ofError(context.getError());
|
|
83
|
+
try {
|
|
84
|
+
return CompletionContext_1.CompletionContext.ofResult(func(context.getResult()));
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
console.log("Caught exception in doApply");
|
|
88
|
+
return CompletionContext_1.CompletionContext.ofError(new CompletionError_1.CompletionError(e));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
CompletableObservable.prototype.doCompose = function (func, context) {
|
|
92
|
+
console.log("doCompose");
|
|
93
|
+
if (context.hasError())
|
|
94
|
+
return CompletionContext_1.CompletionContext.ofError(context.getError());
|
|
95
|
+
try {
|
|
96
|
+
return CompletionContext_1.CompletionContext.ofResult(func(context.getResult()));
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
console.log("Caught exception in doCompose");
|
|
100
|
+
return CompletionContext_1.CompletionContext.ofError(e);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
CompletableObservable.prototype.doAccept = function (context, consumer, handler) {
|
|
104
|
+
console.log("doAccept");
|
|
105
|
+
if (context.hasError()) {
|
|
106
|
+
if (handler != null) {
|
|
107
|
+
try {
|
|
108
|
+
handler(context.getError());
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
console.log("Caught exception in doAccept");
|
|
112
|
+
return context.setError(new CompletionError_1.CompletionError(e));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
try {
|
|
118
|
+
consumer(context.getResult());
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
return context.setError(new CompletionError_1.CompletionError(e));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return context;
|
|
125
|
+
};
|
|
126
|
+
CompletableObservable.prototype.doExceptionally = function (context, func) {
|
|
127
|
+
console.log("doExceptionally");
|
|
128
|
+
if (context.hasError())
|
|
129
|
+
return CompletionContext_1.CompletionContext.ofResult(func(context.getError()));
|
|
130
|
+
return context;
|
|
131
|
+
};
|
|
132
|
+
CompletableObservable.prototype.toObservable = function (input) {
|
|
133
|
+
if (input.hasResult())
|
|
134
|
+
return input.getResult().observable;
|
|
135
|
+
return this.observable.pipe((0, operators_1.map)(function (context, ignore) {
|
|
136
|
+
return CompletionContext_1.CompletionContext.ofError(input.getError());
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
return CompletableObservable;
|
|
140
|
+
}());
|
|
141
|
+
exports.CompletableObservable = CompletableObservable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ICompletionStage} from "./ICompletionStage";
|
|
2
2
|
import {from,Observable,of} from "rxjs";
|
|
3
|
-
import {map,mergeMap} from
|
|
3
|
+
import {map,mergeMap} from 'rxjs/operators';
|
|
4
4
|
import {CompletionContext} from "./CompletionContext";
|
|
5
5
|
import {CompletionError} from "./CompletionError";
|
|
6
6
|
|
|
@@ -35,11 +35,10 @@ class CompletableObservable<T>
|
|
|
35
35
|
return new CompletableObservable<U>(
|
|
36
36
|
this
|
|
37
37
|
.observable
|
|
38
|
-
.pipe(
|
|
38
|
+
.pipe<CompletionContext<U>>(
|
|
39
39
|
mergeMap(
|
|
40
|
-
|
|
41
|
-
this
|
|
42
|
-
.toObservable<U>(this.doCompose<U>(func,context))
|
|
40
|
+
context =>
|
|
41
|
+
this.toObservable<U>(this.doCompose<U>(func,context))
|
|
43
42
|
.pipe(map(context => context)))),
|
|
44
43
|
true);
|
|
45
44
|
}
|
|
@@ -98,7 +97,7 @@ class CompletableObservable<T>
|
|
|
98
97
|
|
|
99
98
|
static fromPromise<U>(promise: Promise<U>): ICompletionStage<U>
|
|
100
99
|
{
|
|
101
|
-
return new CompletableObservable<U>(from(promise),false);
|
|
100
|
+
return new CompletableObservable<U>(<Observable<U>>from(promise),false);
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
static fromError<U>(error: Error): ICompletionStage<U>
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompletionContext = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.result = result;
|
|
8
|
-
this.error = error;
|
|
9
|
-
}
|
|
10
|
-
setResult(result) {
|
|
11
|
-
this.result = result;
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
clearResult() {
|
|
15
|
-
this.result = null;
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
setError(error) {
|
|
19
|
-
this.error = error;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
clearError() {
|
|
23
|
-
this.error = null;
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
getResult() {
|
|
27
|
-
return this.result;
|
|
28
|
-
}
|
|
29
|
-
getError() {
|
|
30
|
-
return this.error;
|
|
31
|
-
}
|
|
32
|
-
hasResult() {
|
|
33
|
-
return this.result != null;
|
|
34
|
-
}
|
|
35
|
-
hasError() {
|
|
36
|
-
return this.error != null;
|
|
37
|
-
}
|
|
38
|
-
combine(other, combiner) {
|
|
39
|
-
if (this.hasError() || other.hasError()) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (x != null && y != null)
|
|
43
|
-
return new CompletionContext(combiner(this.getResult(), other.getResult()), new CompletionError_1.CompletionError([x.getCause(), y.getCause()]));
|
|
44
|
-
else if (x != null)
|
|
45
|
-
return new CompletionContext(combiner(this.getResult(), other.getResult()), x);
|
|
46
|
-
else
|
|
47
|
-
return new CompletionContext(combiner(this.getResult(), other.getResult()), y);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return CompletionContext.ofResult(combiner(this.getResult(), other.getResult()));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
accept(consumer) {
|
|
54
|
-
consumer(this);
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return new CompletionContext(null, null);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return new CompletionContext(result, null);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return new CompletionContext(null, error);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompletionContext = void 0;
|
|
4
|
+
var CompletionError_1 = require("./CompletionError");
|
|
5
|
+
var CompletionContext = /** @class */ (function () {
|
|
6
|
+
function CompletionContext(result, error) {
|
|
7
|
+
this.result = result;
|
|
8
|
+
this.error = error;
|
|
9
|
+
}
|
|
10
|
+
CompletionContext.prototype.setResult = function (result) {
|
|
11
|
+
this.result = result;
|
|
12
|
+
return this;
|
|
13
|
+
};
|
|
14
|
+
CompletionContext.prototype.clearResult = function () {
|
|
15
|
+
this.result = null;
|
|
16
|
+
return this;
|
|
17
|
+
};
|
|
18
|
+
CompletionContext.prototype.setError = function (error) {
|
|
19
|
+
this.error = error;
|
|
20
|
+
return this;
|
|
21
|
+
};
|
|
22
|
+
CompletionContext.prototype.clearError = function () {
|
|
23
|
+
this.error = null;
|
|
24
|
+
return this;
|
|
25
|
+
};
|
|
26
|
+
CompletionContext.prototype.getResult = function () {
|
|
27
|
+
return this.result;
|
|
28
|
+
};
|
|
29
|
+
CompletionContext.prototype.getError = function () {
|
|
30
|
+
return this.error;
|
|
31
|
+
};
|
|
32
|
+
CompletionContext.prototype.hasResult = function () {
|
|
33
|
+
return this.result != null;
|
|
34
|
+
};
|
|
35
|
+
CompletionContext.prototype.hasError = function () {
|
|
36
|
+
return this.error != null;
|
|
37
|
+
};
|
|
38
|
+
CompletionContext.prototype.combine = function (other, combiner) {
|
|
39
|
+
if (this.hasError() || other.hasError()) {
|
|
40
|
+
var x = this.getError();
|
|
41
|
+
var y = other.getError();
|
|
42
|
+
if (x != null && y != null)
|
|
43
|
+
return new CompletionContext(combiner(this.getResult(), other.getResult()), new CompletionError_1.CompletionError([x.getCause(), y.getCause()]));
|
|
44
|
+
else if (x != null)
|
|
45
|
+
return new CompletionContext(combiner(this.getResult(), other.getResult()), x);
|
|
46
|
+
else
|
|
47
|
+
return new CompletionContext(combiner(this.getResult(), other.getResult()), y);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return CompletionContext.ofResult(combiner(this.getResult(), other.getResult()));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
CompletionContext.prototype.accept = function (consumer) {
|
|
54
|
+
consumer(this);
|
|
55
|
+
return this;
|
|
56
|
+
};
|
|
57
|
+
CompletionContext.empty = function () {
|
|
58
|
+
return new CompletionContext(null, null);
|
|
59
|
+
};
|
|
60
|
+
CompletionContext.ofResult = function (result) {
|
|
61
|
+
return new CompletionContext(result, null);
|
|
62
|
+
};
|
|
63
|
+
CompletionContext.ofError = function (error) {
|
|
64
|
+
return new CompletionContext(null, error);
|
|
65
|
+
};
|
|
66
|
+
return CompletionContext;
|
|
67
|
+
}());
|
|
68
|
+
exports.CompletionContext = CompletionContext;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.CompletionError = void 0;
|
|
19
|
+
var CompletionError = /** @class */ (function (_super) {
|
|
20
|
+
__extends(CompletionError, _super);
|
|
21
|
+
function CompletionError(cause) {
|
|
22
|
+
var _this = _super.call(this, cause instanceof Error ? cause.message : cause.toString()) || this;
|
|
23
|
+
_this.cause = cause;
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
CompletionError.prototype.getCause = function () {
|
|
27
|
+
return this.cause;
|
|
28
|
+
};
|
|
29
|
+
return CompletionError;
|
|
30
|
+
}(Error));
|
|
31
|
+
exports.CompletionError = CompletionError;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=IMultiMap.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MultiMap = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.imp = new Map();
|
|
7
|
-
}
|
|
8
|
-
put(key, value) {
|
|
9
|
-
if (key == null)
|
|
10
|
-
throw new Error("key is null");
|
|
11
|
-
if (!this.imp.has(key))
|
|
12
|
-
this.imp.set(key, new Array());
|
|
13
|
-
this.imp.get(key).push(value);
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
remove(key, value) {
|
|
17
|
-
if (value) {
|
|
18
|
-
if (this.imp.has(key)) {
|
|
19
|
-
|
|
20
|
-
values.slice(values.indexOf(value), 1);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
if (this.imp.has(key))
|
|
25
|
-
this.imp.delete(key);
|
|
26
|
-
}
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
get(key) {
|
|
30
|
-
return this.imp.get(key);
|
|
31
|
-
}
|
|
32
|
-
getAt(key, index) {
|
|
33
|
-
return this.imp.get(key)[index];
|
|
34
|
-
}
|
|
35
|
-
getCardinality(key) {
|
|
36
|
-
return this.imp.get(key).length;
|
|
37
|
-
}
|
|
38
|
-
getKeys() {
|
|
39
|
-
return Array.from(this.imp.keys());
|
|
40
|
-
}
|
|
41
|
-
getValues() {
|
|
42
|
-
return Array.from(this.imp.values());
|
|
43
|
-
}
|
|
44
|
-
containsKey(key) {
|
|
45
|
-
return this.imp.has(key);
|
|
46
|
-
}
|
|
47
|
-
containsValue(key, value) {
|
|
48
|
-
if (this.containsKey(key))
|
|
49
|
-
return this.get(key).includes(value);
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MultiMap = void 0;
|
|
4
|
+
var MultiMap = /** @class */ (function () {
|
|
5
|
+
function MultiMap() {
|
|
6
|
+
this.imp = new Map();
|
|
7
|
+
}
|
|
8
|
+
MultiMap.prototype.put = function (key, value) {
|
|
9
|
+
if (key == null)
|
|
10
|
+
throw new Error("key is null");
|
|
11
|
+
if (!this.imp.has(key))
|
|
12
|
+
this.imp.set(key, new Array());
|
|
13
|
+
this.imp.get(key).push(value);
|
|
14
|
+
return this;
|
|
15
|
+
};
|
|
16
|
+
MultiMap.prototype.remove = function (key, value) {
|
|
17
|
+
if (value) {
|
|
18
|
+
if (this.imp.has(key)) {
|
|
19
|
+
var values = this.imp.get(key);
|
|
20
|
+
values.slice(values.indexOf(value), 1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (this.imp.has(key))
|
|
25
|
+
this.imp.delete(key);
|
|
26
|
+
}
|
|
27
|
+
return this;
|
|
28
|
+
};
|
|
29
|
+
MultiMap.prototype.get = function (key) {
|
|
30
|
+
return this.imp.get(key);
|
|
31
|
+
};
|
|
32
|
+
MultiMap.prototype.getAt = function (key, index) {
|
|
33
|
+
return this.imp.get(key)[index];
|
|
34
|
+
};
|
|
35
|
+
MultiMap.prototype.getCardinality = function (key) {
|
|
36
|
+
return this.imp.get(key).length;
|
|
37
|
+
};
|
|
38
|
+
MultiMap.prototype.getKeys = function () {
|
|
39
|
+
return Array.from(this.imp.keys());
|
|
40
|
+
};
|
|
41
|
+
MultiMap.prototype.getValues = function () {
|
|
42
|
+
return Array.from(this.imp.values());
|
|
43
|
+
};
|
|
44
|
+
MultiMap.prototype.containsKey = function (key) {
|
|
45
|
+
return this.imp.has(key);
|
|
46
|
+
};
|
|
47
|
+
MultiMap.prototype.containsValue = function (key, value) {
|
|
48
|
+
if (this.containsKey(key))
|
|
49
|
+
return this.get(key).includes(value);
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
52
|
+
return MultiMap;
|
|
53
|
+
}());
|
|
54
|
+
exports.MultiMap = MultiMap;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompletionError = exports.CompletionContext = exports.CompletableObservable = exports.MultiMap = void 0;
|
|
4
|
+
var MultiMap_1 = require("./Container/MultiMap");
|
|
5
|
+
Object.defineProperty(exports, "MultiMap", { enumerable: true, get: function () { return MultiMap_1.MultiMap; } });
|
|
6
|
+
var CompletableObservable_1 = require("./Concurrent/CompletableObservable");
|
|
7
|
+
Object.defineProperty(exports, "CompletableObservable", { enumerable: true, get: function () { return CompletableObservable_1.CompletableObservable; } });
|
|
8
|
+
var CompletionContext_1 = require("./Concurrent/CompletionContext");
|
|
9
|
+
Object.defineProperty(exports, "CompletionContext", { enumerable: true, get: function () { return CompletionContext_1.CompletionContext; } });
|
|
10
|
+
var CompletionError_1 = require("./Concurrent/CompletionError");
|
|
11
|
+
Object.defineProperty(exports, "CompletionError", { enumerable: true, get: function () { return CompletionError_1.CompletionError; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {IMultiMap} from './
|
|
2
|
-
export {MultiMap} from './
|
|
1
|
+
export {IMultiMap} from './Container/IMultiMap';
|
|
2
|
+
export {MultiMap} from './Container/MultiMap';
|
|
3
3
|
|
|
4
4
|
export {ICompletionStage} from './Concurrent/ICompletionStage';
|
|
5
5
|
export {CompletableObservable} from './Concurrent/CompletableObservable';
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strata.foundation.core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "build/dist/index.js",
|
|
6
|
+
"types": "build/dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"clean": "del-cli -f
|
|
9
|
-
"build": "
|
|
8
|
+
"clean": "del-cli -f build/dist ./*.tgz",
|
|
9
|
+
"build": "npm pack",
|
|
10
|
+
"publish": "npm publish",
|
|
11
|
+
"new-patch": "npm version patch",
|
|
12
|
+
"new-minor": "npm version minor",
|
|
10
13
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
14
|
},
|
|
12
15
|
"keywords": [],
|
|
13
16
|
"author": "",
|
|
14
17
|
"license": "ISC",
|
|
15
18
|
"dependencies": {
|
|
16
|
-
"rxjs": "^
|
|
19
|
+
"rxjs": "^7.8.1"
|
|
17
20
|
}
|
|
18
21
|
}
|
|
Binary file
|
package/tsconfig.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"module": "
|
|
4
|
-
"target": "
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"target": "es2018",
|
|
5
5
|
"sourceMap": true,
|
|
6
6
|
"declaration": true,
|
|
7
|
-
"outDir": "
|
|
7
|
+
"outDir": "build/dist"
|
|
8
8
|
},
|
|
9
9
|
"include": [
|
|
10
|
-
"
|
|
10
|
+
"**/*",
|
|
11
11
|
"typings/**/*"
|
|
12
12
|
],
|
|
13
13
|
"exclude": [
|
|
14
14
|
"node_modules",
|
|
15
15
|
"lib",
|
|
16
|
-
"Strata.
|
|
16
|
+
"Strata.Client.Core.iml"
|
|
17
17
|
]
|
|
18
18
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$">
|
|
6
|
-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
7
|
-
</content>
|
|
8
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
9
|
-
</component>
|
|
10
|
-
</module>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ICompletionStage } from "./ICompletionStage";
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
import { CompletionContext } from "./CompletionContext";
|
|
4
|
-
import { CompletionError } from "./CompletionError";
|
|
5
|
-
export declare class CompletableObservable<T> implements ICompletionStage<T> {
|
|
6
|
-
private observable;
|
|
7
|
-
protected constructor(observable: Observable<T> | Observable<CompletionContext<T>>, hasContext?: boolean);
|
|
8
|
-
thenApply<U>(func: (input: T) => U): ICompletionStage<U>;
|
|
9
|
-
thenCompose<U>(func: (input: T) => ICompletionStage<U>): ICompletionStage<U>;
|
|
10
|
-
thenAccept(consumer: (input: T) => void, handler?: (error: Error) => void): ICompletionStage<T>;
|
|
11
|
-
exceptionally(func: (error: Error) => T): ICompletionStage<T>;
|
|
12
|
-
subscribe(consumer?: (result: T) => void, handler?: (error: CompletionError) => void): void;
|
|
13
|
-
static fromResult<U>(result: U): ICompletionStage<U>;
|
|
14
|
-
static fromObservable<U>(observable: Observable<U>): ICompletionStage<U>;
|
|
15
|
-
static fromPromise<U>(promise: Promise<U>): ICompletionStage<U>;
|
|
16
|
-
static fromError<U>(error: Error): ICompletionStage<U>;
|
|
17
|
-
static supplyAsync<U>(supplier: () => U): ICompletionStage<U>;
|
|
18
|
-
private initializeObservable;
|
|
19
|
-
private doApply;
|
|
20
|
-
private doCompose;
|
|
21
|
-
private doAccept;
|
|
22
|
-
private doExceptionally;
|
|
23
|
-
private toObservable;
|
|
24
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompletableObservable = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const CompletionContext_1 = require("./CompletionContext");
|
|
7
|
-
const CompletionError_1 = require("./CompletionError");
|
|
8
|
-
class CompletableObservable {
|
|
9
|
-
constructor(observable, hasContext = false) {
|
|
10
|
-
if (hasContext)
|
|
11
|
-
this.observable = observable;
|
|
12
|
-
else
|
|
13
|
-
this.observable = this.initializeObservable(observable);
|
|
14
|
-
}
|
|
15
|
-
thenApply(func) {
|
|
16
|
-
return new CompletableObservable(this
|
|
17
|
-
.observable
|
|
18
|
-
.pipe(operators_1.map(context => this.doApply(context, func))), true);
|
|
19
|
-
}
|
|
20
|
-
thenCompose(func) {
|
|
21
|
-
return new CompletableObservable(this
|
|
22
|
-
.observable
|
|
23
|
-
.pipe(operators_1.mergeMap((context, i) => this
|
|
24
|
-
.toObservable(this.doCompose(func, context))
|
|
25
|
-
.pipe(operators_1.map(context => context)))), true);
|
|
26
|
-
}
|
|
27
|
-
thenAccept(consumer, handler) {
|
|
28
|
-
return new CompletableObservable(this
|
|
29
|
-
.observable
|
|
30
|
-
.pipe(operators_1.map(context => this.doAccept(context, consumer, handler))), true);
|
|
31
|
-
}
|
|
32
|
-
exceptionally(func) {
|
|
33
|
-
return new CompletableObservable(this
|
|
34
|
-
.observable
|
|
35
|
-
.pipe(operators_1.map(context => this.doExceptionally(context, func))), true);
|
|
36
|
-
}
|
|
37
|
-
subscribe(consumer, handler) {
|
|
38
|
-
if (consumer == null)
|
|
39
|
-
consumer = result => { };
|
|
40
|
-
if (handler == null)
|
|
41
|
-
handler = error => { };
|
|
42
|
-
this
|
|
43
|
-
.observable
|
|
44
|
-
.subscribe(context => {
|
|
45
|
-
if (context.hasError())
|
|
46
|
-
handler(context.getError());
|
|
47
|
-
else
|
|
48
|
-
consumer(context.getResult());
|
|
49
|
-
}, error => handler(error));
|
|
50
|
-
}
|
|
51
|
-
static fromResult(result) {
|
|
52
|
-
return new CompletableObservable(rxjs_1.of(result), false);
|
|
53
|
-
}
|
|
54
|
-
static fromObservable(observable) {
|
|
55
|
-
return new CompletableObservable(observable, false);
|
|
56
|
-
}
|
|
57
|
-
static fromPromise(promise) {
|
|
58
|
-
return new CompletableObservable(rxjs_1.from(promise), false);
|
|
59
|
-
}
|
|
60
|
-
static fromError(error) {
|
|
61
|
-
return new CompletableObservable(new rxjs_1.Observable(observer => observer.next(CompletionContext_1.CompletionContext.ofError(new CompletionError_1.CompletionError(error)))), true);
|
|
62
|
-
}
|
|
63
|
-
static supplyAsync(supplier) {
|
|
64
|
-
return new CompletableObservable(new rxjs_1.Observable(observer => observer.next(supplier())), false);
|
|
65
|
-
}
|
|
66
|
-
initializeObservable(input) {
|
|
67
|
-
return input.pipe(operators_1.map(value => CompletionContext_1.CompletionContext.ofResult(value)));
|
|
68
|
-
}
|
|
69
|
-
doApply(context, func) {
|
|
70
|
-
console.log("doApply");
|
|
71
|
-
if (context.hasError())
|
|
72
|
-
return CompletionContext_1.CompletionContext.ofError(context.getError());
|
|
73
|
-
try {
|
|
74
|
-
return CompletionContext_1.CompletionContext.ofResult(func(context.getResult()));
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
console.log("Caught exception in doApply");
|
|
78
|
-
return CompletionContext_1.CompletionContext.ofError(new CompletionError_1.CompletionError(e));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
doCompose(func, context) {
|
|
82
|
-
console.log("doCompose");
|
|
83
|
-
if (context.hasError())
|
|
84
|
-
return CompletionContext_1.CompletionContext.ofError(context.getError());
|
|
85
|
-
try {
|
|
86
|
-
return CompletionContext_1.CompletionContext.ofResult(func(context.getResult()));
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
console.log("Caught exception in doCompose");
|
|
90
|
-
return CompletionContext_1.CompletionContext.ofError(e);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
doAccept(context, consumer, handler) {
|
|
94
|
-
console.log("doAccept");
|
|
95
|
-
if (context.hasError()) {
|
|
96
|
-
if (handler != null) {
|
|
97
|
-
try {
|
|
98
|
-
handler(context.getError());
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
console.log("Caught exception in doAccept");
|
|
102
|
-
return context.setError(new CompletionError_1.CompletionError(e));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
try {
|
|
108
|
-
consumer(context.getResult());
|
|
109
|
-
}
|
|
110
|
-
catch (e) {
|
|
111
|
-
return context.setError(new CompletionError_1.CompletionError(e));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return context;
|
|
115
|
-
}
|
|
116
|
-
doExceptionally(context, func) {
|
|
117
|
-
console.log("doExceptionally");
|
|
118
|
-
if (context.hasError())
|
|
119
|
-
return CompletionContext_1.CompletionContext.ofResult(func(context.getError()));
|
|
120
|
-
return context;
|
|
121
|
-
}
|
|
122
|
-
toObservable(input) {
|
|
123
|
-
if (input.hasResult())
|
|
124
|
-
return input.getResult().observable;
|
|
125
|
-
return this.observable.pipe(operators_1.map((context, ignore) => CompletionContext_1.CompletionContext.ofError(input.getError())));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.CompletableObservable = CompletableObservable;
|
|
129
|
-
//# sourceMappingURL=CompletableObservable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompletableObservable.js","sourceRoot":"","sources":["../../src/Concurrent/CompletableObservable.ts"],"names":[],"mappings":";;;AACA,+BAAwC;AACxC,8CAA4C;AAC5C,2DAAsD;AACtD,uDAAkD;AAElD,MACM,qBAAqB;IAKvB,YACI,UAA0D,EAC1D,aAAsB,KAAK;QAE3B,IAAI,UAAU;YACV,IAAI,CAAC,UAAU,GAAqC,UAAU,CAAC;;YAE/D,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAgB,UAAU,CAAC,CAAC;IAE/E,CAAC;IAED,SAAS,CAAI,IAAqB;QAE9B,OAAO,IAAI,qBAAqB,CAC5B,IAAI;aACC,UAAU;aACV,IAAI,CAAC,eAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAC,IAAI,CAAC,CAAC,CAAC,EACrD,IAAI,CAAC,CAAC;IACd,CAAC;IAED,WAAW,CAAI,IAAuC;QAElD,OAAO,IAAI,qBAAqB,CAC5B,IAAI;aACC,UAAU;aACV,IAAI,CACD,oBAAQ,CACJ,CAAC,OAAO,EAAC,CAAC,EAAE,EAAE,CACV,IAAI;aACC,YAAY,CAAI,IAAI,CAAC,SAAS,CAAI,IAAI,EAAC,OAAO,CAAC,CAAC;aAChD,IAAI,CAAC,eAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,IAAI,CAAC,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,OAAO,CAAC,QAAQ,EAAE;YAClB,OAAO,qCAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAEhE,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,YAAY,CAAI,KAA6C;QAEjE,IAAI,KAAK,CAAC,SAAS,EAAE;YACjB,OAAkC,KAAK,CAAC,SAAS,EAAG,CAAC,UAAU,CAAC;QAEpE,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACvB,eAAG,CACC,CAAC,OAAO,EAAC,MAAM,EAAE,EAAE,CACf,qCAAiB,CAAC,OAAO,CAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC;CACJ;AApND,sDAoNC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CompletionError } from "./CompletionError";
|
|
2
|
-
export declare class CompletionContext<T> {
|
|
3
|
-
private result;
|
|
4
|
-
private error;
|
|
5
|
-
protected constructor(result: T, error: CompletionError);
|
|
6
|
-
setResult(result: T): CompletionContext<T>;
|
|
7
|
-
clearResult(): CompletionContext<T>;
|
|
8
|
-
setError(error: CompletionError): CompletionContext<T>;
|
|
9
|
-
clearError(): CompletionContext<T>;
|
|
10
|
-
getResult(): T;
|
|
11
|
-
getError(): CompletionError;
|
|
12
|
-
hasResult(): boolean;
|
|
13
|
-
hasError(): boolean;
|
|
14
|
-
combine(other: CompletionContext<T>, combiner: (x: T, y: T) => T): CompletionContext<T>;
|
|
15
|
-
accept(consumer: (context: CompletionContext<T>) => void): CompletionContext<T>;
|
|
16
|
-
static empty<T>(): CompletionContext<T>;
|
|
17
|
-
static ofResult<T>(result: T): CompletionContext<T>;
|
|
18
|
-
static ofError<T>(error: CompletionError): CompletionContext<T>;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompletionContext.js","sourceRoot":"","sources":["../../src/Concurrent/CompletionContext.ts"],"names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Ae,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;iBACrD,IAAI,CAAC,IAAI,IAAI;gBACd,OAAO,IAAI,iBAAiB,CACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAC5C,CAAC,CAAC,CAAC;;gBAEP,OAAO,IAAI,iBAAiB,CACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAC5C,CAAC,CAAC,CAAC;SACd;aAED;YACI,OAAO,iBAAiB,CAAC,QAAQ,CAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;SACrD;IACL,CAAC;IAED,MAAM,CAAC,QAAiD;QAEpD,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,KAAK;QAER,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,QAAQ,CAAI,MAAS;QAExB,OAAO,IAAI,iBAAiB,CAAI,MAAM,EAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,OAAO,CAAI,KAAsB;QAEpC,OAAO,IAAI,iBAAiB,CAAI,IAAI,EAAC,KAAK,CAAC,CAAC;IAChD,CAAC;CACJ;AAvGD,8CAuGC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompletionError = void 0;
|
|
4
|
-
class CompletionError extends Error {
|
|
5
|
-
constructor(cause) {
|
|
6
|
-
super(cause instanceof Error ? cause.message : cause.toString());
|
|
7
|
-
this.cause = cause;
|
|
8
|
-
}
|
|
9
|
-
getCause() {
|
|
10
|
-
return this.cause;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.CompletionError = CompletionError;
|
|
14
|
-
//# sourceMappingURL=CompletionError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompletionError.js","sourceRoot":"","sources":["../../src/Concurrent/CompletionError.ts"],"names":[],"mappings":";;;AAEA,MACM,eACF,SAAQ,KAAK;IAIb,YAAY,KAAU;QAElB,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,QAAQ;QAEJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;CACJ;AAhBD,0CAgBC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export interface ICompletionStage<T> {
|
|
2
|
-
thenApply<U>(func: (input: T) => U): ICompletionStage<U>;
|
|
3
|
-
thenCompose<U>(func: (input: T) => ICompletionStage<U>): ICompletionStage<U>;
|
|
4
|
-
thenAccept(consumer: (result: T) => void, handler?: (error: Error) => void): ICompletionStage<T>;
|
|
5
|
-
exceptionally(func: (error: Error) => T): ICompletionStage<T>;
|
|
6
|
-
subscribe(consumer?: (result: T) => void, handler?: (error: Error) => void): void;
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ICompletionStage.js","sourceRoot":"","sources":["../../src/Concurrent/ICompletionStage.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface IMultiMap<K, V> {
|
|
2
|
-
put(key: K, value: V): IMultiMap<K, V>;
|
|
3
|
-
remove(key: K): IMultiMap<K, V>;
|
|
4
|
-
remove(key: K, value: V): IMultiMap<K, V>;
|
|
5
|
-
get(key: K): Array<V>;
|
|
6
|
-
getAt(key: K, index: number): V;
|
|
7
|
-
getCardinality(key: K): number;
|
|
8
|
-
getKeys(): Array<K>;
|
|
9
|
-
getValues(): Array<Array<V>>;
|
|
10
|
-
containsKey(key: K): boolean;
|
|
11
|
-
containsValue(key: K, value: V): boolean;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IMultiMap.js","sourceRoot":"","sources":["../../src/Utility/IMultiMap.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IMultiMap } from "./IMultiMap";
|
|
2
|
-
export declare class MultiMap<K, V> implements IMultiMap<K, V> {
|
|
3
|
-
private imp;
|
|
4
|
-
constructor();
|
|
5
|
-
put(key: K, value: V): IMultiMap<K, V>;
|
|
6
|
-
remove(key: K): IMultiMap<K, V>;
|
|
7
|
-
remove(key: K, value: V): IMultiMap<K, V>;
|
|
8
|
-
get(key: K): Array<V>;
|
|
9
|
-
getAt(key: K, index: number): V;
|
|
10
|
-
getCardinality(key: K): number;
|
|
11
|
-
getKeys(): Array<K>;
|
|
12
|
-
getValues(): Array<Array<V>>;
|
|
13
|
-
containsKey(key: K): boolean;
|
|
14
|
-
containsValue(key: K, value: V): boolean;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiMap.js","sourceRoot":"","sources":["../../src/Utility/MultiMap.ts"],"names":[],"mappings":";;;AAEA,MACM,QAAQ;IAKV;QAEI,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,EAAc,CAAC;IACrC,CAAC;IAED,GAAG,CAAC,GAAM,EAAE,KAAQ;QAEhB,IAAK,GAAG,IAAI,IAAI;YACZ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QAEnC,IAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAE,GAAG,CAAE;YACrB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAE,GAAG,EAAC,IAAI,KAAK,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AG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,aAAa,CAAC,GAAM,EAAE,KAAQ;QAE1B,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YACrB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEzC,OAAO,KAAK,CAAC;IACjB,CAAC;CAEJ;AAnFD,4BAmFC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { IMultiMap } from './Utility/IMultiMap';
|
|
2
|
-
export { MultiMap } from './Utility/MultiMap';
|
|
3
|
-
export { ICompletionStage } from './Concurrent/ICompletionStage';
|
|
4
|
-
export { CompletableObservable } from './Concurrent/CompletableObservable';
|
|
5
|
-
export { CompletionContext } from './Concurrent/CompletionContext';
|
|
6
|
-
export { CompletionError } from './Concurrent/CompletionError';
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,+CAA4C;AAApC,oGAAA,QAAQ,OAAA;AAGhB,4EAAyE;AAAjE,8HAAA,qBAAqB,OAAA;AAC7B,oEAAiE;AAAzD,sHAAA,iBAAiB,OAAA;AACzB,gEAA6D;AAArD,kHAAA,eAAe,OAAA"}
|
package/src/Utility/MultiMap.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MultiMap = void 0;
|
|
4
|
-
class MultiMap {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.imp = new Map();
|
|
7
|
-
}
|
|
8
|
-
put(key, value) {
|
|
9
|
-
if (key == null)
|
|
10
|
-
throw new Error("key is null");
|
|
11
|
-
if (!this.imp.has(key))
|
|
12
|
-
this.imp.set(key, new Array());
|
|
13
|
-
this.imp.get(key).push(value);
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
remove(key, value) {
|
|
17
|
-
if (value == undefined) {
|
|
18
|
-
if (this.imp.has(key))
|
|
19
|
-
this.imp.delete(key);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
if (this.imp.has(key)) {
|
|
23
|
-
let values = this.imp.get(key);
|
|
24
|
-
values.slice(values.indexOf(value), 1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
get(key, index) {
|
|
30
|
-
if (index == undefined) {
|
|
31
|
-
return this.imp.get(key);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
return;
|
|
35
|
-
this
|
|
36
|
-
.imp
|
|
37
|
-
.get(key)
|
|
38
|
-
.find((v, i, o) => i == index);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
getCardinality(key) {
|
|
42
|
-
return this.imp.get(key).length;
|
|
43
|
-
}
|
|
44
|
-
getKeys() {
|
|
45
|
-
return Array.from(this.imp.keys());
|
|
46
|
-
}
|
|
47
|
-
getValues() {
|
|
48
|
-
return Array.from(this.imp.values());
|
|
49
|
-
}
|
|
50
|
-
containsKey(key) {
|
|
51
|
-
return this.imp.has(key);
|
|
52
|
-
}
|
|
53
|
-
containsValue(key, value) {
|
|
54
|
-
if (this.containsKey(key))
|
|
55
|
-
return this.get(key).includes(value);
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.MultiMap = MultiMap;
|
|
60
|
-
//# sourceMappingURL=MultiMap.js.map
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|