Package jmathexpr.arithmetic.op

Examples of jmathexpr.arithmetic.op.Subtraction


       
        for (NaturalNumber n : subtrahend.coeffs.keySet()) {
            minuend = coeffs.get(n);
           
            if (minuend != null) {
                c = new Subtraction(minuend, subtrahend.coeffs.get(n)).evaluate();
            } else {
                c = new Negation(subtrahend.coeffs.get(n)).evaluate();
            }
           
            if (c instanceof ANumber && ((ANumber) c).isZero()) {
View Full Code Here


        Polynomial p = convert(expr, x);
       
        if (p != null) {
            return subtract(p);
        } else {
            return new Subtraction(this, expr);
        }
    }
View Full Code Here

     */
    private class LeftSubtraction extends SubRule {

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

            return matches && !(a.hit() instanceof ANumber && ((ANumber) a.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

     */
    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

    private class AdditionSubtraction extends SubRule {

        @Override
        public boolean matches(Expression expr) {
            Addition apb = new Addition(a, b);
            Subtraction bmc = new Subtraction(b, c);
           
            return new Subtraction(apb, c).matches(expr) ||
                   new Addition(a, bmc).matches(expr);
        }
View Full Code Here

                   new Addition(a, bmc).matches(expr);
        }

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

     */
    private class SubtractionAddition extends SubRule {

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

            return new Addition(amb, c).matches(expr);
        }

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

TOP

Related Classes of jmathexpr.arithmetic.op.Subtraction

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.