A rolling bloom filter used internally
(do not relay this on the p2p network).
@alias module:utils.RollingFilter
@constructor
@param {Number} items - Expected number of items.
@param {Number} rate - False positive rate (0.0-1.0).
171258
function RollingFilter(items, rate) {
  if (!(this instanceof RollingFilter))
    return new RollingFilter(items, rate);

  this.entries = 0;
  this.generation = 1;
  this.n = 0;
  this.limit = 0;
  this.size = 0;
  this.items = 0;
  this.tweak = 0;
  this.filter = DUMMY;

  if (items != null)
    this.fromRate(items, rate);
}
1086671
public static double quantile(double val, double rate) {
    return val >= 0 && val <= 1 ? -FastMath.log(1 - val) / rate : Double.NaN;
  }
235315
function(item, index) {
                var n = this.length,
                        i = index == null ? n - 1 : index
                if (i < 0)
                    i = Math.max(0, n + i)
                for (; i >= 0; i--)
                    if (this[i] === item)
                        return i
                return -1
            }
1175699
function (err) {
      if (err) {
        callback(err, null)
      }
      _.each(ratesWithTimes, function (rates, currency) {
        rates.forEach(function (timeratepair) {
          var newEntry = {}
          newEntry[currency] = timeratepair.rate
          if (allRates[timeratepair.time]) {
            allRates[timeratepair.time].push(newEntry)
          } else {
            allRates[timeratepair.time] = [newEntry]
          }
        })
      })
      var allRatesNice = []
      _.each(allRates, function (rates, time) {
        var ratesNice = {}
        _.each(rates, function (currencyratepair) {
          _.each(currencyratepair, function (rate, currency) {
            ratesNice[currency] = rate
          })
        })
        allRatesNice.push({time: time, rates: ratesNice})
      })
      callback(null, allRatesNice)
    }
916951
function checkRateRange(num) {
    var numString = num.substring(0, num.length - 1);
    var parseNum = parseInt(numString);
    if (parseNum < 20) {
        throw new Error("The minimum rate is twenty percentage. Received: " + parseNum);
    }
}
334053
def rate_filters(&blk)
      if block_given?
        self.rate_filters.select(&blk)
      else
        Thresholds.new(@thresholds.select{|t| t.class.to_s == "Threshold::RateFilter"})
      end
    end
579671
function preloader( items, preloadFunction, callback ) {

    var itemc = items.length;
    var loadc = 0;

    // called by preloadFunction to notify result
    function _check( err, id ) {
        updateProgress(1);
        if ( err ) {
            alert('Failed to load ' + id + ': ' + err);
        }
        loadc++;
        if ( itemc == loadc ) callback();
    }

    progressTotalCount += items.length;

    // queue each item for fetching
    items.forEach(function(item) {
        preloadFunction( item, _check);
    });
}
1338573
function Item(item) {
  if (!item) item = {};

  utils.syncContents(this, item.contents || item.content);
  this.cache = item.cache || {};
  this.options = item.options || {};
  this.locals = item.locals || {};
  this.data = item.data || {};

  this.define('contents', {
    configurable: true,
    enumerable: false,
    set: function(val) {
      utils.syncContents(this, val);
    },
    get: function() {
      return this._contents;
    }
  });

  var base = item.base;
  delete item.base;

  Vinyl.call(this, item);
  Base.call(this, item);
  delete this.base;
  this.base = base;

  for (var key in item) {
    var val = item[key];
    if (key === 'stat' && utils.isObject(val) && val.mode) {
      this.set(key, utils.cloneStats(val));
    } else if (val) {
      this.set(key, val);
    }
  }

  this.is('Item');
  this.use(utils.option());
  this.use(utils.plugin());
}
1050436
function (items, options) {
            options = options || {};

            _.defaults(options, {
                root: null,
                query: null,
                pageSize: null,
                queryParameters: {},
                sortParameters: null,
                factory: this.$modelFactory || require('js/data/Model'),
                type: null
            });


            this.$filterCache = {};
            this.$sortCache = {};
            this._count = {
                callbacks: [],
                state: COUNTSTATE.UNKNOWN
            };

            if (options.root) {
                _.defaults(options, options.root.options);
                this.$modelFactory = options.root.$modelFactory;
            }

            this.callBase(items, options);

            this.$pageCache = [];
        }
987279
function (query, items) {
            var expression = query.query.where,
                ret = [];

            for (var i = 0; i < items.length; i++) {
                if (this._filterItem(items[i], expression)) {
                    ret.push(items[i]);
                }
            }

            return ret;

        }
1096914
function(target, types, up) {
		var best = null,
			rating = Number.MAX_VALUE;
		this._rateall(target, types, up, function(type, rate) {
			if (rate > -1 && rate < rating) {
				rating = rate;
				best = type;
			}
		});
		return best;
	}
347079
function(amount) {
      for (var sI = 0; sI < this.slices.length; sI++)
        this.slices[sI].start = (this.slices[sI].start + amount);
      for (var id in this.counters)
        this.counters[id].shiftTimestampsForward(amount);
    }
1081344
function transformItem(stream, item) {
    var ret;
    if (isArray(item)) {
        if (isHashArray(item)) {
            ret = transformHashArrayData(stream, item);
        } else {
            ret = transformArrayData(stream, item);
        }
    } else {
        ret = transformHashData(stream, item);
    }
    return ret;
}
116806
public FxRateCalculatorBuilder ratesSnapshot(final Collection<FxRate> rates) {
        if (rates != null) {
            this.ratesSnapshot.clear();
            this.ratesSnapshot = rates.stream().collect(Collectors.toMap(FxRate::getCurrencyPair, t -> t));
        }
        return this;
    }
968010
public void playSequentially(List<Animator> items) {
        if (items != null && items.size() > 0) {
            mNeedsSort = true;
            if (items.size() == 1) {
                play(items.get(0));
            } else {
                for (int i = 0; i < items.size() - 1; ++i) {
                    play(items.get(i)).before(items.get(i+1));
                }
            }
        }
    }
1222620
function(list, iter, callback) {
    var item = list.shift();
    iter(item, function(err) {
      if (err) return callback(err);
      else if (list.length) {
        eachSeries(list, iter, callback);
      } else {
        return callback();
      }
    });
  }
789249
def pattern_filter(items, whitelist=None, blacklist=None, key=None):
    
    key = key or __return_self
    if whitelist:
        whitelisted = _filter(items, whitelist, key)

        if blacklist:
            blacklisted = _filter(items, blacklist, key)
            # Remove any blacklisted items from the whitelisted ones.
            whitelisted.difference_update(blacklisted)

        return [item for item in items if key(item) in whitelisted]

    elif blacklist:
        blacklisted = _filter(items, blacklist, key)
        return [item for item in items if key(item) not in blacklisted]

    else:
        return items