Search in sources :

Example 1 with NamedExpression

use of de.neemann.digital.analyse.expression.NamedExpression in project Digital by hneemann.

the class FormatToExpressionTest method testFormatNamesExp.

public void testFormatNamesExp() throws Exception {
    Variable a = v("A");
    Variable b = v("B");
    Expression e = and(a, b);
    NamedExpression n = new NamedExpression("U", e);
    assertEquals("U = A ∧ B", FormatToExpression.FORMATTER_UNICODE.format(n));
    n = new NamedExpression("V", n);
    assertEquals("V = U = A ∧ B", FormatToExpression.FORMATTER_UNICODE.format(n));
}
Also used : Variable(de.neemann.digital.analyse.expression.Variable) Expression(de.neemann.digital.analyse.expression.Expression) NamedExpression(de.neemann.digital.analyse.expression.NamedExpression) NamedExpression(de.neemann.digital.analyse.expression.NamedExpression)

Example 2 with NamedExpression

use of de.neemann.digital.analyse.expression.NamedExpression in project Digital by hneemann.

the class FormatToExpressionTest method testFormatExpLaTeX.

public void testFormatExpLaTeX() throws Exception {
    Variable a = new Variable("A_n");
    Variable b = new Variable("B_n");
    Expression e = new NamedExpression("Y_n+1", and(a, not(b)));
    assertEquals("Y_{n+1} = A_{n} \\und \\nicht{B_{n}}", FormatToExpression.FORMATTER_LATEX.format(e));
}
Also used : Variable(de.neemann.digital.analyse.expression.Variable) Expression(de.neemann.digital.analyse.expression.Expression) NamedExpression(de.neemann.digital.analyse.expression.NamedExpression) NamedExpression(de.neemann.digital.analyse.expression.NamedExpression)

Aggregations

Expression (de.neemann.digital.analyse.expression.Expression)2 NamedExpression (de.neemann.digital.analyse.expression.NamedExpression)2 Variable (de.neemann.digital.analyse.expression.Variable)2