@Test public void testGetStringValueWithInteger() { List<INumberExpression> list = new ArrayList<>(); list.add(new SimpleNumberExpression(Integer.valueOf(1))); ComposedNumberExpression expr = new ComposedNumberExpression(list, new ArrayList<String>()); String string = expr.getStringValue(null, null); Assert.assertEquals("1", string); }
@Override public String getStringValue(MatchContext context, RutaStream stream) { if(ops.isEmpty() && expressions.size() == 1) { return expressions.get(0).getStringValue(context, stream); } else { return String.valueOf(getDoubleValue(context, stream)); } }
ComposedNumberExpression extends AbstractNumberExpression { @Override public String getStringValue(MatchContext context, RutaStream stream) { if(ops.isEmpty() && expressions.size() == 1) { return expressions.get(0).getStringValue(context, stream); } else { return String.valueOf(getDoubleValue(context, stream)); } } }
ComposedNumberExpression extends AbstractNumberExpression { @Override public String getStringValue(MatchContext context, RutaStream stream) { if(ops.isEmpty() && expressions.size() == 1) { return expressions.get(0).getStringValue(context, stream); } else { return String.valueOf(getDoubleValue(context, stream)); } } ComposedNumberExpression(List<INumberExpression> expressions, List<String> ops); }
ComposedNumberExpression extends AbstractNumberExpression { @Override public String getStringValue(MatchContext context, RutaStream stream) { if(ops.isEmpty() && expressions.size() == 1) { return expressions.get(0).getStringValue(context, stream); } else { return String.valueOf(getDoubleValue(context, stream)); } } ComposedNumberExpression(List<INumberExpression> expressions, List<String> ops); @Override double getDoubleValue(MatchContext context, RutaStream stream); @Override float getFloatValue(MatchContext context, RutaStream stream); @Override int getIntegerValue(MatchContext context, RutaStream stream); @Override String getStringValue(MatchContext context, RutaStream stream); List<INumberExpression> getExpressions(); List<String> getOperators(); }
ComposedNumberExpression extends AbstractNumberExpression { @Override public String getStringValue(MatchContext context, RutaStream stream) { if(ops.isEmpty() && expressions.size() == 1) { return expressions.get(0).getStringValue(context, stream); } else { return String.valueOf(getDoubleValue(context, stream)); } } ComposedNumberExpression(List<INumberExpression> expressions, List<String> ops); @Override double getDoubleValue(MatchContext context, RutaStream stream); @Override float getFloatValue(MatchContext context, RutaStream stream); @Override int getIntegerValue(MatchContext context, RutaStream stream); @Override String getStringValue(MatchContext context, RutaStream stream); List<INumberExpression> getExpressions(); List<String> getOperators();  }