コード例 #1
0
ファイル: Test.java プロジェクト: dingding2014/olap
  public static void main1(String[] args) throws ClassNotFoundException, SQLException {
    OlapConnection conn = getConnection(url);
    CellSet cs = getResultSet(mdx, conn);
    // CellSetAxis c;

    int count = 0;
    if (cs.getAxes().size() > 1) {
      for (Position row : cs.getAxes().get(1)) {
        for (Position column : cs.getAxes().get(0)) {
          for (Member member : row.getMembers()) {
            System.out.println("rows:" + member.getUniqueName());
          }
          for (Member member : column.getMembers()) {
            System.out.println("columns:" + member.getUniqueName());
          }
          final Cell cell = cs.getCell(column, row);

          System.out.println("values:" + cell.getValue());

          Position[] positions = new Position[2];
          positions[0] = column;
          positions[1] = row;

          OlapCell oalpCell = new OlapCell(positions, cell.getValue());

          System.out.println("****" + oalpCell.toString());
          System.out.println(count++);
        }
      }
    }
  }
コード例 #2
0
ファイル: Test.java プロジェクト: dingding2014/olap
  // coordinates.size should be 0 at very first
  public static void explore(
      List<CellSetAxis> axes, List<Position> coordinates, CellSet cs, List<OlapCell> cellList) {
    int level = coordinates.size();
    // System.out.println(level + "  " + axes.size());
    if (level < axes.size()) {
      for (Position p : axes.get(level).getPositions()) {
        coordinates.add(p);
        explore(axes, coordinates, cs, cellList);
      }

      if (level > 0) {
        coordinates.remove(level - 1);
      }

    } else {
      Position[] positions = new Position[coordinates.size()];
      positions = coordinates.toArray(positions);
      Cell cell = cs.getCell(positions);
      OlapCell olapCell = new OlapCell(positions, cell.getValue());
      cellList.add(olapCell);
      // System.out.println((++count) + " " + olapCell.toString());
      coordinates.remove(level - 1);
    }
  }
コード例 #3
0
 /**
  * Prints the formatted value of a Cell at a given position.
  *
  * @param cellSet Cell set
  * @param pw Print writer
  * @param pos Cell coordinates
  */
 private static void printCell(CellSet cellSet, PrintWriter pw, List<Integer> pos) {
   Cell cell = cellSet.getCell(pos);
   pw.print(cell.getFormattedValue());
 }