@Test public void testDecimalParsing() { final Map<String, String> attributes = new HashMap<>(); verifyEquals("${literal(5.5):toDecimal()}", attributes, 5.5D); verifyEquals("${literal(-12.5):toDecimal()}", attributes, -12.5D); verifyEquals("${literal(+12.5):toDecimal()}", attributes, 12.5D); verifyEquals("${literal(-12.5E2):toDecimal()}", attributes, -12.5E2D); verifyEquals("${literal(-12.5e2):toDecimal()}", attributes, -12.5e2D); verifyEquals("${literal(-12.5e+2):toDecimal()}", attributes, -12.5e+2D); verifyEquals("${literal(12.5E+2):toDecimal()}", attributes, 12.5E+2D); verifyEquals("${literal(+12.5e+2):toDecimal()}", attributes, +12.5e+2D); verifyEquals("${literal(+12.5E2):toDecimal()}", attributes, +12.5E2D); verifyEquals("${literal(-12.5e2):toDecimal()}", attributes, -12.5e2D); verifyEquals("${literal(12.5E2):toDecimal()}", attributes, 12.5E2D); verifyEquals("${literal(+12.5e2):toDecimal()}", attributes, +12.5e2D); verifyEquals("${literal(-12.5E-2):toDecimal()}", attributes, -12.5E-2D); verifyEquals("${literal(12.5E-2):toDecimal()}", attributes, 12.5E-2D); verifyEquals("${literal(+12.5e-2):toDecimal()}", attributes, +12.5e-2D); verifyEquals("${literal(.5):toDecimal()}", attributes, .5D); verifyEquals("${literal(.5):toDecimal()}", attributes, .5D); verifyEquals("${literal(-.5):toDecimal()}", attributes, -0.5D); verifyEquals("${literal(+.5):toDecimal()}", attributes, .5D); verifyEquals("${literal(-.5E2):toDecimal()}", attributes, -.5E2D); verifyEquals("${literal(-.5E2):toDecimal()}", attributes, -.5E2D); verifyEquals("${literal(-.5e+2):toDecimal()}", attributes, -.5e+2D); verifyEquals("${literal(.5E+2):toDecimal()}", attributes, .5E+2D); verifyEquals("${literal(+.5e+2):toDecimal()}", attributes, +.5e+2D); verifyEquals("${literal(+.5E2):toDecimal()}", attributes, +.5E2D); verifyEquals("${literal(-.5e2):toDecimal()}", attributes, -.5e2D); verifyEquals("${literal(.5E2):toDecimal()}", attributes, .5E2D); verifyEquals("${literal(+.5e2):toDecimal()}", attributes, +.5e2D); verifyEquals("${literal(-.5E-2):toDecimal()}", attributes, -.5E-2D); verifyEquals("${literal(.5e-2):toDecimal()}", attributes, .5e-2D); verifyEquals("${literal(+.5E-2):toDecimal()}", attributes, +.5E-2D); verifyEquals("${literal(9876543210.0123456789e123):toDecimal()}", attributes, 9876543210.0123456789e123D); verifyEmpty("${literal('A.1e123'):toDecimal()}", attributes); verifyEmpty("${literal('0.Ae123'):toDecimal()}", attributes); verifyEmpty("${literal('0.1eA'):toDecimal()}", attributes); verifyEquals("${literal('0xF1.p2'):toDecimal()}", attributes, 0xF1.p2D); verifyEquals("${literal('+0xF1.P2'):toDecimal()}", attributes, +0xF1.p2D); verifyEquals("${literal('-0xF1.p2'):toDecimal()}", attributes, -0xF1.p2D); verifyEquals("${literal('-0xF1.5Bp2'):toDecimal()}", attributes, -0xF1.5Bp2D); verifyEquals("${literal('-0xF1.5BP2'):toDecimal()}", attributes, -0xF1.5BP2D); verifyEquals("${literal('-0xF1.5BP+2'):toDecimal()}", attributes, -0xF1.5Bp+2D); verifyEquals("${literal('0xF1.5BP+2'):toDecimal()}", attributes, 0xF1.5BP+2D); verifyEquals("${literal('+0xF1.5Bp+2'):toDecimal()}", attributes, +0xF1.5Bp+2D); verifyEquals("${literal('+0xF1.5BP2'):toDecimal()}", attributes, +0xF1.5BP2D); verifyEquals("${literal('-0xF1.5Bp2'):toDecimal()}", attributes, -0xF1.5Bp2D); verifyEquals("${literal('0xF1.5BP2'):toDecimal()}", attributes, 0xF1.5BP2D); verifyEquals("${literal('+0xF1.5Bp2'):toDecimal()}", attributes, +0xF1.5Bp2D); verifyEquals("${literal('-0xF1.5BP-2'):toDecimal()}", attributes, -0xF1.5BP-2D); verifyEquals("${literal('0xF1.5BP-2'):toDecimal()}", attributes, 0xF1.5BP-2D); verifyEquals("${literal('+0xF1.5Bp-2'):toDecimal()}", attributes, +0xF1.5Bp-2D); verifyEquals("${literal('0x.5BP0'):toDecimal()}", attributes, 0x.5BP0D); verifyEquals("${literal('-0x.5BP0'):toDecimal()}", attributes, -0x.5BP0D); verifyEquals("${literal('-0x.5BP+2'):toDecimal()}", attributes, -0x.5BP+2D); verifyEquals("${literal('0x.5BP+2'):toDecimal()}", attributes, 0x.5BP+2D); verifyEquals("${literal('+0x.5Bp+2'):toDecimal()}", attributes, +0x.5Bp+2D); verifyEquals("${literal('+0x.5BP2'):toDecimal()}", attributes, +0x.5BP2D); verifyEquals("${literal('-0x.5Bp2'):toDecimal()}", attributes, -0x.5Bp2D); verifyEquals("${literal('0x.5BP2'):toDecimal()}", attributes, 0x.5BP2D); verifyEquals("${literal('+0x.5Bp+2'):toDecimal()}", attributes, +0x.5Bp2D); verifyEquals("${literal('-0x.5BP-2'):toDecimal()}", attributes, -0x.5BP-2D); verifyEquals("${literal('0x.5Bp-2'):toDecimal()}", attributes, 0x.5Bp-2D); verifyEquals("${literal('+0x.5BP-2'):toDecimal()}", attributes, +0x.5BP-2D); verifyEquals("${literal('0xFEDCBA9876543210.0123456789ABCDEFp123'):toDecimal()}", attributes, 0xFEDCBA9876543210.0123456789ABCDEFp123D); verifyEquals("${literal('0xfedcba9876543210.0123456789abcdefp123'):toDecimal()}", attributes, 0xfedcba9876543210.0123456789abcdefp123D); verifyEmpty("${literal('0xG.1p123'):toDecimal()}", attributes); verifyEmpty("${literal('0x1.Gp123'):toDecimal()}", attributes); verifyEmpty("${literal('0x1.1pA'):toDecimal()}", attributes); verifyEmpty("${literal('0x1.1'):toDecimal()}", attributes); verifyEquals("${literal('" + Double.toString(POSITIVE_INFINITY) + "'):toDecimal():plus(1):plus(2)}", attributes, POSITIVE_INFINITY); verifyEquals("${literal('" + Double.toString(NEGATIVE_INFINITY) + "'):toDecimal():plus(1):plus(2)}", attributes, NEGATIVE_INFINITY); verifyEquals("${literal('" + Double.toString(NaN) + "'):toDecimal():plus(1):plus(2)}", attributes, NaN); }
@Override public String toString() { return "Query [" + query + "]"; }
Query { @Override public String toString() { return "Query [" + query + "]"; } }
Query { @Override public String toString() { return "Query [" + query + "]"; } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); }
Query { @Override public String toString() { return "Query [" + query + "]"; } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); static boolean isValidExpression(final String value); static ResultType getResultType(final String value); static List<ResultType> extractResultTypes(final String value); static List<String> extractExpressions(final String value); static List<Range> extractExpressionRanges(final String value); static void validateExpression(final String value, final boolean allowSurroundingCharacters); static String unescape(final String value); static Query fromTree(final Tree tree, final String text); static Tree compileTree(final String query); static PreparedQuery prepare(final String query); static Query compile(final String query); ResultType getResultType(); @Override String toString(); }
Query { @Override public String toString() { return "Query [" + query + "]"; } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); static boolean isValidExpression(final String value); static ResultType getResultType(final String value); static List<ResultType> extractResultTypes(final String value); static List<String> extractExpressions(final String value); static List<Range> extractExpressionRanges(final String value); static void validateExpression(final String value, final boolean allowSurroundingCharacters); static String unescape(final String value); static Query fromTree(final Tree tree, final String text); static Tree compileTree(final String query); static PreparedQuery prepare(final String query); static Query compile(final String query); ResultType getResultType(); @Override String toString();  }