Esempio n. 1
0
  public String toRasQL() {
    String result = WCPSConstants.MSG_EXTEND + "(" + coverageExprType.toRasQL() + ",[";

    for (int j = 0; j < dims; ++j) {
      if (j > 0) {
        result += ",";
      }

      result += dim[j];
    }

    result += "])";

    return result;
  }
Esempio n. 2
0
  public ExtendCoverageExpr(Node node, XmlQuery xq) throws WCPSException {

    log.trace(node.getNodeName());

    Node child;
    String nodeName;

    axisList = new ArrayList<DimensionIntervalElement>();

    child = node.getFirstChild();
    while (child != null) {
      nodeName = child.getNodeName();

      if (nodeName.equals("#" + WCPSConstants.MSG_TEXT)) {
        child = child.getNextSibling();
        continue;
      }

      try {
        coverageExprType = new CoverageExpr(child, xq);
        coverageInfo = coverageExprType.getCoverageInfo();
        super.children.add(coverageExprType);
        child = child.getNextSibling();
        continue;
      } catch (WCPSException e) {
      }

      try {
        // Start a new axis and save it
        elem = new DimensionIntervalElement(child, xq, coverageInfo);
        log.trace("  " + WCPSConstants.MSG_ADD_NEW_AXIS + ": " + elem.getAxisName());
        axisList.add(elem);
        super.children.add(elem);
        child = elem.getNextNode();
        continue;
      } catch (WCPSException e) {
        log.error(WCPSConstants.ERRTXT_THIS_WAS_NO_DIM + ": " + child.getNodeName());
      }

      // else unknown element
      throw new WCPSException(
          WCPSConstants.ERRTXT_UNKNOWN_NODE_EXTENDCOVERAGE + child.getNodeName());
    }

    dims = coverageInfo.getNumDimensions();
    log.trace("  " + WCPSConstants.MSG_NUMBER_OF_DIMENSIONS + ": " + dims);
    dim = new String[dims];

    for (int j = 0; j < dims; ++j) {
      dim[j] = "*:*";
    }

    Iterator<DimensionIntervalElement> i = axisList.iterator();
    DimensionIntervalElement axis;
    int axisId;
    int axisLo, axisHi;
    int order = 0;

    while (i.hasNext()) {
      axis = i.next();
      axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
      log.trace("  " + WCPSConstants.MSG_AXIS + " " + WCPSConstants.MSG_ID + ": " + axisId);
      log.trace(
          "  " + WCPSConstants.MSG_AXIS + " " + WCPSConstants.MSG_NAME + ": " + axis.getAxisName());
      log.trace("  " + WCPSConstants.MSG_AXIS + " " + WCPSConstants.MSG_COORDS + ": ");

      axisLo = Integer.parseInt(axis.getLowCoord());
      axisHi = Integer.parseInt(axis.getHighCoord());
      dim[axisId] = axisLo + ":" + axisHi;
      coverageInfo.setCellDimension(
          axisId,
          new CellDomainElement(
              BigInteger.valueOf(axisLo), BigInteger.valueOf(axisHi), axis.getAxisName(), order));
      order += 1;
    }
  }