Exemplo n.º 1
0
  /**
   * @param value
   * @param N
   * @throws DataException
   */
  private void populateValueListAndRowIdList(Object value, int N) throws DataException {
    assert N >= 0;
    int activeCount = N < this.firstPassRowNumberCounter ? N : this.firstPassRowNumberCounter;
    for (int i = 0; i < activeCount; i++) {
      if (valueList.get(i) == null) {
        valueList.set(i, value);
        rowIdList.set(i, Integer.valueOf(firstPassRowNumberCounter));
        break;
      } else {
        Object result = this.doCompare(value, valueList.get(i));

        try {
          // filter in
          if (DataTypeUtil.toBoolean(result).booleanValue() == true) {
            for (int j = activeCount - 1; j > i; j--) {
              valueList.set(j, valueList.get(j - 1));
              rowIdList.set(j, rowIdList.get(j - 1));
            }
            valueList.set(i, value);
            rowIdList.set(i, Integer.valueOf(firstPassRowNumberCounter));
            break;
          }
        } catch (BirtException e) {
          throw DataException.wrap(e);
        }
      }
    }
  }
Exemplo n.º 2
0
  /**
   * Do the second pass
   *
   * @param N
   * @return
   */
  private boolean doSecondPass() {
    secondPassRowNumberCounter++;
    if (secondPassRowNumberCounter > this.filterPassController.getSecondPassRowCount())
      this.filterPassController.setSecondPassRowCount(secondPassRowNumberCounter);
    else this.secondPassRowNumberCounter = this.filterPassController.getSecondPassRowCount();

    if (qualifiedRowCounter < N) {
      for (int i = 0; i < N; i++) {
        int rowId = 0;
        if (rowIdList.get(i) != null) {
          rowId = ((Integer) rowIdList.get(i)).intValue();
        }
        if (rowId == secondPassRowNumberCounter) {
          qualifiedRowCounter++;
          reset();
          return true;
        }
      }
      return false;
    } else {
      reset();
      return false;
    }
  }