Inheritance: IDisposable
 public void setUp()
 {
     S = new Model(2,4);
       if (S == null);
       {
       }
 }
    private static void printAnnotation(SBase sb)
    {
        string id = "";

        if (sb.isSetId())
        {
            id = sb.getId();
        }
        printAnnotation(sb, id);
    }
示例#3
0
 /** */
 /* libsbml-internal */
 public int checkCompatibility(SBase arg0)
 {
     int ret = libsbmlPINVOKE.SBase_checkCompatibility(swigCPtr, SBase.getCPtr(arg0));
     return ret;
 }
示例#4
0
 internal static HandleRef getCPtr(SBase obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
示例#5
0
 /**
    * Returns @c true if this object's set of XML namespaces are a subset
    * of the given object's XML namespaces.
    *
    * *
  *
  * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces
  * information.  It is used to communicate the SBML Level, Version, and (in
  * Level 3) packages used in addition to SBML Level 3 Core.  A
  * common approach to using libSBML's SBMLNamespaces facilities is to create an
  * SBMLNamespaces object somewhere in a program once, then hand that object
  * as needed to object constructors that accept SBMLNamespaces as arguments.
  *
  *
    *
    * @param sb an object to compare with respect to namespaces
    *
    * @return bool, @c true if this object's collection of namespaces is
    * a subset of @p sb's, @c false otherwise.
    */
 public bool matchesRequiredSBMLNamespacesForAddition(SBase sb)
 {
     bool ret = libsbmlPINVOKE.SBase_matchesRequiredSBMLNamespacesForAddition__SWIG_0(swigCPtr, SBase.getCPtr(sb));
     return ret;
 }
示例#6
0
        static void testClone(SBase s)
        {
            string ename = s.getElementName();
              SBase c = s.clone();

              if ( c is Compartment ) { Compartment x = (s as Compartment).clone(); c = x; }
              else if ( c is CompartmentType ) { CompartmentType x = (s as CompartmentType).clone(); c = x; }
              else if ( c is Constraint ) { Constraint x = (s as Constraint).clone(); c = x; }
              else if ( c is Delay ) { Delay x = (s as Delay).clone(); c = x; }
              else if ( c is Event ) { Event x = (s as Event).clone(); c = x; }
              else if ( c is EventAssignment ) { EventAssignment x = (s as EventAssignment).clone(); c = x; }
              else if ( c is FunctionDefinition ) { FunctionDefinition x = (s as FunctionDefinition).clone(); c = x; }
              else if ( c is InitialAssignment ) { InitialAssignment x = (s as InitialAssignment).clone(); c = x; }
              else if ( c is KineticLaw ) { KineticLaw x = (s as KineticLaw).clone(); c = x; }
              // currently return type of ListOf::clone() is SBase
              else if ( c is ListOf ) { SBase x = (s as ListOf).clone(); c = x; }
              else if ( c is Model ) { Model x = (s as Model).clone(); c = x; }
              else if ( c is Parameter ) { Parameter x = (s as Parameter).clone(); c = x; }
              else if ( c is Reaction ) { Reaction x = (s as Reaction).clone(); c = x; }
              else if ( c is AlgebraicRule ) { AlgebraicRule x = (s as AlgebraicRule).clone(); c = x; }
              else if ( c is AssignmentRule ) { AssignmentRule x = (s as AssignmentRule).clone(); c = x; }
              else if ( c is RateRule ) { RateRule x = (s as RateRule).clone(); c = x; }
              else if ( c is SBMLDocument ) { SBMLDocument x = (s as SBMLDocument).clone(); c = x; }
              else if ( c is Species ) { Species x = (s as Species).clone(); c = x; }
              else if ( c is SpeciesReference ) { SpeciesReference x = (s as SpeciesReference).clone(); c = x; }
              else if ( c is SpeciesType ) { SpeciesType x = (s as SpeciesType).clone(); c = x; }
              else if ( c is SpeciesReference ) { SpeciesReference x = (s as SpeciesReference).clone(); c = x; }
              else if ( c is StoichiometryMath ) { StoichiometryMath x = (s as StoichiometryMath).clone(); c = x; }
              else if ( c is Trigger ) { Trigger x = (s as Trigger).clone(); c = x; }
              else if ( c is Unit ) { Unit x = (s as Unit).clone(); c = x; }
              else if ( c is UnitDefinition ) { UnitDefinition x = (s as UnitDefinition).clone(); c = x; }
              else if ( c is ListOfCompartmentTypes ) { ListOfCompartmentTypes x = (s as ListOfCompartmentTypes).clone(); c = x; }
              else if ( c is ListOfCompartments ) { ListOfCompartments x = (s as ListOfCompartments).clone(); c = x; }
              else if ( c is ListOfConstraints ) { ListOfConstraints x = (s as ListOfConstraints).clone(); c = x; }
              else if ( c is ListOfEventAssignments ) { ListOfEventAssignments x = (s as ListOfEventAssignments).clone(); c = x; }
              else if ( c is ListOfEvents ) { ListOfEvents x = (s as ListOfEvents).clone(); c = x; }
              else if ( c is ListOfFunctionDefinitions ) { ListOfFunctionDefinitions x = (s as ListOfFunctionDefinitions).clone(); c = x; }
              else if ( c is ListOfInitialAssignments ) { ListOfInitialAssignments x = (s as ListOfInitialAssignments).clone(); c = x; }
              else if ( c is ListOfParameters ) { ListOfParameters x = (s as ListOfParameters).clone(); c = x; }
              else if ( c is ListOfReactions ) { ListOfReactions x = (s as ListOfReactions).clone(); c = x; }
              else if ( c is ListOfRules ) { ListOfRules x = (s as ListOfRules).clone(); c = x; }
              else if ( c is ListOfSpecies ) { ListOfSpecies x = (s as ListOfSpecies).clone(); c = x; }
              else if ( c is ListOfSpeciesReferences ) { ListOfSpeciesReferences x = (s as ListOfSpeciesReferences).clone(); c = x; }
              else if ( c is ListOfSpeciesTypes ) { ListOfSpeciesTypes x = (s as ListOfSpeciesTypes).clone(); c = x; }
              else if ( c is ListOfUnitDefinitions ) { ListOfUnitDefinitions x = (s as ListOfUnitDefinitions).clone(); c = x; }
              else if ( c is ListOfUnits ) { ListOfUnits x = (s as ListOfUnits).clone(); c = x; }
              else
              {
            ERR("[testClone] Error: (" + ename + ") : clone() failed.");
            return;
              }

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

              string enameClone = c.getElementName();

              if ( ename == enameClone )
              {
            //Console.Out.WriteLine("[testClone] OK: (" + ename + ") clone(" + enameClone + ") : type match.");
            OK();
              }
              else
              {
            ERR("[testClone] Error: (" + ename + ") clone(" + enameClone + ") : type mismatch.");
              }
        }
示例#7
0
 /** */
 /* libsbml-internal */
 public new void connectToParent(SBase sbase)
 {
     libsbmlPINVOKE.SBasePlugin_connectToParent(swigCPtr, SBase.getCPtr(sbase));
 }
示例#8
0
 /**
    * Inserts an item at a given position in this ListOf's list of items.
    *
    * This variant of the method makes a clone of the @p item handed to it.
    * This means that when the ListOf is destroyed, the original @p item will
    * <em>not</em> be destroyed.
    *
    * @param location the location in the list where to insert the item.
    * @param item the item to be inserted to the list.
    *
    *
  * @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 insertAndOwn(int location, SBase item)
    */
 public int insert(int location, SBase item)
 {
     int ret = libsbmlPINVOKE.ListOf_insert(swigCPtr, location, SBase.getCPtr(item));
     return ret;
 }
示例#9
0
 public virtual bool filter(SBase element)
 {
     bool ret = (SwigDerivedClassHasMethod("filter", swigMethodTypes0) ? libsbmlPINVOKE.ElementFilter_filterSwigExplicitElementFilter(swigCPtr, SBase.getCPtr(element)) : libsbmlPINVOKE.ElementFilter_filter(swigCPtr, SBase.getCPtr(element)));
     return ret;
 }
示例#10
0
    private static void printNotes(SBase sb, string id)
    {
        if (!sb.isSetNotes()) return;

        Console.WriteLine("----- " + sb.getElementName() + " (" + id
        + ") notes -----");
        Console.WriteLine(sb.getNotesString());
        Console.WriteLine();
    }
示例#11
0
    private static void printNotes(SBase sb)
    {
        string id = "";

        if (sb.isSetId())
        {
            id = sb.getId();
        }
        printNotes(sb, id);
    }
示例#12
0
 /** */
 public new bool isValidTypeForList(SBase item)
 {
     bool ret = libsbmlPINVOKE.SBasePlugin_isValidTypeForList(swigCPtr, SBase.getCPtrAndDisown(item));
     return ret;
 }
示例#13
0
 void setOrAppendNotes(SBase sbase, string note)
 {
     if (sbase.isSetNotes ()) {
         sbase.appendNotes (note);
     } else {
         sbase.setNotes (note);
     }
 }
示例#14
0
    private static void printAnnotation(SBase sb, string id)
    {
        if (!sb.isSetAnnotation()) return;

        Console.Write("----- " + sb.getElementName() + " (" + id
                          + ") annotation -----" + Environment.NewLine);
        Console.Write(sb.getAnnotationString() + Environment.NewLine);
        Console.Write(Environment.NewLine);
    }
示例#15
0
 /**
    * Adds an item to the end of this ListOf's list of items.
    *
    * This method makes a clone of the @p item handed to it.  This means that
    * when the ListOf object is destroyed, the original items will not be
    * destroyed.  For a method with an alternative ownership behavior, see the
    * ListOf::appendAndOwn(@if java SBase@endif) method.
    *
    * @param item the item to be added to the list.
    *
    *
  * @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 appendAndOwn(SBase disownedItem)
    * @see appendFrom(ListOf list)
    */
 public int append(SBase item)
 {
     int ret = libsbmlPINVOKE.ListOf_append(swigCPtr, SBase.getCPtr(item));
     return ret;
 }
示例#16
0
 /**
    * Adds an item to the end of this ListOf's list of items.
    *
    * This method does not clone the @p disownedItem handed to it; instead, it assumes
    * ownership of it.  This means that when the ListOf is destroyed, the item
    * will be destroyed along with it.  For a method with an alternative
    * ownership behavior, see the ListOf::append(SBase item) method.
    *
    * @param disownedItem the item to be added to the list.
    *
    *
  * @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 appendFrom(ListOf list)
    */
 public int appendAndOwn(SBase disownedItem)
 {
     int ret = libsbmlPINVOKE.ListOf_appendAndOwn(swigCPtr, SBase.getCPtrAndDisown(disownedItem));
     return ret;
 }
 /**
    * Takes a list of CVTerm objects and creates a complete SBML annotation
    * around it.
    *
    * This essentially takes the given SBML object, reads out the CVTerm
    * objects attached to it, calls @if clike createRDFAnnotation()@else
    * RDFAnnotationParser::createRDFAnnotation()@endif to create an RDF
    * annotation to hold the terms, and finally calls @if clike
    * createAnnotation()@else
    * RDFAnnotationParser::createAnnotation()@endif to wrap the result as
    * an SBML <code>&lt;annotation&gt;</code> element.
    *
    * @param obj the SBML object to start from
    *
    * @return the XMLNode tree corresponding to the annotation.
    *
    * @if notclike @note Because this is a @em static method, the non-C++
    * language interfaces for libSBML will contain two variants.  One will
    * be a static method on the class (i.e., RDFAnnotationParser), and the
    * other will be a standalone top-level function with the name
    * RDFAnnotationParser_parseCVTerms(). They are functionally
    * identical. @endif
    */
 public static XMLNode parseCVTerms(SBase obj)
 {
     IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseCVTerms(SBase.getCPtr(obj));
     XMLNode ret = (cPtr == IntPtr.Zero) ? null : new XMLNode(cPtr, true);
     return ret;
 }
示例#18
0
 /**
    * Inserts an item at a given position in this ListOf's list of items.
    *
    * This variant of the method does not make a clone of the @p disownedItem handed to it.
    * This means that when the ListOf is destroyed, the original @p item
    * <em>will</em> be destroyed.
    *
    * @param location the location where to insert the item
    * @param disownedItem the item to be inserted to the list
    *
    *
  * @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 insert(int location, SBase item)
    */
 public int insertAndOwn(int location, SBase disownedItem)
 {
     int ret = libsbmlPINVOKE.ListOf_insertAndOwn(swigCPtr, location, SBase.getCPtrAndDisown(disownedItem));
     return ret;
 }
 /**
    * Reads the model history stored in @p obj and creates the
    * XML structure for an SBML annotation representing that history.
    *
    * @param obj any SBase object
    *
    * @return the XMLNode corresponding to an annotation containing
    * MIRIAM-compliant model history information in RDF format.
    *
    * @if notclike @note Because this is a @em static method, the non-C++
    * language interfaces for libSBML will contain two variants.  One will
    * be a static method on the class (i.e., RDFAnnotationParser), and the
    * other will be a standalone top-level function with the name
    * RDFAnnotationParser_parseOnlyModelHistory(). They are functionally
    * identical. @endif
    */
 public static XMLNode parseOnlyModelHistory(SBase obj)
 {
     IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_parseOnlyModelHistory(SBase.getCPtr(obj));
     XMLNode ret = (cPtr == IntPtr.Zero) ? null : new XMLNode(cPtr, false);
     return ret;
 }
    /// <summary>
    /// The function performing the filtering, here we just check 
    /// that we have a valid element, and that it has notes.
    /// </summary>
    /// <param name="element">the current element</param>
    /// <returns><b>true</b> if element is to be included, <b>false</b> otherwise</returns>
    public override bool filter(SBase element)
    {
        // return in case we don't have a valid element
        if (element == null || !element.isSetNotes())
            return false;

        // otherwise we have notes set and want to keep the element
        if (!element.isSetId())
            Console.WriteLine("                     found : {0}", element.getId());
        else
            Console.WriteLine("                     found element without id");

        return true;
    }
示例#21
0
 public void prepend(SBase item)
 {
     libsbmlPINVOKE.SBaseList_prepend(swigCPtr, SBase.getCPtr(item));
 }
示例#22
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.");
              }
        }
 public virtual int transform(SBase element)
 {
     int ret = (SwigDerivedClassHasMethod("transform", swigMethodTypes0) ? libsbmlPINVOKE.IdentifierTransformer_transformSwigExplicitIdentifierTransformer(swigCPtr, SBase.getCPtr(element)) : libsbmlPINVOKE.IdentifierTransformer_transform(swigCPtr, SBase.getCPtr(element)));
     return ret;
 }
示例#24
0
 /**
    * Returns @c true if this object's set of XML namespaces are the same
    * as the given object's XML namespaces.
    *
    * *
  *
  * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces
  * information.  It is used to communicate the SBML Level, Version, and (in
  * Level&nbsp;3) packages used in addition to SBML Level&nbsp;3 Core.  A
  * common approach to using libSBML's SBMLNamespaces facilities is to create an
  * SBMLNamespaces object somewhere in a program once, then hand that object
  * as needed to object constructors that accept SBMLNamespaces as arguments.
  *
  *
    *
    * @param sb an object to compare with respect to namespaces
    *
    * @return bool, @c true if this object's collection of namespaces is
    * the same as @p sb's, @c false otherwise.
    */
 public bool matchesSBMLNamespaces(SBase sb)
 {
     bool ret = libsbmlPINVOKE.SBase_matchesSBMLNamespaces__SWIG_0(swigCPtr, SBase.getCPtr(sb));
     return ret;
 }
示例#25
0
        public static SBase DowncastSBase(IntPtr cPtr, bool owner)
        {
            if (cPtr.Equals(IntPtr.Zero)) return null;

            SBase sb = new SBase(cPtr, false);
            string pkgName = sb.getPackageName();
            if (pkgName == "core")
            {
            switch( sb.getTypeCode() )
            {
                case (int) libsbml.SBML_COMPARTMENT:
                    return new Compartment(cPtr, owner);

                case (int) libsbml.SBML_COMPARTMENT_TYPE:
                    return new CompartmentType(cPtr, owner);

                case (int) libsbml.SBML_CONSTRAINT:
                    return new Constraint(cPtr, owner);

                case (int) libsbml.SBML_DOCUMENT:
                    return new SBMLDocument(cPtr, owner);

                case (int) libsbml.SBML_DELAY:
                    return new Delay(cPtr, owner);

                case (int) libsbml.SBML_EVENT:
                    return new Event(cPtr, owner);

                case (int) libsbml.SBML_EVENT_ASSIGNMENT:
                    return new EventAssignment(cPtr, owner);

                case (int) libsbml.SBML_FUNCTION_DEFINITION:
                    return new FunctionDefinition(cPtr, owner);

                case (int) libsbml.SBML_INITIAL_ASSIGNMENT:
                    return new InitialAssignment(cPtr, owner);

                case (int) libsbml.SBML_KINETIC_LAW:
                    return new KineticLaw(cPtr, owner);

                case (int) libsbml.SBML_LIST_OF:
                     string name = sb.getElementName();
                     if(name == "listOf")
                         {
                    return new ListOf(cPtr, owner);
                     }
                     else if(name == "listOfCompartments")
                     {
                    return new ListOfCompartments(cPtr, owner);
                     }
                     else if(name == "listOfCompartmentTypes")
                     {
                    return new ListOfCompartmentTypes(cPtr, owner);
                     }
                     else if(name == "listOfConstraints")
                     {
                    return new ListOfConstraints(cPtr, owner);
                     }
                     else if(name == "listOfEvents")
                     {
                         return new ListOfEvents(cPtr, owner);
                                 }
                                 else if(name == "listOfEventAssignments")
                                 {
                    return new ListOfEventAssignments(cPtr, owner);
                         }
                         else if(name == "listOfFunctionDefinitions")
                         {
             		               return new ListOfFunctionDefinitions(cPtr, owner);
                         }
                         else if(name == "listOfInitialAssignments")
                         {
                           return new ListOfInitialAssignments(cPtr, owner);
                         }
                         else if(name == "listOfParameters")
                         {
                           return new ListOfParameters(cPtr, owner);
                         }
                         else if(name == "listOfLocalParameters")
                         {
                           return new ListOfLocalParameters(cPtr, owner);
                         }
                     else if(name == "listOfReactions")
                         {
                           return new ListOfReactions(cPtr, owner);
                         }
                         else if(name == "listOfRules")
                         {
                           return new ListOfRules(cPtr, owner);
                                 }
                         else if(name == "listOfSpecies")
                         {
                           return new ListOfSpecies(cPtr, owner);
                                 }
                         else if(name == "listOfUnknowns")
                         {
                           return new ListOfSpeciesReferences(cPtr, owner);
                                 }
                         else if(name == "listOfReactants")
                         {
                           return new ListOfSpeciesReferences(cPtr, owner);
                                 }
                         else if(name == "listOfProducts")
                         {
                           return new ListOfSpeciesReferences(cPtr, owner);
                                 }
                         else if(name == "listOfModifiers")
                         {
                           return new ListOfSpeciesReferences(cPtr, owner);
                                 }
                         else if(name == "listOfSpeciesTypes")
                         {
                           return new ListOfSpeciesTypes(cPtr, owner);
                                 }
                         else if(name == "listOfUnits")
                         {
                           return new ListOfUnits(cPtr, owner);
                                 }
                         else if(name == "listOfUnitDefinitions")
                         {
                           return new ListOfUnitDefinitions(cPtr, owner);
                                 }
                         return new ListOf(cPtr, owner);

                case (int) libsbml.SBML_MODEL:
                    return new Model(cPtr, owner);

                case (int) libsbml.SBML_PARAMETER:
                    return new Parameter(cPtr, owner);

            case (int) libsbml.SBML_PRIORITY:
                return new Priority(cPtr, owner);

                case (int) libsbml.SBML_LOCAL_PARAMETER:
                    return new LocalParameter(cPtr, owner);

                case (int) libsbml.SBML_REACTION:
                    return new Reaction(cPtr, owner);

                case (int) libsbml.SBML_SPECIES:
                    return new Species(cPtr, owner);

                case (int) libsbml.SBML_SPECIES_REFERENCE:
                    return new SpeciesReference(cPtr, owner);

                case (int) libsbml.SBML_MODIFIER_SPECIES_REFERENCE:
                    return new ModifierSpeciesReference(cPtr, owner);

                case (int) libsbml.SBML_SPECIES_TYPE:
                    return new SpeciesType(cPtr, owner);

                case (int) libsbml.SBML_TRIGGER:
                    return new Trigger(cPtr, owner);

                case (int) libsbml.SBML_UNIT_DEFINITION:
                    return new UnitDefinition(cPtr, owner);

                case (int) libsbml.SBML_UNIT:
                    return new Unit(cPtr, owner);

                case (int) libsbml.SBML_ALGEBRAIC_RULE:
                    return new AlgebraicRule(cPtr, owner);

                case (int) libsbml.SBML_ASSIGNMENT_RULE:
                    return new AssignmentRule(cPtr, owner);

                case (int) libsbml.SBML_RATE_RULE:
                    return new RateRule(cPtr, owner);

                case (int) libsbml.SBML_STOICHIOMETRY_MATH:
                    return new StoichiometryMath(cPtr, owner);

                default:
                    return new SBase(cPtr, owner);
            }
            }
            else
            {
            SBMLExtension sbmlext = SBMLExtensionRegistry.getInstance().getExtension(pkgName);
            if (sbmlext != null)
            {
                return sbmlext.DowncastSBase(cPtr,owner);
            }
            }
            return new SBase(cPtr, owner);
        }
示例#26
0
        internal static HandleRef getCPtrAndDisown(SBase obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
    /// <summary>
    /// The function actually doing the transforming. This function is called 
    /// once for each SBase element in the model. 
    /// </summary>
    /// <param name="element">the current element</param>
    /// <returns>status code</returns>
    public override int transform(SBase element)
    {
        // return in case we don't have a valid element
        if (element == null || element.getTypeCode() == libsbml.SBML_LOCAL_PARAMETER)
            return libsbml.LIBSBML_OPERATION_SUCCESS;

        // or if there is nothing to do
        if (!element.isSetName() || element.getId() == element.getName())
            return libsbml.LIBSBML_OPERATION_SUCCESS;

        // find the new id
        string newId = getValidIdForName(element.getName());

        // set it
        element.setId(newId);

        // remember it
        existingIds.Add(newId);

        return libsbml.LIBSBML_OPERATION_SUCCESS;
    }
示例#28
0
 /**
    * Sets the parent SBML object of this SBML object.
    * (Creates a child-parent relationship by the child)
    * This function is called when a child element is
    * set/added/created by its parent element (e.g. by setXXX,
    * addXXX, createXXX, and connectToChild functions of the
    * parent element).
    *
    * @param parent the SBML object to use
    */
 /* libsbml-internal */
 public void connectToParent(SBase parent)
 {
     libsbmlPINVOKE.SBase_connectToParent(swigCPtr, SBase.getCPtr(parent));
 }
 /**
    * Takes an SBML object and creates an empty XMLNode corresponding to an
    * RDF 'Description' element.
    *
    * This method is a handy way of creating RDF description objects linked
    * by the appropriate 'metaid' field to the given @p object, for
    * insertion into RDF annotations in a model.  The method retrieves the
    * 'metaid' attribute from the @p object passed in as argument, then
    * creates an empty element having the following form
    * (where <span class='code' style='background-color: #eed0d0'>metaid</span>
    * the value of the 'metaid' attribute of the argument):
    *
 <div class='fragment'>
 &lt;rdf:Description rdf:about=&quot;#<span style='background-color: #eed0d0'>metaid</span>&quot; xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'&gt;<br>
 ...<br>
 &lt;/rdf:Description&gt;<br>
 </div>
    * Note that this method does @em not create a complete annotation or
    * even an RDF element; it only creates the 'Description' portion.  Callers
    * will need to use other methods such as
    * @if clike createRDFAnnotation()@else RDFAnnotationParser::createRDFAnnotation()@endif
    * to create the rest of the structure for an annotation.
    *
    * @param obj the object to which the 'Description' refers
    *
    * @return a new XMLNode containing the 'rdf:Description' element with
    * its 'about' attribute value set to the @p object meta identifier.
    *
    * @see createRDFAnnotation()
    */
 public static XMLNode createRDFDescription(SBase obj)
 {
     IntPtr cPtr = libsbmlPINVOKE.RDFAnnotationParser_createRDFDescription(SBase.getCPtr(obj));
     XMLNode ret = (cPtr == IntPtr.Zero) ? null : new XMLNode(cPtr, true);
     return ret;
 }