/**
   * Returns the measure values for a set of bucket values.
   *
   * @param bucketValues the bucket values
   * @return the measure values corresponding to the bucket values
   */
  public MeasureValue[] getMeasureValues(Bucket[] bucketValues) {
    BucketMap map = bucketValueMap;

    for (int i = 0; map != null && i < allBuckets.length - 1; ++i) {
      map = (BucketMap) map.get(bucketValues[i]);
    }

    return map == null ? null : (MeasureValue[]) map.get(bucketValues[allBuckets.length - 1]);
  }
  protected MeasureValue[][][] retrieveTotals(List vals, List bucketMaps) {
    MeasureValue[][][] totals = new MeasureValue[rowBucketCount + 1][colBucketCount + 1][];

    for (int row = rowRetrTotalMax; row >= rowRetrTotalMin; --row) {
      if (!rowRetrTotals[row]) {
        continue;
      }

      BucketMap rowMap = (BucketMap) bucketMaps.get(row);
      for (int i = row; rowMap != null && i < rowBucketCount; ++i) {
        Entry totalEntry = rowMap.getTotalEntry();
        rowMap = totalEntry == null ? null : (BucketMap) totalEntry.getValue();
      }

      for (int col = 0; col <= rowRetrColMax[row]; ++col) {
        BucketMap colMap = rowMap;

        if (col < colBucketCount - 1) {
          if (row == rowBucketCount) {
            rowMap = (BucketMap) bucketMaps.get(rowBucketCount + col + 1);
          } else if (rowMap != null) {
            rowMap = (BucketMap) rowMap.get((Bucket) vals.get(rowBucketCount + col));
          }
        }

        if (!retrieveTotal[row][col]) {
          continue;
        }

        for (int i = col + 1; colMap != null && i < colBucketCount; ++i) {
          colMap = (BucketMap) colMap.getTotalEntry().getValue();
        }

        if (colMap != null) {
          if (col == colBucketCount) {
            MeasureValue[] measureValues =
                (MeasureValue[]) colMap.get((Bucket) vals.get(rowBucketCount + colBucketCount - 1));
            totals[row][col] = getUserMeasureValues(measureValues);
          } else {
            Map.Entry totalEntry = colMap.getTotalEntry();
            if (totalEntry != null) {
              MeasureValue[] totalValues = (MeasureValue[]) totalEntry.getValue();
              totals[row][col] = getUserMeasureValues(totalValues);
            }
          }
        }

        if (totals[row][col] == null) {
          totals[row][col] = zeroUserMeasureValues;
        }
      }
    }

    return totals;
  }