Exemple #1
0
  @Override
  public <L extends List<IEntity>> L query(final IEntityMatcher pEntityMatcher, final L pResult) {
    final int childCount = this.getChildCount();
    for (int i = 0; i < childCount; i++) {
      final IEntity child = this.mChildren.get(i);
      if (pEntityMatcher.matches(child)) {
        pResult.add(child);
      }

      child.query(pEntityMatcher, pResult);
    }

    return pResult;
  }
Exemple #2
0
  @SuppressWarnings("unchecked")
  @Override
  public <L extends List<S>, S extends IEntity> L queryForSubclass(
      final IEntityMatcher pEntityMatcher, final L pResult) throws ClassCastException {
    final int childCount = this.getChildCount();
    for (int i = 0; i < childCount; i++) {
      final IEntity child = this.mChildren.get(i);
      if (pEntityMatcher.matches(child)) {
        pResult.add((S) child);
      }

      child.queryForSubclass(pEntityMatcher, pResult);
    }

    return pResult;
  }
Exemple #3
0
  @SuppressWarnings("unchecked")
  @Override
  public <S extends IEntity> S queryFirstForSubclass(final IEntityMatcher pEntityMatcher) {
    final int childCount = this.getChildCount();
    for (int i = 0; i < childCount; i++) {
      final IEntity child = this.mChildren.get(i);
      if (pEntityMatcher.matches(child)) {
        return (S) child;
      }

      final S childQueryFirst = child.queryFirstForSubclass(pEntityMatcher);
      if (childQueryFirst != null) {
        return childQueryFirst;
      }
    }

    return null;
  }