Пример #1
0
  protected Bucket[] getBucketValues(Object[] bucketValues) {
    Bucket[] bucketVals = new Bucket[allBuckets.length];

    for (int i = 0; i < allBuckets.length; ++i) {
      BucketDefinition bucket = allBuckets[i];
      Object value = bucketValues[i];
      bucketVals[i] = bucket.create(value);
    }

    return bucketVals;
  }
Пример #2
0
  protected void checkTotals() {
    rowRetrTotalMin = rowBucketCount + 1;
    rowRetrTotalMax = -1;
    rowRetrTotals = new boolean[rowBucketCount + 1];
    rowRetrColMax = new int[rowBucketCount + 1];
    for (int row = 0; row <= rowBucketCount; ++row) {
      rowRetrColMax[row] = -1;
      boolean total = false;
      for (int col = 0; col <= colBucketCount; ++col) {
        if (retrieveTotal[row][col]) {
          total = true;
          rowRetrColMax[row] = col;
        }
      }

      rowRetrTotals[row] = total;
      if (total) {
        if (row < rowRetrTotalMin) {
          rowRetrTotalMin = row;
        }
        rowRetrTotalMax = row;

        if (row < rowBucketCount) {
          allBuckets[row].setComputeTotal();
        }
      }
    }

    for (int col = 0; col < colBucketCount; ++col) {
      BucketDefinition colBucket = allBuckets[rowBucketCount + col];
      if (!colBucket.computeTotal()) {
        boolean total = false;
        for (int row = 0; !total && row <= rowBucketCount; ++row) {
          total = retrieveTotal[row][col];
        }

        if (total) {
          colBucket.setComputeTotal();
        }
      }
    }

    for (int d = 0; d < DIMENSIONS; ++d) {
      boolean dTotal = false;

      for (int i = 0; i < buckets[d].length; ++i) {
        if (dTotal) {
          buckets[d][i].setComputeTotal();
        } else {
          dTotal = buckets[d][i].computeTotal();
        }
      }
    }
  }