예제 #1
0
        /// <summary>
        /// [ EventStruct ]
        ///  [[ Id , Name , StringTrigger , StringDelay , TimeUnit , [[ VariableAssignment , StringAssignment ]] ]] 
        /// </summary>
        /// <param name="aSBMLmodel"></param>
        /// <returns></returns>
        public static List<EventStruct> getEvent(Model aSBMLmodel)
        {
            List<EventStruct> list = new List<EventStruct>();
            ListOfEvents events = aSBMLmodel.getListOfEvents();
            for (int i = 0; i < events.size(); i++ )
            {
                Event anEvent = aSBMLmodel.getEvent(i);
                string anId_Ev = anEvent.getId();
                string aName_Ev = anEvent.getName();
                Trigger anASTNode_Ev_Tr = anEvent.getTrigger();
                string aString_Ev_Tr = libsbml.libsbml.formulaToString(anASTNode_Ev_Tr.getMath());
                Delay anASTNode_Ev_De = anEvent.getDelay();
                string aString_Ev_De = libsbml.libsbml.formulaToString(anASTNode_Ev_Tr.getMath());

                string aTimeUnit_Ev = anEvent.getTimeUnits();

                List<EventAssignmentStruct> listOfEventAssignments = new List<EventAssignmentStruct>();

                ListOfEventAssignments assignments = anEvent.getListOfEventAssignments();
                for (int j = 0; j < assignments.size(); j++ )
                {
                    EventAssignment anEventAssignment = anEvent.getEventAssignment(j);

                    string aVariable_Ev_As = anEventAssignment.getVariable();
                    ASTNode anASTNode_Ev_As = anEventAssignment.getMath();
                    string aString_Ev_As = libsbml.libsbml.formulaToString(anASTNode_Ev_As);

                    EventAssignmentStruct listOfEventAssignment = new EventAssignmentStruct(
                        aVariable_Ev_As,
                        aString_Ev_As);

                    listOfEventAssignments.Add(listOfEventAssignment);
                }
                EventStruct eventStruct = new EventStruct(
                    anId_Ev,
                    aName_Ev,
                    aString_Ev_Tr,
                    aString_Ev_De,
                    aTimeUnit_Ev,
                    listOfEventAssignments);

                list.Add(eventStruct);
            }
            return list;
        }
예제 #2
0
 public void TestConstructorOfStructs()
 {
     //
     CompartmentStruct c = new CompartmentStruct(
         "ID",
         "Name",
         0,
         0.0,
         0.0,
         "Unit",
         "Parent",
         false);
     //
     EventStruct e = new EventStruct(
         "ID",
         "Name",
         "Trigger",
         "delay",
         "TimeUnit",
         new List<EventAssignmentStruct>());
     //
     EventAssignmentStruct ea = new EventAssignmentStruct(
         "Variable",
         "Formula");
     //
     FunctionDefinitionStruct fd = new FunctionDefinitionStruct(
         "ID",
         "Name",
         "Formula");
     //
     ParameterStruct p = new ParameterStruct(
         "ID",
         "Name",
         0.0,
         "Unit",
         false);
     //
     ReactionStruct r = new ReactionStruct(
         "ID",
         "Name",
         new List<KineticLawStruct>(),
         false,
         false,
         new List<ReactantStruct>(),
         new List<ProductStruct>(),
         new List<string>());
     //
     KineticLawStruct k = new KineticLawStruct(
         "Formula",
         new List<string>(),
         "TimeUnit",
         "Substance",
         new List<ParameterStruct>(),
         null);
     //
     ReactantStruct rs = new ReactantStruct(
         "Species",
         0,
         "Formula",
         0);
     //
     ProductStruct ps = new ProductStruct(
         "Species",
         0.0,
         "Formula",
         0);
     //
     RuleStruct rule = new RuleStruct(
         0,
         "Formula",
         "Variable");
     //
     SpeciesStruct s = new SpeciesStruct(
         "ID",
         "Name",
         "Parent",
         0.0,
         0.0,
         "Substance",
         "Spatial",
         "Unit",
         false,
         false,
         0,
         false);
     //
     UnitDefinitionStruct ud = new UnitDefinitionStruct(
         "ID",
         "Name",
         new List<UnitStruct>());
     //
     UnitStruct u = new UnitStruct(
         "Kind",
         0,
         0,
         0.0,
         0.0);
     //
     VariableReferenceStruct v = new VariableReferenceStruct(
         "Name",
         "Variable",
         0);
     //
     InitialAssignmentStruct i = new InitialAssignmentStruct(
         "Name",
         0.0);
 }