setTrigger() public method

public setTrigger ( Trigger trigger ) : int
trigger Trigger
return int
Exemplo n.º 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);
       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;
 }
Exemplo n.º 2
0
 public void test_Model_addEvent1()
 {
     Model m = new  Model(2,2);
       Event e = new  Event(2,2);
       Trigger t = new  Trigger(2,2);
       int i = m.addEvent(e);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       e.setTrigger(t);
       i = m.addEvent(e);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       e.createEventAssignment();
       i = m.addEvent(e);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumEvents() == 1 );
       e = null;
       m = null;
 }
Exemplo n.º 3
0
 public void test_Model_addEvent2()
 {
     Model m = new  Model(2,2);
       Event e = new  Event(2,1);
       Trigger t = new  Trigger(2,1);
       e.setTrigger(t);
       e.createEventAssignment();
       int i = m.addEvent(e);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumEvents() == 0 );
       e = null;
       m = null;
 }
Exemplo n.º 4
0
 public void test_L3_Event_hasRequiredElements()
 {
     Event e = new  Event(3,1);
       assertEquals( false, e.hasRequiredElements() );
       Trigger t = new  Trigger(3,1);
       e.setTrigger(t);
       assertEquals( true, e.hasRequiredElements() );
       e = null;
 }
 public void test_internal_consistency_check_99905_trigger()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Trigger trigger = new Trigger(2,4);
       Event e = new Event(2,4);
       Model m = d.createModel();
       d.setLevelAndVersion(2,2,false);
       trigger.setSBOTerm(5);
       e.setTrigger(trigger);
       m.addEvent(e);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
Exemplo n.º 6
0
 public void test_Event()
 {
     Event e = new Event(2,4);
       assertEquals( false, (e.hasRequiredElements()) );
       Trigger t = new Trigger(2,4);
       e.setTrigger(t);
       assertEquals( false, (e.hasRequiredElements()) );
       e.createEventAssignment();
       assertEquals( true, e.hasRequiredElements() );
       e = null;
 }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
0
 public void test_Model_getEventById()
 {
     Event e1 = new  Event(2,4);
       Event e2 = new  Event(2,4);
       Trigger t = new  Trigger(2,4);
       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);
 }
Exemplo n.º 9
0
 public void test_Trigger_parent_add()
 {
     Trigger d = new Trigger(2,4);
       Event e = new Event(2,4);
       e.setTrigger(d);
       d = null;
       assertTrue( e == e.getTrigger().getParentSBMLObject() );
       e = null;
 }
Exemplo n.º 10
0
 public void test_Event_parent_add()
 {
     Event e = new Event(2,4);
       Trigger t = new Trigger(2,4);
       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() );
 }
Exemplo n.º 11
0
 public void test_Trigger_ancestor_add()
 {
     Trigger d = new Trigger(2,4);
       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;
 }
Exemplo n.º 12
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);
       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 );
 }