getElementName() public method

public getElementName ( ) : string
return string
Ejemplo n.º 1
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.º 2
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.");
              }
        }
Ejemplo n.º 3
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();
    }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
    }