MCPcopy Create free account
hub / github.com/microsoft/SandDance / Bitmaps

Function Bitmaps

docs/tests/v2/es6/js/sanddance.js:125823–125909  ·  view source on GitHub ↗

* Maintains CrossFilter state.

()

Source from the content-addressed store, hash-verified

125821 * Maintains CrossFilter state.
125822 */
125823function Bitmaps() {
125824 var width = 8,
125825 data = [],
125826 seen = (0, _arrays.array32)(0),
125827 curr = array(0, width),
125828 prev = array(0, width);
125829 return {
125830 data: function () {
125831 return data;
125832 },
125833 seen: function () {
125834 return seen = lengthen(seen, data.length);
125835 },
125836 add: function (array) {
125837 for (var i = 0, j = data.length, n = array.length, t; i < n; ++i) {
125838 t = array[i];
125839 t._index = j++;
125840 data.push(t);
125841 }
125842 },
125843 remove: function (num, map) {
125844 // map: index -> boolean (true => remove)
125845 var n = data.length,
125846 copy = Array(n - num),
125847 reindex = data,
125848 // reuse old data array for index map
125849 t,
125850 i,
125851 j; // seek forward to first removal
125852
125853 for (i = 0; !map[i] && i < n; ++i) {
125854 copy[i] = data[i];
125855 reindex[i] = i;
125856 } // condense arrays
125857
125858
125859 for (j = i; i < n; ++i) {
125860 t = data[i];
125861
125862 if (!map[i]) {
125863 reindex[i] = j;
125864 curr[j] = curr[i];
125865 prev[j] = prev[i];
125866 copy[j] = t;
125867 t._index = j++;
125868 } else {
125869 reindex[i] = -1;
125870 }
125871
125872 curr[i] = 0; // clear unused bits
125873 }
125874
125875 data = copy;
125876 return reindex;
125877 },
125878 size: function () {
125879 return data.length;
125880 },

Callers

nothing calls this directly

Calls 3

arrayFunction · 0.70
lengthenFunction · 0.70
maxMethod · 0.45

Tested by

no test coverage detected