/** * Assigns a value to the <code>queryNode</code>. * * @param node must be of type string, decimal, double or integer; otherwise * an InvalidQueryException is added to {@link #exceptions}. * @param queryNode current node in the query tree. */ private void assignValue(SimpleNode node, RelationQueryNode queryNode) { if (node.getId() == JJTSTRINGLITERAL) { queryNode.setStringValue(unescapeQuotes(node.getValue())); } else if (node.getId() == JJTDECIMALLITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTDOUBLELITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTINTEGERLITERAL) { // if this is an expression that contains position() do not change // the type. if (queryNode.getValueType() == QueryConstants.TYPE_POSITION) { queryNode.setPositionValue(Integer.parseInt(node.getValue())); } else { queryNode.setLongValue(Long.parseLong(node.getValue())); } } else { exceptions.add(new InvalidQueryException("Unsupported literal type:" + node.toString())); } }
/** * Assigns a value to the <code>queryNode</code>. * * @param node must be of type string, decimal, double or integer; otherwise * an InvalidQueryException is added to {@link #exceptions}. * @param queryNode current node in the query tree. */ private void assignValue(SimpleNode node, RelationQueryNode queryNode) { if (node.getId() == JJTSTRINGLITERAL) { queryNode.setStringValue(unescapeQuotes(node.getValue())); } else if (node.getId() == JJTDECIMALLITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTDOUBLELITERAL) { queryNode.setDoubleValue(Double.parseDouble(node.getValue())); } else if (node.getId() == JJTINTEGERLITERAL) { // if this is an expression that contains position() do not change // the type. if (queryNode.getValueType() == QueryConstants.TYPE_POSITION) { queryNode.setPositionValue(Integer.parseInt(node.getValue())); } else { queryNode.setLongValue(Long.parseLong(node.getValue())); } } else { exceptions.add(new InvalidQueryException("Unsupported literal type:" + node.toString())); } }
rel.setPositionValue(1); rel.addPathElement(PATH_FACTORY.createElement(FN_POSITION_FULL)); } else { ((RelationQueryNode) queryNode).setPositionValue(1); } else if (queryNode.getType() == QueryNode.TYPE_LOCATION) { ((LocationStepQueryNode) queryNode).setIndex(1); ((RelationQueryNode) queryNode).setPositionValue(LocationStepQueryNode.LAST); } else if (queryNode.getType() == QueryNode.TYPE_LOCATION) { ((LocationStepQueryNode) queryNode).setIndex(LocationStepQueryNode.LAST);
rel.setPositionValue(1); rel.addPathElement(PATH_FACTORY.createElement(FN_POSITION_FULL)); } else { ((RelationQueryNode) queryNode).setPositionValue(1); } else if (queryNode.getType() == QueryNode.TYPE_LOCATION) { ((LocationStepQueryNode) queryNode).setIndex(1); ((RelationQueryNode) queryNode).setPositionValue(LocationStepQueryNode.LAST); } else if (queryNode.getType() == QueryNode.TYPE_LOCATION) { ((LocationStepQueryNode) queryNode).setIndex(LocationStepQueryNode.LAST);