本文整理汇总了C#中Port.setSBaseRef方法的典型用法代码示例。如果您正苦于以下问题:C# Port.setSBaseRef方法的具体用法?C# Port.setSBaseRef怎么用?C# Port.setSBaseRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Port
的用法示例。
在下文中一共展示了Port.setSBaseRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
Parameter m1param2 = moddef1.createParameter();
m1param2.setId("param2");
m1param2.setConstant(false);
m1param2.setValue(3.2);
ModelDefinition moddef2 = new ModelDefinition();
moddef2.setId("Mod2");
Parameter subparam2 = moddef2.createParameter();
subparam2.setId("subparam2");
subparam2.setConstant(false);
compdoc.addModelDefinition(moddef2);
ExternalModelDefinition extmod1 = compdoc.createExternalModelDefinition();
extmod1.setId("ExtMod1");
extmod1.setSource("urn:miriam:biomodels.db:BIOMD0000000127");
ExternalModelDefinition extmod2 = new ExternalModelDefinition();
extmod2.setId("ExtMod2");
extmod2.setSource("otherfile.xml");
extmod2.setModelRef("modelnamethere");
extmod2.setMd5("406022s908ge74sklj");
compdoc.addExternalModelDefinition(extmod2);
Submodel submod1 = mplugin.createSubmodel();
submod1.setId("submod1");
submod1.setModelRef("Mod1");
Deletion del1 = submod1.createDeletion();
del1.setId("deletionA");
del1.setIdRef("param2");
Submodel submod2 = new Submodel();
submod2.setId("submod2");
submod2.setModelRef("ExtMod1");
submod2.setSubstanceConversionFactor("subcf");
submod2.setTimeConversionFactor("tcf");
submod2.setExtentConversionFactor("xtf");
Deletion del2 = new Deletion();
del2.setId("deletionB");
del2.setMetaIdRef("_0010110");
rv = submod2.addDeletion(del2);
del2.setId("deletionC");
del2.unsetMetaIdRef();
del2.setPortRef("port2");
rv = submod2.addDeletion(del2);
del2.unsetId();
del2.unsetPortRef();
del2.setUnitRef("mph");
rv = submod2.addDeletion(del2);
del2.unsetUnitRef();
del2.setIdRef("submodG");
SBaseRef sbr = del2.createSBaseRef();
sbr.setIdRef("element5");
rv = submod2.addDeletion(del2);
Deletion del3 = new Deletion();
del3.setIdRef("submodG");
SBaseRef sbr2 = new SBaseRef();
sbr2.setIdRef("subsubmodQ");
SBaseRef subsbr = sbr2.createSBaseRef();
subsbr.setPortRef("toBdel");
del3.setSBaseRef(sbr2);
submod2.addDeletion(del3);
mplugin.addSubmodel(submod2);
Port port1 = mplugin.createPort();
port1.setId("port1");
port1.setMetaIdRef("_110013");
Port port2 = new Port();
port2.setId("port2");
port2.setIdRef("x");
mplugin.addPort(port2);
port2.setId("port3");
port2.setIdRef("submod2");
port2.setSBaseRef(sbr2);
mplugin.addPort(port2);
libsbml.writeSBMLToFile(document, "comp_example1.xml");
document = libsbml.readSBMLFromFile("comp_example1.xml");
if (document == null)
{
Console.WriteLine("Error reading back in file.");
retval = -1;
}
else
{
document.setConsistencyChecks(libsbml.LIBSBML_CAT_UNITS_CONSISTENCY, false);
document.checkConsistency();
if (document.getErrorLog().getNumFailsWithSeverity(2) > 0 ||
document.getErrorLog().getNumFailsWithSeverity(3) > 0)
{
OStringStream stream = new OStringStream();
document.printErrors(stream);
Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" +
stream.str());
retval = -1;
}
libsbml.writeSBMLToFile(document, "comp_example1_rt.xml");
}
return retval;
}