Inheritance: SBase
Ejemplo n.º 1
0
 public void test_ListOf_clear()
 {
     ListOf lo = new  ListOf();
       SBase sp = new  Species(2,4);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       assertTrue( lo.size() == 5 );
       lo.clear(true);
       assertTrue( lo.size() == 0 );
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.appendAndOwn(sp);
       assertTrue( lo.size() == 5 );
       SBase elem;
       elem = lo.get(0);
       elem = null;
       elem = lo.get(1);
       elem = null;
       elem = lo.get(2);
       elem = null;
       elem = lo.get(3);
       elem = null;
       elem = lo.get(4);
       elem = null;
       lo.clear(false);
       assertTrue( lo.size() == 0 );
       lo = null;
 }
Ejemplo n.º 2
0
 public void test_ListOf_create()
 {
     ListOf lo = new  ListOf();
       assertTrue( lo.getTypeCode() == libsbml.SBML_LIST_OF );
       assertTrue( lo.getNotes() == null );
       assertTrue( lo.getAnnotation() == null );
       assertTrue( lo.getMetaId() == "" );
       assertTrue( lo.size() == 0 );
       lo = null;
 }
Ejemplo n.º 3
0
        internal static HandleRef getCPtrAndDisown(ListOf obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
Ejemplo n.º 4
0
 internal static HandleRef getCPtr(ListOf obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Ejemplo n.º 5
0
 /**
    * Adds a clone of a list of items to this ListOf's list.
    *
    * Note that because this clones the objects handed to it, the original
    * items will not be destroyed when this ListOf object is destroyed.
    *
    * @param list a list of items to be added.
    *
    *
  * @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 libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    *
    * @see append(SBase item)
    * @see appendAndOwn(SBase disownedItem)
    */
 public new int appendFrom(ListOf list)
 {
     int ret = libsbmlPINVOKE.ListOf_appendFrom(swigCPtr, ListOf.getCPtr(list));
     return ret;
 }
Ejemplo n.º 6
0
 /**
    * Copy constructor; creates a copy of this ListOf.
    *
    * @param orig the ListOf instance to copy.
    */
 public ListOf(ListOf orig)
     : this(libsbmlPINVOKE.new_ListOf__SWIG_4(ListOf.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
Ejemplo n.º 7
0
        static void testListOfRemove(ListOf lof, SBase s)
        {
            string ename = s.getElementName();

              lof.append(s);
              SBase c = lof.get(0);

              if ( c is CompartmentType ) { CompartmentType x = (lof as ListOfCompartmentTypes).remove(0); c = x; }
              else if ( c is Compartment ) { Compartment x = (lof as ListOfCompartments).remove(0); c = x; }
              else if ( c is Constraint )  { Constraint x = (lof as ListOfConstraints).remove(0); c = x; }
              else if ( c is EventAssignment ) { EventAssignment x = (lof as ListOfEventAssignments).remove(0); c = x; }
              else if ( c is Event ) { Event x = (lof as ListOfEvents).remove(0); c = x; }
              else if ( c is FunctionDefinition ) { FunctionDefinition x = (lof as ListOfFunctionDefinitions).remove(0); c = x; }
              else if ( c is InitialAssignment ) { InitialAssignment x = (lof as ListOfInitialAssignments).remove(0); c = x; }
              else if ( c is Parameter ) { Parameter x = (lof as ListOfParameters).remove(0); c = x; }
              else if ( c is Reaction ) { Reaction x = (lof as ListOfReactions).remove(0); c = x; }
              else if ( c is Rule ) { Rule x = (lof as ListOfRules).remove(0); c = x; }
              else if ( c is Species ) { Species x = (lof as ListOfSpecies).remove(0); c = x; }
              else if ( c is SpeciesReference ) {SimpleSpeciesReference x = (lof as ListOfSpeciesReferences).remove(0); c = x; }
              else if ( c is SpeciesType ) { SpeciesType x = (lof as ListOfSpeciesTypes).remove(0); c = x; }
              else if ( c is UnitDefinition ) { UnitDefinition x = (lof as ListOfUnitDefinitions).remove(0); c = x; }
              else if ( c is Unit ) { Unit x = (lof as ListOfUnits).remove(0); c = x; }
              else
              {
            ERR("[testListOfRemove] Error: (" + ename + ") : ListOfXXX::remove() failed.");
            return;
              }

              if ( c == null)
              {
            ERR("[testListOfRemove] Error: (" + ename + ") : ListOfXXX::remove() failed.");
            return;
              }

              string enameGet = c.getElementName();

              if ( ename == enameGet )
              {
            //Console.Out.WriteLine("[testListOfRemove] OK: (" + ename + ") remove(" + enameGet + ") : type match.");
            OK();
              }
              else
              {
            ERR("[testListOfRemove] Error: (" + ename + ") remove(" + enameGet + ") : type mismatch.");
              }
        }
Ejemplo n.º 8
0
 public void test_ListOf_copyConstructor()
 {
     ListOf o1 = new ListOf();
       Species s = new Species(2,1);
       s.setId("species_1");
       o1.append(s);
       s = null;
       ListOf o2 = new ListOf(o1);
       assertTrue( o2.size() == 1 );
       assertTrue( ((Species) o2.get(0)).getId() ==  "species_1" );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
Ejemplo n.º 9
0
 internal static HandleRef getCPtr(ListOf obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 10
0
        int appendFrom(ListOf list)
        {
            int ret = libsbmlPINVOKE.ListOf_appendFrom(swigCPtr, ListOf.getCPtr(list));

            return(ret);
        }
Ejemplo n.º 11
0
 public void test_ListOf_get()
 {
     ListOf lo = new  ListOf();
       assertTrue( lo.size() == 0 );
       SBase sp = new  Species(2,4);
       lo.append(sp);
       assertTrue( lo.size() == 1 );
       SBase elem = lo.get(1);
       assertTrue( sp != elem );
       sp = null;
       lo = null;
 }
Ejemplo n.º 12
0
 public void test_ListOf_remove()
 {
     ListOf lo = new  ListOf();
       SBase sp = new  Species(2,4);
       assertTrue( lo.size() == 0 );
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       assertTrue( lo.size() == 5 );
       SBase elem;
       elem = lo.remove(0);
       elem = null;
       elem = lo.remove(0);
       elem = null;
       elem = lo.remove(0);
       elem = null;
       elem = lo.remove(0);
       elem = null;
       elem = lo.remove(0);
       elem = null;
       assertTrue( lo.size() == 0 );
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.appendAndOwn(sp);
       assertTrue( lo.size() == 5 );
       lo = null;
 }