UNPKG

@rimbu/proximity

Version:

Immutable ProximityMap implementation for TypeScript

41 lines 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProximityMapContext = void 0; var tslib_1 = require("tslib"); var map_custom_1 = require("@rimbu/collection-types/map-custom"); var index_cjs_1 = require("./implementation/index.cjs"); var builder_cjs_1 = require("./builder.cjs"); /** * Default concrete implementation of {@link ProximityMap.Context}.<br/> * <br/> * It wires the configured {@link DistanceFunction} and `HashMap` context together and * is used by the `ProximityMap` factory methods to create new instances. * * @typeparam UK - the upper key type bound for which the context can be used */ var ProximityMapContext = /** @class */ (function (_super) { tslib_1.__extends(ProximityMapContext, _super); function ProximityMapContext(distanceFunction, hashMapContext) { var _this = _super.call(this) || this; _this.distanceFunction = distanceFunction; _this.hashMapContext = hashMapContext; _this.typeTag = 'ProximityMap'; _this.builder = function () { return _this.createBuilder(); }; _this._empty = Object.freeze(new index_cjs_1.ProximityMapEmpty(_this)); return _this; } ProximityMapContext.prototype.isValidKey = function (key) { return true; }; ProximityMapContext.prototype.isNonEmptyInstance = function (source) { return source instanceof index_cjs_1.ProximityMapNonEmpty; }; ProximityMapContext.prototype.createBuilder = function (source) { return new builder_cjs_1.ProximityMapBuilder(this, source); }; return ProximityMapContext; }(map_custom_1.RMapBase.ContextBase)); exports.ProximityMapContext = ProximityMapContext; //# sourceMappingURL=context.cjs.map