Beispiel #1
0
 public void setUp()
 {
     D = new  Trigger(2,4);
       if (D == null);
       {
       }
 }
 public void setUp()
 {
     T = new  Trigger(3,1);
       if (T == null);
       {
       }
 }
Beispiel #3
0
 public void test_Trigger_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
       sbmlns.addNamespaces(xmlns);
       Trigger object1 = new  Trigger(sbmlns);
       assertTrue( object1.getTypeCode() == libsbml.SBML_TRIGGER );
       assertTrue( object1.getMetaId() == "" );
       assertTrue( object1.getNotes() == null );
       assertTrue( object1.getAnnotation() == null );
       assertTrue( object1.getLevel() == 2 );
       assertTrue( object1.getVersion() == 1 );
       assertTrue( object1.getNamespaces() != null );
       assertTrue( object1.getNamespaces().getLength() == 2 );
       object1 = null;
 }
Beispiel #4
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()
 {
     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;
 }
 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() );
 }
Beispiel #7
0
 /**
    * Sets the trigger definition of this Event to a copy of the given
    * Trigger object instance.
    *
    * @param trigger the Trigger object instance to use.
    *
    * @return integer value indicating success/failure of the
    * function.  @if clike The value is drawn from the
    * enumeration #OperationReturnValues_t. @endif The possible values
    * returned by this function are:
    * @li @link libsbmlcs#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbmlcs#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink
    * @li @link libsbmlcs#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink
    */
 public int setTrigger(Trigger trigger)
 {
     int ret = libsbmlPINVOKE.Event_setTrigger(swigCPtr, Trigger.getCPtr(trigger));
     return ret;
 }
 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;
 }
 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;
 }
Beispiel #10
0
        internal static HandleRef getCPtrAndDisown(Trigger obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
 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;
 }
Beispiel #12
0
 public void tearDown()
 {
     D = null;
 }
 public void test_Trigger()
 {
     Trigger t = new Trigger(2,4);
       assertEquals( true, t.hasRequiredAttributes() );
       t = null;
 }
 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;
 }
Beispiel #15
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);
       {
       }
 }
Beispiel #16
0
 /**
    * Copy constructor; creates a copy of this Trigger.
    *
    * @param orig the object to copy.
    *
    * @throws SBMLConstructorException
    * Thrown if the argument @p orig is @c null.
    */
 public Trigger(Trigger orig)
     : this(libsbmlPINVOKE.new_Trigger__SWIG_2(Trigger.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
Beispiel #17
0
 internal static HandleRef getCPtr(Trigger obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 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_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 );
 }
Beispiel #20
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_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() );
 }
 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_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;
 }
 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()) );
 }
 public void test_Event_setTrigger1()
 {
     Trigger trigger = new  Trigger(2,1);
       int i = E.setTrigger(trigger);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertEquals( false, E.isSetTrigger() );
 }
 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()) );
 }
 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;
 }
Beispiel #28
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;
 }
        public void test_Trigger_constructor()
        {
            SBase s;

              try
              {
            s = new Trigger(2,1);
            s = new Trigger(2,2);
            s = new Trigger(2,3);
            s = new Trigger(2,4);
            s = new Trigger(3,1);
            s = new Trigger(SN21);
            s = new Trigger(SN22);
            s = new Trigger(SN23);
            s = new Trigger(SN24);
            s = new Trigger(SN31);
              }
              catch (SBMLConstructorException e)
              {
             s = null;
              }
              assertTrue(s != null);

              string msg = "";

              try
              {
            s = new Trigger(1,1);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";
              try
              {
            s = new Trigger(1,2);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";
              try
              {
            s = new Trigger(9,9);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";
              try
              {
            s = new Trigger(SN11);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";
              try
              {
            s = new Trigger(SN12);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";
              try
              {
            s = new Trigger(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
Beispiel #30
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;
 }