SpeciesReference clone() { SpeciesReference ret = (SpeciesReference)libsbml.DowncastSBase(libsbmlPINVOKE.SpeciesReference_clone(swigCPtr), true); return(ret); }
SpeciesReference(SpeciesReference orig) : this(libsbmlPINVOKE.new_SpeciesReference__SWIG_2(SpeciesReference.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) { throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); } }
public void setUp() { SR = new SpeciesReference(3,1); if (SR == null); { } }
SpeciesReference clone() { IntPtr cPtr = libsbmlPINVOKE.SpeciesReference_clone(swigCPtr); SpeciesReference ret = (cPtr == IntPtr.Zero) ? null : new SpeciesReference(cPtr, true); return(ret); }
public void setUp() { sr = new SpeciesReference(2,4); if (sr == null); { } }
public void test_SpeciesReference_setDenominator2() { SpeciesReference c = new SpeciesReference(2,2); int i = c.setDenominator(4); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( c.getDenominator() == 4 ); c = null; }
public void test_Reaction_addReactant() { SpeciesReference sr = new SpeciesReference(2,4); sr.setSpecies( "s"); R.addReactant(sr); assertTrue( R.getNumReactants() == 1 ); assertTrue( R.getNumProducts() == 0 ); assertTrue( R.getNumModifiers() == 0 ); sr = null; }
public void test_Reaction_addProduct2() { Reaction m = new Reaction(2,2); SpeciesReference p = new SpeciesReference(2,1); p.setSpecies( "k"); int i = m.addProduct(p); assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH ); assertTrue( m.getNumProducts() == 0 ); p = null; m = null; }
internal static HandleRef getCPtrAndDisown(SpeciesReference obj) { HandleRef ptr = new HandleRef(null, IntPtr.Zero); if (obj != null) { ptr = obj.swigCPtr; obj.swigCMemOwn = false; } return(ptr); }
public void test_SpeciesReference_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2,1); sbmlns.addNamespaces(xmlns); SpeciesReference object1 = new SpeciesReference(sbmlns); assertTrue( object1.getTypeCode() == libsbml.SBML_SPECIES_REFERENCE ); assertTrue( object1.getMetaId() == "" ); assertTrue( object1.getNotes() == null ); assertTrue( object1.getAnnotation() == null ); assertTrue( object1.getLevel() == 2 ); assertTrue( object1.getVersion() == 1 ); assertTrue( object1.getNamespaces() != null ); assertTrue( object1.getNamespaces().getLength() == 2 ); object1 = null; }
public void test_Reaction_addProduct1() { Reaction m = new Reaction(2,2); SpeciesReference p = new SpeciesReference(2,2); SpeciesReference p1 = new SpeciesReference(2,2); p1.setSpecies( "k"); p1.setId( "k1"); int i = m.addProduct(p); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); p.setSpecies( "k"); p.setId( "k1"); i = m.addProduct(p); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumProducts() == 1 ); i = m.addProduct(p1); assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID ); assertTrue( m.getNumProducts() == 1 ); p = null; p1 = null; m = null; }
public void test_SpeciesReference_setId3() { SpeciesReference c = new SpeciesReference(2,1); int i = c.setId( "cell"); assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE ); assertEquals( false, c.isSetId() ); c = null; }
public void test_L3_SpeciesReference_hasRequiredAttributes() { SpeciesReference sr = new SpeciesReference(3,1); assertEquals( false, sr.hasRequiredAttributes() ); sr.setSpecies( "id"); assertEquals( false, sr.hasRequiredAttributes() ); sr.setConstant(false); assertEquals( true, sr.hasRequiredAttributes() ); sr = null; }
public void test_Reaction_addReactant3() { Reaction m = new Reaction(2,2); SpeciesReference p = new SpeciesReference(1,2); p.setSpecies( "k"); int i = m.addReactant(p); assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH ); assertTrue( m.getNumReactants() == 0 ); p = null; m = null; }
/** * Adds a given SpeciesReference object as a product in this Reaction. * * The SpeciesReference instance in @p sr is copied. * * @param sr a SpeciesReference object referring to a Species in the * enclosing Model * * * @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_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink * * * @note This method should be used with some caution. The fact that this * method @em copies the object passed to it means that the caller will be * left holding a physically different object instance than the one contained * inside this object. Changes made to the original object instance (such as * resetting attribute values) will <em>not affect the instance in this * object</em>. In addition, the caller should make sure to free the * original object if it is no longer being used, or else a memory leak will * result. Please see other methods on this class (particularly a * corresponding method whose name begins with the word <code>create</code>) * for alternatives that do not lead to these issues. * * * * @see createProduct() */ public int addProduct(SpeciesReference sr) { int ret = libsbmlPINVOKE.Reaction_addProduct__SWIG_0(swigCPtr, SpeciesReference.getCPtr(sr)); return ret; }
public void test_StoichiometryMath_parent_add() { StoichiometryMath m = new StoichiometryMath(2,4); SpeciesReference sr = new SpeciesReference(2,4); sr.setStoichiometryMath(m); m = null; assertTrue( sr == sr.getStoichiometryMath().getParentSBMLObject() ); sr = null; }
public void test_SpeciesReference() { SpeciesReference sr = new SpeciesReference(2,4); assertEquals( false, (sr.hasRequiredAttributes()) ); sr.setSpecies("sr"); assertEquals( true, sr.hasRequiredAttributes() ); sr = null; }
public void test_Reaction_getReactant() { SpeciesReference sr1 = new SpeciesReference(2,4); SpeciesReference sr2 = new SpeciesReference(2,4); sr1.setSpecies( "R1"); sr2.setSpecies( "R2"); R.addReactant(sr1); R.addReactant(sr2); sr1 = null; sr2 = null; assertTrue( R.getNumReactants() == 2 ); assertTrue( R.getNumProducts() == 0 ); assertTrue( R.getNumModifiers() == 0 ); sr1 = R.getReactant(0); sr2 = R.getReactant(1); assertTrue(( "R1" == sr1.getSpecies() )); assertTrue(( "R2" == sr2.getSpecies() )); }
internal static HandleRef getCPtr(SpeciesReference obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public void test_SpeciesReference() { SpeciesReference sr = new SpeciesReference(2,4); assertEquals( true, sr.hasRequiredElements() ); sr = null; }
private static int Main(string[] args) { var retval = 0; var sbmlns = new SBMLNamespaces(3, 1, "comp", 1); // create the document var document = new SBMLDocument(sbmlns); //Create our submodel var compdoc = (CompSBMLDocumentPlugin) (document.getPlugin("comp")); compdoc.setRequired(true); var mod1 = compdoc.createModelDefinition(); mod1.setId("enzyme"); mod1.setName("enzyme"); var comp = mod1.createCompartment(); comp.setSpatialDimensions(3); comp.setConstant(true); comp.setId("comp"); comp.setSize(1L); var spec = new Species(3, 1); spec.setCompartment("comp"); spec.setHasOnlySubstanceUnits(false); spec.setConstant(false); spec.setBoundaryCondition(false); spec.setId("S"); mod1.addSpecies(spec); spec.setId("E"); mod1.addSpecies(spec); spec.setId("D"); mod1.addSpecies(spec); spec.setId("ES"); mod1.addSpecies(spec); var rxn = new Reaction(3, 1); rxn.setReversible(true); rxn.setFast(false); var rxn2 = new Reaction(rxn); rxn.setId("J0"); rxn2.setId("J1"); var sr = new SpeciesReference(3, 1); sr.setConstant(true); sr.setStoichiometry(1); sr.setSpecies("S"); rxn.addReactant(sr); sr.setSpecies("E"); rxn.addReactant(sr); rxn2.addProduct(sr); sr.setSpecies("ES"); rxn.addProduct(sr); rxn2.addReactant(sr); sr.setSpecies("D"); rxn2.addProduct(sr); mod1.addReaction(rxn); mod1.addReaction(rxn2); // create the Model var model = document.createModel(); model.setId("aggregate"); // Create a submodel var mplugin = (CompModelPlugin) (model.getPlugin("comp")); var submod1 = mplugin.createSubmodel(); submod1.setId("submod1"); submod1.setModelRef("enzyme"); var submod2 = new Submodel(); submod2.setId("submod2"); submod2.setModelRef("enzyme"); mplugin.addSubmodel(submod2); libsbml.writeSBMLToFile(document, "enzyme_model.xml"); document = libsbml.readSBMLFromFile("enzyme_model.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) { var stream = new OStringStream(); document.printErrors(stream); Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" + stream.str()); retval = -1; } libsbml.writeSBMLToFile(document, "enzyme_model_rt.xml"); } return retval; }
private static int Main(string[] args) { var retval = 0; var sbmlns = new SBMLNamespaces(3, 1, "comp", 1); // create the document var document = new SBMLDocument(sbmlns); //Define the external model definition var compdoc = (CompSBMLDocumentPlugin)(document.getPlugin("comp")); compdoc.setRequired(true); var extmod = compdoc.createExternalModelDefinition(); extmod.setId("ExtMod1"); extmod.setSource("enzyme_model.xml"); extmod.setModelRef("enzyme"); //Define the 'simple' model var mod1 = compdoc.createModelDefinition(); mod1.setId("simple"); var comp = mod1.createCompartment(); comp.setSpatialDimensions(3); comp.setConstant(true); comp.setId("comp"); comp.setSize(1L); var spec = new Species(sbmlns); //We have to construct it this way because we get the comp plugin from it later. spec.setCompartment("comp"); spec.setHasOnlySubstanceUnits(false); spec.setConstant(false); spec.setBoundaryCondition(false); spec.setId("S"); spec.setInitialConcentration(5); mod1.addSpecies(spec); spec.setId("D"); spec.setInitialConcentration(10); mod1.addSpecies(spec); var rxn = new Reaction(3, 1); rxn.setReversible(true); rxn.setFast(false); rxn.setId("J0"); var sr = new SpeciesReference(3, 1); sr.setConstant(true); sr.setStoichiometry(1); sr.setSpecies("S"); rxn.addReactant(sr); sr.setSpecies("D"); rxn.addProduct(sr); mod1.addReaction(rxn); var mod1plug = (CompModelPlugin)(mod1.getPlugin("comp")); var port = new Port(); port.setId("S_port"); port.setIdRef("S"); mod1plug.addPort(port); var port2 = mod1plug.createPort(); port2.setId("D_port"); port2.setIdRef("D"); port.setId("comp_port"); port.setIdRef("comp"); mod1plug.addPort(port); port.setId("J0_port"); port.setIdRef("J0"); mod1plug.addPort(port); // create the Model var model = document.createModel(); model.setId("complexified"); // Set the submodels var mplugin = (CompModelPlugin)(model.getPlugin("comp")); var submod1 = mplugin.createSubmodel(); submod1.setId("A"); submod1.setModelRef("ExtMod1"); var submod2 = mplugin.createSubmodel(); submod2.setId("B"); submod2.setModelRef("simple"); var del = submod2.createDeletion(); del.setPortRef("J0_port"); // Synchronize the compartments var mcomp = model.createCompartment(); mcomp.setSpatialDimensions(3); mcomp.setConstant(true); mcomp.setId("comp"); mcomp.setSize(1L); var compartplug = (CompSBasePlugin)(mcomp.getPlugin("comp")); var re = new ReplacedElement(); re.setIdRef("comp"); re.setSubmodelRef("A"); compartplug.addReplacedElement(re); re.setSubmodelRef("B"); re.unsetIdRef(); re.setPortRef("comp_port"); compartplug.addReplacedElement(re); //Synchronize the species spec.setId("S"); spec.setInitialConcentration(5); var specplug = (CompSBasePlugin)(spec.getPlugin("comp")); var sre = specplug.createReplacedElement(); sre.setSubmodelRef("A"); sre.setIdRef("S"); var sre2 = specplug.createReplacedElement(); sre2.setSubmodelRef("B"); sre2.setPortRef("S_port"); model.addSpecies(spec); spec.setId("D"); spec.setInitialConcentration(10); sre.setIdRef("D"); sre2.setPortRef("D_port"); model.addSpecies(spec); libsbml.writeSBMLToFile(document, "spec_example3.xml"); document = libsbml.readSBMLFromFile("spec_example3.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) { var stream = new OStringStream(); document.printErrors(stream); Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" + stream.str()); retval = -1; } libsbml.writeSBMLToFile(document, "spec_example3_rt.xml"); } return retval; }
public void test_internal_consistency_check_99921() { SBMLDocument d = new SBMLDocument(2,4); long errors; SpeciesReference sr = new SpeciesReference(2,4); d.setLevelAndVersion(2,1,false); Model m = d.createModel(); Compartment c = m.createCompartment(); c.setId("c"); Species s = m.createSpecies(); s.setId("s"); Reaction r = m.createReaction(); r.setId("r"); s.setCompartment("c"); sr.setSpecies("s"); sr.setName("mmm"); r.addReactant(sr); errors = d.checkInternalConsistency(); assertTrue( errors == 1 ); assertTrue( d.getError(0).getErrorId() == 21101 ); d = null; }
public void tearDown() { SR = null; }
public void test_StoichiometryMath_ancestor_create() { SpeciesReference sr = new SpeciesReference(2,4); StoichiometryMath sm = sr.createStoichiometryMath(); assertTrue( sm.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr ); assertTrue( sm.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( sm.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); StoichiometryMath obj = sr.getStoichiometryMath(); assertTrue( obj.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }
public void test_L3_SpeciesReference_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(3,1); sbmlns.addNamespaces(xmlns); SpeciesReference sr = new SpeciesReference(sbmlns); assertTrue( sr.getTypeCode() == libsbml.SBML_SPECIES_REFERENCE ); assertTrue( sr.getMetaId() == "" ); assertTrue( sr.getNotes() == null ); assertTrue( sr.getAnnotation() == null ); assertTrue( sr.getLevel() == 3 ); assertTrue( sr.getVersion() == 1 ); assertTrue( sr.getNamespaces() != null ); assertTrue( sr.getNamespaces().getLength() == 2 ); assertTrue( sr.getId() == "" ); assertTrue( sr.getName() == "" ); assertTrue( sr.getSpecies() == "" ); assertEquals( true, isnan(sr.getStoichiometry()) ); assertTrue( sr.getConstant() == false ); assertEquals( false, sr.isSetId() ); assertEquals( false, sr.isSetName() ); assertEquals( false, sr.isSetSpecies() ); assertEquals( false, sr.isSetStoichiometry() ); assertEquals( false, sr.isSetConstant() ); sr = null; }
public void test_SpeciesReference_Reactant_parent_add() { SpeciesReference sr = new SpeciesReference(2,4); Reaction r = new Reaction(2,4); sr.setSpecies("s"); r.addReactant(sr); sr = null; ListOf lo = r.getListOfReactants(); assertTrue( lo == r.getReactant(0).getParentSBMLObject() ); assertTrue( r == lo.getParentSBMLObject() ); }
public void test_Reaction_getReactantById() { SpeciesReference sr1 = new SpeciesReference(2,4); sr1.setSpecies( "R1"); SpeciesReference sr2 = new SpeciesReference(2,4); sr2.setSpecies( "R2"); R.addReactant(sr1); R.addReactant(sr2); assertTrue( R.getNumReactants() == 2 ); assertTrue( R.getNumProducts() == 0 ); assertTrue( R.getNumModifiers() == 0 ); assertNotEquals(R.getReactant( "R1"),sr1); assertNotEquals(R.getReactant( "R2"),sr2); assertEquals(R.getReactant( "R3"),null); sr1 = null; sr2 = null; }
internal static HandleRef getCPtr(SpeciesReference obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }
/** * Copy constructor; creates a copy of this SpeciesReference. * * @param orig the SpeciesReference instance to copy. * * @throws @if python ValueError @else SBMLConstructorException @endif * Thrown if the argument @p orig is @c null. */ public SpeciesReference(SpeciesReference orig) : this(libsbmlPINVOKE.new_SpeciesReference__SWIG_2(SpeciesReference.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); }
/** * Adds a given SpeciesReference object as a reactant in this Reaction. * * The SpeciesReference instance in @p sr is copied. * * @param sr a SpeciesReference object referring to a Species in the * enclosing Model * * @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 libsbmlcs.libsbml.LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS @endlink * @li @link libsbmlcs.libsbml.LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH @endlink * @li @link libsbmlcs.libsbml.LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH @endlink * @li @link libsbmlcs.libsbml.LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID @endlink * @li @link libsbmlcs.libsbml.LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT @endlink * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED @endlink * * * * @note This method should be used with some caution. The fact that this * method @em copies the object passed to it means that the caller will be * left holding a physically different object instance than the one contained * inside this object. Changes made to the original object instance (such as * resetting attribute values) will <em>not affect the instance in this * object</em>. In addition, the caller should make sure to free the * original object if it is no longer being used, or else a memory leak will * result. Please see other methods on this class (particularly a * corresponding method whose name begins with the word <code>create</code>) * for alternatives that do not lead to these issues. * * * * @see createReactant() */ public int addReactant(SpeciesReference sr) { int ret = libsbmlPINVOKE.Reaction_addReactant(swigCPtr, SpeciesReference.getCPtr(sr)); return ret; }
internal static HandleRef getCPtrAndDisown(SpeciesReference obj) { HandleRef ptr = new HandleRef(null, IntPtr.Zero); if (obj != null) { ptr = obj.swigCPtr; obj.swigCMemOwn = false; } return ptr; }
public void test_SpeciesReference_Reactant_ancestor_add() { SpeciesReference sr = new SpeciesReference(2,4); Reaction r = new Reaction(2,4); sr.setSpecies("s"); r.addReactant(sr); sr = null; ListOf lo = r.getListOfReactants(); SpeciesReference obj = r.getReactant(0); assertTrue( obj.getAncestorOfType(libsbml.SBML_REACTION) == r ); assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null ); }
public void test_SpeciesReference_constructor() { SBase s; try { s = new SpeciesReference(1,1); s = new SpeciesReference(1,2); s = new SpeciesReference(2,1); s = new SpeciesReference(2,2); s = new SpeciesReference(2,3); s = new SpeciesReference(2,4); s = new SpeciesReference(3,1); s = new SpeciesReference(SN11); s = new SpeciesReference(SN12); s = new SpeciesReference(SN21); s = new SpeciesReference(SN22); s = new SpeciesReference(SN23); s = new SpeciesReference(SN24); s = new SpeciesReference(SN31); } catch (SBMLConstructorException e) { s = null; } assertTrue(s != null); string msg = ""; try { s = new SpeciesReference(9,9); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new SpeciesReference(SN99); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); }
public void test_StoichiometryMath_ancestor_add() { StoichiometryMath m = new StoichiometryMath(2,4); SpeciesReference sr = new SpeciesReference(2,4); sr.setStoichiometryMath(m); m = null; StoichiometryMath obj = sr.getStoichiometryMath(); assertTrue( obj.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr ); assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == null ); assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); sr = null; }