149150151152153154155
@Override public boolean matches(Expression expr) { target = expr; return new Equality(new Sum(ax, b), new Sum(cx, d)).matches(expr); }
126127128129130131132133134
*/ private class SqrtAdd extends SubRule { @Override public boolean matches(Expression expr) { ExpressionPattern sum = new Sum(s, a); return new Equality(sum, b).matches(expr); }
149150151152153154155156157158159
for (NaturalNumber n : coeffs.descendingKeySet()) { c = coeffs.get(n).evaluate(); term = new Multiplication(c, new Exponentiation(xvalue, n)); if (sum == null) { sum = new Sum(term); } else { sum = Sum.add(sum, term); } }
55565758596061
new Addition(a, bpc).matches(expr); } @Override public Expression apply() { return new Sum(new Addition(new Addition(a.evaluate(), b.evaluate()), c.evaluate())); }
75767778798081
new Addition(a, bmc).matches(expr); } @Override public Expression apply() { return new Sum(new Subtraction(new Addition(a.evaluate(), b.evaluate()), c.evaluate())); }
93949596979899
return new Addition(amb, c).matches(expr); } @Override public Expression apply() { return new Sum(new Addition(new Subtraction(a.evaluate(), b.evaluate()), c.evaluate())); }
113114115116117118119120121
*/ private class Addition extends SubRule { @Override public boolean matches(Expression expr) { ExpressionPattern sum = new Sum(s, a); return new Equality(sum, b).matches(expr); }