Package org.jamesii.core.math.parsetree

Examples of org.jamesii.core.math.parsetree.Node.calc()


public class TestLengthNode extends TestValueNodeAbstract<LengthNode, INode> {

  @Override
  public void testCalc() {
    Node node = getInstance(getA(0));
    ValueNode<Integer> res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);

    node = getInstance(getA(1));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);
View Full Code Here


    Node node = getInstance(getA(0));
    ValueNode<Integer> res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);

    node = getInstance(getA(1));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);

    node = getInstance(getA(2));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);
View Full Code Here

    node = getInstance(getA(1));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);

    node = getInstance(getA(2));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);

    node = getInstance(getA(3));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(2) == 0);
View Full Code Here

    node = getInstance(getA(2));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);

    node = getInstance(getA(3));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(2) == 0);

    node =
        getInstance(new ListNode(toList(new MultNode(new ValueNode<>(2),
            new ValueNode<>(-2.)))));
View Full Code Here

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

    node =
        getInstance(new ListNode(toList(new MultNode(new ValueNode<>(2),
            new ValueNode<>(-2.)))));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(1) == 0);

    node =
        getInstance(new ListNode(toList(new MultNode(new ValueNode<>(2),
            new ValueNode<>(-2.)), new MultNode(new ValueNode<>(2),
View Full Code Here

    node =
        getInstance(new ListNode(toList(new MultNode(new ValueNode<>(2),
            new ValueNode<>(-2.)), new MultNode(new ValueNode<>(2),
            new ValueNode<>(-3.)))));
    res = node.calc(null);
    assertTrue(res.getValue().compareTo(2) == 0);
  }

  private List<INode> toList(Node... nodes) {
    ArrayList<INode> result = new ArrayList<>();
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public void testCalc() {
    Node node = getInstance(getA(0));
    ListNode res = node.calc(null);
    List<INode> resList = res.getValue();
    assertTrue(((ValueNode<Integer>) resList.get(0)).getValue().compareTo(1) == 0);

    node = getInstance(getA(1));
    res = node.calc(null);
View Full Code Here

    ListNode res = node.calc(null);
    List<INode> resList = res.getValue();
    assertTrue(((ValueNode<Integer>) resList.get(0)).getValue().compareTo(1) == 0);

    node = getInstance(getA(1));
    res = node.calc(null);
    resList = res.getValue();
    assertTrue(((ValueNode<Integer>) resList.get(0)).getValue().compareTo(-1) == 0);

    node = getInstance(getA(2));
    res = node.calc(null);
View Full Code Here

    res = node.calc(null);
    resList = res.getValue();
    assertTrue(((ValueNode<Integer>) resList.get(0)).getValue().compareTo(-1) == 0);

    node = getInstance(getA(2));
    res = node.calc(null);
    resList = res.getValue();
    assertTrue(((ValueNode<Integer>) resList.get(0)).getValue().compareTo(0) == 0);

    node = getInstance(getA(3));
    ListNode res2 = node.calc(null);
View Full Code Here

    res = node.calc(null);
    resList = res.getValue();
    assertTrue(((ValueNode<Integer>) resList.get(0)).getValue().compareTo(0) == 0);

    node = getInstance(getA(3));
    ListNode res2 = node.calc(null);
    resList = res2.getValue();
    assertTrue(((ValueNode<Double>) resList.get(0)).getValue().compareTo(1.) == 0);

    node = getInstance(getA(4));
    res2 = node.calc(null);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.