count method

int count()

Implementation

int count() {
  final driver = Query.chooseDriver(_driverCandidates);
  final driverIsA = identical(driver, _a);
  final driverIsB = identical(driver, _b);
  final driverIsC = identical(driver, _c);
  final driverIsD = identical(driver, _d);
  var matches = 0;
  _world.beginQuery(this);
  try {
    for (var i = 0; i < driver.length; i++) {
      final entityIndex = driver.entityIndexAt(i);
      if ((driverIsA ? i : _a.denseIndexOf(entityIndex)) < 0) continue;
      if ((driverIsB ? i : _b.denseIndexOf(entityIndex)) < 0) continue;
      if ((driverIsC ? i : _c.denseIndexOf(entityIndex)) < 0) continue;
      if ((driverIsD ? i : _d.denseIndexOf(entityIndex)) < 0) continue;
      if (!Query.passesFilters(entityIndex, _withStores, _withoutStores)) {
        continue;
      }
      matches++;
    }
    return matches;
  } finally {
    _world.endQuery();
  }
}