Examples of calc()


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

  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.));
View Full Code Here

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

  }

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

    node = new MinusNode(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Integer> res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(1) == 0);
View Full Code Here

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

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

    node = new MinusNode(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Integer> res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(1) == 0);

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

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

    node = new MinusNode(new ValueNode<>(2), new ValueNode<>(1));
    ValueNode<Integer> res2 = node.calc(null);
    assertTrue(res2.getValue().compareTo(1) == 0);

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

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

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

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

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

  }

}
View Full Code Here

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

    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

Examples of org.lilypondbeans.MidiPositions.calc()

    private void checkMidi() {
        try {
            ASTScore root = ASTScore.createFromFile(lyFileName, true);
            MidiPositions mid = new MidiPositions(root);
            mid.calc();

            SimpleMidiPlayer midi = view.pdfPanel.getMidiPlayer();

            System.out.print(((double) midi.getSize()) / (double) 1000);
            System.out.print(":m");
View Full Code Here

Examples of org.lilypondbeans.MidiPositions.calc()

    public void parseMidi(String file) throws Exception {
        try {
            ASTScore root = ASTScore.createFromFile(file, true);
            MidiPositions mid = new MidiPositions(root);
            mid.calc();
            double s1 = mid.getCalcedMidiSeconds();
            LineNumberReader rd = new LineNumberReader(new FileReader(file.replace(".ly", ".m")));
            double s2 = Double.parseDouble(rd.readLine());
            rd.close();
        } catch (Exception ex) {
View Full Code Here

Examples of org.lilypondbeans.MidiPositions.calc()

            double cache = getCachedMidiLen(file);
            if (cache == 0) {
                return;
            }
            MidiPositions mid = new MidiPositions(score);
            mid.calc();
            double tm = mid.getCalcedMidiSeconds();
            if (tm == 0) {
                return;
            }
            if (Math.abs(tm - cache) < TIME_TOLLERANCE) {
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.