@Test public void formula35() throws RecognitionException { ReadExpressionTester exp = new ReadExpressionTester(formula("=tanh(0.5493)")); assertThat(exp.getExpression().getName(), equalTo("tanh(0.5493)")); VDouble result = (VDouble) exp.getFunction().readValue(); assertThat(result.getValue(), closeTo(0.5, 0.0001)); }
public static DesiredRateReadWriteExpression<?, Object> formula(String formula) { DesiredRateExpression<?> exp = parseFormula(formula); if (exp instanceof LastOfChannelExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, org.diirt.datasource.vtype.ExpressionLanguage.vType(exp.getName())); } else if (exp instanceof ErrorDesiredRateExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Parsing error")); } else { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Read-only formula")); } }
ExpressionLanguage { public static DesiredRateReadWriteExpression<?, Object> formula(String formula) { DesiredRateExpression<?> exp = parseFormula(formula); if (exp instanceof LastOfChannelExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, org.diirt.datasource.vtype.ExpressionLanguage.vType(exp.getName())); } else if (exp instanceof ErrorDesiredRateExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Parsing error")); } else { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Read-only formula")); } } }
ExpressionLanguage { public static DesiredRateReadWriteExpression<?, Object> formula(String formula) { DesiredRateExpression<?> exp = parseFormula(formula); if (exp instanceof LastOfChannelExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, org.diirt.datasource.vtype.ExpressionLanguage.vType(exp.getName())); } else if (exp instanceof ErrorDesiredRateExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Parsing error")); } else { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Read-only formula")); } } private  ExpressionLanguage(); }
ExpressionLanguage { public static DesiredRateReadWriteExpression<?, Object> formula(String formula) { DesiredRateExpression<?> exp = parseFormula(formula); if (exp instanceof LastOfChannelExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, org.diirt.datasource.vtype.ExpressionLanguage.vType(exp.getName())); } else if (exp instanceof ErrorDesiredRateExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Parsing error")); } else { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Read-only formula")); } } private  ExpressionLanguage(); static String channelFromFormula(String formula); static DesiredRateReadWriteExpression<?, Object> formula(String formula); static DesiredRateReadWriteExpression<?, Object> formula(FormulaAst ast); static DesiredRateExpression<?> formulaArg(String formula); static DesiredRateExpression<T> formula(String formula, Class<T> readType); }
ExpressionLanguage { public static DesiredRateReadWriteExpression<?, Object> formula(String formula) { DesiredRateExpression<?> exp = parseFormula(formula); if (exp instanceof LastOfChannelExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, org.diirt.datasource.vtype.ExpressionLanguage.vType(exp.getName())); } else if (exp instanceof ErrorDesiredRateExpression) { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Parsing error")); } else { return new DesiredRateReadWriteExpressionImpl<>(exp, readOnlyWriteExpression("Read-only formula")); } } private  ExpressionLanguage(); static String channelFromFormula(String formula); static DesiredRateReadWriteExpression<?, Object> formula(String formula); static DesiredRateReadWriteExpression<?, Object> formula(FormulaAst ast); static DesiredRateExpression<?> formulaArg(String formula); static DesiredRateExpression<T> formula(String formula, Class<T> readType);  }