Package jmathexpr.arithmetic.op

Examples of jmathexpr.arithmetic.op.Multiplication


            return matches && !(c.hit() instanceof ANumber && ((ANumber) c.hit()).isOne());
        }

        @Override
        public Expression apply() {
            return new Addition(new Multiplication(a.hit(), b.hit()),
                    new Multiplication(a.hit(), c.hit()));
        }
View Full Code Here


     */
    private class RightSubtraction extends SubRule {

        @Override
        public boolean matches(Expression expr) {
            boolean matches = new Multiplication(new Subtraction(a, b), c).matches(expr);
           
            return matches && !(c.hit() instanceof ANumber && ((ANumber) c.hit()).isOne());
        }
View Full Code Here

            return matches && !(c.hit() instanceof ANumber && ((ANumber) c.hit()).isOne());
        }

        @Override
        public Expression apply() {
            return new Subtraction(new Multiplication(a.hit(), b.hit()),
                    new Multiplication(a.hit(), c.hit()));
        }
View Full Code Here

        @Override
        public Expression apply() {
            OrderedPair factor = p.euclideanDivision(Polynomial.create(x, x));
           
            return new Equality(new Multiplication(factor.a(), x), Naturals.zero());
        }
View Full Code Here

        private final TerminationPattern a = new AnyPattern();
        private final TerminationPattern b = new AnyPattern();

        @Override
        public boolean matches(Expression expr) {
            return new Equality(new Multiplication(a, b), Naturals.zero()).matches(expr);
        }
View Full Code Here

     */
    private class LeftMultiplication extends SubRule {

        @Override
        public boolean matches(Expression expr) {
            Expression atb = new Multiplication(a, b);
           
            return new Multiplication(atb, c).matches(expr);
        }
View Full Code Here

                    && denominator.matches(d);
        } else if (expr instanceof Division) {
            return numerator.matches(((Division) expr).lhs())
                    && denominator.matches(((Division) expr).rhs());
        } else if (expr instanceof Multiplication) {
            Multiplication m = (Multiplication) expr;
           
            if (matches(m.lhs())) { // a/b * c -> ac/b
                return numerator.matches(new Multiplication(numerator.hit(), m.rhs()));
            } else if (matches(m.rhs())) { // a * b/c -> ab/c
                return numerator.matches(new Multiplication(m.lhs(), numerator.hit()));
            }
        }
       
        return false;
    }
View Full Code Here

            return new Multiplication(atb, c).matches(expr);
        }

        @Override
        public Expression apply() {
            return new Multiplication(a.evaluate(), new Multiplication(b.evaluate(), c.evaluate()));
        }
View Full Code Here

     */
    private class RightMultiplication extends SubRule {

        @Override
        public boolean matches(Expression expr) {
            Expression btc = new Multiplication(b, c);
           
            return new Multiplication(a, btc).matches(expr);
        }
View Full Code Here

            return new Multiplication(a, btc).matches(expr);
        }

        @Override
        public Expression apply() {
            return new Multiplication(new Multiplication(a.evaluate(), b.evaluate()), c.evaluate());
        }
View Full Code Here

TOP

Related Classes of jmathexpr.arithmetic.op.Multiplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.