Inheritance: SBase
示例#1
0
 public void setUp()
 {
     D = new  Delay(2,4);
       if (D == 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;
 }
示例#3
0
 public void test_Delay_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
       sbmlns.addNamespaces(xmlns);
       Delay object1 = new  Delay(sbmlns);
       assertTrue( object1.getTypeCode() == libsbml.SBML_DELAY );
       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;
 }
示例#4
0
        internal static HandleRef getCPtrAndDisown(Delay obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
示例#5
0
 internal static HandleRef getCPtr(Delay obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
示例#6
0
 /**
    * Copy constructor; creates a copy of this Delay.
    *
    * @param orig the object to copy.
    *
    * @throws @if python ValueError @else SBMLConstructorException @endif
    * Thrown if the argument @p orig is @c null.
    */
 public Delay(Delay orig)
     : this(libsbmlPINVOKE.new_Delay__SWIG_2(Delay.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 public void test_Delay_parent_add()
 {
     Delay d = new Delay(2,4);
       d.setMath(libsbml.parseFormula("1"));
       Event e = new Event(2,4);
       e.setDelay(d);
       d = null;
       assertTrue( e == e.getDelay().getParentSBMLObject() );
       e = null;
 }
 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() );
 }
 public void test_Delay_ancestor_add()
 {
     Delay d = new Delay(2,4);
       Event e = new Event(2,4);
       e.setDelay(d);
       d = null;
       Delay obj = e.getDelay();
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == e );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       e = null;
 }
 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_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_internal_consistency_check_99905_delay()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Delay delay = new Delay(2,4);
       Event e = new Event(2,4);
       Model m = d.createModel();
       d.setLevelAndVersion(2,2,false);
       delay.setSBOTerm(5);
       e.setDelay(delay);
       m.addEvent(e);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
示例#13
0
文件: Delay.cs 项目: Tubbz-alt/carbon
 internal static HandleRef getCPtr(Delay obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
 public void test_Delay()
 {
     Delay d = new Delay(2,4);
       assertEquals( true, d.hasRequiredAttributes() );
       d = null;
 }
示例#15
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);
       {
       }
 }
示例#16
0
 public void tearDown()
 {
     D = null;
 }
 public void test_Delay_parent_add()
 {
     Delay d = new Delay(2,4);
       Event e = new Event(2,4);
       e.setDelay(d);
       d = null;
       assertTrue( e == e.getDelay().getParentSBMLObject() );
       e = 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;
 }
 public void test_Event_setDelay2()
 {
     Delay Delay = new  Delay(2,1);
       int i = E.setDelay(Delay);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertEquals( false, E.isSetDelay() );
       i = E.unsetDelay();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
 }
示例#20
0
 /**
    * Sets the delay definition of this Event to a copy of the given Delay
    * object instance.
    *
    * @param delay the Delay 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 setDelay(Delay delay)
 {
     int ret = libsbmlPINVOKE.Event_setDelay(swigCPtr, Delay.getCPtr(delay));
     return ret;
 }
        public void test_Delay_constructor()
        {
            SBase s;

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

              string msg = "";

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

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

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

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

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

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