public void visit(StringValue stringValue) { buffer.append("'" + stringValue.getValue() + "'"); }
@Override public void visit(StringValue stringValue) { if (stringValue.getPrefix() != null) { buffer.append(stringValue.getPrefix()); } buffer.append("'").append(stringValue.getValue()).append("'"); }
jj_consume_token(K_ESCAPE); token = jj_consume_token(S_CHAR_LITERAL); result.setEscape((new StringValue(token.image)).getValue()); break; default:
public void visit(StringValue stringValue) { buffer.append("'" + stringValue.getValue() + "'"); }
public static String getStringValue(Expression expression) { if (StringValue.class.isInstance(expression)) { return ((StringValue)expression).getValue(); } else if (Column.class.isInstance(expression)) { String columnName = expression.toString(); Matcher matcher = SURROUNDED_IN_QUOTES.matcher(columnName); if (matcher.matches()) { return matcher.group(1); } return columnName; } return expression.toString(); }
@Override public void visit(StringValue expression) { String termRightName = expression.getValue(); result = fac.getConstantLiteral(termRightName, COL_TYPE.STRING); }
@Override public void visit(StringValue expression) { process(expression.getValue(), Predicate.COL_TYPE.STRING); }
@Override public void visit(StringValue expression) { process(expression.getValue(), XSD.STRING); }
@Override public void visit(StringValue stringValue) { if (stringValue.getPrefix() != null) { buffer.append(stringValue.getPrefix()); } buffer.append("'").append(stringValue.getValue()).append("'"); }
public void visit(StringValue stringValue) { buffer.append(stringValue.getComment() != null ? stringValue.getComment() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("'").append(stringValue.getValue()).append("'"); }
/** * CoordSys is valid if: null, empty, or start with "ICRS" * * @param adqlFunction */ @SuppressWarnings("unchecked") void validateCoordSys(Function adqlFunction) { boolean valid = false; List<Expression> params = adqlFunction.getParameters().getExpressions(); Expression firstPara = params.get(0); if (firstPara instanceof NullValue) valid = true; else if (firstPara instanceof StringValue) { StringValue sv = (StringValue) firstPara; if (sv == null || sv.getValue().isEmpty() || sv.getValue().startsWith(RegionFinder.ICRS_PREFIX)) valid = true; } if (!valid) throw new UnsupportedOperationException(firstPara.toString() + " is not a supported coordinate system."); }
@Override protected Expression convertToImplementation(Function func) { if (!func.getName().equalsIgnoreCase("match")) return func; List<Expression> exprs = func.getParameters().getExpressions(); if (exprs.size() == 2) { Expression e1 = exprs.get(0); Expression e2 = exprs.get(1); if (e1 instanceof Column && e2 instanceof StringValue) { Column col = (Column) e1; String query = ((StringValue) e2).getValue(); return new TextSearchMatch(col, query); } } throw new IllegalArgumentException("invalid args to match: expected match(<column>,<string>)"); }
public static Object getValue(Expression incomingExpression, Expression otherSide, FieldType defaultFieldType, Map<String, FieldType> fieldNameToFieldTypeMapping) throws ParseException { FieldType fieldType = otherSide !=null ? firstNonNull(fieldNameToFieldTypeMapping.get(getStringValue(otherSide)), defaultFieldType) : FieldType.UNKNOWN; if (LongValue.class.isInstance(incomingExpression)) { return normalizeValue((((LongValue)incomingExpression).getValue()),fieldType); } else if (SignedExpression.class.isInstance(incomingExpression)) { return normalizeValue((((SignedExpression)incomingExpression).toString()),fieldType); } else if (StringValue.class.isInstance(incomingExpression)) { return normalizeValue((((StringValue)incomingExpression).getValue()),fieldType); } else if (Column.class.isInstance(incomingExpression)) { return normalizeValue(getStringValue(incomingExpression),fieldType); } else { throw new ParseException("can not parseNaturalLanguageDate: " + incomingExpression.toString()); } }
private static RegexFunction getRegexFunction(Function function) throws ParseException { final String column = getStringValue(function.getParameters().getExpressions().get(0)); final String regex = fixDoubleSingleQuotes( ((StringValue) (function.getParameters().getExpressions().get(1))).getValue()); try { Pattern.compile(regex); } catch (PatternSyntaxException e) { throw new ParseException(e.getMessage()); } RegexFunction regexFunction = new RegexFunction(column, regex); if (function.getParameters().getExpressions().size() == 3 && StringValue.class .isInstance(function.getParameters().getExpressions().get(2))) { regexFunction.setOptions( ((StringValue) (function.getParameters().getExpressions().get(2))).getValue()); } return regexFunction; }
public static DateFunction isDateFunction(Expression incomingExpression) throws ParseException { if (ComparisonOperator.class.isInstance(incomingExpression)) { ComparisonOperator comparisonOperator = (ComparisonOperator)incomingExpression; String rightExpression = getStringValue(comparisonOperator.getRightExpression()); if (Function.class.isInstance(comparisonOperator.getLeftExpression())) { Function function = ((Function)comparisonOperator.getLeftExpression()); if ("date".equals(function.getName().toLowerCase()) && (function.getParameters().getExpressions().size()==2) && StringValue.class.isInstance(function.getParameters().getExpressions().get(1))) { String column = getStringValue(function.getParameters().getExpressions().get(0)); DateFunction dateFunction = null; try { dateFunction = new DateFunction(((StringValue)(function.getParameters().getExpressions().get(1))).getValue(),rightExpression,column); dateFunction.setComparisonFunction(comparisonOperator); } catch (IllegalArgumentException e) { throw new ParseException(e.getMessage()); } return dateFunction; } } } return null; }
String regionParamStr = strV.getValue(); String[] tokens = regionParamStr.split(" "); String fname = tokens[0].toUpperCase();
return ((StringValue) expression).getValue(); } else if (expression instanceof LongValue) { return ((LongValue) expression).getValue();
jj_consume_token(K_ESCAPE); token = jj_consume_token(S_CHAR_LITERAL); result.setEscape((new StringValue(token.image)).getValue()); break;
result.setCommentLiteral(token.specialToken.image); result.setEscape((new StringValue(token.image)).getValue()); break;