setMath() публичный Метод

public setMath ( ASTNode math ) : int
math ASTNode
Результат int
Пример #1
0
 public void test_Model_addEvent4()
 {
     Model m = new  Model(2,2);
       Event e = new  Event(2,2);
       Trigger t = new  Trigger(2,2);
       t.setMath(libsbml.parseFormula("true"));
       e.setId( "e");
       e.setTrigger(t);
       e.createEventAssignment();
       Event e1 = new  Event(2,2);
       e1.setId( "e");
       e1.setTrigger(t);
       e1.createEventAssignment();
       int i = m.addEvent(e);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumEvents() == 1 );
       i = m.addEvent(e1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumEvents() == 1 );
       e = null;
       e1 = null;
       m = null;
 }
 public void test_Event_setTrigger1()
 {
     Trigger trigger = new  Trigger(2,1);
       trigger.setMath(libsbml.parseFormula("true"));
       int i = E.setTrigger(trigger);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertEquals( false, E.isSetTrigger() );
 }
Пример #3
0
 public void test_WriteSBML_Event_trigger_withSBO()
 {
     string expected = "<event id=\"e\">\n" +
     "  <trigger sboTerm=\"SBO:0000064\">\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" +
     "</event>";
       D.setLevelAndVersion(2,3,false);
       Event e = D.createModel().createEvent();
       e.setId("e");
       ASTNode node = libsbml.parseFormula("leq(P1,t)");
       Trigger t = new Trigger ( 2,3 );
       t.setMath(node);
       t.setSBOTerm(64);
       e.setTrigger(t);
       assertEquals( true, equals(expected,e.toSBML()) );
 }
Пример #4
0
 public void test_Model_addEvent2()
 {
     Model m = new  Model(2,2);
       Event e = new  Event(2,1);
       Trigger t = new  Trigger(2,1);
       t.setMath(libsbml.parseFormula("true"));
       e.setTrigger(t);
       e.createEventAssignment();
       int i = m.addEvent(e);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumEvents() == 0 );
       e = null;
       m = null;
 }
Пример #5
0
 public void test_Trigger_ancestor_add()
 {
     Trigger d = new Trigger(2,4);
       d.setMath(libsbml.parseFormula("true"));
       Event e = new Event(2, 4);
       e.setTrigger(d);
       d = null;
       Trigger obj = e.getTrigger();
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == e );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       e = null;
 }
Пример #6
0
 public void test_WriteSBML_Event_full()
 {
     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" +
     "  <listOfEventAssignments>\n" +
     "    <eventAssignment sboTerm=\"SBO:0000064\" variable=\"k2\">\n" +
     "      <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "        <cn type=\"integer\"> 0 </cn>\n" +
     "      </math>\n" +
     "    </eventAssignment>\n" +
     "  </listOfEventAssignments>\n" +
     "</event>";
       D.setLevelAndVersion(2,3,false);
       Event e = D.createModel().createEvent();
       e.setId("e");
       ASTNode node = libsbml.parseFormula("leq(P1,t)");
       Trigger t = new Trigger ( 2,3 );
       t.setMath(node);
       ASTNode math = libsbml.parseFormula("0");
       EventAssignment ea = new EventAssignment ( 2,3 );
       ea.setVariable("k2");
       ea.setMath(math);
       ea.setSBOTerm(64);
       e.setTrigger(t);
       e.addEventAssignment(ea);
       assertEquals( true, equals(expected,e.toSBML()) );
 }
Пример #7
0
 public void test_Event_setTrigger()
 {
     ASTNode math1 = libsbml.parseFormula("0");
       Trigger trigger = new  Trigger(2,4);
       trigger.setMath(math1);
       E.setTrigger(trigger);
       assertNotEquals(E.getTrigger(),null);
       assertEquals( true, E.isSetTrigger() );
       if (E.getTrigger() == trigger);
       {
       }
       E.setTrigger(E.getTrigger());
       assertNotEquals(E.getTrigger(),trigger);
       E.setTrigger(null);
       assertEquals( false, E.isSetTrigger() );
       if (E.getTrigger() != null);
       {
       }
 }
 public void test_Trigger()
 {
     Trigger t = new Trigger(2,4);
       assertEquals( false, (t.hasRequiredElements()) );
       t.setMath(libsbml.parseFormula("ar"));
       assertEquals( true, t.hasRequiredElements() );
       t = null;
 }
 public void test_Trigger_parent_add()
 {
     Trigger d = new Trigger(2,4);
       d.setMath(libsbml.parseFormula("true"));
       Event e = new Event(2, 4);
       e.setTrigger(d);
       d = null;
       assertTrue( e == e.getTrigger().getParentSBMLObject() );
       e = null;
 }
Пример #10
0
 public void test_Event_full()
 {
     ASTNode math1 = libsbml.parseFormula("0");
       Trigger trigger = new  Trigger(2,4);
       ASTNode math = libsbml.parseFormula("0");
       Event e = new  Event(2,4);
       EventAssignment ea = new  EventAssignment(2,4);
       ea.setVariable( "k");
       ea.setMath(math);
       trigger.setMath(math1);
       e.setTrigger(trigger);
       e.setId( "e1");
       e.setName( "Set k2 to zero when P1 <= t");
       e.addEventAssignment(ea);
       assertTrue( e.getNumEventAssignments() == 1 );
       assertNotEquals(e.getEventAssignment(0),ea);
       math = null;
       e = null;
 }
 public void test_Event_parent_add()
 {
     Event e = new Event(2,4);
       Trigger t = new Trigger(2,4);
       t.setMath(libsbml.parseFormula("true"));
       e.setTrigger(t);
       e.createEventAssignment();
       Model m = new Model(2,4);
       m.addEvent(e);
       e = null;
       ListOf lo = m.getListOfEvents();
       assertTrue( lo == m.getEvent(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
Пример #12
0
 public void test_L3_Event_hasRequiredElements()
 {
     Event e = new  Event(3,1);
       assertEquals( false, e.hasRequiredElements() );
       Trigger t = new  Trigger(3,1);
       t.setInitialValue(true);
       t.setPersistent(true);
       t.setMath(libsbml.parseFormula("true"));
       e.setTrigger(t);
       assertEquals( true, e.hasRequiredElements() );
       e = null;
 }
Пример #13
0
 public void test_Trigger_copyConstructor()
 {
     Trigger o1 = new Trigger(2,4);
       ASTNode node = new ASTNode(libsbml.AST_CONSTANT_PI);
       o1.setMath(node);
       node = null;
       assertTrue( o1.getMath() != null );
       Trigger o2 = new Trigger(o1);
       assertTrue( o2.getMath() != null );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = 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;
 }
Пример #15
0
 public void test_Model_getEventById()
 {
     Event e1 = new  Event(2,4);
       Event e2 = new  Event(2,4);
       Trigger t = new  Trigger(2,4);
       t.setMath(libsbml.parseFormula("true"));
       e1.setTrigger(t);
       e2.setTrigger(t);
       e1.createEventAssignment();
       e2.createEventAssignment();
       e1.setId( "e1" );
       e2.setId( "e2" );
       M.addEvent(e1);
       M.addEvent(e2);
       assertTrue( M.getNumEvents() == 2 );
       assertNotEquals(M.getEvent( "e1" ),e1);
       assertNotEquals(M.getEvent( "e2" ),e2);
       assertEquals(M.getEvent( "e3" ),null);
 }
 public void test_Event_setTrigger2()
 {
     ASTNode math1 = libsbml.parseFormula("0");
       Trigger trigger = new  Trigger(2,4);
       trigger.setMath(math1);
       int i = E.setTrigger(trigger);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertNotEquals(E.getTrigger(),null);
       assertEquals( true, E.isSetTrigger() );
 }
Пример #17
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()) );
 }
 public void test_Event()
 {
     Event e = new Event(2,4);
       assertEquals( false, (e.hasRequiredElements()) );
       Trigger t = new Trigger(2,4);
       t.setMath(libsbml.parseFormula("true"));
       e.setTrigger(t);
       assertEquals( false, (e.hasRequiredElements()) );
       e.createEventAssignment();
       assertEquals( true, e.hasRequiredElements() );
       e = null;
 }
Пример #19
0
 public void test_Event_ancestor_add()
 {
     Event e = new Event(2,4);
       Model m = new Model(2,4);
       Trigger t = new Trigger(2,4);
       t.setMath(libsbml.parseFormula("true"));
       e.setTrigger(t);
       e.createEventAssignment();
       m.addEvent(e);
       e = null;
       ListOf lo = m.getListOfEvents();
       Event obj = m.getEvent(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
 }