@fluid-experimental/property-common 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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.
Files changed (127) hide show
  1. package/.eslintrc.js +9 -11
  2. package/.mocharc.json +6 -6
  3. package/README.md +1 -0
  4. package/api-extractor.json +2 -2
  5. package/dist/chronometer.d.ts.map +1 -1
  6. package/dist/chronometer.js.map +1 -1
  7. package/dist/consoleUtils.d.ts.map +1 -1
  8. package/dist/consoleUtils.js +4 -1
  9. package/dist/consoleUtils.js.map +1 -1
  10. package/dist/constants.d.ts +6 -6
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +16 -26
  13. package/dist/constants.js.map +1 -1
  14. package/dist/datastructures/collection.d.ts.map +1 -1
  15. package/dist/datastructures/collection.js +5 -4
  16. package/dist/datastructures/collection.js.map +1 -1
  17. package/dist/datastructures/dataArray.d.ts.map +1 -1
  18. package/dist/datastructures/dataArray.js +18 -9
  19. package/dist/datastructures/dataArray.js.map +1 -1
  20. package/dist/datastructures/integer64.d.ts.map +1 -1
  21. package/dist/datastructures/integer64.js +1 -1
  22. package/dist/datastructures/integer64.js.map +1 -1
  23. package/dist/datastructures/sortedCollection.d.ts.map +1 -1
  24. package/dist/datastructures/sortedCollection.js +3 -1
  25. package/dist/datastructures/sortedCollection.js.map +1 -1
  26. package/dist/deferredPromise.d.ts +1 -1
  27. package/dist/deferredPromise.d.ts.map +1 -1
  28. package/dist/deferredPromise.js +9 -3
  29. package/dist/deferredPromise.js.map +1 -1
  30. package/dist/deterministicRandomGenerator.d.ts.map +1 -1
  31. package/dist/deterministicRandomGenerator.js +6 -6
  32. package/dist/deterministicRandomGenerator.js.map +1 -1
  33. package/dist/error_objects/flaggedError.d.ts.map +1 -1
  34. package/dist/error_objects/flaggedError.js.map +1 -1
  35. package/dist/error_objects/httpError.d.ts.map +1 -1
  36. package/dist/error_objects/httpError.js +9 -9
  37. package/dist/error_objects/httpError.js.map +1 -1
  38. package/dist/error_objects/httpErrorNoStack.d.ts.map +1 -1
  39. package/dist/error_objects/httpErrorNoStack.js.map +1 -1
  40. package/dist/error_objects/operationError.d.ts +7 -7
  41. package/dist/error_objects/operationError.d.ts.map +1 -1
  42. package/dist/error_objects/operationError.js +7 -7
  43. package/dist/error_objects/operationError.js.map +1 -1
  44. package/dist/guidUtils.d.ts.map +1 -1
  45. package/dist/guidUtils.js +10 -9
  46. package/dist/guidUtils.js.map +1 -1
  47. package/dist/hashCalculator.d.ts.map +1 -1
  48. package/dist/hashCalculator.js.map +1 -1
  49. package/dist/joinPaths.d.ts.map +1 -1
  50. package/dist/joinPaths.js.map +1 -1
  51. package/dist/packageVersion.d.ts +1 -1
  52. package/dist/packageVersion.js +1 -1
  53. package/dist/packageVersion.js.map +1 -1
  54. package/lib/chronometer.d.ts.map +1 -1
  55. package/lib/chronometer.js.map +1 -1
  56. package/lib/consoleUtils.d.ts.map +1 -1
  57. package/lib/consoleUtils.js +4 -1
  58. package/lib/consoleUtils.js.map +1 -1
  59. package/lib/constants.d.ts +6 -6
  60. package/lib/constants.d.ts.map +1 -1
  61. package/lib/constants.js +16 -26
  62. package/lib/constants.js.map +1 -1
  63. package/lib/datastructures/collection.d.ts.map +1 -1
  64. package/lib/datastructures/collection.js +5 -4
  65. package/lib/datastructures/collection.js.map +1 -1
  66. package/lib/datastructures/dataArray.d.ts.map +1 -1
  67. package/lib/datastructures/dataArray.js +18 -9
  68. package/lib/datastructures/dataArray.js.map +1 -1
  69. package/lib/datastructures/integer64.d.ts.map +1 -1
  70. package/lib/datastructures/integer64.js +1 -1
  71. package/lib/datastructures/integer64.js.map +1 -1
  72. package/lib/datastructures/sortedCollection.d.ts.map +1 -1
  73. package/lib/datastructures/sortedCollection.js +3 -1
  74. package/lib/datastructures/sortedCollection.js.map +1 -1
  75. package/lib/deferredPromise.d.ts +1 -1
  76. package/lib/deferredPromise.d.ts.map +1 -1
  77. package/lib/deferredPromise.js +9 -3
  78. package/lib/deferredPromise.js.map +1 -1
  79. package/lib/deterministicRandomGenerator.d.ts.map +1 -1
  80. package/lib/deterministicRandomGenerator.js +6 -6
  81. package/lib/deterministicRandomGenerator.js.map +1 -1
  82. package/lib/error_objects/flaggedError.d.ts.map +1 -1
  83. package/lib/error_objects/flaggedError.js.map +1 -1
  84. package/lib/error_objects/httpError.d.ts.map +1 -1
  85. package/lib/error_objects/httpError.js +9 -9
  86. package/lib/error_objects/httpError.js.map +1 -1
  87. package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -1
  88. package/lib/error_objects/httpErrorNoStack.js.map +1 -1
  89. package/lib/error_objects/operationError.d.ts +7 -7
  90. package/lib/error_objects/operationError.d.ts.map +1 -1
  91. package/lib/error_objects/operationError.js +7 -7
  92. package/lib/error_objects/operationError.js.map +1 -1
  93. package/lib/guidUtils.d.ts.map +1 -1
  94. package/lib/guidUtils.js +10 -9
  95. package/lib/guidUtils.js.map +1 -1
  96. package/lib/hashCalculator.d.ts.map +1 -1
  97. package/lib/hashCalculator.js.map +1 -1
  98. package/lib/joinPaths.d.ts.map +1 -1
  99. package/lib/joinPaths.js.map +1 -1
  100. package/lib/packageVersion.d.ts +1 -1
  101. package/lib/packageVersion.js +1 -1
  102. package/lib/packageVersion.js.map +1 -1
  103. package/package.json +42 -40
  104. package/platform-dependent/README.md +1 -0
  105. package/platform-dependent/browser.js +5 -5
  106. package/platform-dependent/package.json +14 -14
  107. package/platform-dependent/server.js +5 -5
  108. package/prettier.config.cjs +1 -1
  109. package/src/chronometer.ts +174 -169
  110. package/src/consoleUtils.ts +16 -11
  111. package/src/constants.ts +1683 -1640
  112. package/src/datastructures/collection.ts +417 -416
  113. package/src/datastructures/dataArray.ts +516 -492
  114. package/src/datastructures/integer64.ts +102 -99
  115. package/src/datastructures/sortedCollection.ts +155 -145
  116. package/src/deferredPromise.ts +43 -42
  117. package/src/deterministicRandomGenerator.ts +59 -59
  118. package/src/error_objects/flaggedError.ts +29 -29
  119. package/src/error_objects/httpError.ts +45 -42
  120. package/src/error_objects/httpErrorNoStack.ts +17 -17
  121. package/src/error_objects/operationError.ts +62 -62
  122. package/src/guidUtils.ts +182 -171
  123. package/src/hashCalculator.ts +5 -2
  124. package/src/joinPaths.ts +15 -9
  125. package/src/packageVersion.ts +1 -1
  126. package/tsconfig.esnext.json +6 -6
  127. package/tsconfig.json +9 -13
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,4DAA4D;AAC5D;;GAEG;AACH,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,MAAM,IAAI,GAAG;IACT,aAAa,EAAE,0CAA0C;IACzD,kBAAkB,EAAE,iCAAiC;IACrD,kBAAkB,EAAE,mDAAmD;IACvE,aAAa,EAAE,yBAAyB;IACxC,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,sCAAsC;CACxD,CAAC;AAEF,MAAM,OAAO,UAAU;IAInB;;;;;OAKG;IACH,YAAsB,QAAQ,qBAAqB,EAAY,KAAqB;QAA9D,UAAK,GAAL,KAAK,CAAwB;QAAY,UAAK,GAAL,KAAK,CAAgB;QAT1E,WAAM,GAA0B,EAAE,CAAC;QACnC,WAAM,GAAwB,EAAE,CAAC;IAS3C,CAAC;IAED,4BAA4B;IAC5B,KAAK,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,IAAI,CAAC;IAC9B,OAAO,CAAC,QAAQ,IAAI,CAAC;IAErB,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,IAAI;QACX,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,MAAuB,EAAE,QAAW;QACpC,IAAI,CAAC,UAAU,CAAC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,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACxB,OAAO,IAAI,CAAC;SACf;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE1B,uEAAuE;QACvE,uBAAuB;QAEvB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,aAA4B;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC;QAEhC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n TYPE_MISMATCH: \"Type does not match this collection type\",\n KEY_ALREADY_EXISTS: \"Collection key already exists. \",\n KEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n MUST_GIVE_KEY: \"Collection missing key.\",\n MUST_GIVE_VALUE: \"Collection missing value.\",\n KEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n protected _items: { [key: string]: T; } = {};\n protected _order: (string | number)[] = [];\n\n /**\n * @param _name - a friendly name to describe this collection. If undefined\n * the collection will have a default \"Untitled Collection\" assigned to its name.\n * @param _type - optional parameter pointing to the constructor\n * of a type this Collection will host.\n */\n constructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {\n }\n\n // Pass-thru binding handles\n onAdd(in_key, in_value) { }\n onRemove(in_key, in_value) { }\n onClear(in_items) { }\n\n public get items() {\n return this._items;\n }\n\n public get keys() {\n return Object.keys(this._items);\n }\n\n /**\n * @param in_key - Key to store the value under\n * @param in_value - Value to store in the collection\n * @returns Return the value passed in\n */\n add(in_key: number | string, in_value: T): T {\n this._checkType(in_value);\n this._checkIsNewKey(in_key);\n\n this._items[in_key] = in_value;\n this._order.push(in_key);\n\n this.onAdd(in_key, in_value);\n\n return in_value;\n }\n\n /**\n * Checks if in_value's type is equal to this Collection type. If this collection\n * has no type set, the check will pass.\n *\n * @param in_value - A value that is equal to the type managed by this collection.\n * @returns Return true if the type is a valid type for this\n * collection, throw otherwise.\n */\n private _checkType(in_value: T) {\n if (this._type && !(in_value instanceof this._type)) {\n throw new Error(MSGS.TYPE_MISMATCH);\n } else {\n return true;\n }\n }\n\n /**\n * Bulk add items.\n * @param in_items - List of key-value pairs to be stored in the collection\n * @returns this collection after add\n */\n bulkAdd(in_items: { [key: string]: T; }) {\n _.each(in_items, (item, key) => {\n this.add(key, item);\n });\n return this;\n }\n\n /**\n * Bulk remove items.\n * @param in_items - List of key-value items to be removed\n * @returns this collection after add\n */\n bulkRemove(in_items: { [key: string]: T; }) {\n _.each(in_items, (item, key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Test if this collection is empty\n * @returns true if empty, false otherwise\n * */\n isEmpty() {\n return _.isEmpty(this._items);\n }\n\n /**\n * Return the first item in the collection, null if empty\n * @returns first item, or undefined if empty\n * */\n getFirstItem(): T | undefined {\n const index = _.first(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * Return the last item in the collection, null if empty\n * @returns - last item, or undefined if empty\n * */\n getLastItem(): T | undefined {\n const index = _.last(this._order);\n return index === undefined ? index : this._items[index];\n }\n\n /**\n * @returns Returns the type of collection (Array, etc.)\n */\n getType() {\n return this._type;\n }\n\n /**\n * @returns Returns the name of the collection\n */\n getName(): string {\n return this._name;\n }\n\n /**\n * Filter out by function\n * @param in_filterFunction - with arguments key and item\n * @returns A new filtered collection\n */\n filter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n const keeper = in_filterFunction(in_key, in_item);\n if (keeper) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterKey\n * @param in_filterKey - a single key or an array of keys, if the\n * item matches any of the keys it will be filtered in.\n * @returns New filtered collection with all the items\n * matching at least one key.\n */\n filterByKey(in_filterKey: string | string[]): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = _.isArray(in_filterKey)\n ? function(in_key, in_item) {\n if (in_filterKey.includes(in_key)) {\n rtn.add(in_key, in_item);\n }\n } : function(in_key, in_item) {\n if (in_key === in_filterKey) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Filter out all keys NOT matching the in_filterValue\n * @param in_filterValue - Value to filter on\n * @returns Return a filtered collection\n */\n filterByValue(in_filterValue: T): Collection<T> {\n const rtn = new Collection<T>();\n\n const filterCb = function(in_key, in_item) {\n if (in_item === in_filterValue) {\n rtn.add(in_key, in_item);\n }\n };\n\n this.iterate(filterCb);\n\n return rtn;\n }\n\n /**\n * Remove an item from this Collection. This method returns a Boolean indicating\n * the success or failure of the removal. This is practical because if we were\n * to throw an error when the key doesn't exist, it would require additional\n * checks by the caller to make sure this key exists prior to removal. Which\n * would make the attempt of removal more verbose and also costly because the\n * caller would have to keep a list – somewhere else – of the things he can\n * and cannot remove.\n *\n * @param in_key - the key we wish to remove\n * @returns true if the key exists and was removed, false otherwise.\n */\n remove(in_key: number | string): boolean {\n if (!this.has(in_key)) {\n return false;\n }\n\n const remember = this._items[in_key];\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._items[in_key];\n this._order.splice(this._order.indexOf(in_key), 1);\n\n this.onRemove(in_key, remember);\n\n return true;\n }\n\n /**\n * Return the number of items in this Collection\n * @returns the number of items in the collection\n */\n getCount(): number {\n return this._order.length;\n }\n\n /**\n * Returns this collection as an ordered Array\n * @returns Array including the values\n */\n getAsArray() {\n const rtnArr: T[] = new Array(this.getCount());\n\n for (let i = 0; i < this._order.length; i++) {\n rtnArr[i] = this._items[this._order[i]];\n }\n\n return rtnArr;\n }\n\n /**\n * @param in_key - the key we are looking for\n * @returns true if the item exists\n */\n has(in_key: string | number): boolean {\n return Object.prototype.hasOwnProperty.call(this._items, in_key);\n }\n\n /**\n * Return an item associated with the given key\n * @param in_key - the key for the item in this\n * Collection\n * @returns The item\n */\n item(in_key: number | string) {\n return this._items[in_key];\n }\n\n /**\n * Checks if this is a new key in the collection. Throw if already exists.\n * @param in_key - The key to check against\n * @returns true if key is new\n */\n private _checkIsNewKey(in_key: number | string) {\n if (this.has(in_key)) {\n throw new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Checks if the key exists in the collection. Throw if not.\n * @param in_key - the key to check against\n * @returns true if key exists\n */\n private _checkKeyExists(in_key: number | string) {\n if (!this.has(in_key)) {\n throw new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n }\n\n return true;\n }\n\n /**\n * Set an existing key to a value. If key doesn't exist this call will throw\n * an error.\n * @param in_key - The key we want to modify\n * @param in_value - The value we are to set at this key\n * @returns The value passed in\n */\n set(in_key: string, in_value: T) {\n this._checkKeyExists(in_key);\n\n this._items[in_key] = in_value;\n\n return in_value;\n }\n\n /**\n * Iterate over this collection and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - A function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterate(in_callback) {\n for (const key of this._order) {\n const continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * Iterate over this collection starting from the tail and run the callback with passing the key and\n * item in the iteration loop.\n * @param in_callback - a function that we will call on each item\n * of this collection. If the callback returns false then the iteration will exit early.\n */\n iterateFromTail(in_callback) {\n let key; let continu;\n for (let i = this._order.length - 1; i >= 0; i--) {\n key = this._order[i];\n continu = in_callback(key, this._items[key]);\n if (continu === false) {\n break;\n }\n }\n }\n\n /**\n * @returns Return an object containing the items of this collection\n */\n getItems(): { [key: string]: T; } {\n const result = {};\n\n _.each(this._items, function(item, key) {\n result[key] = item;\n });\n\n return result;\n }\n\n /**\n * Return the list of keys\n * @returns List of keys\n */\n getKeys(): string[] {\n return Object.keys(this._items);\n }\n\n /**\n * Method used to get the first element in the collection along with its key.\n */\n peak() {\n return {\n item: this._items[this._order[0]],\n key: this._order[0],\n };\n }\n\n /**\n * Clear this collection\n * @returns this collection\n */\n clear() {\n if (_.isEmpty(this._items)) {\n return this;\n }\n\n this.onClear(this._items);\n\n // Best to just iterate through and remove everything, so that OnRemove\n // handlers are called.\n\n _.each(this.getKeys(), (key) => {\n this.remove(key);\n });\n\n return this;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n * @returns new Collection\n */\n clone(): Collection<T> {\n const newCol = new Collection<T>(this._name, this._type);\n newCol.bulkAdd(this._items);\n return newCol;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @param in_collection - the collection we want to\n * copy from.\n */\n copy(in_collection: Collection<T>) {\n this.clear();\n const its = in_collection.items;\n\n _.each(its, (item, key) => {\n this.add(key, item);\n });\n }\n\n get values() {\n return this.getAsArray();\n }\n}\n"]}
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/datastructures/collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,4DAA4D;AAC5D;;GAEG;AACH,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,MAAM,IAAI,GAAG;IACZ,aAAa,EAAE,0CAA0C;IACzD,kBAAkB,EAAE,iCAAiC;IACrD,kBAAkB,EAAE,mDAAmD;IACvE,aAAa,EAAE,yBAAyB;IACxC,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,sCAAsC;CACrD,CAAC;AAEF,MAAM,OAAO,UAAU;IAItB;;;;;OAKG;IACH,YAAsB,QAAQ,qBAAqB,EAAY,KAAqB;QAA9D,UAAK,GAAL,KAAK,CAAwB;QAAY,UAAK,GAAL,KAAK,CAAgB;QAT1E,WAAM,GAAyB,EAAE,CAAC;QAClC,WAAM,GAAwB,EAAE,CAAC;IAQ4C,CAAC;IAExF,4BAA4B;IAC5B,KAAK,CAAC,MAAM,EAAE,QAAQ,IAAG,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,IAAG,CAAC;IAC7B,OAAO,CAAC,QAAQ,IAAG,CAAC;IAEpB,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAW,IAAI;QACd,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,MAAuB,EAAE,QAAW;QACvC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEzB,IAAI,CAAC,KAAK,C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GAAG,EAAE,EAAE;YAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACJ,MAAM,MAAM,GAAG,IAAI,UAAU,CAAI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,aAA4B;QAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC;QAEhC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC1B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n/**\n * @fileoverview Collection class definition\n */\nimport _ from \"lodash\";\n\nconst MSGS = {\n\tTYPE_MISMATCH: \"Type does not match this collection type\",\n\tKEY_ALREADY_EXISTS: \"Collection key already exists. \",\n\tKEY_DOES_NOT_EXIST: \"Collection key does not exist in this collection.\",\n\tMUST_GIVE_KEY: \"Collection missing key.\",\n\tMUST_GIVE_VALUE: \"Collection missing value.\",\n\tKEY_NOT_VALID: \"Key must be of type String or Number\",\n};\n\nexport class Collection<T> {\n\tprotected _items: { [key: string]: T } = {};\n\tprotected _order: (string | number)[] = [];\n\n\t/**\n\t * @param _name - a friendly name to describe this collection. If undefined\n\t * the collection will have a default \"Untitled Collection\" assigned to its name.\n\t * @param _type - optional parameter pointing to the constructor\n\t * of a type this Collection will host.\n\t */\n\tconstructor(protected _name = \"Untitled Collection\", protected _type?: new () => any) {}\n\n\t// Pass-thru binding handles\n\tonAdd(in_key, in_value) {}\n\tonRemove(in_key, in_value) {}\n\tonClear(in_items) {}\n\n\tpublic get items() {\n\t\treturn this._items;\n\t}\n\n\tpublic get keys() {\n\t\treturn Object.keys(this._items);\n\t}\n\n\t/**\n\t * @param in_key - Key to store the value under\n\t * @param in_value - Value to store in the collection\n\t * @returns Return the value passed in\n\t */\n\tadd(in_key: number | string, in_value: T): T {\n\t\tthis._checkType(in_value);\n\t\tthis._checkIsNewKey(in_key);\n\n\t\tthis._items[in_key] = in_value;\n\t\tthis._order.push(in_key);\n\n\t\tthis.onAdd(in_key, in_value);\n\n\t\treturn in_value;\n\t}\n\n\t/**\n\t * Checks if in_value's type is equal to this Collection type. If this collection\n\t * has no type set, the check will pass.\n\t *\n\t * @param in_value - A value that is equal to the type managed by this collection.\n\t * @returns Return true if the type is a valid type for this\n\t * collection, throw otherwise.\n\t */\n\tprivate _checkType(in_value: T) {\n\t\tif (this._type && !(in_value instanceof this._type)) {\n\t\t\tthrow new Error(MSGS.TYPE_MISMATCH);\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\t/**\n\t * Bulk add items.\n\t * @param in_items - List of key-value pairs to be stored in the collection\n\t * @returns this collection after add\n\t */\n\tbulkAdd(in_items: { [key: string]: T }) {\n\t\t_.each(in_items, (item, key) => {\n\t\t\tthis.add(key, item);\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Bulk remove items.\n\t * @param in_items - List of key-value items to be removed\n\t * @returns this collection after add\n\t */\n\tbulkRemove(in_items: { [key: string]: T }) {\n\t\t_.each(in_items, (item, key) => {\n\t\t\tthis.remove(key);\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Test if this collection is empty\n\t * @returns true if empty, false otherwise\n\t * */\n\tisEmpty() {\n\t\treturn _.isEmpty(this._items);\n\t}\n\n\t/**\n\t * Return the first item in the collection, null if empty\n\t * @returns first item, or undefined if empty\n\t * */\n\tgetFirstItem(): T | undefined {\n\t\tconst index = _.first(this._order);\n\t\treturn index === undefined ? index : this._items[index];\n\t}\n\n\t/**\n\t * Return the last item in the collection, null if empty\n\t * @returns - last item, or undefined if empty\n\t * */\n\tgetLastItem(): T | undefined {\n\t\tconst index = _.last(this._order);\n\t\treturn index === undefined ? index : this._items[index];\n\t}\n\n\t/**\n\t * @returns Returns the type of collection (Array, etc.)\n\t */\n\tgetType() {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * @returns Returns the name of the collection\n\t */\n\tgetName(): string {\n\t\treturn this._name;\n\t}\n\n\t/**\n\t * Filter out by function\n\t * @param in_filterFunction - with arguments key and item\n\t * @returns A new filtered collection\n\t */\n\tfilter(in_filterFunction: (key: string, item: T) => boolean): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = function (in_key, in_item) {\n\t\t\tconst keeper = in_filterFunction(in_key, in_item);\n\t\t\tif (keeper) {\n\t\t\t\trtn.add(in_key, in_item);\n\t\t\t}\n\t\t};\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Filter out all keys NOT matching the in_filterKey\n\t * @param in_filterKey - a single key or an array of keys, if the\n\t * item matches any of the keys it will be filtered in.\n\t * @returns New filtered collection with all the items\n\t * matching at least one key.\n\t */\n\tfilterByKey(in_filterKey: string | string[]): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = _.isArray(in_filterKey)\n\t\t\t? function (in_key, in_item) {\n\t\t\t\t\tif (in_filterKey.includes(in_key)) {\n\t\t\t\t\t\trtn.add(in_key, in_item);\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: function (in_key, in_item) {\n\t\t\t\t\tif (in_key === in_filterKey) {\n\t\t\t\t\t\trtn.add(in_key, in_item);\n\t\t\t\t\t}\n\t\t\t };\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Filter out all keys NOT matching the in_filterValue\n\t * @param in_filterValue - Value to filter on\n\t * @returns Return a filtered collection\n\t */\n\tfilterByValue(in_filterValue: T): Collection<T> {\n\t\tconst rtn = new Collection<T>();\n\n\t\tconst filterCb = function (in_key, in_item) {\n\t\t\tif (in_item === in_filterValue) {\n\t\t\t\trtn.add(in_key, in_item);\n\t\t\t}\n\t\t};\n\n\t\tthis.iterate(filterCb);\n\n\t\treturn rtn;\n\t}\n\n\t/**\n\t * Remove an item from this Collection. This method returns a Boolean indicating\n\t * the success or failure of the removal. This is practical because if we were\n\t * to throw an error when the key doesn't exist, it would require additional\n\t * checks by the caller to make sure this key exists prior to removal. Which\n\t * would make the attempt of removal more verbose and also costly because the\n\t * caller would have to keep a list – somewhere else – of the things he can\n\t * and cannot remove.\n\t *\n\t * @param in_key - the key we wish to remove\n\t * @returns true if the key exists and was removed, false otherwise.\n\t */\n\tremove(in_key: number | string): boolean {\n\t\tif (!this.has(in_key)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst remember = this._items[in_key];\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\tdelete this._items[in_key];\n\t\tthis._order.splice(this._order.indexOf(in_key), 1);\n\n\t\tthis.onRemove(in_key, remember);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Return the number of items in this Collection\n\t * @returns the number of items in the collection\n\t */\n\tgetCount(): number {\n\t\treturn this._order.length;\n\t}\n\n\t/**\n\t * Returns this collection as an ordered Array\n\t * @returns Array including the values\n\t */\n\tgetAsArray() {\n\t\tconst rtnArr: T[] = new Array(this.getCount());\n\n\t\tfor (let i = 0; i < this._order.length; i++) {\n\t\t\trtnArr[i] = this._items[this._order[i]];\n\t\t}\n\n\t\treturn rtnArr;\n\t}\n\n\t/**\n\t * @param in_key - the key we are looking for\n\t * @returns true if the item exists\n\t */\n\thas(in_key: string | number): boolean {\n\t\treturn Object.prototype.hasOwnProperty.call(this._items, in_key);\n\t}\n\n\t/**\n\t * Return an item associated with the given key\n\t * @param in_key - the key for the item in this\n\t * Collection\n\t * @returns The item\n\t */\n\titem(in_key: number | string) {\n\t\treturn this._items[in_key];\n\t}\n\n\t/**\n\t * Checks if this is a new key in the collection. Throw if already exists.\n\t * @param in_key - The key to check against\n\t * @returns true if key is new\n\t */\n\tprivate _checkIsNewKey(in_key: number | string) {\n\t\tif (this.has(in_key)) {\n\t\t\tthrow new Error(`${MSGS.KEY_ALREADY_EXISTS} ${in_key}`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Checks if the key exists in the collection. Throw if not.\n\t * @param in_key - the key to check against\n\t * @returns true if key exists\n\t */\n\tprivate _checkKeyExists(in_key: number | string) {\n\t\tif (!this.has(in_key)) {\n\t\t\tthrow new Error(`${MSGS.KEY_DOES_NOT_EXIST} ${in_key}`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Set an existing key to a value. If key doesn't exist this call will throw\n\t * an error.\n\t * @param in_key - The key we want to modify\n\t * @param in_value - The value we are to set at this key\n\t * @returns The value passed in\n\t */\n\tset(in_key: string, in_value: T) {\n\t\tthis._checkKeyExists(in_key);\n\n\t\tthis._items[in_key] = in_value;\n\n\t\treturn in_value;\n\t}\n\n\t/**\n\t * Iterate over this collection and run the callback with passing the key and\n\t * item in the iteration loop.\n\t * @param in_callback - A function that we will call on each item\n\t * of this collection. If the callback returns false then the iteration will exit early.\n\t */\n\titerate(in_callback) {\n\t\tfor (const key of this._order) {\n\t\t\tconst continu = in_callback(key, this._items[key]);\n\t\t\tif (continu === false) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Iterate over this collection starting from the tail and run the callback with passing the key and\n\t * item in the iteration loop.\n\t * @param in_callback - a function that we will call on each item\n\t * of this collection. If the callback returns false then the iteration will exit early.\n\t */\n\titerateFromTail(in_callback) {\n\t\tlet key;\n\t\tlet continu;\n\t\tfor (let i = this._order.length - 1; i >= 0; i--) {\n\t\t\tkey = this._order[i];\n\t\t\tcontinu = in_callback(key, this._items[key]);\n\t\t\tif (continu === false) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @returns Return an object containing the items of this collection\n\t */\n\tgetItems(): { [key: string]: T } {\n\t\tconst result = {};\n\n\t\t_.each(this._items, function (item, key) {\n\t\t\tresult[key] = item;\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Return the list of keys\n\t * @returns List of keys\n\t */\n\tgetKeys(): string[] {\n\t\treturn Object.keys(this._items);\n\t}\n\n\t/**\n\t * Method used to get the first element in the collection along with its key.\n\t */\n\tpeak() {\n\t\treturn {\n\t\t\titem: this._items[this._order[0]],\n\t\t\tkey: this._order[0],\n\t\t};\n\t}\n\n\t/**\n\t * Clear this collection\n\t * @returns this collection\n\t */\n\tclear() {\n\t\tif (_.isEmpty(this._items)) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.onClear(this._items);\n\n\t\t// Best to just iterate through and remove everything, so that OnRemove\n\t\t// handlers are called.\n\n\t\t_.each(this.getKeys(), (key) => {\n\t\t\tthis.remove(key);\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @param in_collection - the collection we want to\n\t * copy from.\n\t * @returns new Collection\n\t */\n\tclone(): Collection<T> {\n\t\tconst newCol = new Collection<T>(this._name, this._type);\n\t\tnewCol.bulkAdd(this._items);\n\t\treturn newCol;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @param in_collection - the collection we want to\n\t * copy from.\n\t */\n\tcopy(in_collection: Collection<T>) {\n\t\tthis.clear();\n\t\tconst its = in_collection.items;\n\n\t\t_.each(its, (item, key) => {\n\t\t\tthis.add(key, item);\n\t\t});\n\t}\n\n\tget values() {\n\t\treturn this.getAsArray();\n\t}\n}\n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IAAI,EAAE,MAAM;IAIxB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAQpB;;;;OAIG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE;IAM9C;;;;OAIG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,KAAA;CAa/B;AAED,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,GACb,CAAC"}
@@ -23,7 +23,7 @@ class BaseDataArray {
23
23
  }
24
24
  // The 'eslint-...' is used to disable the rule that requires
25
25
  // constructors to start with a capitalized letter.
26
- this._buffer = new this.bufferConstructor(this.size); // eslint-disable-line new-cap
26
+ this._buffer = new this.bufferConstructor(this.size);
27
27
  }
28
28
  /**
29
29
  * Get the value at an index. If no index is passed, return zeroth item.
@@ -144,7 +144,9 @@ class BaseDataArray {
144
144
  * @param in_array - The input array.
145
145
  */
146
146
  set(in_offset, in_array) {
147
- if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {
147
+ if (in_array instanceof ArrayBuffer ||
148
+ in_array instanceof Array ||
149
+ in_array instanceof this.getBufferCtor()) {
148
150
  this._buffer.set(in_array, in_offset);
149
151
  }
150
152
  else if (in_array instanceof BaseDataArray) {
@@ -203,7 +205,7 @@ class BaseDataArray {
203
205
  // target buffer with the desired new size
204
206
  // The 'eslint-...' is used to disable the rule that requires
205
207
  // constructors to start with a capitalized letter.
206
- const newBuffer = new in_bufferCtor(in_newSize); // eslint-disable-line new-cap
208
+ const newBuffer = new in_bufferCtor(in_newSize);
207
209
  const oldSize = in_buffer.length;
208
210
  const oldBuffer = in_buffer;
209
211
  const isShrinking = oldSize > in_newSize;
@@ -226,11 +228,13 @@ class BaseDataArray {
226
228
  * @returns The DataArray itself
227
229
  */
228
230
  resize(size) {
231
+ // this can be costly!!!
229
232
  this._alloc(size);
230
233
  this.size = size;
231
234
  return this;
232
235
  }
233
236
  copy() {
237
+ // and this!
234
238
  const newBuffer = new this.bufferConstructor(this.size); // buffer with the desired new size
235
239
  newBuffer.set(this._buffer);
236
240
  return newBuffer;
@@ -337,7 +341,9 @@ class UniversalDataArray extends BaseDataArray {
337
341
  * @param in_array - The input array.
338
342
  */
339
343
  set(in_offset, in_array) {
340
- if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {
344
+ if (in_array instanceof ArrayBuffer ||
345
+ in_array instanceof Array ||
346
+ in_array instanceof this.getBufferCtor()) {
341
347
  this.arraySet(this._buffer, in_array, in_offset);
342
348
  }
343
349
  else if (in_array instanceof BaseDataArray) {
@@ -423,8 +429,7 @@ class StringDataArray extends BaseDataArray {
423
429
  * @param in_string - The input string.
424
430
  */
425
431
  set(in_offset, in_string) {
426
- this._buffer =
427
- `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset + in_string.length)}`;
432
+ this._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset + in_string.length)}`;
428
433
  }
429
434
  /**
430
435
  * Return a range of characters in the string.
@@ -438,7 +443,9 @@ class StringDataArray extends BaseDataArray {
438
443
  }
439
444
  return this._buffer.slice(in_idxStart, in_idxEnd);
440
445
  }
441
- get length() { return this._buffer.length; }
446
+ get length() {
447
+ return this._buffer.length;
448
+ }
442
449
  }
443
450
  /**
444
451
  * A data container that can contain boolean type
@@ -470,7 +477,7 @@ class BoolDataArray extends UniversalDataArray {
470
477
  */
471
478
  insertRange(in_offset, in_array) {
472
479
  const toBeAdded = in_array.map((val) => !!val);
473
- this._buffer.splice.call(this._buffer, ...([in_offset, 0].concat(toBeAdded)));
480
+ this._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(toBeAdded));
474
481
  this.size = this.size + in_array.length;
475
482
  }
476
483
  /**
@@ -479,7 +486,9 @@ class BoolDataArray extends UniversalDataArray {
479
486
  * @param in_array - The input array.
480
487
  */
481
488
  set(in_offset, in_array) {
482
- if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {
489
+ if (in_array instanceof ArrayBuffer ||
490
+ in_array instanceof Array ||
491
+ in_array instanceof this.getBufferCtor()) {
483
492
  this.arraySetBool(this._buffer, in_array, in_offset);
484
493
  }
485
494
  else if (in_array instanceof BaseDataArray) {
@@ -1 +1 @@
1
- {"version":3,"file":"dataArray.js","sourceRoot":"","sources":["../../src/datastructures/dataArray.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wDAAwD;AACxD,4DAA4D;AAE5D;;GAEG;AAEH;;;GAGG;AACH,MAAM,aAAa;IAYf,YAAY,CAAC,EAAE,CAAE;QACb,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACvB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;SACjD;aAAM;YACH,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;SACjB;QACD,6DAA6D;QAC7D,mDAAmD;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,8BAA8B;IACxF,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,MAAM,GAAG,CAAC;QACf,IAAI,MAAM,IAAI,IAAI,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACtD;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,WAAmB,EAAE,SAAiB;QAChD,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI,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,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,SAAiB,EAAE,QAAQ;QAC3B,IAAI,QAAQ,YAAY,WAAW,IAAI,QAAQ,YAAY,KAAK,IAAI,QAAQ,YAAY,IAAI,CAAC,aAAa,EAAE,EAAE;YAC1G,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;SACxD;aAAM,IAAI,QAAQ,YAAY,aAAa,EAAE;YAC1C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC;SACpE;aAAM;YACH,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;SACvF;IACL,CAAC;CACJ;AAED,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,GAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n\n/**\n * The data arrays definition file.\n */\n\n/**\n * A typed data container that is persistable, high-performance, and can be used\n * as a backing store for collaborative property sets.\n */\nclass BaseDataArray {\n protected _buffer: any;\n private readonly bufferConstructor;\n protected size: number;\n\n constructor(size: number);\n\n /**\n * @param bufferConstructor - This is the constructor to be used to setup the internal buffer of the DataArray.\n * @param size - The initial size with which to allocate the array.\n */\n constructor(bufferConstructor: any, size: number);\n constructor(a, b?) {\n if (typeof a === \"number\") {\n this.size = a;\n this.bufferConstructor = this.getBufferCtor();\n } else {\n this.bufferConstructor = a;\n this.size = b;\n }\n // The 'eslint-...' is used to disable the rule that requires\n // constructors to start with a capitalized letter.\n this._buffer = new this.bufferConstructor(this.size); // eslint-disable-line new-cap\n }\n\n /**\n * Get the value at an index. If no index is passed, return zeroth item.\n * @param in_idx - The specific item in the data array.\n * @returns The value at that index.\n */\n getValue(in_idx = 0): any {\n if (in_idx >= this.size || in_idx < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n\n return this._buffer[in_idx];\n }\n\n /**\n * Return a range of values in the array.\n * @param in_idxStart - the starting index\n * @param in_idxEnd - the end index\n * @returns the array of values in the range\n */\n getValueRange(in_idxStart: number, in_idxEnd: number) {\n if (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n\n return this._buffer.subarray(in_idxStart, in_idxEnd);\n }\n\n /**\n * Return the serialized form of Data Arrays.\n * @returns An object containing an array of the values.\n */\n serialize(): number[] {\n return Array.from(this._buffer.subarray(0, this.size));\n }\n\n /**\n * Deserialize data from a serialized representation\n * @param in_serialized - the serialized representation\n */\n deserialize(in_serialized) {\n const values = in_serialized;\n const length = in_serialized.length;\n if (length !== this.size) {\n this.resize(length);\n this.size = length;\n }\n let i;\n for (i = 0; i < length; i++) {\n this._buffer[i] = values[i];\n }\n }\n\n /**\n * Set value at an index.\n * @param in_idx - the index\n * @param in_value - the value we want to set at index\n */\n setValue(in_idx: number, in_value) {\n if (in_idx < this._buffer.length) {\n this._buffer[in_idx] = in_value;\n } else {\n console.error(\"DataArray setValue in_idx is out of bounds.\");\n }\n }\n\n /**\n * creates a copy of a typed array with removed elements\n * @param in_arr - the input array (won't be modified)\n * @param in_offset - starting index of range that will be removed\n * @param in_deleteCount - number of removed elements\n * @returns a copy of the input array without the selected range\n */\n private _removeElementsFromArray(in_arr, in_offset: number, in_deleteCount: number) {\n // TODO: this function can be optimized\n const newSize = this.size - in_deleteCount;\n const splicedArray = new in_arr.constructor(newSize);\n splicedArray.set(in_arr.subarray(0, in_offset));\n splicedArray.set(in_arr.subarray(in_offset + in_deleteCount, this.size), in_offset);\n return splicedArray;\n }\n\n /**\n * remove a range of elements from the array\n * @param in_offset - start of the range\n * @param in_deleteCount - number of elements to be removed\n */\n removeRange(in_offset: number, in_deleteCount: number) {\n if (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n this._buffer = this._removeElementsFromArray(this._buffer, in_offset, in_deleteCount);\n this.size = this.size - in_deleteCount;\n } else {\n console.error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n }\n }\n\n /**\n * copy an array with elements inserted into the copy\n * @param in_arr - the input array (won't be modified)\n * @param in_offset - the index where the new elements will be inserted\n * @param in_addedArray - the array with the elements that will be added\n * @returns the combined array\n */\n private _insert(in_arr, in_offset: number, in_addedArray) {\n // TODO: this function can be optimized\n const newSize = this.size + (in_addedArray.length as number);\n const insertedArray = new in_arr.constructor(newSize);\n insertedArray.set(in_arr.subarray(0, in_offset));\n insertedArray.set(in_addedArray, in_offset);\n insertedArray.set(in_arr.subarray(in_offset, this.size), in_offset + (in_addedArray.length as number));\n return insertedArray;\n }\n\n /**\n * insert the content of an array into the DataArray\n * @param in_offset - the target index\n * @param in_array - the array to be inserted\n */\n insertRange(in_offset: number, in_array) {\n this._buffer = this._insert(this._buffer, in_offset, in_array);\n this.size = this.size + (in_array.length as number);\n }\n\n /**\n * Set this array values to be equal to in_array values.\n * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n * @param in_array - The input array.\n */\n set(in_offset: number, in_array) {\n if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {\n this._buffer.set(in_array, in_offset);\n } else if (in_array instanceof BaseDataArray) {\n this._buffer.set(in_array.getBuffer(), in_offset);\n } else {\n console.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n }\n }\n\n /**\n * Insert a value at the end of the array, creates a new element at the end and sets the value.\n * @param in_value - The new value.\n */\n push(in_value) {\n // Adjust the buffer if necessary\n const bufferLength = this._buffer.length;\n if (this.size > bufferLength - 1) {\n this._alloc(this.size * 2 || 1); // grow by a factor of 2x\n }\n // set the value and update size\n this.setValue(this.size, in_value);\n this.size++;\n }\n\n /**\n * Get direct access to the data (for performance reasons) this should be uses read only.\n * @returns The (read only) raw data.\n */\n getBuffer() {\n return this._buffer;\n }\n\n /**\n * Get the constructor of the underlying `TypedArray`.\n * @returns The constructor for the data buffer.\n */\n getBufferCtor() {\n return this.bufferConstructor;\n }\n\n /**\n * Apply a given function to all elements of the array.\n * @param in_fn - The function that will be applied to every element.\n */\n iterate(in_fn) {\n const l = this.size;\n for (let i = 0; i < l; i++) {\n in_fn(this._buffer[i]);\n }\n }\n\n /**\n * Tet a resized buffer copy.\n * @param in_bufferCtor - The constructor for the returned buffer.\n * @param in_buffer - The input buffer (won't be modified).\n * @param in_newSize - The target size.\n * @returns The buffer with the new size.\n */\n private resizeBuffer(in_bufferCtor, in_buffer, in_newSize: number) {\n // target buffer with the desired new size\n // The 'eslint-...' is used to disable the rule that requires\n // constructors to start with a capitalized letter.\n const newBuffer = new in_bufferCtor(in_newSize); // eslint-disable-line new-cap\n const oldSize = in_buffer.length;\n const oldBuffer = in_buffer;\n const isShrinking = oldSize > in_newSize;\n newBuffer.set(isShrinking ? oldBuffer.subarray(0, in_newSize) : oldBuffer);\n return newBuffer;\n }\n\n /**\n * Allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n * which makes pushes to the array less expensive later).\n * @param size - The target allocated space.\n * @returns The DataArray itself.\n */\n protected _alloc(size: number): any {\n this._buffer = this.resizeBuffer(this.bufferConstructor, this._buffer, size);\n return this;\n }\n\n /**\n * Change the size of the array\n * @param size - The target size\n * @returns The DataArray itself\n */\n resize(size: number) { // this can be costly!!!\n this._alloc(size);\n this.size = size;\n return this;\n }\n\n copy() { // and this!\n const newBuffer = new this.bufferConstructor(this.size); // buffer with the desired new size\n newBuffer.set(this._buffer);\n return newBuffer;\n }\n\n get length() {\n return this.size;\n }\n}\n\nclass Int8DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Int8Array, size);\n }\n}\n\nclass Int16DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Int16Array, size);\n }\n}\n\nclass Int32DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Int32Array, size);\n }\n}\n\nclass Uint8DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Uint8Array, size);\n }\n}\n\nclass Uint16DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Uint16Array, size);\n }\n}\n\nclass Uint32DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Uint32Array, size);\n }\n}\n\nclass Float32DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Float32Array, size);\n }\n}\n\nclass Float64DataArray extends BaseDataArray {\n constructor(size: number) {\n super(Float64Array, size);\n }\n}\n\n/**\n * A data container that can contain every native type\n *\n * @param size - The initial size with which to allocate the array.\n */\nclass UniversalDataArray extends BaseDataArray {\n constructor(bufferConstructor: any, size: number);\n constructor(size: number);\n constructor(a?, b?) {\n if (b === undefined) {\n super(Array, a);\n } else {\n super(a, b);\n }\n }\n\n /**\n * Helper function to write array values into another array at a given offset.\n *\n * @param array - The target array.\n * @param values - The values we need to write.\n * @param offset - The starting index in target array.\n */\n private arraySet(array, values, offset = 0) {\n let index = 0;\n values.forEach(function(value) {\n array[index + offset] = value;\n index++;\n });\n }\n\n /**\n * Insert the content of an array into the DataArray.\n * @param in_offset - The target index.\n * @param in_array - The array to be inserted.\n */\n insertRange(in_offset: number, in_array: any[]) {\n this._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(in_array));\n this.size = this.size + in_array.length;\n }\n\n /**\n * Eemove a range of elements from the array.\n * @param in_offset - The start of the range.\n * @param in_deleteCount - The number of elements to be removed.\n */\n removeRange(in_offset: number, in_deleteCount: number) {\n if (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n this._buffer.splice(in_offset, in_deleteCount);\n this.size -= in_deleteCount;\n } else {\n throw Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n }\n }\n\n /**\n * Set this array values to be equal to in_array values.\n * @param in_offset - An optional offset in this array to begin start\n * setting this arrays values to in_array values.\n * @param in_array - The input array.\n */\n set(in_offset: number, in_array) {\n if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {\n this.arraySet(this._buffer, in_array, in_offset);\n } else if (in_array instanceof BaseDataArray) {\n this.arraySet(this._buffer, in_array.getBuffer(), in_offset);\n } else {\n console.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n }\n }\n\n /**\n * Return a range of values in the array.\n * @param in_idxStart - the starting index\n * @param in_idxEnd - the end index - this offset is exclusive\n * @returns the array of values in the range\n */\n getValueRange(in_idxStart: number, in_idxEnd: number) {\n if (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n return this._buffer.slice(in_idxStart, in_idxEnd);\n }\n\n /**\n * change the size of a javascript array and keep the content, if possible. Keeps the input buffer.\n * @param in_buffer - input buffer - not changed\n * @param in_newSize - target size\n * @returns an Array of the new size\n */\n private resizeBufferArray(in_buffer, in_newSize) {\n // target buffer with the desired new size\n const newBuffer = new Array(in_newSize);\n const oldSize = in_buffer.length;\n const oldBuffer = in_buffer;\n const isShrinking = oldSize > in_newSize;\n this.arraySet(newBuffer, isShrinking ? oldBuffer.slice(0, in_newSize) : oldBuffer);\n return newBuffer;\n }\n\n /**\n * allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n * which makes pushes to the array less expensive later)\n * @param size - the target allocated space\n * @returns the DataArray itself\n */\n protected _alloc(size: number): any {\n this._buffer = this.resizeBufferArray(this._buffer, size);\n return this;\n }\n}\n\n/**\n * A data container that contains a string\n */\nclass StringDataArray extends BaseDataArray {\n constructor() {\n super(String, 0);\n this.size = 0;\n this._buffer = \"\";\n }\n /**\n * insert the content of a string into the StringDataArray\n * @param in_offset - the target index\n * @param in_string - the string to be inserted\n */\n insertRange(in_offset: number, in_string: string) {\n this._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset)}`;\n this.size = this.size + in_string.length;\n }\n\n /**\n * remove a range of elements from the string\n * @param in_offset - start of the range\n * @param in_deleteCount - number of elements to be removed\n */\n removeRange(in_offset: number, in_deleteCount: number) {\n if (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n this._buffer = `${this._buffer.substr(0, in_offset)}${this._buffer.substr(in_offset + in_deleteCount)}`;\n this.size -= in_deleteCount;\n } else {\n throw Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n }\n }\n\n /**\n * Set this array values to be equal to in_string values.\n * @param in_offset - The offset in this array to begin start setting this arrays values to in_string values.\n * @param in_string - The input string.\n */\n set(in_offset: number, in_string: string) {\n this._buffer =\n `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(in_offset + in_string.length)}`;\n }\n\n /**\n * Return a range of characters in the string.\n * @param in_idxStart - the starting index\n * @param in_idxEnd - the end index - this offset is exclusive\n * @returns the characters in the range\n */\n getValueRange(in_idxStart: number, in_idxEnd: number): string {\n if (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n throw new Error(\"Trying to access out of bounds!\");\n }\n return this._buffer.slice(in_idxStart, in_idxEnd);\n }\n\n get length() { return this._buffer.length; }\n}\n\n/**\n * A data container that can contain boolean type\n */\nclass BoolDataArray extends UniversalDataArray {\n /**\n * @param size - The initial size with which to allocate the array.\n */\n constructor(size: number) {\n super(Array, size);\n }\n\n /**\n * helper function to write and cast to boolean array values into another array at a given offset\n * @param array - target array\n * @param values - the values we need to write\n * @param offset - starting index in target array\n */\n private arraySetBool(array, values, offset = 0) {\n let index = 0;\n values.forEach(function(value) {\n array[index + offset] = !!(value as boolean);\n index++;\n });\n }\n\n /**\n * insert the content of an array into the DataArray\n * @param in_offset - the target index\n * @param in_array - the array to be inserted\n */\n insertRange(in_offset: number, in_array: any[]) {\n const toBeAdded: any[] = in_array.map((val) => !!(val as boolean));\n this._buffer.splice.call(this._buffer, ...([in_offset, 0].concat(toBeAdded)));\n this.size = this.size + in_array.length;\n }\n\n /**\n * Set this array values to be equal to in_array values.\n * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n * @param in_array - The input array.\n */\n set(in_offset: number, in_array) {\n if (in_array instanceof ArrayBuffer || in_array instanceof Array || in_array instanceof this.getBufferCtor()) {\n this.arraySetBool(this._buffer, in_array, in_offset);\n } else if (in_array instanceof BaseDataArray) {\n this.arraySetBool(this._buffer, in_array.getBuffer(), in_offset);\n } else {\n console.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n }\n }\n}\n\nexport {\n BaseDataArray,\n Float32DataArray,\n Float64DataArray,\n Int8DataArray,\n Int16DataArray,\n Int32DataArray,\n Uint8DataArray,\n Uint16DataArray,\n Uint32DataArray,\n UniversalDataArray,\n StringDataArray,\n BoolDataArray,\n};\n"]}
1
+ {"version":3,"file":"dataArray.js","sourceRoot":"","sources":["../../src/datastructures/dataArray.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wDAAwD;AACxD,4DAA4D;AAE5D;;GAEG;AAEH;;;GAGG;AACH,MAAM,aAAa;IAYlB,YAAY,CAAC,EAAE,CAAE;QAChB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;SAC9C;aAAM;YACN,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;SACd;QACD,6DAA6D;QAC7D,mDAAmD;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,MAAM,GAAG,CAAC;QAClB,IAAI,M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AAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAE,GAAe,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,SAAiB,EAAE,QAAQ;QAC9B,IACC,QAAQ,YAAY,WAAW;YAC/B,QAAQ,YAAY,KAAK;YACzB,QAAQ,YAAY,IAAI,CAAC,aAAa,EAAE,EACvC;YACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;SACrD;aAAM,IAAI,QAAQ,YAAY,aAAa,EAAE;YAC7C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,SAAS,CAAC,CAAC;SACjE;aAAM;YACN,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;SACpF;IACF,CAAC;CACD;AAED,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,GACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint accessor-pairs: [2, { \"getWithoutSet\": false }] */\n\n/**\n * The data arrays definition file.\n */\n\n/**\n * A typed data container that is persistable, high-performance, and can be used\n * as a backing store for collaborative property sets.\n */\nclass BaseDataArray {\n\tprotected _buffer: any;\n\tprivate readonly bufferConstructor;\n\tprotected size: number;\n\n\tconstructor(size: number);\n\n\t/**\n\t * @param bufferConstructor - This is the constructor to be used to setup the internal buffer of the DataArray.\n\t * @param size - The initial size with which to allocate the array.\n\t */\n\tconstructor(bufferConstructor: any, size: number);\n\tconstructor(a, b?) {\n\t\tif (typeof a === \"number\") {\n\t\t\tthis.size = a;\n\t\t\tthis.bufferConstructor = this.getBufferCtor();\n\t\t} else {\n\t\t\tthis.bufferConstructor = a;\n\t\t\tthis.size = b;\n\t\t}\n\t\t// The 'eslint-...' is used to disable the rule that requires\n\t\t// constructors to start with a capitalized letter.\n\t\tthis._buffer = new this.bufferConstructor(this.size);\n\t}\n\n\t/**\n\t * Get the value at an index. If no index is passed, return zeroth item.\n\t * @param in_idx - The specific item in the data array.\n\t * @returns The value at that index.\n\t */\n\tgetValue(in_idx = 0): any {\n\t\tif (in_idx >= this.size || in_idx < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\n\t\treturn this._buffer[in_idx];\n\t}\n\n\t/**\n\t * Return a range of values in the array.\n\t * @param in_idxStart - the starting index\n\t * @param in_idxEnd - the end index\n\t * @returns the array of values in the range\n\t */\n\tgetValueRange(in_idxStart: number, in_idxEnd: number) {\n\t\tif (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\n\t\treturn this._buffer.subarray(in_idxStart, in_idxEnd);\n\t}\n\n\t/**\n\t * Return the serialized form of Data Arrays.\n\t * @returns An object containing an array of the values.\n\t */\n\tserialize(): number[] {\n\t\treturn Array.from(this._buffer.subarray(0, this.size));\n\t}\n\n\t/**\n\t * Deserialize data from a serialized representation\n\t * @param in_serialized - the serialized representation\n\t */\n\tdeserialize(in_serialized) {\n\t\tconst values = in_serialized;\n\t\tconst length = in_serialized.length;\n\t\tif (length !== this.size) {\n\t\t\tthis.resize(length);\n\t\t\tthis.size = length;\n\t\t}\n\t\tlet i;\n\t\tfor (i = 0; i < length; i++) {\n\t\t\tthis._buffer[i] = values[i];\n\t\t}\n\t}\n\n\t/**\n\t * Set value at an index.\n\t * @param in_idx - the index\n\t * @param in_value - the value we want to set at index\n\t */\n\tsetValue(in_idx: number, in_value) {\n\t\tif (in_idx < this._buffer.length) {\n\t\t\tthis._buffer[in_idx] = in_value;\n\t\t} else {\n\t\t\tconsole.error(\"DataArray setValue in_idx is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * creates a copy of a typed array with removed elements\n\t * @param in_arr - the input array (won't be modified)\n\t * @param in_offset - starting index of range that will be removed\n\t * @param in_deleteCount - number of removed elements\n\t * @returns a copy of the input array without the selected range\n\t */\n\tprivate _removeElementsFromArray(in_arr, in_offset: number, in_deleteCount: number) {\n\t\t// TODO: this function can be optimized\n\t\tconst newSize = this.size - in_deleteCount;\n\t\tconst splicedArray = new in_arr.constructor(newSize);\n\t\tsplicedArray.set(in_arr.subarray(0, in_offset));\n\t\tsplicedArray.set(in_arr.subarray(in_offset + in_deleteCount, this.size), in_offset);\n\t\treturn splicedArray;\n\t}\n\n\t/**\n\t * remove a range of elements from the array\n\t * @param in_offset - start of the range\n\t * @param in_deleteCount - number of elements to be removed\n\t */\n\tremoveRange(in_offset: number, in_deleteCount: number) {\n\t\tif (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n\t\t\tthis._buffer = this._removeElementsFromArray(this._buffer, in_offset, in_deleteCount);\n\t\t\tthis.size = this.size - in_deleteCount;\n\t\t} else {\n\t\t\tconsole.error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * copy an array with elements inserted into the copy\n\t * @param in_arr - the input array (won't be modified)\n\t * @param in_offset - the index where the new elements will be inserted\n\t * @param in_addedArray - the array with the elements that will be added\n\t * @returns the combined array\n\t */\n\tprivate _insert(in_arr, in_offset: number, in_addedArray) {\n\t\t// TODO: this function can be optimized\n\t\tconst newSize = this.size + (in_addedArray.length as number);\n\t\tconst insertedArray = new in_arr.constructor(newSize);\n\t\tinsertedArray.set(in_arr.subarray(0, in_offset));\n\t\tinsertedArray.set(in_addedArray, in_offset);\n\t\tinsertedArray.set(\n\t\t\tin_arr.subarray(in_offset, this.size),\n\t\t\tin_offset + (in_addedArray.length as number),\n\t\t);\n\t\treturn insertedArray;\n\t}\n\n\t/**\n\t * insert the content of an array into the DataArray\n\t * @param in_offset - the target index\n\t * @param in_array - the array to be inserted\n\t */\n\tinsertRange(in_offset: number, in_array) {\n\t\tthis._buffer = this._insert(this._buffer, in_offset, in_array);\n\t\tthis.size = this.size + (in_array.length as number);\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_array values.\n\t * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n\t * @param in_array - The input array.\n\t */\n\tset(in_offset: number, in_array) {\n\t\tif (\n\t\t\tin_array instanceof ArrayBuffer ||\n\t\t\tin_array instanceof Array ||\n\t\t\tin_array instanceof this.getBufferCtor()\n\t\t) {\n\t\t\tthis._buffer.set(in_array, in_offset);\n\t\t} else if (in_array instanceof BaseDataArray) {\n\t\t\tthis._buffer.set(in_array.getBuffer(), in_offset);\n\t\t} else {\n\t\t\tconsole.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n\t\t}\n\t}\n\n\t/**\n\t * Insert a value at the end of the array, creates a new element at the end and sets the value.\n\t * @param in_value - The new value.\n\t */\n\tpush(in_value) {\n\t\t// Adjust the buffer if necessary\n\t\tconst bufferLength = this._buffer.length;\n\t\tif (this.size > bufferLength - 1) {\n\t\t\tthis._alloc(this.size * 2 || 1); // grow by a factor of 2x\n\t\t}\n\t\t// set the value and update size\n\t\tthis.setValue(this.size, in_value);\n\t\tthis.size++;\n\t}\n\n\t/**\n\t * Get direct access to the data (for performance reasons) this should be uses read only.\n\t * @returns The (read only) raw data.\n\t */\n\tgetBuffer() {\n\t\treturn this._buffer;\n\t}\n\n\t/**\n\t * Get the constructor of the underlying `TypedArray`.\n\t * @returns The constructor for the data buffer.\n\t */\n\tgetBufferCtor() {\n\t\treturn this.bufferConstructor;\n\t}\n\n\t/**\n\t * Apply a given function to all elements of the array.\n\t * @param in_fn - The function that will be applied to every element.\n\t */\n\titerate(in_fn) {\n\t\tconst l = this.size;\n\t\tfor (let i = 0; i < l; i++) {\n\t\t\tin_fn(this._buffer[i]);\n\t\t}\n\t}\n\n\t/**\n\t * Tet a resized buffer copy.\n\t * @param in_bufferCtor - The constructor for the returned buffer.\n\t * @param in_buffer - The input buffer (won't be modified).\n\t * @param in_newSize - The target size.\n\t * @returns The buffer with the new size.\n\t */\n\tprivate resizeBuffer(in_bufferCtor, in_buffer, in_newSize: number) {\n\t\t// target buffer with the desired new size\n\t\t// The 'eslint-...' is used to disable the rule that requires\n\t\t// constructors to start with a capitalized letter.\n\t\tconst newBuffer = new in_bufferCtor(in_newSize);\n\t\tconst oldSize = in_buffer.length;\n\t\tconst oldBuffer = in_buffer;\n\t\tconst isShrinking = oldSize > in_newSize;\n\t\tnewBuffer.set(isShrinking ? oldBuffer.subarray(0, in_newSize) : oldBuffer);\n\t\treturn newBuffer;\n\t}\n\n\t/**\n\t * Allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n\t * which makes pushes to the array less expensive later).\n\t * @param size - The target allocated space.\n\t * @returns The DataArray itself.\n\t */\n\tprotected _alloc(size: number): any {\n\t\tthis._buffer = this.resizeBuffer(this.bufferConstructor, this._buffer, size);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Change the size of the array\n\t * @param size - The target size\n\t * @returns The DataArray itself\n\t */\n\tresize(size: number) {\n\t\t// this can be costly!!!\n\t\tthis._alloc(size);\n\t\tthis.size = size;\n\t\treturn this;\n\t}\n\n\tcopy() {\n\t\t// and this!\n\t\tconst newBuffer = new this.bufferConstructor(this.size); // buffer with the desired new size\n\t\tnewBuffer.set(this._buffer);\n\t\treturn newBuffer;\n\t}\n\n\tget length() {\n\t\treturn this.size;\n\t}\n}\n\nclass Int8DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Int8Array, size);\n\t}\n}\n\nclass Int16DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Int16Array, size);\n\t}\n}\n\nclass Int32DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Int32Array, size);\n\t}\n}\n\nclass Uint8DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Uint8Array, size);\n\t}\n}\n\nclass Uint16DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Uint16Array, size);\n\t}\n}\n\nclass Uint32DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Uint32Array, size);\n\t}\n}\n\nclass Float32DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Float32Array, size);\n\t}\n}\n\nclass Float64DataArray extends BaseDataArray {\n\tconstructor(size: number) {\n\t\tsuper(Float64Array, size);\n\t}\n}\n\n/**\n * A data container that can contain every native type\n *\n * @param size - The initial size with which to allocate the array.\n */\nclass UniversalDataArray extends BaseDataArray {\n\tconstructor(bufferConstructor: any, size: number);\n\tconstructor(size: number);\n\tconstructor(a?, b?) {\n\t\tif (b === undefined) {\n\t\t\tsuper(Array, a);\n\t\t} else {\n\t\t\tsuper(a, b);\n\t\t}\n\t}\n\n\t/**\n\t * Helper function to write array values into another array at a given offset.\n\t *\n\t * @param array - The target array.\n\t * @param values - The values we need to write.\n\t * @param offset - The starting index in target array.\n\t */\n\tprivate arraySet(array, values, offset = 0) {\n\t\tlet index = 0;\n\t\tvalues.forEach(function (value) {\n\t\t\tarray[index + offset] = value;\n\t\t\tindex++;\n\t\t});\n\t}\n\n\t/**\n\t * Insert the content of an array into the DataArray.\n\t * @param in_offset - The target index.\n\t * @param in_array - The array to be inserted.\n\t */\n\tinsertRange(in_offset: number, in_array: any[]) {\n\t\tthis._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(in_array));\n\t\tthis.size = this.size + in_array.length;\n\t}\n\n\t/**\n\t * Eemove a range of elements from the array.\n\t * @param in_offset - The start of the range.\n\t * @param in_deleteCount - The number of elements to be removed.\n\t */\n\tremoveRange(in_offset: number, in_deleteCount: number) {\n\t\tif (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n\t\t\tthis._buffer.splice(in_offset, in_deleteCount);\n\t\t\tthis.size -= in_deleteCount;\n\t\t} else {\n\t\t\tthrow Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_array values.\n\t * @param in_offset - An optional offset in this array to begin start\n\t * setting this arrays values to in_array values.\n\t * @param in_array - The input array.\n\t */\n\tset(in_offset: number, in_array) {\n\t\tif (\n\t\t\tin_array instanceof ArrayBuffer ||\n\t\t\tin_array instanceof Array ||\n\t\t\tin_array instanceof this.getBufferCtor()\n\t\t) {\n\t\t\tthis.arraySet(this._buffer, in_array, in_offset);\n\t\t} else if (in_array instanceof BaseDataArray) {\n\t\t\tthis.arraySet(this._buffer, in_array.getBuffer(), in_offset);\n\t\t} else {\n\t\t\tconsole.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n\t\t}\n\t}\n\n\t/**\n\t * Return a range of values in the array.\n\t * @param in_idxStart - the starting index\n\t * @param in_idxEnd - the end index - this offset is exclusive\n\t * @returns the array of values in the range\n\t */\n\tgetValueRange(in_idxStart: number, in_idxEnd: number) {\n\t\tif (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\t\treturn this._buffer.slice(in_idxStart, in_idxEnd);\n\t}\n\n\t/**\n\t * change the size of a javascript array and keep the content, if possible. Keeps the input buffer.\n\t * @param in_buffer - input buffer - not changed\n\t * @param in_newSize - target size\n\t * @returns an Array of the new size\n\t */\n\tprivate resizeBufferArray(in_buffer, in_newSize) {\n\t\t// target buffer with the desired new size\n\t\tconst newBuffer = new Array(in_newSize);\n\t\tconst oldSize = in_buffer.length;\n\t\tconst oldBuffer = in_buffer;\n\t\tconst isShrinking = oldSize > in_newSize;\n\t\tthis.arraySet(newBuffer, isShrinking ? oldBuffer.slice(0, in_newSize) : oldBuffer);\n\t\treturn newBuffer;\n\t}\n\n\t/**\n\t * allocate memory for the array (for performance reasons, you can allocate more space than the current length,\n\t * which makes pushes to the array less expensive later)\n\t * @param size - the target allocated space\n\t * @returns the DataArray itself\n\t */\n\tprotected _alloc(size: number): any {\n\t\tthis._buffer = this.resizeBufferArray(this._buffer, size);\n\t\treturn this;\n\t}\n}\n\n/**\n * A data container that contains a string\n */\nclass StringDataArray extends BaseDataArray {\n\tconstructor() {\n\t\tsuper(String, 0);\n\t\tthis.size = 0;\n\t\tthis._buffer = \"\";\n\t}\n\t/**\n\t * insert the content of a string into the StringDataArray\n\t * @param in_offset - the target index\n\t * @param in_string - the string to be inserted\n\t */\n\tinsertRange(in_offset: number, in_string: string) {\n\t\tthis._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(\n\t\t\tin_offset,\n\t\t)}`;\n\t\tthis.size = this.size + in_string.length;\n\t}\n\n\t/**\n\t * remove a range of elements from the string\n\t * @param in_offset - start of the range\n\t * @param in_deleteCount - number of elements to be removed\n\t */\n\tremoveRange(in_offset: number, in_deleteCount: number) {\n\t\tif (in_offset + in_deleteCount < (this._buffer.length as number) + 1) {\n\t\t\tthis._buffer = `${this._buffer.substr(0, in_offset)}${this._buffer.substr(\n\t\t\t\tin_offset + in_deleteCount,\n\t\t\t)}`;\n\t\t\tthis.size -= in_deleteCount;\n\t\t} else {\n\t\t\tthrow Error(\"DataArray removeRange in_offset + in_deleteCount is out of bounds.\");\n\t\t}\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_string values.\n\t * @param in_offset - The offset in this array to begin start setting this arrays values to in_string values.\n\t * @param in_string - The input string.\n\t */\n\tset(in_offset: number, in_string: string) {\n\t\tthis._buffer = `${this._buffer.substr(0, in_offset)}${in_string}${this._buffer.substr(\n\t\t\tin_offset + in_string.length,\n\t\t)}`;\n\t}\n\n\t/**\n\t * Return a range of characters in the string.\n\t * @param in_idxStart - the starting index\n\t * @param in_idxEnd - the end index - this offset is exclusive\n\t * @returns the characters in the range\n\t */\n\tgetValueRange(in_idxStart: number, in_idxEnd: number): string {\n\t\tif (in_idxStart >= this.size || in_idxEnd > this.size || in_idxStart < 0 || in_idxEnd < 0) {\n\t\t\tthrow new Error(\"Trying to access out of bounds!\");\n\t\t}\n\t\treturn this._buffer.slice(in_idxStart, in_idxEnd);\n\t}\n\n\tget length() {\n\t\treturn this._buffer.length;\n\t}\n}\n\n/**\n * A data container that can contain boolean type\n */\nclass BoolDataArray extends UniversalDataArray {\n\t/**\n\t * @param size - The initial size with which to allocate the array.\n\t */\n\tconstructor(size: number) {\n\t\tsuper(Array, size);\n\t}\n\n\t/**\n\t * helper function to write and cast to boolean array values into another array at a given offset\n\t * @param array - target array\n\t * @param values - the values we need to write\n\t * @param offset - starting index in target array\n\t */\n\tprivate arraySetBool(array, values, offset = 0) {\n\t\tlet index = 0;\n\t\tvalues.forEach(function (value) {\n\t\t\tarray[index + offset] = !!(value as boolean);\n\t\t\tindex++;\n\t\t});\n\t}\n\n\t/**\n\t * insert the content of an array into the DataArray\n\t * @param in_offset - the target index\n\t * @param in_array - the array to be inserted\n\t */\n\tinsertRange(in_offset: number, in_array: any[]) {\n\t\tconst toBeAdded: any[] = in_array.map((val) => !!(val as boolean));\n\t\tthis._buffer.splice.call(this._buffer, ...[in_offset, 0].concat(toBeAdded));\n\t\tthis.size = this.size + in_array.length;\n\t}\n\n\t/**\n\t * Set this array values to be equal to in_array values.\n\t * @param in_offset - An optional offset in this array to begin start setting this arrays values to in_array values.\n\t * @param in_array - The input array.\n\t */\n\tset(in_offset: number, in_array) {\n\t\tif (\n\t\t\tin_array instanceof ArrayBuffer ||\n\t\t\tin_array instanceof Array ||\n\t\t\tin_array instanceof this.getBufferCtor()\n\t\t) {\n\t\t\tthis.arraySetBool(this._buffer, in_array, in_offset);\n\t\t} else if (in_array instanceof BaseDataArray) {\n\t\t\tthis.arraySetBool(this._buffer, in_array.getBuffer(), in_offset);\n\t\t} else {\n\t\t\tconsole.error(\"DataArray set() must be called with Array, TypedArray or DataArray\");\n\t\t}\n\t}\n}\n\nexport {\n\tBaseDataArray,\n\tFloat32DataArray,\n\tFloat64DataArray,\n\tInt8DataArray,\n\tInt16DataArray,\n\tInt32DataArray,\n\tUint8DataArray,\n\tUint16DataArray,\n\tUint32DataArray,\n\tUniversalDataArray,\n\tStringDataArray,\n\tBoolDataArray,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"integer64.d.ts","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;;;;;;;;GAUG;AACH,qBAAa,SAAS;IACN,SAAS,CAAC,GAAG;IAAM,SAAS,CAAC,IAAI;gBAAvB,GAAG,SAAI,EAAY,IAAI,SAAI;IAEjD;;OAEG;IACH,YAAY;IAIZ;;OAEG;IACH,WAAW;IAIX,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,SAAK,GAAG,MAAM;CAqBrE;AA0DD;;GAEG;AACH,qBAAa,KAAM,SAAQ,SAAS;IAChC,MAAM,CAAC,UAAU,cAAuB,MAAM,2BAG5C;IAEF,KAAK;IAIL,QAAQ,CAAC,KAAK,SAAK;CAGtB;AAED;;GAEG;AACH,qBAAa,MAAO,SAAQ,SAAS;IACjC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,SAAK;IAKlD,KAAK;IAIL,QAAQ,CAAC,KAAK,KAAA;CAGjB"}
1
+ {"version":3,"file":"integer64.d.ts","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;;;;;;;;GAUG;AACH,qBAAa,SAAS;IACT,SAAS,CAAC,GAAG;IAAM,SAAS,CAAC,IAAI;gBAAvB,GAAG,SAAI,EAAY,IAAI,SAAI;IAEjD;;OAEG;IACH,YAAY;IAIZ;;OAEG;IACH,WAAW;IAIX,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,SAAK,GAAG,MAAM;CAwBlE;AA0DD;;GAEG;AACH,qBAAa,KAAM,SAAQ,SAAS;IACnC,MAAM,CAAC,UAAU,cAAwB,MAAM,2BAG7C;IAEF,KAAK;IAIL,QAAQ,CAAC,KAAK,SAAK;CAGnB;AAED;;GAEG;AACH,qBAAa,MAAO,SAAQ,SAAS;IACpC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,SAAK;IAKlD,KAAK;IAIL,QAAQ,CAAC,KAAK,KAAA;CAGd"}
@@ -44,7 +44,7 @@ export class Integer64 {
44
44
  let high = this.getValueHigh();
45
45
  let low = this.getValueLow();
46
46
  let result = "";
47
- const sign = !!(isSigned && (high & 0x80000000)); // eslint-disable-line no-bitwise
47
+ const sign = !!(isSigned && high & 0x80000000); // eslint-disable-line no-bitwise
48
48
  if (sign) {
49
49
  high = ~high; // eslint-disable-line no-bitwise
50
50
  low = BIT32 - low;
@@ -1 +1 @@
1
- {"version":3,"file":"integer64.js","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,OAAO,SAAS;IAClB,YAAsB,MAAM,CAAC,EAAY,OAAO,CAAC;QAA3B,QAAG,GAAH,GAAG,CAAI;QAAY,SAAI,GAAJ,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EAAE,QAAQ,CAAC,CAAC;QAC1E,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,KAAK;QACD,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,QAAQ,CAAC,KAAK;QACV,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview implements (U)Int64 Datastructures\n */\n\nimport _ from \"lodash\";\nimport { ConsoleUtils } from \"../consoleUtils\";\nimport { constants } from \"../constants\";\n\nconst BIT32 = 4294967296;\nconst { MSG } = constants;\n\n/**\n * A data representation class for 64 bit integer types.\n *\n * @remarks This is necessary since js doesn't support 64bit integers natively yet.\n *\n * Please note this class is immutable.\n * There are and there won't be set functions! (see javascript String class)\n *\n * @param low - Lower 32 bit\n * @param high - Higher 32 bit\n */\nexport class Integer64 {\n constructor(protected low = 0, protected high = 0) { }\n\n /**\n * @returns The higher 32 bit integer part\n */\n getValueHigh() {\n return this.high;\n }\n\n /**\n * @returns The lower 32 bit integer part\n */\n getValueLow() {\n return this.low;\n }\n\n protected _int64toString(isSigned: boolean, in_radix = 10): string {\n ConsoleUtils.assert(_.isNumber(in_radix), `${MSG.IN_RADIX_MUST_BE_NUMBER} ${in_radix}`);\n ConsoleUtils.assert(in_radix >= 2 && 36 >= in_radix, `${MSG.BASE_OUT_OF_RANGE} ${in_radix}`);\n\n let high = this.getValueHigh();\n let low = this.getValueLow();\n let result = \"\";\n const sign = !!(isSigned && (high & 0x80000000)); // eslint-disable-line no-bitwise\n if (sign) {\n high = ~high; // eslint-disable-line no-bitwise\n low = BIT32 - low;\n }\n do {\n const mod = (high % in_radix) * BIT32 + low;\n high = Math.floor(high / in_radix);\n low = Math.floor(mod / in_radix);\n result = (mod % in_radix).toString(in_radix) + result;\n } while (high || low);\n\n return sign ? `-${result}` : result;\n }\n}\n\n/**\n * stringToInt function parses a string argument updates object's lower and higher 32 bit integer parts.\n *\n * @param in_signed - If the expect response should be signed or unsigned.\n * @param in_string - The value to parse. Leading whitespace in the string argument is ignored.\n * @param in_radix - An integer between 2 and 36 that represents the\n * radix (the base in mathematical numeral systems) of the above mentioned string.\n *\n * @throws If `in_string` is not a string.\n * @throws If `in_radix` is entered but is not a number between 2 and 36.\n * @throws If the property is a `Uint64` property and `in_string` is a negative number.\n * @throws If `in_string` contains characters other than numbers.\n *\n * @returns Low and high bits of `Int64`.\n */\nfunction _stringToInt64(in_signed: boolean, in_string: string, in_radix = 10): number[] {\n ConsoleUtils.assert(_.isString(in_string), MSG.IN_STRING_MUST_BE_STRING + in_string);\n const string = in_string.trim();\n\n ConsoleUtils.assert(_.isNumber(in_radix), `${MSG.IN_RADIX_BETWEEN_2_36} ${in_radix}`);\n ConsoleUtils.assert(in_radix >= 2 && 36 >= in_radix, `${MSG.BASE_OUT_OF_RANGE} ${in_radix}`);\n\n let position = 0;\n let negative = false;\n let high = 0;\n let low = 0;\n if (string[0] === \"-\") {\n negative = true;\n position += 1;\n }\n\n ConsoleUtils.assert(!negative || in_signed, MSG.CANNOT_UPDATE_TO_NEGATIVE + string);\n\n while (position < string.length) {\n const digit = parseInt(string[position++], in_radix);\n if (isNaN(digit)) {\n throw new TypeError(MSG.CANNOT_PARSE_INVALID_CHARACTERS + string);\n }\n low = low * in_radix + digit;\n high = high * in_radix + Math.floor(low / BIT32);\n low %= BIT32;\n }\n\n if (negative) {\n // eslint-disable-next-line no-bitwise\n high = ~high;\n if (low) {\n low = BIT32 - low;\n } else {\n high += 1;\n }\n }\n\n return [low, high];\n}\n\n/**\n * A data representation class for the signed 64 bit integer type\n */\nexport class Int64 extends Integer64 {\n static fromString = function(in_string: string, radix = 10) {\n const [low, high] = _stringToInt64(true, in_string, radix);\n return new Int64(low, high);\n };\n\n clone() {\n return new Int64(this.low, this.high);\n }\n\n toString(radix = 10) {\n return this._int64toString(true, radix);\n }\n}\n\n/**\n * A data representation class for the unsigned 64 bit integer type\n */\nexport class Uint64 extends Integer64 {\n static fromString(in_string: string, in_radix = 10) {\n const [low, high] = _stringToInt64.call(this, false, in_string, in_radix);\n return new Uint64(low, high);\n }\n\n clone() {\n return new Uint64(this.low, this.high);\n }\n\n toString(radix) {\n return this._int64toString(false, radix);\n }\n}\n"]}
1
+ {"version":3,"file":"integer64.js","sourceRoot":"","sources":["../../src/datastructures/integer64.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,OAAO,SAAS;IACrB,YAAsB,MAAM,CAAC,EAAY,OAAO,CAAC;QAA3B,QAAG,GAAH,GAAG,CAAI;QAAY,SAAI,GAAJ,IAAI,CAAI;IAAG,CAAC;IAErD;;OAEG;IACH,YAAY;QACX,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,WAAW;QACV,OAAO,IAAI,CAAC,GAAG,CAAC;IACjB,CAAC;IAES,cAAc,CAAC,QAAiB,EAAE,QAAQ,GAAG,EAAE;QACxD,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,GAAG,CAAC,uBAAuB,IAAI,QAAQ,EAAE,CAAC,CAAC;QACxF,YAAY,CAAC,MAAM,CAClB,QAAQ,IAAI,CAAC,IAAI,EAAE,IAAI,QAAQ,EAC/B,GAAG,GAAG,CAAC,iBAAiB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AAE,IAAI,CAAC,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,SAAS;IAMnC,KAAK;QACJ,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,QAAQ,CAAC,KAAK,GAAG,EAAE;QAClB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;;AAXM,gBAAU,GAAG,UAAU,SAAiB,EAAE,KAAK,GAAG,EAAE;IAC1D,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC;AAWH;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,SAAS;IACpC,MAAM,CAAC,UAAU,CAAC,SAAiB,EAAE,QAAQ,GAAG,EAAE;QACjD,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC1E,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK;QACJ,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ,CAAC,KAAK;QACb,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview implements (U)Int64 Datastructures\n */\n\nimport _ from \"lodash\";\nimport { ConsoleUtils } from \"../consoleUtils\";\nimport { constants } from \"../constants\";\n\nconst BIT32 = 4294967296;\nconst { MSG } = constants;\n\n/**\n * A data representation class for 64 bit integer types.\n *\n * @remarks This is necessary since js doesn't support 64bit integers natively yet.\n *\n * Please note this class is immutable.\n * There are and there won't be set functions! (see javascript String class)\n *\n * @param low - Lower 32 bit\n * @param high - Higher 32 bit\n */\nexport class Integer64 {\n\tconstructor(protected low = 0, protected high = 0) {}\n\n\t/**\n\t * @returns The higher 32 bit integer part\n\t */\n\tgetValueHigh() {\n\t\treturn this.high;\n\t}\n\n\t/**\n\t * @returns The lower 32 bit integer part\n\t */\n\tgetValueLow() {\n\t\treturn this.low;\n\t}\n\n\tprotected _int64toString(isSigned: boolean, in_radix = 10): string {\n\t\tConsoleUtils.assert(_.isNumber(in_radix), `${MSG.IN_RADIX_MUST_BE_NUMBER} ${in_radix}`);\n\t\tConsoleUtils.assert(\n\t\t\tin_radix >= 2 && 36 >= in_radix,\n\t\t\t`${MSG.BASE_OUT_OF_RANGE} ${in_radix}`,\n\t\t);\n\n\t\tlet high = this.getValueHigh();\n\t\tlet low = this.getValueLow();\n\t\tlet result = \"\";\n\t\tconst sign = !!(isSigned && high & 0x80000000); // eslint-disable-line no-bitwise\n\t\tif (sign) {\n\t\t\thigh = ~high; // eslint-disable-line no-bitwise\n\t\t\tlow = BIT32 - low;\n\t\t}\n\t\tdo {\n\t\t\tconst mod = (high % in_radix) * BIT32 + low;\n\t\t\thigh = Math.floor(high / in_radix);\n\t\t\tlow = Math.floor(mod / in_radix);\n\t\t\tresult = (mod % in_radix).toString(in_radix) + result;\n\t\t} while (high || low);\n\n\t\treturn sign ? `-${result}` : result;\n\t}\n}\n\n/**\n * stringToInt function parses a string argument updates object's lower and higher 32 bit integer parts.\n *\n * @param in_signed - If the expect response should be signed or unsigned.\n * @param in_string - The value to parse. Leading whitespace in the string argument is ignored.\n * @param in_radix - An integer between 2 and 36 that represents the\n * radix (the base in mathematical numeral systems) of the above mentioned string.\n *\n * @throws If `in_string` is not a string.\n * @throws If `in_radix` is entered but is not a number between 2 and 36.\n * @throws If the property is a `Uint64` property and `in_string` is a negative number.\n * @throws If `in_string` contains characters other than numbers.\n *\n * @returns Low and high bits of `Int64`.\n */\nfunction _stringToInt64(in_signed: boolean, in_string: string, in_radix = 10): number[] {\n\tConsoleUtils.assert(_.isString(in_string), MSG.IN_STRING_MUST_BE_STRING + in_string);\n\tconst string = in_string.trim();\n\n\tConsoleUtils.assert(_.isNumber(in_radix), `${MSG.IN_RADIX_BETWEEN_2_36} ${in_radix}`);\n\tConsoleUtils.assert(in_radix >= 2 && 36 >= in_radix, `${MSG.BASE_OUT_OF_RANGE} ${in_radix}`);\n\n\tlet position = 0;\n\tlet negative = false;\n\tlet high = 0;\n\tlet low = 0;\n\tif (string[0] === \"-\") {\n\t\tnegative = true;\n\t\tposition += 1;\n\t}\n\n\tConsoleUtils.assert(!negative || in_signed, MSG.CANNOT_UPDATE_TO_NEGATIVE + string);\n\n\twhile (position < string.length) {\n\t\tconst digit = parseInt(string[position++], in_radix);\n\t\tif (isNaN(digit)) {\n\t\t\tthrow new TypeError(MSG.CANNOT_PARSE_INVALID_CHARACTERS + string);\n\t\t}\n\t\tlow = low * in_radix + digit;\n\t\thigh = high * in_radix + Math.floor(low / BIT32);\n\t\tlow %= BIT32;\n\t}\n\n\tif (negative) {\n\t\t// eslint-disable-next-line no-bitwise\n\t\thigh = ~high;\n\t\tif (low) {\n\t\t\tlow = BIT32 - low;\n\t\t} else {\n\t\t\thigh += 1;\n\t\t}\n\t}\n\n\treturn [low, high];\n}\n\n/**\n * A data representation class for the signed 64 bit integer type\n */\nexport class Int64 extends Integer64 {\n\tstatic fromString = function (in_string: string, radix = 10) {\n\t\tconst [low, high] = _stringToInt64(true, in_string, radix);\n\t\treturn new Int64(low, high);\n\t};\n\n\tclone() {\n\t\treturn new Int64(this.low, this.high);\n\t}\n\n\ttoString(radix = 10) {\n\t\treturn this._int64toString(true, radix);\n\t}\n}\n\n/**\n * A data representation class for the unsigned 64 bit integer type\n */\nexport class Uint64 extends Integer64 {\n\tstatic fromString(in_string: string, in_radix = 10) {\n\t\tconst [low, high] = _stringToInt64.call(this, false, in_string, in_radix);\n\t\treturn new Uint64(low, high);\n\t}\n\n\tclone() {\n\t\treturn new Uint64(this.low, this.high);\n\t}\n\n\ttoString(radix) {\n\t\treturn this._int64toString(false, radix);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sortedCollection.d.ts","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,mBAAmB,CAAC,CAA+C;IAE3E;;;;;;OAMG;gBACS,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAA;IAItC;;;;;;;;;;;OAWG;IACH,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM;IAK9D;;;;;;;OAOG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC;IASxC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAMrB;;;OAGG;IACH,KAAK,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAO5B;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IAiCjC;;;;;;OAMG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAOjC;;;;;;OAMG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAMjD"}
1
+ {"version":3,"file":"sortedCollection.d.ts","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,mBAAmB,CAAC,CAA+C;IAE3E;;;;;;OAMG;gBACS,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAA;IAItC;;;;;;;;;;;OAWG;IACH,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM;IAK9D;;;;;;;OAOG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC;IASxC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM;IAMrB;;;OAGG;IACH,KAAK,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAO5B;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IAqCjC;;;;;;OAMG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAUjC;;;;;;OAMG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAS9C"}
@@ -105,7 +105,9 @@ export class SortedCollection extends Collection {
105
105
  if (in_array.length === 1) {
106
106
  return 1;
107
107
  }
108
- return (middleIndex + 1) + this._binarySearchNearestIndex(in_array.slice(middleIndex + 1, in_array.length), in_key);
108
+ return (middleIndex +
109
+ 1 +
110
+ this._binarySearchNearestIndex(in_array.slice(middleIndex + 1, in_array.length), in_key));
109
111
  }
110
112
  return middleIndex;
111
113
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sortedCollection.js","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,UAAU,EAA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AAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7F,OAAO,gBAAgB,KAAK,IAAI,CAAC,QAAQ,EAAE;YACvC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;OAMG;IACH,sBAAsB,CAAC,MAAuB;QAC1C,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjG,OAAO,oBAAoB,KAAK,CAAC;YAC7B,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview\n * Declaration of the SortedCollection class\n */\n\nimport _ from \"lodash\";\nimport { Collection } from \"./collection\";\n\nexport class SortedCollection<T> extends Collection<T> {\n private _sortedKeys: string[] = [];\n private _comparisonFunction?: (x: string, y: string) => number = undefined;\n\n /**\n * A sorted collection class.\n * @param in_name - a friendly name to describe this collection. If undefined\n * the collection will have a default \"Untitled Collection\" assigned to its name.\n * @param in_type - optional parameter pointing to the constructor\n * of a type this Collection will host.\n */\n constructor(in_name?: string, in_type?) {\n super(in_name, in_type);\n }\n\n /**\n * Set the comparison function. By default the keys will be sorted wrt their ASCII code.\n *\n * @param in_fn - The function to compare two entries.\n * The return value of this function must convey to the following cases:\n *\n * - if a \\> b, then the return value must be greater than 0.\n *\n * - if a \\< b, then the return value must be less than 0.\n *\n * - if a == b, then the return value must be 0.\n */\n setComparisonFunction(in_fn?: (x: string, y: string) => number) {\n console.assert(_.isFunction(in_fn), \"Must provide a function\");\n this._comparisonFunction = in_fn;\n }\n\n /**\n * Add an item to the collection. Sort the list of keys in an ascending order.\n *\n * @param in_key - Key to store the value under.\n * @param in_value - Value to store in the collection.\n *\n * @returns The value passed in.\n */\n add(in_key: string | number, in_value: T) {\n const toReturn = super.add(in_key, in_value);\n\n this._sortedKeys.push(in_key.toString());\n this._sortedKeys.sort(this._comparisonFunction);\n\n return toReturn;\n }\n\n /**\n * Remove an item from this Collection. This method returns a Boolean indicating\n * the success or failure of the removal. This is practical because if we were\n * to throw an error when the key doesn't exist, it would require additional\n * checks by the caller to make sure this key exists prior to removal. Which\n * would make the attempt of removal more verbose and also costly because the\n * caller would have to keep a list – somewhere else – of the things he can\n * and cannot remove.\n *\n * @param in_key - the key we wish to remove\n * @returns true if the key exists and was removed, false otherwise.\n */\n remove(in_key: string) {\n const toReturn = super.remove(in_key);\n this._sortedKeys = _.without(this._sortedKeys, in_key);\n return toReturn;\n }\n\n /**\n * Copy the items of in_collection to this collection.\n * @returns cloned SortedCollection\n */\n clone(): SortedCollection<T> {\n const newCol = new SortedCollection<T>(this._name, this._type);\n newCol.setComparisonFunction(this._comparisonFunction);\n newCol.bulkAdd(this._items);\n return newCol;\n }\n\n /**\n * Internal function use to search (binary search) for the nearest index that\n * the given key would be inserted.\n * i.e. given the array [10, 20, 30, 40, 50] the index that 35 should be inserted at is 3\n * @param in_array - Target array\n * @param in_key - Key to check against\n * @returns The index at which the key would be inserted in\n */\n private _binarySearchNearestIndex(in_array: string[], in_key: string): number {\n if (this._comparisonFunction === undefined) {\n return _.sortedIndex(in_array, in_key);\n } else {\n const middleIndex = Math.floor((in_array.length - 1) / 2);\n\n if (middleIndex < 0) {\n return 0;\n }\n\n if (this._comparisonFunction(in_array[middleIndex], in_key) > 0) {\n if (in_array.length === 1) {\n return 0;\n }\n\n return this._binarySearchNearestIndex(in_array.slice(0, middleIndex), in_key);\n }\n\n if (this._comparisonFunction(in_array[middleIndex], in_key) < 0) {\n if (in_array.length === 1) {\n return 1;\n }\n\n return (middleIndex + 1) + this._binarySearchNearestIndex(\n in_array.slice(middleIndex + 1, in_array.length),\n in_key,\n );\n }\n\n return middleIndex;\n }\n }\n\n /**\n * Return the nearest next item to the given key i.e.\n * For the given list of keys ['1.0.1', '2.0.0', '2.2.0', '7.0.1'] the nearest next item to 6.0.1 is\n * the item mapped by '7.0.1'\n * @param in_key - The key to check against in order to get the nearest next item\n * @returns The nearest next item\n */\n getNearestNextItem(in_key: string) {\n const closestNextIndex = this._binarySearchNearestIndex(this._sortedKeys, in_key.toString());\n return closestNextIndex === this.getCount()\n ? undefined\n : this.item(this._sortedKeys[closestNextIndex]);\n }\n\n /**\n * Return the nearest previous item to the given key i.e.\n * For the given list of keys ['1.0.1', '2.0.0', '2.2.0', '7.0.1'] the nearest previous item to 6.0.1 is\n * the item mapped by '7.0.1'\n * @param in_key - The key to check against in order to get the nearest previous item\n * @returns The nearest previous item\n */\n getNearestPreviousItem(in_key: string | number) {\n const closestPreviousIndex = this._binarySearchNearestIndex(this._sortedKeys, in_key.toString());\n return closestPreviousIndex === 0\n ? undefined\n : this.item(this._sortedKeys[closestPreviousIndex - 1]);\n }\n}\n"]}
1
+ {"version":3,"file":"sortedCollection.js","sourceRoot":"","sources":["../../src/datastructures/sortedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,OAAO,gBAAoB,SAAQ,UAAa;IAIrD;;;;;;OAMG;IACH,YAAY,OAAgB,EAAE,OAAQ;QACrC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAXjB,gBAAW,GAAa,EAAE,CAAC;QAC3B,wBAAmB,GAAsC,SAAS,CAAC;IAW3E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,qBAAqB,CAAC,KAAwC;QAC7D,OAAO,CAAC,MAAM,CAAC,C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,yBAAyB,CAC1D,IAAI,CAAC,WAAW,EAChB,MAAM,CAAC,QAAQ,EAAE,CACjB,CAAC;QACF,OAAO,oBAAoB,KAAK,CAAC;YAChC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview\n * Declaration of the SortedCollection class\n */\n\nimport _ from \"lodash\";\nimport { Collection } from \"./collection\";\n\nexport class SortedCollection<T> extends Collection<T> {\n\tprivate _sortedKeys: string[] = [];\n\tprivate _comparisonFunction?: (x: string, y: string) => number = undefined;\n\n\t/**\n\t * A sorted collection class.\n\t * @param in_name - a friendly name to describe this collection. If undefined\n\t * the collection will have a default \"Untitled Collection\" assigned to its name.\n\t * @param in_type - optional parameter pointing to the constructor\n\t * of a type this Collection will host.\n\t */\n\tconstructor(in_name?: string, in_type?) {\n\t\tsuper(in_name, in_type);\n\t}\n\n\t/**\n\t * Set the comparison function. By default the keys will be sorted wrt their ASCII code.\n\t *\n\t * @param in_fn - The function to compare two entries.\n\t * The return value of this function must convey to the following cases:\n\t *\n\t * - if a \\> b, then the return value must be greater than 0.\n\t *\n\t * - if a \\< b, then the return value must be less than 0.\n\t *\n\t * - if a == b, then the return value must be 0.\n\t */\n\tsetComparisonFunction(in_fn?: (x: string, y: string) => number) {\n\t\tconsole.assert(_.isFunction(in_fn), \"Must provide a function\");\n\t\tthis._comparisonFunction = in_fn;\n\t}\n\n\t/**\n\t * Add an item to the collection. Sort the list of keys in an ascending order.\n\t *\n\t * @param in_key - Key to store the value under.\n\t * @param in_value - Value to store in the collection.\n\t *\n\t * @returns The value passed in.\n\t */\n\tadd(in_key: string | number, in_value: T) {\n\t\tconst toReturn = super.add(in_key, in_value);\n\n\t\tthis._sortedKeys.push(in_key.toString());\n\t\tthis._sortedKeys.sort(this._comparisonFunction);\n\n\t\treturn toReturn;\n\t}\n\n\t/**\n\t * Remove an item from this Collection. This method returns a Boolean indicating\n\t * the success or failure of the removal. This is practical because if we were\n\t * to throw an error when the key doesn't exist, it would require additional\n\t * checks by the caller to make sure this key exists prior to removal. Which\n\t * would make the attempt of removal more verbose and also costly because the\n\t * caller would have to keep a list – somewhere else – of the things he can\n\t * and cannot remove.\n\t *\n\t * @param in_key - the key we wish to remove\n\t * @returns true if the key exists and was removed, false otherwise.\n\t */\n\tremove(in_key: string) {\n\t\tconst toReturn = super.remove(in_key);\n\t\tthis._sortedKeys = _.without(this._sortedKeys, in_key);\n\t\treturn toReturn;\n\t}\n\n\t/**\n\t * Copy the items of in_collection to this collection.\n\t * @returns cloned SortedCollection\n\t */\n\tclone(): SortedCollection<T> {\n\t\tconst newCol = new SortedCollection<T>(this._name, this._type);\n\t\tnewCol.setComparisonFunction(this._comparisonFunction);\n\t\tnewCol.bulkAdd(this._items);\n\t\treturn newCol;\n\t}\n\n\t/**\n\t * Internal function use to search (binary search) for the nearest index that\n\t * the given key would be inserted.\n\t * i.e. given the array [10, 20, 30, 40, 50] the index that 35 should be inserted at is 3\n\t * @param in_array - Target array\n\t * @param in_key - Key to check against\n\t * @returns The index at which the key would be inserted in\n\t */\n\tprivate _binarySearchNearestIndex(in_array: string[], in_key: string): number {\n\t\tif (this._comparisonFunction === undefined) {\n\t\t\treturn _.sortedIndex(in_array, in_key);\n\t\t} else {\n\t\t\tconst middleIndex = Math.floor((in_array.length - 1) / 2);\n\n\t\t\tif (middleIndex < 0) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tif (this._comparisonFunction(in_array[middleIndex], in_key) > 0) {\n\t\t\t\tif (in_array.length === 1) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\treturn this._binarySearchNearestIndex(in_array.slice(0, middleIndex), in_key);\n\t\t\t}\n\n\t\t\tif (this._comparisonFunction(in_array[middleIndex], in_key) < 0) {\n\t\t\t\tif (in_array.length === 1) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tmiddleIndex +\n\t\t\t\t\t1 +\n\t\t\t\t\tthis._binarySearchNearestIndex(\n\t\t\t\t\t\tin_array.slice(middleIndex + 1, in_array.length),\n\t\t\t\t\t\tin_key,\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn middleIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Return the nearest next item to the given key i.e.\n\t * For the given list of keys ['1.0.1', '2.0.0', '2.2.0', '7.0.1'] the nearest next item to 6.0.1 is\n\t * the item mapped by '7.0.1'\n\t * @param in_key - The key to check against in order to get the nearest next item\n\t * @returns The nearest next item\n\t */\n\tgetNearestNextItem(in_key: string) {\n\t\tconst closestNextIndex = this._binarySearchNearestIndex(\n\t\t\tthis._sortedKeys,\n\t\t\tin_key.toString(),\n\t\t);\n\t\treturn closestNextIndex === this.getCount()\n\t\t\t? undefined\n\t\t\t: this.item(this._sortedKeys[closestNextIndex]);\n\t}\n\n\t/**\n\t * Return the nearest previous item to the given key i.e.\n\t * For the given list of keys ['1.0.1', '2.0.0', '2.2.0', '7.0.1'] the nearest previous item to 6.0.1 is\n\t * the item mapped by '7.0.1'\n\t * @param in_key - The key to check against in order to get the nearest previous item\n\t * @returns The nearest previous item\n\t */\n\tgetNearestPreviousItem(in_key: string | number) {\n\t\tconst closestPreviousIndex = this._binarySearchNearestIndex(\n\t\t\tthis._sortedKeys,\n\t\t\tin_key.toString(),\n\t\t);\n\t\treturn closestPreviousIndex === 0\n\t\t\t? undefined\n\t\t\t: this.item(this._sortedKeys[closestPreviousIndex - 1]);\n\t}\n}\n"]}
@@ -13,7 +13,7 @@ export declare class DeferredPromise<T> implements Promise<T> {
13
13
  private _rejectSelf;
14
14
  private readonly promise;
15
15
  constructor();
16
- [Symbol.toStringTag]: string;
16
+ readonly [Symbol.toStringTag]: string;
17
17
  finally(onfinally?: () => void): Promise<T>;
18
18
  /**
19
19
  * Fetches a node style callback that fulfills the promise when called.
@@ -1 +1 @@
1
- {"version":3,"file":"deferredPromise.d.ts","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;;IAQrC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAEhB,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxD;;;OAGG;IACH,KAAK;IAUQ,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC5C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KACpB,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACxD,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KACtB,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GACzD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAIlB,KAAK,CAAC,OAAO,GAAG,KAAK,EAC9B,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KACtB,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GACvD,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAIhB,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,MAAM,CAAC,MAAM,EAAE,GAAG;CAC5B"}
1
+ {"version":3,"file":"deferredPromise.d.ts","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;;IAQrC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAqB;IAE7C,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxD;;;OAGG;IACH,KAAK;IAUQ,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC/C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACjF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GACjF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAIlB,KAAK,CAAC,OAAO,GAAG,KAAK,EACjC,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAC/E,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAIhB,OAAO,CAAC,GAAG,EAAE,CAAC;IAGd,MAAM,CAAC,MAAM,EAAE,GAAG;CAGzB"}
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ var _a;
5
6
  /**
6
7
  * Creates a Promise that can be fulfilled or rejected later in an arbitrary manner (rather than
7
8
  * through the constructor's executor).
@@ -10,6 +11,7 @@
10
11
  */
11
12
  export class DeferredPromise {
12
13
  constructor() {
14
+ this[_a] = "DeferredPromise";
13
15
  this.promise = new Promise((resolve, reject) => {
14
16
  this._resolveSelf = resolve;
15
17
  this._rejectSelf = reject;
@@ -37,8 +39,12 @@ export class DeferredPromise {
37
39
  async catch(onrejected) {
38
40
  return this.promise.then(onrejected);
39
41
  }
40
- resolve(val) { this._resolveSelf(val); }
41
- reject(reason) { this._rejectSelf(reason); }
42
+ resolve(val) {
43
+ this._resolveSelf(val);
44
+ }
45
+ reject(reason) {
46
+ this._rejectSelf(reason);
47
+ }
42
48
  }
43
- Symbol.toStringTag;
49
+ _a = Symbol.toStringTag;
44
50
  //# sourceMappingURL=deferredPromise.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAKxB;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAGM,KAAK,CAAC,OAAO,CAAC,SAAsB;QACvC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,KAAK;QACD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACrB,yEAAyE;YACzE,IAAI,KAAK,EAAE;gBACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC7B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,IAAI,CACb,WACwD,EACxD,UACwD;QAExD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,KAAK,CACd,UACsD;QAEtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEM,OAAO,CAAC,GAAM,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAW,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC3D;AAtCI,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Creates a Promise that can be fulfilled or rejected later in an arbitrary manner (rather than\n * through the constructor's executor).\n * For example, a deferred promise could be fulfilled after waiting for many asynchronous\n * tasks to terminate. This class becomes useful when combining classic async calls with promises.\n */\nexport class DeferredPromise<T> implements Promise<T> {\n private _resolveSelf;\n private _rejectSelf;\n private readonly promise: Promise<T>;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolveSelf = resolve;\n this._rejectSelf = reject;\n });\n }\n [Symbol.toStringTag]: string;\n\n public async finally(onfinally?: () => void): Promise<T> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Fetches a node style callback that fulfills the promise when called.\n * @returns A node style callback that fulfills the promise when called.\n */\n getCb() {\n return (error, result) => {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (error) {\n return this.reject(error);\n }\n return this.resolve(result);\n };\n }\n\n public async then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) =>\n TResult1 | PromiseLike<TResult1>) | undefined | null,\n onrejected?: ((reason: any) =>\n TResult2 | PromiseLike<TResult2>) | undefined | null,\n ): Promise<TResult1 | TResult2> {\n return this.promise.then(onfulfilled, onrejected);\n }\n\n public async catch<TResult = never>(\n onrejected?: ((reason: any) =>\n TResult | PromiseLike<TResult>) | undefined | null,\n ): Promise<T | TResult> {\n return this.promise.then(onrejected);\n }\n\n public resolve(val: T) { this._resolveSelf(val); }\n public reject(reason: any) { this._rejectSelf(reason); }\n}\n"]}
1
+ {"version":3,"file":"deferredPromise.js","sourceRoot":"","sources":["../src/deferredPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAK3B;QAMS,QAAoB,GAAW,iBAAiB,CAAC;QALzD,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC3B,CAAC,CAAC,CAAC;IACJ,CAAC;IAGM,KAAK,CAAC,OAAO,CAAC,SAAsB;QAC1C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK;QACJ,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACxB,yEAAyE;YACzE,IAAI,KAAK,EAAE;gBACV,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC1B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,WAAiF,EACjF,UAAmF;QAEnF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC;IAEM,KAAK,CAAC,KAAK,CACjB,UAAiF;QAEjF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAEM,OAAO,CAAC,GAAM;QACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IACM,MAAM,CAAC,MAAW;QACxB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACD;KAvCU,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Creates a Promise that can be fulfilled or rejected later in an arbitrary manner (rather than\n * through the constructor's executor).\n * For example, a deferred promise could be fulfilled after waiting for many asynchronous\n * tasks to terminate. This class becomes useful when combining classic async calls with promises.\n */\nexport class DeferredPromise<T> implements Promise<T> {\n\tprivate _resolveSelf;\n\tprivate _rejectSelf;\n\tprivate readonly promise: Promise<T>;\n\n\tconstructor() {\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis._resolveSelf = resolve;\n\t\t\tthis._rejectSelf = reject;\n\t\t});\n\t}\n\treadonly [Symbol.toStringTag]: string = \"DeferredPromise\";\n\n\tpublic async finally(onfinally?: () => void): Promise<T> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * Fetches a node style callback that fulfills the promise when called.\n\t * @returns A node style callback that fulfills the promise when called.\n\t */\n\tgetCb() {\n\t\treturn (error, result) => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\tif (error) {\n\t\t\t\treturn this.reject(error);\n\t\t\t}\n\t\t\treturn this.resolve(result);\n\t\t};\n\t}\n\n\tpublic async then<TResult1 = T, TResult2 = never>(\n\t\tonfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,\n\t\tonrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,\n\t): Promise<TResult1 | TResult2> {\n\t\treturn this.promise.then(onfulfilled, onrejected);\n\t}\n\n\tpublic async catch<TResult = never>(\n\t\tonrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,\n\t): Promise<T | TResult> {\n\t\treturn this.promise.then(onrejected);\n\t}\n\n\tpublic resolve(val: T) {\n\t\tthis._resolveSelf(val);\n\t}\n\tpublic reject(reason: any) {\n\t\tthis._rejectSelf(reason);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"deterministicRandomGenerator.d.ts","sourceRoot":"","sources":["../src/deterministicRandomGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;GAMG;AACH,qBAAa,4BAA4B;IACrC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;IAErB;;;OAGG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM;IAcpC;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,SAAM;IAKnB;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAsBnC"}
1
+ {"version":3,"file":"deterministicRandomGenerator.d.ts","sourceRoot":"","sources":["../src/deterministicRandomGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;GAMG;AACH,qBAAa,4BAA4B;IACxC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;IAErB;;;OAGG;gBACS,OAAO,EAAE,MAAM,GAAG,MAAM;IAcpC;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,SAAM;IAKnB;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAsBhC"}
@@ -43,7 +43,7 @@ export class DeterministicRandomGenerator {
43
43
  */
44
44
  random(in_max = 1.0) {
45
45
  const randomInteger = this.irandom();
46
- return randomInteger / 4294967296 * in_max;
46
+ return (randomInteger / 4294967296) * in_max;
47
47
  }
48
48
  /**
49
49
  * Creates an integer point random number.
@@ -66,11 +66,11 @@ export class DeterministicRandomGenerator {
66
66
  }
67
67
  else {
68
68
  return in_max < 16777619
69
- // The random generator doesn't seem to be very good.
70
- // It is quite biased (e.g. it generates too many even numbers)
71
- // this is a hack to solve at least this problem, but we probably should
72
- // instead use a different approach altogether
73
- ? ((this._guid1[0]) % 16777619) % in_max
69
+ ? // The random generator doesn't seem to be very good.
70
+ // It is quite biased (e.g. it generates too many even numbers)
71
+ // this is a hack to solve at least this problem, but we probably should
72
+ // instead use a different approach altogether
73
+ (this._guid1[0] % 16777619) % in_max
74
74
  : this._guid1[0] % in_max;
75
75
  }
76
76
  }