Examples of calc()


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

    INode node = getInstance(getA(0));
    ValueNode<Double> res = node.calc(null);
    assertTrue(res.getValue().compareTo(Math.ceil(1)) == 0);

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

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

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

Examples of org.jamesii.core.math.parsetree.bool.NotNode.calc()

  @Override
  public void testCalc() {

    NotNode n = getInstance(getA(1));

    ValueNode<Boolean> res = n.calc(null);
    assertTrue(res.getValue());

    NotNode n2 = new NotNode(new NotNode(new ValueNode<>(false)));
    res = n2.calc(null);
    assertTrue(!res.getValue());
View Full Code Here

Examples of org.jamesii.core.math.parsetree.control.CaseNode.calc()

    caseTerms.add(new Pair<Comparable<?>, INode>(2, new ValueNode<>(3)));
    caseTerms.add(new Pair<Comparable<?>, INode>(1, new AddNode(
        new ValueNode<>(3), new ValueNode<>(3))));

    CaseNode cn = new CaseNode(new ValueNode<>(2), caseTerms);
    ValueNode<Integer> res = cn.calc(null);
    assertTrue(res.getValue().compareTo(3) == 0);

    cn = new CaseNode(new ValueNode<>(1), caseTerms);
    res = cn.calc(null);
    assertTrue(res.getValue().compareTo(6) == 0);
View Full Code Here

Examples of org.jamesii.core.math.parsetree.control.IfThenElseNode.calc()

  @Override
  public void testCalc() {
    IfThenElseNode ifN =
        new IfThenElseNode(new ValueNode<>(true), new ValueNode<>(5),
            new ValueNode<>(7));
    ValueNode<Integer> res = ifN.calc(null);
    assertTrue(res.getValue().compareTo(5) == 0);

    ifN =
        new IfThenElseNode(new ValueNode<>(false), new ValueNode<>(5),
            new ValueNode<>(7));
View Full Code Here

Examples of org.jamesii.core.math.parsetree.control.IfThenElseNode.calc()

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

    ifN =
        new IfThenElseNode(new ValueNode<>(false), new ValueNode<>(5),
            new ValueNode<>(7));
    res = ifN.calc(null);
    assertTrue(res.getValue().compareTo(7) == 0);

    ifN =
        new IfThenElseNode(new OrNode(new ValueNode<>(false), new ValueNode<>(
            false)), new ValueNode<>(5), new ValueNode<>(7));
View Full Code Here

Examples of org.jamesii.core.math.parsetree.control.IfThenElseNode.calc()

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

    ifN =
        new IfThenElseNode(new OrNode(new ValueNode<>(false), new ValueNode<>(
            false)), new ValueNode<>(5), new ValueNode<>(7));
    res = ifN.calc(null);
    assertTrue(res.getValue().compareTo(7) == 0);

    ifN =
        new IfThenElseNode(new OrNode(new ValueNode<>(true), new ValueNode<>(
            false)), new ValueNode<>(5), new ValueNode<>(7));
View Full Code Here

Examples of org.jamesii.core.math.parsetree.control.IfThenElseNode.calc()

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

    ifN =
        new IfThenElseNode(new OrNode(new ValueNode<>(true), new ValueNode<>(
            false)), new ValueNode<>(5), new ValueNode<>(7));
    res = ifN.calc(null);
    assertTrue(res.getValue().compareTo(5) == 0);

    ifN =
        new IfThenElseNode(new ValueNode<>(false), new ValueNode<>(5),
            new OrNode(new ValueNode<>(true), new ValueNode<>(true)));
View Full Code Here

Examples of org.jamesii.core.math.parsetree.control.IfThenElseNode.calc()

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

    ifN =
        new IfThenElseNode(new ValueNode<>(false), new ValueNode<>(5),
            new OrNode(new ValueNode<>(true), new ValueNode<>(true)));
    ValueNode<Boolean> res2 = ifN.calc(null);
    assertTrue(res2.getValue().compareTo(true) == 0);

    ifN =
        new IfThenElseNode(new ValueNode<>(true), new OrNode(new ValueNode<>(
            true), new ValueNode<>(true)), new ValueNode<>(5));
View Full Code Here

Examples of org.jamesii.core.math.parsetree.control.IfThenElseNode.calc()

    assertTrue(res2.getValue().compareTo(true) == 0);

    ifN =
        new IfThenElseNode(new ValueNode<>(true), new OrNode(new ValueNode<>(
            true), new ValueNode<>(true)), new ValueNode<>(5));
    res2 = ifN.calc(null);
    assertTrue(res2.getValue().compareTo(true) == 0);
  }

  @Override
  public void testClone() {
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.