"use strict"; var Shim = require("collections/shim"); var ArcSet = require("./arc-set"); var GenericCollection = require("collections/generic-collection"); var GenericMap = require("collections/generic-map"); var PropertyChanges = require("collections/listen/property-changes"); module.exports = ArcMap; function ArcMap(values, maxLength, equals, hash, getDefault) { if (!(this instanceof ArcMap)) { return new ArcMap(values, maxLength, equals, hash); } equals = equals || Object.equals; hash = hash || Object.hash; getDefault = getDefault || Function.noop; this.contentEquals = equals; this.contentHash = hash; this.getDefault = getDefault; this.store = new ArcSet( undefined, maxLength, function keysEqual(a, b) { return equals(a.key, b.key); }, function keyHash(item) { return hash(item.key); } ); this.length = 0; this.addEach(values); } Object.addEach(ArcMap.prototype, GenericCollection.prototype); Object.addEach(ArcMap.prototype, GenericMap.prototype); Object.addEach(ArcMap.prototype, PropertyChanges.prototype); ArcMap.prototype.constructClone = function (values) { return new this.constructor( values, this.maxLength, this.contentEquals, this.contentHash, this.getDefault ); };