Search in sources :

Example 6 with BeautiSubTemplate

use of beast.app.beauti.BeautiSubTemplate in project beast2 by CompEvol.

the class BeautiSubTemplateTest method testBeautiSubTemplateCombined.

@Test
public void testBeautiSubTemplateCombined() throws Exception {
    BeautiSubTemplate t = new BeautiSubTemplate();
    // minimal template + connector + name + condition for 2 entries
    t.initByName("class", RealParameter.class.getName(), "mainid", "kappa", "value", "<state idref='thestate'>" + "  <if cond='kappa/estimate=true'>" + "    <parameter id='kappa' name='stateNode' value='1.0'/>" + "    <parameter id='gamma' value='3.0'/>" + "  </if>" + "</state>" + "<logger idref='tracer'>" + "  <if cond='gamma/estimate=true'>" + "    <log idref='kappa'/>" + "    <log idref='gamma'/>" + "  </if>" + "</logger>");
    assertEquals(4, t.connectorsInput.get().size());
    BeautiConnector c = t.connectorsInput.get().get(0);
    assertEquals("kappa", c.sourceIDInput.get());
    assertEquals("thestate", c.targetIDInput.get());
    assertEquals("stateNode", c.inputNameInput.get());
    assertEquals("kappa/estimate=true", c.conditionInput.get());
    c = t.connectorsInput.get().get(1);
    assertEquals("gamma", c.sourceIDInput.get());
    assertEquals("thestate", c.targetIDInput.get());
    assertEquals("parameter", c.inputNameInput.get());
    assertEquals("kappa/estimate=true", c.conditionInput.get());
    c = t.connectorsInput.get().get(2);
    assertEquals("kappa", c.sourceIDInput.get());
    assertEquals("tracer", c.targetIDInput.get());
    assertEquals("log", c.inputNameInput.get());
    assertEquals("gamma/estimate=true", c.conditionInput.get());
    c = t.connectorsInput.get().get(3);
    assertEquals("gamma", c.sourceIDInput.get());
    assertEquals("tracer", c.targetIDInput.get());
    assertEquals("log", c.inputNameInput.get());
    assertEquals("gamma/estimate=true", c.conditionInput.get());
    String xml = t.xMLInput.get();
    assertEquals("<![CDATA[      <parameter id=\"kappa\" name=\"stateNode\" value=\"1.0\"/>    <parameter id=\"gamma\" value=\"3.0\"/>              ]]>", xml);
}
Also used : BeautiConnector(beast.app.beauti.BeautiConnector) RealParameter(beast.core.parameter.RealParameter) BeautiSubTemplate(beast.app.beauti.BeautiSubTemplate) Test(org.junit.Test)

Aggregations

BeautiSubTemplate (beast.app.beauti.BeautiSubTemplate)6 BeautiConnector (beast.app.beauti.BeautiConnector)5 RealParameter (beast.core.parameter.RealParameter)5 Test (org.junit.Test)5 BEASTInterface (beast.core.BEASTInterface)1 Dimension (java.awt.Dimension)1 JLabel (javax.swing.JLabel)1