示例#1
0
  public SortCondition(Expr expr, int dir) {
    expression = expr;
    direction = dir;

    if (dir != Query.ORDER_ASCENDING && dir != Query.ORDER_DESCENDING && dir != Query.ORDER_DEFAULT)
      ALog.fatal(this, "Unknown sort direction");
  }
示例#2
0
  @Override
  public NodeValue exec(NodeValue v) {
    if (!v.isString()) {
      ALog.warn(this, "date: argument not a string: " + v);
      throw new ExprEvalException("date: argument not a string: " + v);
    }

    String lexicalForm = v.getString();

    // Quite picky about format
    if (!lexicalForm.matches("\\d{4}-\\d{2}-\\d{2}")) {
      ALog.warn(this, "date: argument not in date format: " + v);
      throw new ExprEvalException("date: argument not in date format: " + v);
    }

    lexicalForm = lexicalForm + "T00:00:00Z";

    NodeValue nv = NodeValue.makeNode(lexicalForm, XSDDatatype.XSDdateTime);
    return nv;
  }