Package org.jamesii.core.math.parsetree

Examples of org.jamesii.core.math.parsetree.NodeFactory


import junit.framework.TestCase;

public class TestNodeFactory extends TestCase {

  public void testCreateNode() {
    NodeFactory nf = new NodeFactory();
    AbsNode n = nf.createNode(AbsNode.class, new ValueNode<>(-2));

    ValueNode<Double> resAbs = n.calc(null);

    assertTrue(resAbs.getValue().compareTo(2.) == 0);

    MultNode m =
        nf.createNode(MultNode.class, new ValueNode<>(-2), new ValueNode<>(3.));

    ValueNode<Double> resMult = m.calc(null);

    assertTrue(resMult.getValue().compareTo(-6.) == 0);
  }
View Full Code Here

TOP

Related Classes of org.jamesii.core.math.parsetree.NodeFactory

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.