コード例 #1
0
ファイル: ScenarioImpl.java プロジェクト: rikima/mondrian
    /**
     * Creates a WritebackCell.
     *
     * @param cube Cube
     * @param members Members that form context
     * @param constrainedColumnsBitKey Bitmap of columns which have values
     * @param keyValues List of values, by bit position
     * @param newValue New value
     * @param currentValue Current value
     * @param allocationPolicy Allocation policy
     */
    WritebackCell(
        RolapCube cube,
        List<RolapMember> members,
        BitKey constrainedColumnsBitKey,
        Object[] keyValues,
        double newValue,
        double currentValue,
        AllocationPolicy allocationPolicy) {
      assert keyValues.length == constrainedColumnsBitKey.cardinality();
      Util.discard(cube); // not used currently
      Util.discard(constrainedColumnsBitKey); // not used currently
      Util.discard(keyValues); // not used currently
      this.newValue = newValue;
      this.currentValue = currentValue;
      this.allocationPolicy = allocationPolicy;
      this.atomicCellCount = computeAtomicCellCount(cube, members);

      // Build the array of members by ordinal. If a member is not
      // specified for a particular dimension, use the 'all' member (not
      // necessarily the same as the default member).
      final List<RolapHierarchy> hierarchyList = cube.getHierarchies();
      this.membersByOrdinal = new Member[hierarchyList.size()];
      for (int i = 0; i < membersByOrdinal.length; i++) {
        membersByOrdinal[i] = hierarchyList.get(i).getDefaultMember();
      }
      for (RolapMember member : members) {
        final RolapHierarchy hierarchy = member.getHierarchy();
        if (isScenario(hierarchy)) {
          assert member.isAll();
        }
        // REVIEW The following works because Measures is the only
        // dimension whose members do not belong to RolapCubeDimension,
        // just a regular RolapDimension, but has ordinal 0.
        final int ordinal = hierarchy.getOrdinalInCube();
        membersByOrdinal[ordinal] = member;
      }
    }