本文整理汇总了C#中libsbml.Model.getEvent方法的典型用法代码示例。如果您正苦于以下问题:C# Model.getEvent方法的具体用法?C# Model.getEvent怎么用?C# Model.getEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbml.Model
的用法示例。
在下文中一共展示了Model.getEvent方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_Event_parent_create
public void test_Event_parent_create()
{
Model m = new Model(2,4);
Event e = m.createEvent();
ListOf lo = m.getListOfEvents();
assertTrue( lo == m.getEvent(0).getParentSBMLObject() );
assertTrue( lo == e.getParentSBMLObject() );
assertTrue( m == lo.getParentSBMLObject() );
}
示例2: getEvent
/// <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;
}
示例3: test_Event_ancestor_create
public void test_Event_ancestor_create()
{
Model m = new Model(2,4);
Event e = m.createEvent();
ListOf lo = m.getListOfEvents();
assertTrue( e.getAncestorOfType(libsbml.SBML_MODEL) == m );
assertTrue( e.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
assertTrue( e.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
assertTrue( e.getAncestorOfType(libsbml.SBML_PARAMETER) == null );
Event obj = m.getEvent(0);
assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null );
}
示例4: test_Event_parent_add
public void test_Event_parent_add()
{
Event e = new Event(2,4);
Trigger t = new Trigger(2,4);
e.setTrigger(t);
e.createEventAssignment();
Model m = new Model(2,4);
m.addEvent(e);
e = null;
ListOf lo = m.getListOfEvents();
assertTrue( lo == m.getEvent(0).getParentSBMLObject() );
assertTrue( m == lo.getParentSBMLObject() );
}
示例5: test_ReadSBML_metaid_Event
public void test_ReadSBML_metaid_Event()
{
SBase sb;
Event e;
string s = wrapSBML_L2v1("<listOfEvents>" +
" <event metaid='e'>" +
" <listOfEventAssignments metaid='loea'>" +
" <eventAssignment metaid='ea'/>" +
" </listOfEventAssignments>" +
" </event>" +
"</listOfEvents>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M != null );
e = M.getEvent(0);
sb = e;
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "e" == sb.getMetaId() ));
sb = e.getListOfEventAssignments();
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "loea" == sb.getMetaId() ));
sb = e.getEventAssignment(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "ea" == sb.getMetaId() ));
}
示例6: test_Event_ancestor_add
public void test_Event_ancestor_add()
{
Event e = new Event(2,4);
Model m = new Model(2,4);
Trigger t = new Trigger(2,4);
e.setTrigger(t);
e.createEventAssignment();
m.addEvent(e);
e = null;
ListOf lo = m.getListOfEvents();
Event obj = m.getEvent(0);
assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
}
示例7: test_ReadSBML_metaid
public void test_ReadSBML_metaid()
{
SBase sb;
string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" +
" <functionDefinition metaid='fd'/>" +
"</listOfFunctionDefinitions>" +
"<listOfUnitDefinitions>" +
" <unitDefinition metaid='ud'/>" +
"</listOfUnitDefinitions>" +
"<listOfCompartments>" +
" <compartment metaid='c'/>" +
"</listOfCompartments>" +
"<listOfSpecies>" +
" <species metaid='s'/>" +
"</listOfSpecies>" +
"<listOfParameters>" +
" <parameter metaid='p'/>" +
"</listOfParameters>" +
"<listOfRules>" +
" <rateRule metaid='rr'/>" +
"</listOfRules>" +
"<listOfReactions>" +
" <reaction metaid='rx'/>" +
"</listOfReactions>" +
"<listOfEvents>" +
" <event metaid='e'/>" +
"</listOfEvents>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M != null );
sb = M.getFunctionDefinition(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "fd" == sb.getMetaId() ));
sb = M.getUnitDefinition(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "ud" == sb.getMetaId() ));
sb = M.getCompartment(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "c" == sb.getMetaId() ));
sb = M.getSpecies(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "s" == sb.getMetaId() ));
sb = M.getParameter(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "p" == sb.getMetaId() ));
sb = M.getRule(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "rr" == sb.getMetaId() ));
sb = M.getReaction(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "rx" == sb.getMetaId() ));
sb = M.getEvent(0);
assertEquals( true, sb.isSetMetaId() );
assertTrue(( "e" == sb.getMetaId() ));
}
示例8: test_ReadSBML_Event_trigger
public void test_ReadSBML_Event_trigger()
{
Event e;
Trigger trigger;
string formula;
string s = wrapSBML_L2v1("<listOfEvents>" +
" <event>" +
" <trigger>" +
" <math>" +
" <apply>" +
" <leq/>" +
" <ci> P1 </ci>" +
" <ci> t </ci>" +
" </apply>" +
" </math>" +
" </trigger>" +
" </event>" +
"</listOfEvents>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumEvents() == 1 );
e = M.getEvent(0);
assertTrue( e != null );
assertEquals( false, e.isSetDelay() );
assertEquals( true, e.isSetTrigger() );
trigger = e.getTrigger();
formula = libsbml.formulaToString(trigger.getMath());
assertTrue( formula != null );
assertTrue(( "leq(P1, t)" == formula ));
}
示例9: test_ReadSBML_Event_delay
public void test_ReadSBML_Event_delay()
{
Event e;
Delay delay;
string formula;
string s = wrapSBML_L2v1("<listOfEvents>" +
" <event> <delay> <math> <cn> 5 </cn> </math> </delay> </event>" +
"</listOfEvents>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumEvents() == 1 );
e = M.getEvent(0);
assertTrue( e != null );
assertEquals( true, e.isSetDelay() );
assertEquals( false, e.isSetTrigger() );
delay = e.getDelay();
formula = libsbml.formulaToString(delay.getMath());
assertTrue( formula != null );
assertTrue(( "5" == formula ));
}
示例10: test_ReadSBML_EventAssignment
public void test_ReadSBML_EventAssignment()
{
Event e;
EventAssignment ea;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfEvents>" +
" <event>" +
" <listOfEventAssignments>" +
" <eventAssignment variable='k2'>" +
" <math> <cn> 0 </cn> </math>" +
" </eventAssignment>" +
" </listOfEventAssignments>" +
" </event>" +
"</listOfEvents>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumEvents() == 1 );
e = M.getEvent(0);
assertTrue( e != null );
assertTrue( e.getNumEventAssignments() == 1 );
ea = e.getEventAssignment(0);
assertTrue( ea != null );
assertEquals( true, ea.isSetVariable() );
assertTrue(( "k2" == ea.getVariable() ));
assertEquals( true, ea.isSetMath() );
math = ea.getMath();
formula = libsbml.formulaToString(math);
assertTrue( formula != null );
assertTrue(( "0" == formula ));
}
示例11: test_ReadSBML_Event
public void test_ReadSBML_Event()
{
Event e;
string s = wrapSBML_L2v2("<listOfEvents>" +
" <event id='e1' name='MyEvent' timeUnits='time'/>" +
"</listOfEvents>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumEvents() == 1 );
e = M.getEvent(0);
assertTrue( e != null );
assertEquals( true, e.isSetId() );
assertEquals( true, e.isSetName() );
assertEquals( true, e.isSetTimeUnits() );
assertEquals( false, e.isSetTrigger() );
assertEquals( false, e.isSetDelay() );
assertTrue(( "e1" == e.getId() ));
assertTrue(( "MyEvent" == e.getName() ));
assertTrue(( "time" == e.getTimeUnits() ));
}