Package org.jamesii.core.math.parsetree

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


    b = getInstance(new ValueNode<>(2), new ValueNode<>(2));
    result = b.calc(null);
    assertTrue(result.getValue());

    b = getInstance(new ValueNode<>(0), new ValueNode<>(0));
    result = b.calc(null);
    assertTrue(result.getValue());
  }

}
View Full Code Here


  }

  @Override
  public void testCalc() {
    BinaryNode node = getInstance(new ValueNode<>(2.), new ValueNode<>(1.));
    ValueNode<Double> res = node.calc(null);
    assertTrue(res.getValue().compareTo(2.) == 0);

    BinaryNode node2 = getInstance(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Double> res2 = node2.calc(null);
    assertTrue(res2.getValue().compareTo(2.) == 0);
View Full Code Here

    BinaryNode node = getInstance(new ValueNode<>(2.), new ValueNode<>(1.));
    ValueNode<Double> res = node.calc(null);
    assertTrue(res.getValue().compareTo(2.) == 0);

    BinaryNode node2 = getInstance(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Double> res2 = node2.calc(null);
    assertTrue(res2.getValue().compareTo(2.) == 0);

    BinaryNode node3 = getInstance(new ValueNode<>(2), new ValueNode<>(3.));
    ValueNode<Double> res3 = node3.calc(null);
    assertTrue(res3.getValue().compareTo(8.) == 0);
View Full Code Here

    BinaryNode node2 = getInstance(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Double> res2 = node2.calc(null);
    assertTrue(res2.getValue().compareTo(2.) == 0);

    BinaryNode node3 = getInstance(new ValueNode<>(2), new ValueNode<>(3.));
    ValueNode<Double> res3 = node3.calc(null);
    assertTrue(res3.getValue().compareTo(8.) == 0);

    node3 = getInstance(new ValueNode<>(2), new ValueNode<>(0.));
    res3 = node3.calc(null);
    assertTrue(res3.getValue().compareTo(1.) == 0);
View Full Code Here

    BinaryNode node3 = getInstance(new ValueNode<>(2), new ValueNode<>(3.));
    ValueNode<Double> res3 = node3.calc(null);
    assertTrue(res3.getValue().compareTo(8.) == 0);

    node3 = getInstance(new ValueNode<>(2), new ValueNode<>(0.));
    res3 = node3.calc(null);
    assertTrue(res3.getValue().compareTo(1.) == 0);

    BinaryNode node4 =
        getInstance(getInstance(new ValueNode<>(1), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(3.)));
View Full Code Here

    assertTrue(res3.getValue().compareTo(1.) == 0);

    BinaryNode node4 =
        getInstance(getInstance(new ValueNode<>(1), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(3.)));
    ValueNode<Double> res4 = node4.calc(null);
    assertTrue(res4.getValue().compareTo(1.) == 0);

    node4 =
        getInstance(getInstance(new ValueNode<>(2), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(3.)));
View Full Code Here

    assertTrue(res4.getValue().compareTo(1.) == 0);

    node4 =
        getInstance(getInstance(new ValueNode<>(2), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(3.)));
    res4 = node4.calc(null);
    assertTrue(res4.getValue().compareTo(16777216.) == 0);

    node4 =
        getInstance(getInstance(new ValueNode<>(2), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(1.)));
View Full Code Here

    assertTrue(res4.getValue().compareTo(16777216.) == 0);

    node4 =
        getInstance(getInstance(new ValueNode<>(2), new ValueNode<>(3.)),
            getInstance(new ValueNode<>(2), new ValueNode<>(1.)));
    res4 = node4.calc(null);
    assertTrue(res4.getValue().compareTo(64.) == 0);

  }

}
View Full Code Here

  }

  @Override
  public void testCalc() {
    BinaryNode b = getInstance(new ValueNode<>(true), new ValueNode<>(false));
    ValueNode<Boolean> result = b.calc(null);
    assertTrue(result.getValue());

    b = getInstance(new ValueNode<>(true), new ValueNode<>(true));
    result = b.calc(null);
    assertTrue(!result.getValue());
View Full Code Here

    BinaryNode b = getInstance(new ValueNode<>(true), new ValueNode<>(false));
    ValueNode<Boolean> result = b.calc(null);
    assertTrue(result.getValue());

    b = getInstance(new ValueNode<>(true), new ValueNode<>(true));
    result = b.calc(null);
    assertTrue(!result.getValue());

    b = getInstance(new ValueNode<>(false), new ValueNode<>(true));
    result = b.calc(null);
    assertTrue(result.getValue());
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.