2013-05-06 67 views
0

我正在使用Olap4j連接到GWT中的OLAP服務器。但是,當我嘗試遍歷行和列時,在編譯期間出現「找不到符號」錯誤。找不到符號 - Java

我的代碼

for (Position axis_0 : cellSet.getAxes().get(Axis.COLUMNS.axisOrdinal()).getPositions()) { 
      List<Member> mem0 = axis_0.getMembers(); 
      for (Position axis_1 : cellSet.getAxes().get(Axis.ROWS.axisOrdinal()).getPositions()) { 
       List<Member> mem1 = axis_1.getMembers(); 
       Cell currentCell = cellSet.getCell(axis_0, axis_1); 
       data = new HashMap(); 
       for (int i = 0; i < mem0.size(); i++) { 
        data.put(mem0.get(i).getDimension().getName().replaceAll(" ", ""), mem0.get(i).getUniqueName()); 
       } 
       for (int i = 0; i < mem1.size(); i++) { 
        data.put(mem1.get(i).getDimension().getName().replaceAll(" ", ""), mem1.get(i).getUniqueName()); 
       } 
       data.put("value", Float.parseFloat((currentCell.getValue()==null)?"0":currentCell.getValue().toString())); 
       data.put("cellID", count); 
       data.put("Scenarios", scenario); 
       collection.add(data); 
       count+=1; 
      } 
     } 

錯誤

Error message

回答

0

我能得到通過這樣的重組也驗證碼:

CellSetAxis columnAxis = (CellSetAxis) cellSet.getAxes().get(Axis.COLUMNS.axisOrdinal()); 
    CellSetAxis rowAxis = (CellSetAxis) cellSet.getAxes().get(Axis.ROWS.axisOrdinal()); 
    List<Position> colPositions = columnAxis.getPositions(); 
    List<Position> rowPositions = rowAxis.getPositions(); 

    for (Position axis_0 : colPositions) { 
     List<Member> mem0 = axis_0.getMembers(); 
     for (Position axis_1 : rowPositions) { 
      List<Member> mem1 = axis_1.getMembers(); 
      Cell currentCell = cellSet.getCell(axis_0, axis_1); 
      data = new HashMap(); 
      for (int i = 0; i < mem0.size(); i++) { 
       data.put(mem0.get(i).getDimension().getName().replaceAll(" ", ""), mem0.get(i).getUniqueName()); 
      } 
      for (int i = 0; i < mem1.size(); i++) { 
       data.put(mem1.get(i).getDimension().getName().replaceAll(" ", ""), mem1.get(i).getUniqueName()); 
      } 
      data.put("value", Float.parseFloat((currentCell.getValue()==null)?"0":currentCell.getValue().toString())); 
      data.put("cellID", count); 
      data.put("Scenarios", scenario); 
      collection.add(data); 
      count+=1; 
     } 
    }