setMath() public method

public setMath ( ASTNode math ) : int
math ASTNode
return int
Example #1
0
 public void test_WriteSBML_Event_both()
 {
     string expected = "<event id=\"e\">\n" +
     "  <trigger>\n" +
     "    <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "      <apply>\n" +
     "        <leq/>\n" +
     "        <ci> P1 </ci>\n" +
     "        <ci> t </ci>\n" +
     "      </apply>\n" +
     "    </math>\n" +
     "  </trigger>\n" +
     "  <delay>\n" +
     "    <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "      <cn type=\"integer\"> 5 </cn>\n" +
     "    </math>\n" +
     "  </delay>\n" +
     "</event>";
       D.setLevelAndVersion(2,1,false);
       Event e = D.createModel().createEvent();
       e.setId("e");
       ASTNode node1 = libsbml.parseFormula("leq(P1,t)");
       Trigger t = new Trigger ( 2,1 );
       t.setMath(node1);
       ASTNode node = libsbml.parseFormula("5");
       Delay d = new Delay ( 2,1 );
       d.setMath(node);
       e.setDelay(d);
       e.setTrigger(t);
       assertEquals( true, equals(expected,e.toSBML()) );
 }
Example #2
0
 public void test_WriteSBML_Event_delayWithSBO()
 {
     string expected = "<event id=\"e\">\n" +
     "  <delay sboTerm=\"SBO:0000064\">\n" +
     "    <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "      <cn type=\"integer\"> 5 </cn>\n" +
     "    </math>\n" +
     "  </delay>\n" +
     "</event>";
       D.setLevelAndVersion(2,3,false);
       Event e = D.createModel().createEvent();
       e.setId("e");
       ASTNode node = libsbml.parseFormula("5");
       Delay d = new Delay ( 2,3 );
       d.setMath(node);
       d.setSBOTerm(64);
       e.setDelay(d);
       assertEquals( true, equals(expected,e.toSBML()) );
 }
 public void test_Event_setDelay1()
 {
     ASTNode math1 = libsbml.parseFormula("0");
       Delay Delay = new  Delay(2,4);
       Delay.setMath(math1);
       int i = E.setDelay(Delay);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertNotEquals(E.getDelay(),null);
       assertEquals( true, E.isSetDelay() );
       i = E.unsetDelay();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, E.isSetDelay() );
 }
Example #4
0
 public void test_Delay_copyConstructor()
 {
     Delay o1 = new Delay(2,4);
       ASTNode node = new ASTNode(libsbml.AST_CONSTANT_PI);
       o1.setMath(node);
       node = null;
       assertTrue( o1.getMath() != null );
       Delay o2 = new Delay(o1);
       assertTrue( o2.getMath() != null );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
Example #5
0
 public void test_Event_setDelay()
 {
     ASTNode math1 = libsbml.parseFormula("0");
       Delay Delay = new  Delay(2,4);
       Delay.setMath(math1);
       E.setDelay(Delay);
       assertNotEquals(E.getDelay(),null);
       assertEquals( true, E.isSetDelay() );
       if (E.getDelay() == Delay);
       {
       }
       E.setDelay(E.getDelay());
       assertNotEquals(E.getDelay(),Delay);
       E.setDelay(null);
       assertEquals( false, E.isSetDelay() );
       if (E.getDelay() != null);
       {
       }
 }
 public void test_Delay()
 {
     Delay d = new Delay(2,4);
       assertEquals( false, (d.hasRequiredElements()) );
       d.setMath(libsbml.parseFormula("a+b"));
       assertEquals( true, d.hasRequiredElements() );
       d = null;
 }
 public void test_Event_parent_NULL()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       Model m = d.createModel();
       Event c = m.createEvent();
       EventAssignment ea = c.createEventAssignment();
       Trigger t = new Trigger(2,4);
       t.setMath(new ASTNode());
       Delay dy = new Delay(2,4);
       dy.setMath(new ASTNode());
       c.setTrigger(t);
       c.setDelay(dy);
       assertTrue( c.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( c.getTrigger().getParentSBMLObject() == c );
       assertEquals(c.getDelay().getSBMLDocument(),d);
       assertTrue( ea.getAncestorOfType(libsbml.SBML_EVENT) == c );
       Event c1 = c.clone();
       d = null;
       assertTrue( c1.getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( c1.getParentSBMLObject() == null );
       assertEquals(c1.getSBMLDocument(),null);
       assertTrue( c1.getEventAssignment(0).getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( c1.getEventAssignment(0).getAncestorOfType(libsbml.SBML_EVENT) == c1 );
       assertTrue( c1.getEventAssignment(0).getParentSBMLObject() != null );
       assertEquals(c1.getEventAssignment(0).getSBMLDocument(),null);
       assertTrue( c1.getTrigger().getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( c1.getTrigger().getAncestorOfType(libsbml.SBML_EVENT) == c1 );
       assertTrue( c1.getTrigger().getParentSBMLObject() != null );
       assertEquals(c1.getTrigger().getSBMLDocument(),null);
       assertTrue( c1.getDelay().getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( c1.getDelay().getAncestorOfType(libsbml.SBML_EVENT) == c1 );
       assertTrue( c1.getDelay().getParentSBMLObject() != null );
       assertEquals(c1.getDelay().getSBMLDocument(),null);
       c1 = null;
 }