1 //------------------------------------------------------------------------------ 2 // <auto-generated /> 3 // 4 // This file was automatically generated by SWIG (http://www.swig.org). 5 // Version 4.0.2 6 // 7 // Do not make changes to this file unless you know what you are doing--modify 8 // the SWIG interface file instead. 9 //------------------------------------------------------------------------------ 10 11 namespace libsbml { 12 13 using System; 14 using System.Runtime.InteropServices; 15 16 /** 17 * @sbmlpackage{core} 18 * 19 @htmlinclude pkg-marker-core.html Overall SBML container object. 20 * 21 * @if clike LibSBML uses the class SBMLDocument as a 22 * top-level container for storing SBML content and data associated with it 23 * (such as warnings and error messages). The two primary means of reading 24 * an SBML model, SBMLReader::readSBML() and 25 * SBMLReader::readSBMLFromString(), both return a pointer to an 26 * SBMLDocument object. From there, callers can inquire about any errors 27 * encountered (e.g., using SBMLDocument::getNumErrors()), access the Model 28 * object, and perform other actions such as consistency-checking and model 29 * translation. 30 * @endif@if python LibSBML uses the class SBMLDocument as a 31 * top-level container for storing SBML content and data associated with it 32 * (such as warnings and error messages). The two primary means of reading 33 * an SBML model, SBMLReader::readSBML() and 34 * SBMLReader::readSBMLFromString(), both return a pointer to an 35 * SBMLDocument object. From there, callers can inquire about any errors 36 * encountered (e.g., using SBMLDocument::getNumErrors()), access the Model 37 * object, and perform other actions such as consistency-checking and model 38 * translation. 39 * @endif@if java LibSBML uses the class SBMLDocument as a top-level 40 * container for storing SBML content and data associated with it (such as 41 * warnings and error messages). The two primary means of reading an SBML 42 * model, SBMLReader::readSBML(String filename) and 43 * SBMLReader::readSBMLFromString(String xml), both return an SBMLDocument 44 * object. From there, callers can inquire about any errors encountered 45 * (e.g., using SBMLDocument::getNumErrors()), access the Model object, and 46 * perform other actions such as consistency-checking and model 47 * translation. 48 * @endif 49 * 50 * When creating fresh models programmatically, the starting point is 51 * typically the creation of an SBMLDocument object instance. The 52 * SBMLDocument constructor accepts arguments for the SBML Level and 53 * Version of the model to be created. After creating the SBMLDocument 54 * object, calling programs then typically call SBMLDocument::createModel() 55 * almost immediately, and then proceed to call the methods on the Model 56 * object to fill out the model's contents. 57 * 58 * SBMLDocument corresponds roughly to the class <i>Sbml</i> defined in the 59 * SBML Level 2 specification and <i>SBML</i> in the Level 3 60 * specification. It does not have a direct correspondence in SBML 61 * Level 1. (However, to make matters simpler for applications, 62 * libSBML creates an SBMLDocument no matter whether the model is 63 * Level 1, Level 2 or Level 3.) In its barest form, when written out in 64 * XML format for (e.g.) SBML Level 2 Version 4, the corresponding 65 * structure is the following: 66 * @verbatim 67 <sbml xmlns='http://www.sbml.org/sbml/level2/version4' level='2' version='4'> 68 ... 69 </sbml>@endverbatim 70 * 71 * SBMLDocument is derived from SBase, and therefore contains the usual SBase 72 * attributes (in SBML Level 2 and Level 3) of 'metaid' and 'sboTerm', as 73 * well as the subelements 'notes' and 'annotation'. It also contains the 74 * attributes 'level' and 'version' indicating the Level and Version of the 75 * SBML data structure. These can be accessed using the methods defined by 76 * the SBase class for that purpose. 77 * 78 * @section checking Checking consistency and adherence to SBML specifications 79 * 80 * One of the most important features of libSBML is its ability to perform 81 * SBML validation to ensure that a model adheres to the SBML specification 82 * for whatever Level+Version combination the model uses. SBMLDocument 83 * provides the methods for running consistency-checking and validation 84 * rules on the SBML content. 85 * 86 * First, a brief explanation of the rationale is in order. In libSBML 87 * versions up to and including the version 3.3.x series, the 88 * individual methods for creating and setting attributes and other 89 * components were quite lenient, and allowed a caller to compose SBML 90 * entities that might not, in the end, represent valid SBML. This allowed 91 * applications the freedom to do things such as save incomplete models 92 * (which is useful when models are being developed over long periods of 93 * time). In the version 4.x series, libSBML is somewhat stricter, 94 * but still permits structures to be created independently and the results 95 * to be combined in a separate step. In all these cases, it means that a 96 * separate validation step is necessary when a calling program finally 97 * wants to finish a complete SBML document. 98 * 99 * The primary interface to this validation facility is SBMLDocument's 100 * SBMLDocument::checkInternalConsistency() and 101 * SBMLDocument::checkConsistency(). The former verifies the basic 102 * internal consistency and syntax of an SBML document, and the latter 103 * implements more elaborate validation rules (both those defined by the 104 * SBML specifications, as well as additional rules offered by libSBML). 105 * 106 * @if clike The checks performed by SBMLDocument::checkInternalConsistency() are 107 * hardwired and cannot be changed by calling programs, but the validation 108 * performed by SBMLDocument::checkConsistency() is under program control 109 * using the method SBMLDocument::setConsistencyChecks(). Applications can 110 * selectively disable specific kinds of checks that they may not be 111 * interested in, by calling SBMLDocument::setConsistencyChecks() with 112 * appropriate parameters. 113 * @endif@if python The checks performed by SBMLDocument::checkInternalConsistency() are 114 * hardwired and cannot be changed by calling programs, but the validation 115 * performed by SBMLDocument::checkConsistency() is under program control 116 * using the method SBMLDocument::setConsistencyChecks(). Applications can 117 * selectively disable specific kinds of checks that they may not be 118 * interested in, by calling SBMLDocument::setConsistencyChecks() with 119 * appropriate parameters. 120 * @endif@if java The checks performed by SBMLDocument::checkInternalConsistency() are 121 * hardwired and cannot be changed by calling programs, but the validation 122 * performed by SBMLDocument::checkConsistency() is under program control 123 * using the method SBMLDocument::setConsistencyChecks(int categ, boolean 124 * onoff). Applications can selectively disable specific kinds of checks 125 * that they may not be interested by calling 126 * SBMLDocument::setConsistencyChecks(int categ, boolean onoff) with 127 * appropriate parameters. 128 * @endif 129 * 130 * These methods have slightly different relevance depending on whether a 131 * model is created programmaticaly from scratch, or whether it is read in 132 * from a file or data stream. The following list summarizes the possible 133 * scenarios. 134 * 135 * <em>Scenario 1: Creating a model from scratch</em>. Before writing out 136 * the model, 137 * 138 * @li Call SBMLDocument::checkInternalConsistency(), then inquire about 139 * the results by calling SBMLDocument::getNumErrors() 140 * 141 * @li Call @if java SBMLDocument::setConsistencyChecks(int categ, boolean 142 * onoff) @else SBMLDocument::setConsistencyChecks() @endif to configure 143 * which checks will be performed by SBMLDocument::checkConsistency() 144 * 145 * @li Call SBMLDocument::checkConsistency(), then inquire about the results by 146 * calling SBMLDocument::getNumErrors() 147 * 148 * <em>Scenario 2: Reading a model from a file or data stream.</em> After 149 * reading the model, 150 * 151 * @li Basic consistency checks will have been performed automatically by 152 * libSBML upon reading the content, so you only need to inquire about the 153 * results by using SBMLDocument::getNumErrors() 154 * 155 * @li Call @if java SBMLDocument::setConsistencyChecks(int categ, boolean 156 * onoff) @else SBMLDocument::setConsistencyChecks() @endif to configure 157 * which checks are performed by SBMLDocument::checkConsistency() 158 * 159 * @li Call SBMLDocument::checkConsistency(), then inquire about the results 160 * by calling SBMLDocument::getNumErrors() 161 * 162 * @if clike An example of using the consistency-checking 163 * and validation facilities is provided in this manual in the 164 * section @ref libsbml-example. @endif 165 * 166 * It should be noted that as of SBML Level 3 Version 2, the Model 167 * became an optional child of SBMLDocument, instead of being required. This 168 * means that one can no longer use SBMLDocument::getModel() as a cheap method 169 * of checking if an SBML document was read in properly: the more robust 170 * getError methods detailed above must be used instead. 171 * 172 * @section converting Converting documents between Levels and Versions of SBML 173 * 174 * LibSBML provides facilities for limited translation of SBML between 175 * Levels and Versions of the SBML specifications. The method for doing is 176 * is @if java SBMLDocument::setLevelAndVersion(long lev, long ver, boolean strict) @else setLevelAndVersion() @endif. In 177 * general, models can be converted upward without difficulty (e.g., from 178 * SBML Level 1 to Level 2, or from an earlier Version of 179 * Level 2 to the latest Version of Level 2). Sometimes models 180 * can be translated downward as well, if they do not use constructs 181 * specific to more advanced Levels of SBML. 182 * 183 * Calling @if java SBMLDocument::setLevelAndVersion(long lev, long ver, boolean strict) @else SBMLDocument::setLevelAndVersion() @endif will not @em necessarily lead 184 * to a successful conversion. The method will return a boolean value 185 * to indicate success or failure. Callers must check the error log (see 186 * next section) attached to the SBMLDocument object after calling 187 * @if java SBMLDocument::setLevelAndVersion(long lev, long ver) @else SBMLDocument::setLevelAndVersion() @endif in order to assess whether any 188 * problems arose. 189 * 190 * If an application is interested in translating to a lower Level and/or 191 * Version of SBML within a Level, the following methods allow for prior 192 * assessment of whether there is sufficient compatibility to make a 193 * translation possible: 194 * 195 * @li SBMLDocument::checkL1Compatibility(), 196 * @li SBMLDocument::checkL2v1Compatibility(), 197 * @li SBMLDocument::checkL2v2Compatibility(), 198 * @li SBMLDocument::checkL2v3Compatibility(), 199 * @li SBMLDocument::checkL2v4Compatibility(), 200 * @li SBMLDocument::checkL2v5Compatibility(), and 201 * @li SBMLDocument::checkL3v1Compatibility(). 202 * 203 * Some changes between Versions of SBML Level 2 may lead to 204 * unexpected behaviors when attempting conversions in either direction. 205 * For example, SBML Level 2 Version 4 relaxed the requirement 206 * for consistency in units of measurement between expressions annd 207 * quantities in a model. As a result, a model written in Version 4, 208 * if converted to Version 3 with no other changes, may fail 209 * validation as a Version 3 model because Version 3 imposed 210 * stricter requirements on unit consistency. 211 * 212 * Other changes between SBML Level 2 and Level 3 make downward conversions 213 * challenging. In some cases, it means that a model converted to 214 * Level 2 from Level 3 will contain attributes that were not 215 * explicitly given in the Level 3 model, because in Level 2 216 * these attributes may have been optional or have default values. 217 * 218 * @section errors Error handling 219 * 220 * Upon reading a model, SBMLDocument logs any problems encountered while 221 * reading the model from the file or data stream. The log contains 222 * objects that record diagnostic information about any notable issues that 223 * arose. Whether the problems are warnings or errors, they are both 224 * reported through a single common interface involving the object class 225 * SBMLError. 226 * 227 * The methods SBMLDocument::getNumErrors(), @if java SBMLDocument::getError(long n) @else SBMLDocument::getError() @endif and 228 * SBMLDocument::printErrors() allow callers to interact with the warnings 229 * or errors logged. Alternatively, callers may retrieve the entire log as 230 * an SBMLErrorLog object using the method SBMLDocument::getErrorLog(). 231 * The SBMLErrorLog object provides some alternative methods for 232 * interacting with the set of errors and warnings. In either case, 233 * applications typically should first call SBMLDocument::getNumErrors() to 234 * find out if any issues have been logged after specific libSBML 235 * operations such as the ones discussed in the sections above. If they 236 * have, then an application will should proceed to inspect the individual 237 * reports using either the direct interfaces on SBMLDocument or using the 238 * methods on the SBMLErrorLog object. 239 * 240 * @if clike An example of using the error facility is 241 * provided in this manual in the 242 * section @ref libsbml-example. @endif 243 * 244 */ 245 246 public class SBMLDocument : SBase { 247 private HandleRef swigCPtr; 248 SBMLDocument(IntPtr cPtr, bool cMemoryOwn)249 internal SBMLDocument(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.SBMLDocument_SWIGUpcast(cPtr), cMemoryOwn) 250 { 251 //super(libsbmlPINVOKE.SBMLDocumentUpcast(cPtr), cMemoryOwn); 252 swigCPtr = new HandleRef(this, cPtr); 253 } 254 getCPtr(SBMLDocument obj)255 internal static HandleRef getCPtr(SBMLDocument obj) 256 { 257 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 258 } 259 getCPtrAndDisown(SBMLDocument obj)260 internal static HandleRef getCPtrAndDisown (SBMLDocument obj) 261 { 262 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 263 264 if (obj != null) 265 { 266 ptr = obj.swigCPtr; 267 obj.swigCMemOwn = false; 268 } 269 270 return ptr; 271 } 272 Dispose(bool disposing)273 protected override void Dispose(bool disposing) { 274 lock(this) { 275 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 276 if (swigCMemOwn) { 277 swigCMemOwn = false; 278 libsbmlPINVOKE.delete_SBMLDocument(swigCPtr); 279 } 280 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 281 } 282 base.Dispose(disposing); 283 } 284 } 285 286 287 /** 288 * The default SBML Level of new SBMLDocument objects. 289 * 290 * 291 * 292 * This 'default Level' corresponds to the most recent SBML specification 293 * Level available at the time libSBML version @htmlinclude 294 * libsbml-version.html was released. The default Level is used by 295 * SBMLDocument if no Level is explicitly specified at the time of the 296 * construction of an SBMLDocument instance. 297 * 298 * 299 * @return an integer indicating the most recent SBML specification Level. 300 * 301 * 302 * @if python @note Because this is a static method on a class, the Python 303 * language interface for libSBML will contain two variants. One will be the 304 * expected, normal static method on the class (i.e., a regular 305 * <em>methodName</em>), and the other will be a standalone top-level 306 * function with the name <em>ClassName_methodName()</em>. This is merely an 307 * artifact of how the language interfaces are created in libSBML. The 308 * methods are functionally identical. @endif 309 * 310 * 311 * 312 * @see @if clike getDefaultVersion() @else SBMLDocument::getDefaultVersion() @endif 313 */ public getDefaultLevel()314 static long getDefaultLevel() { return (long)libsbmlPINVOKE.SBMLDocument_getDefaultLevel(); } 315 316 317 /** 318 * The default Version of new SBMLDocument objects. 319 * 320 * 321 * 322 * This 'default Version' corresponds to the most recent Version within the 323 * most recent Level of SBML available at the time libSBML version 324 * @htmlinclude libsbml-version.html was released. The default Version is 325 * used by SBMLDocument if no Version is explicitly specified at the time of 326 * the construction of an SBMLDocument instance. 327 * 328 * 329 * @return an integer indicating the most recent SBML specification 330 * Version. 331 * 332 * 333 * @if python @note Because this is a static method on a class, the Python 334 * language interface for libSBML will contain two variants. One will be the 335 * expected, normal static method on the class (i.e., a regular 336 * <em>methodName</em>), and the other will be a standalone top-level 337 * function with the name <em>ClassName_methodName()</em>. This is merely an 338 * artifact of how the language interfaces are created in libSBML. The 339 * methods are functionally identical. @endif 340 * 341 * 342 * 343 * @see @if clike getDefaultLevel() @else SBMLDocument::getDefaultLevel() @endif 344 */ public getDefaultVersion()345 static long getDefaultVersion() { return (long)libsbmlPINVOKE.SBMLDocument_getDefaultVersion(); } 346 347 348 /** 349 * Creates a new SBMLDocument, optionally with given values for the SBML 350 * Level and Version. 351 * 352 * If <em>both</em> the SBML Level and Version attributes are not 353 * specified, the SBML document is treated as having the latest Level and 354 * Version of SBML as determined by SBMLDocument::getDefaultLevel() and 355 * SBMLDocument::getDefaultVersion(); <em>however</em>, the SBMLDocument 356 * object is otherwise left blank. In particular, the blank SBMLDocument 357 * object has no associated XML attributes, including (but not limited 358 * to) an XML namespace declaration. The XML namespace declaration is 359 * not added until the model is written out, <em>or</em> the method 360 * SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 361 * is called. This may be important to keep in mind 362 * if an application needs to add additional XML namespace declarations 363 * on the <code><sbml></code> element. Application writers should 364 * either provide values for @p level and @p version on the call to this 365 * constructor, or else call 366 * SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 367 * shortly after creating the SBMLDocument object. 368 * 369 * @param level an integer for the SBML Level. 370 * 371 * @param version an integer for the Version within the SBML Level. 372 * 373 * 374 * @throws SBMLConstructorException 375 * Thrown if the given @p level and @p version combination are invalid 376 * or if this object is incompatible with the given level and version. 377 * 378 * 379 * 380 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 381 * 382 * @see SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 383 * @see getDefaultLevel() 384 * @see getDefaultVersion() 385 */ public SBMLDocument(long level, long version)386 SBMLDocument(long level, long version) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_0(level, version), true) { 387 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 388 } 389 390 391 /** 392 * Creates a new SBMLDocument, optionally with given values for the SBML 393 * Level and Version. 394 * 395 * If <em>both</em> the SBML Level and Version attributes are not 396 * specified, the SBML document is treated as having the latest Level and 397 * Version of SBML as determined by SBMLDocument::getDefaultLevel() and 398 * SBMLDocument::getDefaultVersion(); <em>however</em>, the SBMLDocument 399 * object is otherwise left blank. In particular, the blank SBMLDocument 400 * object has no associated XML attributes, including (but not limited 401 * to) an XML namespace declaration. The XML namespace declaration is 402 * not added until the model is written out, <em>or</em> the method 403 * SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 404 * is called. This may be important to keep in mind 405 * if an application needs to add additional XML namespace declarations 406 * on the <code><sbml></code> element. Application writers should 407 * either provide values for @p level and @p version on the call to this 408 * constructor, or else call 409 * SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 410 * shortly after creating the SBMLDocument object. 411 * 412 * @param level an integer for the SBML Level. 413 * 414 * @param version an integer for the Version within the SBML Level. 415 * 416 * 417 * @throws SBMLConstructorException 418 * Thrown if the given @p level and @p version combination are invalid 419 * or if this object is incompatible with the given level and version. 420 * 421 * 422 * 423 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 424 * 425 * @see SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 426 * @see getDefaultLevel() 427 * @see getDefaultVersion() 428 */ public SBMLDocument(long level)429 SBMLDocument(long level) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_1(level), true) { 430 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 431 } 432 433 434 /** 435 * Creates a new SBMLDocument, optionally with given values for the SBML 436 * Level and Version. 437 * 438 * If <em>both</em> the SBML Level and Version attributes are not 439 * specified, the SBML document is treated as having the latest Level and 440 * Version of SBML as determined by SBMLDocument::getDefaultLevel() and 441 * SBMLDocument::getDefaultVersion(); <em>however</em>, the SBMLDocument 442 * object is otherwise left blank. In particular, the blank SBMLDocument 443 * object has no associated XML attributes, including (but not limited 444 * to) an XML namespace declaration. The XML namespace declaration is 445 * not added until the model is written out, <em>or</em> the method 446 * SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 447 * is called. This may be important to keep in mind 448 * if an application needs to add additional XML namespace declarations 449 * on the <code><sbml></code> element. Application writers should 450 * either provide values for @p level and @p version on the call to this 451 * constructor, or else call 452 * SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 453 * shortly after creating the SBMLDocument object. 454 * 455 * @param level an integer for the SBML Level. 456 * 457 * @param version an integer for the Version within the SBML Level. 458 * 459 * 460 * @throws SBMLConstructorException 461 * Thrown if the given @p level and @p version combination are invalid 462 * or if this object is incompatible with the given level and version. 463 * 464 * 465 * 466 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 467 * 468 * @see SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 469 * @see getDefaultLevel() 470 * @see getDefaultVersion() 471 */ public SBMLDocument()472 SBMLDocument() : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_2(), true) { 473 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 474 } 475 476 477 /** 478 * Creates a new SBMLDocument using the given SBMLNamespaces object 479 * @p sbmlns. 480 * 481 * 482 * 483 * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces 484 * information. It is used to communicate the SBML Level, Version, and (in 485 * Level 3) packages used in addition to SBML Level 3 Core. A 486 * common approach to using libSBML's SBMLNamespaces facilities is to create an 487 * SBMLNamespaces object somewhere in a program once, then hand that object 488 * as needed to object constructors that accept SBMLNamespaces as arguments. 489 * 490 * 491 * 492 * @param sbmlns an SBMLNamespaces object. 493 * 494 * 495 * @throws SBMLConstructorException 496 * Thrown if the given @p sbmlns is inconsistent or incompatible 497 * with this object. 498 * 499 * 500 */ public SBMLDocument(SBMLNamespaces sbmlns)501 SBMLDocument(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_3(SBMLNamespaces.getCPtr(sbmlns)), true) { 502 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 503 } 504 505 506 /** 507 * Copy constructor; creates a copy of this SBMLDocument. 508 * 509 * @param orig the object to copy. 510 */ public SBMLDocument(SBMLDocument orig)511 SBMLDocument(SBMLDocument orig) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_4(SBMLDocument.getCPtr(orig)), true) { 512 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 513 } 514 515 516 /** 517 * Creates and returns a deep copy of this SBMLDocument object. 518 * 519 * @return the (deep) copy of this SBMLDocument object. 520 */ public new clone()521 SBMLDocument clone() { 522 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_clone(swigCPtr); 523 SBMLDocument ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLDocument(cPtr, true); 524 return ret; 525 } 526 527 528 /** 529 * Returns @c true if the Model object has been set, otherwise 530 * returns @c false. 531 * 532 * @return @c true if the Model object has been set 533 */ public isSetModel()534 bool isSetModel() { 535 bool ret = libsbmlPINVOKE.SBMLDocument_isSetModel(swigCPtr); 536 return ret; 537 } 538 539 540 /** 541 * Returns the Model object stored in this SBMLDocument. 542 * 543 * It is important to note that this method <em>does not create</em> a 544 * Model instance. The model in the SBMLDocument must have been created 545 * at some prior time, for example using SBMLDocument::createModel() 546 * or SBMLDocument::setModel(@if java Model@endif). 547 * This method returns @c null if a model does not yet exist. 548 * 549 * @return the Model contained in this SBMLDocument, or @c null if no such model exists. 550 * 551 * @see createModel() 552 */ public new getModel()553 Model getModel() { 554 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getModel__SWIG_0(swigCPtr); 555 Model ret = (cPtr == global::System.IntPtr.Zero) ? null : new Model(cPtr, false); 556 return ret; 557 } 558 559 560 /** 561 * Returns the first child element found that has the given @p id in the 562 * model-wide SId namespace, or @c null if no such object is found. 563 * 564 * @param id string representing the id of the object to find. 565 * 566 * @return pointer to the first element found with the given @p id. 567 */ public new getElementBySId(string id)568 SBase getElementBySId(string id) { 569 SBase ret = (SBase) libsbml.DowncastSBase(libsbmlPINVOKE.SBMLDocument_getElementBySId(swigCPtr, id), false); 570 return ret; 571 } 572 573 574 /** 575 * Returns the first child element it can find with the given @p metaid, or 576 * itself if it has the given @p metaid, or @c null if no such object is 577 * found. 578 * 579 * @param metaid string representing the metaid of the object to find. 580 * 581 * @return pointer to the first element found with the given @p metaid. 582 */ public new getElementByMetaId(string metaid)583 SBase getElementByMetaId(string metaid) { 584 SBase ret = (SBase) libsbml.DowncastSBase(libsbmlPINVOKE.SBMLDocument_getElementByMetaId(swigCPtr, metaid), false); 585 return ret; 586 } 587 588 589 /** 590 * Removes FunctionDefinition constructs from the document and expands 591 * any instances of their use within <code><math></code> elements. 592 * 593 * For example, suppose a Model contains a FunctionDefinition with 594 * identifier @c 'f' representing the math expression: <em>f(x, y) = x * 595 * y</em>. Suppose further that there is a reaction in which the 596 * <code><math></code> element of the KineticLaw object contains 597 * <code>f(s, p)</code>, where @c s and @c p are other identifiers 598 * defined in the model. The outcome of invoking this method is that the 599 * <code><math></code> of the KineticLaw now represents the 600 * expression <em>s * p</em> and the model no longer contains any 601 * FunctionDefinition objects. 602 * 603 * @return bool @c true if the transformation was successful, 604 * @c false, otherwise. 605 * 606 * @note This function will check the consistency of a model before 607 * attemptimg the transformation. If the model is not valid SBML, the 608 * transformation will not be performed and the function will return 609 * @c false. 610 */ public expandFunctionDefinitions()611 bool expandFunctionDefinitions() { 612 bool ret = libsbmlPINVOKE.SBMLDocument_expandFunctionDefinitions(swigCPtr); 613 return ret; 614 } 615 616 617 /** 618 * Removes InitialAssignment constructs from the document and 619 * replaces them with appropriate values. 620 * 621 * For example, suppose a Model contains a InitialAssignment to a symbol 622 * @c 'k' where @c 'k' is the identifier of a Parameter. The outcome of 623 * invoking this method is that the 'value' attribute of the Parameter 624 * definition is set to the result calculated using the InitialAssignment 625 * object's <code><math></code> formula, and the corresponding 626 * InitialAssignment is then removed from the Model. 627 * 628 * @return bool @c true if the transformation was successful, 629 * @c false, otherwise. 630 * 631 * @note This function will check the consistency of a model before 632 * attemptimg the transformation. If the model is not valid SBML, the 633 * transformation will not be performed and the function will return 634 * @c false. As part of that process, this method will check that it has 635 * values for any components referred to by the <code><math></code> 636 * elements of InitialAssignment objects. In cases where not all of the 637 * values have been declared (e.g., if the mathematical expression refers 638 * to model entities that have no declared values), the InitialAssignment 639 * in question will @em not be removed and this method will return 640 * @c false. 641 */ public expandInitialAssignments()642 bool expandInitialAssignments() { 643 bool ret = libsbmlPINVOKE.SBMLDocument_expandInitialAssignments(swigCPtr); 644 return ret; 645 } 646 647 648 /** 649 * Sets the SBML Level and Version of this SBMLDocument instance, 650 * attempting to convert the model as needed. 651 * 652 * This method is the principal way in libSBML to convert models between 653 * Levels and Versions of SBML. Generally, models can be converted 654 * upward without difficulty (e.g., from SBML Level 1 to 655 * Level 2, or from an earlier Version of Level 2 to the latest 656 * Version of Level 2). Sometimes models can be translated downward 657 * as well, if they do not use constructs specific to more advanced 658 * Levels of SBML. 659 * 660 * Before calling this method, callers may check compatibility directly 661 * using the methods SBMLDocument::checkL1Compatibility(), 662 * SBMLDocument::checkL2v1Compatibility(), 663 * SBMLDocument::checkL2v2Compatibility(), 664 * SBMLDocument::checkL2v3Compatibility(), 665 * SBMLDocument::checkL2v4Compatibility(), 666 * SBMLDocument::checkL2v5Compatibility(), 667 * SBMLDocument::checkL3v1Compatibility(), and 668 * SBMLDocument::checkL3v2Compatibility(). 669 * 670 * The valid combinations of SBML Level and Version as of this release 671 * of libSBML are the following: 672 * <ul> 673 * <li> Level 1 Version 2 674 * <li> Level 2 Version 1 675 * <li> Level 2 Version 2 676 * <li> Level 2 Version 3 677 * <li> Level 2 Version 4 678 * <li> Level 2 Version 5 679 * <li> Level 3 Version 1 680 * <li> Level 3 Version 2 681 * </ul> 682 * 683 * Strict conversion applies the additional criteria that both the 684 * source and the target model must be consistent SBML. Users can 685 * control the consistency checks that are applied using the 686 * SBMLDocument::setConsistencyChecksForConversion(@if java int, boolean@endif) method. If either 687 * the source or the potential target model have validation errors, the 688 * conversion is not performed. When a strict conversion is successful, 689 * the underlying SBML object model is altered to reflect the new level 690 * and version. Thus, information that cannot be converted 691 * (e.g. sboTerms) will be lost. 692 * 693 * @param level the desired SBML Level. 694 * 695 * @param version the desired Version within the SBML Level. 696 * 697 * @param strict boolean indicating whether to check consistency 698 * of both the source and target model when performing 699 * conversion (defaults to <code> true </code>). 700 * 701 * @param ignorePackages boolean indicating whether the presence of 702 * packages should be ignored by the conversion routine 703 * (defaults to <code> false </code>). 704 * 705 * @return @c true if the level and version of the document were 706 * successfully set to the requested values (which may have required 707 * conversion of the model), @c false otherwise. 708 * 709 * @note Calling this method will not @em necessarily lead to a successful 710 * conversion. If the conversion fails, it will be logged in the error 711 * list associated with this SBMLDocument. Callers should consult 712 * getNumErrors() to find out if the conversion succeeded without 713 * problems. For conversions from Level 2 to Level 1, callers 714 * can also check the Level of the model after calling this method to 715 * find out whether it is Level 1. (If the conversion to 716 * Level 1 failed, the Level of this model will be left unchanged.) 717 * 718 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 719 * 720 * @see checkL1Compatibility() 721 * @see checkL2v1Compatibility() 722 * @see checkL2v2Compatibility() 723 * @see checkL2v3Compatibility() 724 * @see checkL2v4Compatibility() 725 * @see checkL2v5Compatibility() 726 * @see checkL3v1Compatibility() 727 */ public setLevelAndVersion(long level, long version, bool strict, bool ignorePackages)728 bool setLevelAndVersion(long level, long version, bool strict, bool ignorePackages) { 729 bool ret = libsbmlPINVOKE.SBMLDocument_setLevelAndVersion__SWIG_0(swigCPtr, level, version, strict, ignorePackages); 730 return ret; 731 } 732 733 734 /** 735 * Sets the SBML Level and Version of this SBMLDocument instance, 736 * attempting to convert the model as needed. 737 * 738 * This method is the principal way in libSBML to convert models between 739 * Levels and Versions of SBML. Generally, models can be converted 740 * upward without difficulty (e.g., from SBML Level 1 to 741 * Level 2, or from an earlier Version of Level 2 to the latest 742 * Version of Level 2). Sometimes models can be translated downward 743 * as well, if they do not use constructs specific to more advanced 744 * Levels of SBML. 745 * 746 * Before calling this method, callers may check compatibility directly 747 * using the methods SBMLDocument::checkL1Compatibility(), 748 * SBMLDocument::checkL2v1Compatibility(), 749 * SBMLDocument::checkL2v2Compatibility(), 750 * SBMLDocument::checkL2v3Compatibility(), 751 * SBMLDocument::checkL2v4Compatibility(), 752 * SBMLDocument::checkL2v5Compatibility(), 753 * SBMLDocument::checkL3v1Compatibility(), and 754 * SBMLDocument::checkL3v2Compatibility(). 755 * 756 * The valid combinations of SBML Level and Version as of this release 757 * of libSBML are the following: 758 * <ul> 759 * <li> Level 1 Version 2 760 * <li> Level 2 Version 1 761 * <li> Level 2 Version 2 762 * <li> Level 2 Version 3 763 * <li> Level 2 Version 4 764 * <li> Level 2 Version 5 765 * <li> Level 3 Version 1 766 * <li> Level 3 Version 2 767 * </ul> 768 * 769 * Strict conversion applies the additional criteria that both the 770 * source and the target model must be consistent SBML. Users can 771 * control the consistency checks that are applied using the 772 * SBMLDocument::setConsistencyChecksForConversion(@if java int, boolean@endif) method. If either 773 * the source or the potential target model have validation errors, the 774 * conversion is not performed. When a strict conversion is successful, 775 * the underlying SBML object model is altered to reflect the new level 776 * and version. Thus, information that cannot be converted 777 * (e.g. sboTerms) will be lost. 778 * 779 * @param level the desired SBML Level. 780 * 781 * @param version the desired Version within the SBML Level. 782 * 783 * @param strict boolean indicating whether to check consistency 784 * of both the source and target model when performing 785 * conversion (defaults to <code> true </code>). 786 * 787 * @param ignorePackages boolean indicating whether the presence of 788 * packages should be ignored by the conversion routine 789 * (defaults to <code> false </code>). 790 * 791 * @return @c true if the level and version of the document were 792 * successfully set to the requested values (which may have required 793 * conversion of the model), @c false otherwise. 794 * 795 * @note Calling this method will not @em necessarily lead to a successful 796 * conversion. If the conversion fails, it will be logged in the error 797 * list associated with this SBMLDocument. Callers should consult 798 * getNumErrors() to find out if the conversion succeeded without 799 * problems. For conversions from Level 2 to Level 1, callers 800 * can also check the Level of the model after calling this method to 801 * find out whether it is Level 1. (If the conversion to 802 * Level 1 failed, the Level of this model will be left unchanged.) 803 * 804 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 805 * 806 * @see checkL1Compatibility() 807 * @see checkL2v1Compatibility() 808 * @see checkL2v2Compatibility() 809 * @see checkL2v3Compatibility() 810 * @see checkL2v4Compatibility() 811 * @see checkL2v5Compatibility() 812 * @see checkL3v1Compatibility() 813 */ public setLevelAndVersion(long level, long version, bool strict)814 bool setLevelAndVersion(long level, long version, bool strict) { 815 bool ret = libsbmlPINVOKE.SBMLDocument_setLevelAndVersion__SWIG_1(swigCPtr, level, version, strict); 816 return ret; 817 } 818 819 820 /** 821 * Sets the SBML Level and Version of this SBMLDocument instance, 822 * attempting to convert the model as needed. 823 * 824 * This method is the principal way in libSBML to convert models between 825 * Levels and Versions of SBML. Generally, models can be converted 826 * upward without difficulty (e.g., from SBML Level 1 to 827 * Level 2, or from an earlier Version of Level 2 to the latest 828 * Version of Level 2). Sometimes models can be translated downward 829 * as well, if they do not use constructs specific to more advanced 830 * Levels of SBML. 831 * 832 * Before calling this method, callers may check compatibility directly 833 * using the methods SBMLDocument::checkL1Compatibility(), 834 * SBMLDocument::checkL2v1Compatibility(), 835 * SBMLDocument::checkL2v2Compatibility(), 836 * SBMLDocument::checkL2v3Compatibility(), 837 * SBMLDocument::checkL2v4Compatibility(), 838 * SBMLDocument::checkL2v5Compatibility(), 839 * SBMLDocument::checkL3v1Compatibility(), and 840 * SBMLDocument::checkL3v2Compatibility(). 841 * 842 * The valid combinations of SBML Level and Version as of this release 843 * of libSBML are the following: 844 * <ul> 845 * <li> Level 1 Version 2 846 * <li> Level 2 Version 1 847 * <li> Level 2 Version 2 848 * <li> Level 2 Version 3 849 * <li> Level 2 Version 4 850 * <li> Level 2 Version 5 851 * <li> Level 3 Version 1 852 * <li> Level 3 Version 2 853 * </ul> 854 * 855 * Strict conversion applies the additional criteria that both the 856 * source and the target model must be consistent SBML. Users can 857 * control the consistency checks that are applied using the 858 * SBMLDocument::setConsistencyChecksForConversion(@if java int, boolean@endif) method. If either 859 * the source or the potential target model have validation errors, the 860 * conversion is not performed. When a strict conversion is successful, 861 * the underlying SBML object model is altered to reflect the new level 862 * and version. Thus, information that cannot be converted 863 * (e.g. sboTerms) will be lost. 864 * 865 * @param level the desired SBML Level. 866 * 867 * @param version the desired Version within the SBML Level. 868 * 869 * @param strict boolean indicating whether to check consistency 870 * of both the source and target model when performing 871 * conversion (defaults to <code> true </code>). 872 * 873 * @param ignorePackages boolean indicating whether the presence of 874 * packages should be ignored by the conversion routine 875 * (defaults to <code> false </code>). 876 * 877 * @return @c true if the level and version of the document were 878 * successfully set to the requested values (which may have required 879 * conversion of the model), @c false otherwise. 880 * 881 * @note Calling this method will not @em necessarily lead to a successful 882 * conversion. If the conversion fails, it will be logged in the error 883 * list associated with this SBMLDocument. Callers should consult 884 * getNumErrors() to find out if the conversion succeeded without 885 * problems. For conversions from Level 2 to Level 1, callers 886 * can also check the Level of the model after calling this method to 887 * find out whether it is Level 1. (If the conversion to 888 * Level 1 failed, the Level of this model will be left unchanged.) 889 * 890 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 891 * 892 * @see checkL1Compatibility() 893 * @see checkL2v1Compatibility() 894 * @see checkL2v2Compatibility() 895 * @see checkL2v3Compatibility() 896 * @see checkL2v4Compatibility() 897 * @see checkL2v5Compatibility() 898 * @see checkL3v1Compatibility() 899 */ public setLevelAndVersion(long level, long version)900 bool setLevelAndVersion(long level, long version) { 901 bool ret = libsbmlPINVOKE.SBMLDocument_setLevelAndVersion__SWIG_2(swigCPtr, level, version); 902 return ret; 903 } 904 905 906 /** */ /* libsbml-internal */ public updateSBMLNamespace(string package, long level, long version)907 void updateSBMLNamespace(string package, long level, long version) { 908 libsbmlPINVOKE.SBMLDocument_updateSBMLNamespace(swigCPtr, package, level, version); 909 } 910 911 912 /** 913 * Sets the Model for this SBMLDocument to a copy of the given Model. 914 * 915 * @param m the new Model to use. 916 * 917 * 918 * @return integer value indicating success/failure of the 919 * function. @if clike The value is drawn from the 920 * enumeration #OperationReturnValues_t. @endif The possible values 921 * returned by this function are: 922 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 923 * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink 924 * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink 925 * 926 * @see createModel() 927 * @see getModel() 928 */ public setModel(Model m)929 int setModel(Model m) { 930 int ret = libsbmlPINVOKE.SBMLDocument_setModel(swigCPtr, Model.getCPtr(m)); 931 return ret; 932 } 933 934 935 /** 936 * Creates a new Model inside this SBMLDocument, and returns a pointer to 937 * it. 938 * 939 * In SBML Level 2, the use of an identifier on a Model object is 940 * optional. This method takes an optional argument, @p sid, for setting 941 * the identifier. If not supplied, the identifier attribute on the 942 * Model instance is not set. 943 * 944 * @param sid the identifier of the new Model to create. 945 * 946 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 947 * 948 * @see getModel() 949 * @see SBMLDocument::setModel(@if java Model@endif) 950 */ public createModel(string sid)951 Model createModel(string sid) { 952 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_createModel__SWIG_0(swigCPtr, sid); 953 Model ret = (cPtr == global::System.IntPtr.Zero) ? null : new Model(cPtr, false); 954 return ret; 955 } 956 957 958 /** 959 * Creates a new Model inside this SBMLDocument, and returns a pointer to 960 * it. 961 * 962 * In SBML Level 2, the use of an identifier on a Model object is 963 * optional. This method takes an optional argument, @p sid, for setting 964 * the identifier. If not supplied, the identifier attribute on the 965 * Model instance is not set. 966 * 967 * @param sid the identifier of the new Model to create. 968 * 969 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 970 * 971 * @see getModel() 972 * @see SBMLDocument::setModel(@if java Model@endif) 973 */ public createModel()974 Model createModel() { 975 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_createModel__SWIG_1(swigCPtr); 976 Model ret = (cPtr == global::System.IntPtr.Zero) ? null : new Model(cPtr, false); 977 return ret; 978 } 979 980 981 /** 982 * Sets the location of this SBMLDocument. 983 * 984 * Called automatically when readSBMLFromFile is used, but may be set 985 * manually as well. 986 */ public setLocationURI(string uri)987 void setLocationURI(string uri) { 988 libsbmlPINVOKE.SBMLDocument_setLocationURI(swigCPtr, uri); 989 } 990 991 992 /** 993 * Get the location of this SBMLDocument. 994 * 995 * If this document was read from a file or had its location set manually, 996 * that filename or set location will be returned, otherwise, an empty 997 * string is returned. 998 */ public getLocationURI()999 string getLocationURI() { 1000 string ret = libsbmlPINVOKE.SBMLDocument_getLocationURI__SWIG_0(swigCPtr); 1001 return ret; 1002 } 1003 1004 1005 /** 1006 * Controls the consistency checks that are performed when 1007 * SBMLDocument::checkConsistency() is called. 1008 * 1009 * This method works by adding or subtracting consistency checks from the 1010 * set of all possible checks that SBMLDocument::checkConsistency() knows 1011 * how to perform. This method may need to be called multiple times in 1012 * order to achieve the desired combination of checks. The first 1013 * argument (@p category) in a call to this method indicates the category 1014 * of consistency/error checks that are to be turned on or off, and the 1015 * second argument (@p apply, a boolean) indicates whether to turn it on 1016 * (value of @c true) or off (value of @c false). 1017 * 1018 * @if clike 1019 * The possible categories (values to the argument @p category) are the 1020 * set of values from the enumeration #SBMLErrorCategory_t. 1021 * The following are the possible choices: 1022 * @endif@if java 1023 * The possible categories (values to the argument @p category) are the 1024 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1025 * in the interface class {@link libsbmlConstants}. 1026 * The following are the possible choices: 1027 * @endif@if python 1028 * The possible categories (values to the argument @p category) are the 1029 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1030 * in the interface class @link libsbml libsbml@endlink. 1031 * The following are the possible choices: 1032 * @endif 1033 * <ul> 1034 * <li> @link libsbml#LIBSBML_CAT_GENERAL_CONSISTENCY LIBSBML_CAT_GENERAL_CONSISTENCY@endlink: 1035 * Correctness and consistency of specific SBML language constructs. 1036 * Performing this set of checks is highly recommended. With respect to 1037 * the SBML specification, these concern failures in applying the 1038 * validation rules numbered 2xxxx in the Level 2 1039 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1040 * 1041 * <li> @link libsbml#LIBSBML_CAT_IDENTIFIER_CONSISTENCY LIBSBML_CAT_IDENTIFIER_CONSISTENCY@endlink: 1042 * Correctness and consistency of identifiers used for model entities. An 1043 * example of inconsistency would be using a species identifier in a 1044 * reaction rate formula without first having declared the species. With 1045 * respect to the SBML specification, these concern failures in applying 1046 * the validation rules numbered 103xx in the Level 2 1047 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1048 * 1049 * <li> @link libsbml#LIBSBML_CAT_UNITS_CONSISTENCY LIBSBML_CAT_UNITS_CONSISTENCY@endlink: 1050 * Consistency of measurement units associated with quantities in a model. 1051 * With respect to the SBML specification, these concern failures in 1052 * applying the validation rules numbered 105xx in the Level 2 1053 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1054 * 1055 * <li> @link libsbml#LIBSBML_CAT_MATHML_CONSISTENCY LIBSBML_CAT_MATHML_CONSISTENCY@endlink: 1056 * Syntax of MathML constructs. With respect to the SBML specification, 1057 * these concern failures in applying the validation rules numbered 102xx 1058 * in the Level 2 Versions 2–4 and Level 3 1059 * Versions 1–2 specifications. 1060 * 1061 * <li> @link libsbml#LIBSBML_CAT_SBO_CONSISTENCY LIBSBML_CAT_SBO_CONSISTENCY@endlink: 1062 * Consistency and validity of %SBO identifiers (if any) used in the model. 1063 * With respect to the SBML specification, these concern failures in 1064 * applying the validation rules numbered 107xx in the Level 2 1065 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1066 * 1067 * <li> @link libsbml#LIBSBML_CAT_OVERDETERMINED_MODEL LIBSBML_CAT_OVERDETERMINED_MODEL@endlink: 1068 * Static analysis of whether the system of equations implied by a model is 1069 * mathematically overdetermined. With respect to the SBML specification, 1070 * this is validation rule #10601 in the Level 2 1071 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1072 * 1073 * <li> @link libsbml#LIBSBML_CAT_MODELING_PRACTICE LIBSBML_CAT_MODELING_PRACTICE@endlink: 1074 * Additional checks for recommended good modeling practice. (These are 1075 * tests performed by libSBML and do not have equivalent SBML validation 1076 * rules.) </ul> 1077 * 1078 * <em>By default, all validation checks are applied</em> to the model in 1079 * an SBMLDocument object @em unless 1080 * SBMLDocument::setConsistencyChecks(@if java int categ, boolean onoff@endif) 1081 * is called to indicate that only a subset should be applied. Further, 1082 * this default (i.e., performing all checks) applies separately to 1083 * <em>each new SBMLDocument object</em> created. In other words, each 1084 * time a model is read using SBMLReader::readSBML(@if java String filename@endif), 1085 * SBMLReader::readSBMLFromString(@if java String xml@endif), 1086 * or the global functions readSBML() and readSBMLFromString(), a new 1087 * SBMLDocument is created and for that document, a call to 1088 * SBMLDocument::checkConsistency() will default to applying all possible checks. 1089 * Calling programs must invoke 1090 * SBMLDocument::setConsistencyChecks(@if java int categ, boolean onoff@endif) 1091 * for each such new model if they wish to change the consistency checks 1092 * applied. 1093 * 1094 * @param category a value drawn from @if clike #SBMLErrorCategory_t@else 1095 * the set of SBML error categories@endif indicating the 1096 * consistency checking/validation to be turned on or off. 1097 * 1098 * @param apply a boolean indicating whether the checks indicated by 1099 * @p category should be applied or not. 1100 * 1101 * @see SBMLDocument::checkConsistency() 1102 */ public setConsistencyChecks(int category, bool apply)1103 void setConsistencyChecks(int category, bool apply) { 1104 libsbmlPINVOKE.SBMLDocument_setConsistencyChecks(swigCPtr, category, apply); 1105 } 1106 1107 1108 /** 1109 * Controls the consistency checks that are performed when 1110 * SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) is called. 1111 * 1112 * This method works by adding or subtracting consistency checks from the 1113 * set of all possible checks that may be performed to avoid conversion 1114 * to or from an invalid document. This method may need to be called 1115 * multiple times in 1116 * order to achieve the desired combination of checks. The first 1117 * argument (@p category) in a call to this method indicates the category 1118 * of consistency/error checks that are to be turned on or off, and the 1119 * second argument (@p apply, a boolean) indicates whether to turn it on 1120 * (value of @c true) or off (value of @c false). 1121 * 1122 * @if clike 1123 * The possible categories (values to the argument @p category) are the 1124 * set of values from the enumeration #SBMLErrorCategory_t. 1125 * The following are the possible choices: 1126 * @endif@if java 1127 * The possible categories (values to the argument @p category) are the 1128 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1129 * in the interface class {@link libsbmlConstants}. 1130 * The following are the possible choices: 1131 * @endif@if python 1132 * The possible categories (values to the argument @p category) are the 1133 * set of constants whose names begin with the characters <code>LIBSBML_CAT_</code> 1134 * in the interface class @link libsbml libsbml@endlink. 1135 * The following are the possible choices: 1136 * @endif 1137 * <ul> 1138 * <li> @link libsbml#LIBSBML_CAT_GENERAL_CONSISTENCY LIBSBML_CAT_GENERAL_CONSISTENCY@endlink: 1139 * Correctness and consistency of specific SBML language constructs. 1140 * Performing this set of checks is highly recommended. With respect to 1141 * the SBML specification, these concern failures in applying the 1142 * validation rules numbered 2xxxx in the Level 2 1143 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1144 * 1145 * <li> @link libsbml#LIBSBML_CAT_IDENTIFIER_CONSISTENCY LIBSBML_CAT_IDENTIFIER_CONSISTENCY@endlink: 1146 * Correctness and consistency of identifiers used for model entities. An 1147 * example of inconsistency would be using a species identifier in a 1148 * reaction rate formula without first having declared the species. With 1149 * respect to the SBML specification, these concern failures in applying 1150 * the validation rules numbered 103xx in the Level 2 1151 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1152 * 1153 * <li> @link libsbml#LIBSBML_CAT_UNITS_CONSISTENCY LIBSBML_CAT_UNITS_CONSISTENCY@endlink: 1154 1155 * Consistency of measurement units associated with quantities in a model. 1156 * With respect to the SBML specification, these concern failures in 1157 * applying the validation rules numbered 105xx in the Level 2 1158 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1159 * 1160 * <li> @link libsbml#LIBSBML_CAT_MATHML_CONSISTENCY LIBSBML_CAT_MATHML_CONSISTENCY@endlink: 1161 * Syntax of MathML constructs. With respect to the SBML specification, 1162 * these concern failures in applying the validation rules numbered 102xx 1163 * in the Level 2 Versions 2–4 and Level 3 1164 * Versions 1–2 specifications. 1165 * 1166 * <li> @link libsbml#LIBSBML_CAT_SBO_CONSISTENCY LIBSBML_CAT_SBO_CONSISTENCY@endlink: 1167 * Consistency and validity of %SBO identifiers (if any) used in the model. 1168 * With respect to the SBML specification, these concern failures in 1169 * applying the validation rules numbered 107xx in the Level 2 1170 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1171 * 1172 * <li> @link libsbml#LIBSBML_CAT_OVERDETERMINED_MODEL LIBSBML_CAT_OVERDETERMINED_MODEL@endlink: 1173 * Static analysis of whether the system of equations implied by a model is 1174 * mathematically overdetermined. With respect to the SBML specification, 1175 * this is validation rule #10601 in the Level 2 1176 * Versions 2–4 and Level 3 Versions 1–2 specifications. 1177 * 1178 * <li> @link libsbml#LIBSBML_CAT_MODELING_PRACTICE LIBSBML_CAT_MODELING_PRACTICE@endlink: 1179 * Additional checks for recommended good modeling practice. (These are 1180 * tests performed by libSBML and do not have equivalent SBML validation 1181 * rules.) 1182 * </ul> 1183 * 1184 * <em>By default, all validation checks are applied</em> to the model in 1185 * an SBMLDocument object @em unless 1186 * SBMLDocument::setConsistencyChecks(@if java int, boolean@endif) 1187 * is called to indicate that only a subset should be applied. Further, 1188 * this default (i.e., performing all checks) applies separately to 1189 * <em>each new SBMLDocument object</em> created. In other words, each 1190 * time a model is read using SBMLReader::readSBML(@if java String@endif), 1191 * SBMLReader::readSBMLFromString(@if java String@endif), 1192 * or the global functions readSBML() and readSBMLFromString(), a new 1193 * SBMLDocument is created and for that document, a call to 1194 * SBMLDocument::checkConsistency() will default to applying all possible checks. 1195 * Calling programs must invoke 1196 * SBMLDocument::setConsistencyChecks(@if java int, boolean@endif) 1197 * for each such new model if they wish to change the consistency checks 1198 * applied. 1199 * 1200 * @param category a value drawn from @if clike #SBMLErrorCategory_t@else 1201 * the set of SBML error categories@endif indicating the consistency 1202 * checking/validation to be turned on or off. 1203 * 1204 * @param apply a boolean indicating whether the checks indicated by 1205 * @p category should be applied or not. 1206 * 1207 * @see SBMLDocument::setLevelAndVersion(@if java long, long, boolean@endif) 1208 */ public setConsistencyChecksForConversion(int category, bool apply)1209 void setConsistencyChecksForConversion(int category, bool apply) { 1210 libsbmlPINVOKE.SBMLDocument_setConsistencyChecksForConversion(swigCPtr, category, apply); 1211 } 1212 1213 1214 /** 1215 * Performs consistency checking and validation on this SBML document. 1216 * 1217 * If this method returns a nonzero value (meaning, one or more 1218 * consistency checks have failed for SBML document), the failures may be 1219 * due to warnings @em or errors. Callers should inspect the severity 1220 * flag in the individual SBMLError objects returned by 1221 * SBMLDocument::getError(@if java long@endif) to determine the nature of the failures. 1222 * 1223 * @return the number of failed checks (errors) encountered. 1224 * 1225 * @see SBMLDocument::checkInternalConsistency() 1226 */ public checkConsistency()1227 long checkConsistency() { return (long)libsbmlPINVOKE.SBMLDocument_checkConsistency(swigCPtr); } 1228 1229 1230 /** 1231 * Performs consistency checking and validation on this SBML document 1232 * using the ultra strict units validator that assumes that there 1233 * are no hidden numerical conversion factors. 1234 * 1235 * If this method returns a nonzero value (meaning, one or more 1236 * consistency checks have failed for SBML document), the failures may be 1237 * due to warnings @em or errors. Callers should inspect the severity 1238 * flag in the individual SBMLError objects returned by 1239 * SBMLDocument::getError(@if java long@endif) to determine the nature of the failures. 1240 * 1241 * @return the number of failed checks (errors) encountered. 1242 * 1243 * @see SBMLDocument::checkInternalConsistency() 1244 */ public checkConsistencyWithStrictUnits()1245 long checkConsistencyWithStrictUnits() { return (long)libsbmlPINVOKE.SBMLDocument_checkConsistencyWithStrictUnits(swigCPtr); } 1246 1247 1248 /** 1249 * Performs consistency checking and validation on this SBML document. 1250 * 1251 * If this method returns a nonzero value (meaning, one or more 1252 * consistency checks have failed for SBML document), the failures may be 1253 * due to warnings @em or errors. Callers should inspect the severity 1254 * flag in the individual SBMLError objects returned by 1255 * SBMLDocument::getError(@if java long@endif) to determine the nature of the failures. 1256 * 1257 * @note unlike checkConsistency this method will write the document 1258 * in order to determine all errors for the document. This will 1259 * also clear the error log. 1260 * 1261 * @return the number of failed checks (errors) encountered. 1262 * 1263 * @see SBMLDocument::checkConsistency() 1264 */ public validateSBML()1265 long validateSBML() { return (long)libsbmlPINVOKE.SBMLDocument_validateSBML(swigCPtr); } 1266 1267 1268 /** 1269 * Performs consistency checking on libSBML's internal representation of 1270 * an SBML Model. 1271 * 1272 * Callers should query the results of the consistency check by calling 1273 * SBMLDocument::getError(@if java long@endif). 1274 * 1275 * @return the number of failed checks (errors) encountered. 1276 * 1277 * The distinction between this method and 1278 * SBMLDocument::checkConsistency() is that this method reports on 1279 * fundamental syntactic and structural errors that violate the XML 1280 * Schema for SBML; by contrast, SBMLDocument::checkConsistency() 1281 * performs more elaborate model verifications and also validation 1282 * according to the validation rules written in the appendices of the 1283 * SBML Level 2 Versions 2–4 specification documents. 1284 * 1285 * @see SBMLDocument::checkConsistency() 1286 */ public checkInternalConsistency()1287 long checkInternalConsistency() { return (long)libsbmlPINVOKE.SBMLDocument_checkInternalConsistency(swigCPtr); } 1288 1289 1290 /** 1291 * Performs a set of consistency checks on the document to establish 1292 * whether it is compatible with SBML Level 1 and can be converted 1293 * to Level 1. 1294 * 1295 * Callers should query the results of the consistency check by calling 1296 * SBMLDocument::getError(@if java long@endif). 1297 * 1298 * @return the number of failed checks (errors) encountered. 1299 */ public checkL1Compatibility(bool inConversion)1300 long checkL1Compatibility(bool inConversion) { return (long)libsbmlPINVOKE.SBMLDocument_checkL1Compatibility__SWIG_0(swigCPtr, inConversion); } 1301 1302 1303 /** 1304 * Performs a set of consistency checks on the document to establish 1305 * whether it is compatible with SBML Level 1 and can be converted 1306 * to Level 1. 1307 * 1308 * Callers should query the results of the consistency check by calling 1309 * SBMLDocument::getError(@if java long@endif). 1310 * 1311 * @return the number of failed checks (errors) encountered. 1312 */ public checkL1Compatibility()1313 long checkL1Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL1Compatibility__SWIG_1(swigCPtr); } 1314 1315 1316 /** 1317 * Performs a set of consistency checks on the document to establish 1318 * whether it is compatible with SBML Level 2 Version 1 and can 1319 * be converted to Level 2 Version 1. 1320 * 1321 * Callers should query the results of the consistency check by calling 1322 * SBMLDocument::getError(@if java long@endif). 1323 * 1324 * @return the number of failed checks (errors) encountered. 1325 */ public checkL2v1Compatibility(bool inConversion)1326 long checkL2v1Compatibility(bool inConversion) { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v1Compatibility__SWIG_0(swigCPtr, inConversion); } 1327 1328 1329 /** 1330 * Performs a set of consistency checks on the document to establish 1331 * whether it is compatible with SBML Level 2 Version 1 and can 1332 * be converted to Level 2 Version 1. 1333 * 1334 * Callers should query the results of the consistency check by calling 1335 * SBMLDocument::getError(@if java long@endif). 1336 * 1337 * @return the number of failed checks (errors) encountered. 1338 */ public checkL2v1Compatibility()1339 long checkL2v1Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v1Compatibility__SWIG_1(swigCPtr); } 1340 1341 1342 /** 1343 * Performs a set of consistency checks on the document to establish 1344 * whether it is compatible with SBML Level 2 Version 2 and can 1345 * be converted to Level 2 Version 2. 1346 * 1347 * Callers should query the results of the consistency check by calling 1348 * SBMLDocument::getError(@if java long@endif). 1349 * 1350 * @return the number of failed checks (errors) encountered. 1351 */ public checkL2v2Compatibility(bool inConversion)1352 long checkL2v2Compatibility(bool inConversion) { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v2Compatibility__SWIG_0(swigCPtr, inConversion); } 1353 1354 1355 /** 1356 * Performs a set of consistency checks on the document to establish 1357 * whether it is compatible with SBML Level 2 Version 2 and can 1358 * be converted to Level 2 Version 2. 1359 * 1360 * Callers should query the results of the consistency check by calling 1361 * SBMLDocument::getError(@if java long@endif). 1362 * 1363 * @return the number of failed checks (errors) encountered. 1364 */ public checkL2v2Compatibility()1365 long checkL2v2Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v2Compatibility__SWIG_1(swigCPtr); } 1366 1367 1368 /** 1369 * Performs a set of consistency checks on the document to establish 1370 * whether it is compatible with SBML Level 2 Version 3 and can 1371 * be converted to Level 2 Version 3. 1372 * 1373 * Callers should query the results of the consistency check by calling 1374 * SBMLDocument::getError(@if java long@endif). 1375 * 1376 * @return the number of failed checks (errors) encountered. 1377 */ public checkL2v3Compatibility(bool inConversion)1378 long checkL2v3Compatibility(bool inConversion) { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v3Compatibility__SWIG_0(swigCPtr, inConversion); } 1379 1380 1381 /** 1382 * Performs a set of consistency checks on the document to establish 1383 * whether it is compatible with SBML Level 2 Version 3 and can 1384 * be converted to Level 2 Version 3. 1385 * 1386 * Callers should query the results of the consistency check by calling 1387 * SBMLDocument::getError(@if java long@endif). 1388 * 1389 * @return the number of failed checks (errors) encountered. 1390 */ public checkL2v3Compatibility()1391 long checkL2v3Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v3Compatibility__SWIG_1(swigCPtr); } 1392 1393 1394 /** 1395 * Performs a set of consistency checks on the document to establish 1396 * whether it is compatible with SBML Level 2 Version 4 and can 1397 * be converted to Level 2 Version 4. 1398 * 1399 * Callers should query the results of the consistency check by calling 1400 * SBMLDocument::getError(@if java long@endif). 1401 * 1402 * @return the number of failed checks (errors) encountered. 1403 */ public checkL2v4Compatibility()1404 long checkL2v4Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v4Compatibility(swigCPtr); } 1405 1406 1407 /** 1408 * Performs a set of consistency checks on the document to establish 1409 * whether it is compatible with SBML Level 2 Version 5 and can 1410 * be converted to Level 2 Version 5. 1411 * 1412 * Callers should query the results of the consistency check by calling 1413 * SBMLDocument::getError(@if java long@endif). 1414 * 1415 * @return the number of failed checks (errors) encountered. 1416 */ public checkL2v5Compatibility()1417 long checkL2v5Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v5Compatibility(swigCPtr); } 1418 1419 1420 /** 1421 * Performs a set of consistency checks on the document to establish 1422 * whether it is compatible with SBML Level 3 Version 1 and can 1423 * be converted to Level 3 Version 1. 1424 * 1425 * Callers should query the results of the consistency check by calling 1426 * SBMLDocument::getError(@if java long@endif). 1427 * 1428 * @return the number of failed checks (errors) encountered. 1429 */ public checkL3v1Compatibility()1430 long checkL3v1Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL3v1Compatibility(swigCPtr); } 1431 1432 1433 /** 1434 * Performs a set of consistency checks on the document to establish 1435 * whether it is compatible with SBML Level 3 Version 2 and can 1436 * be converted to Level 3 Version 2. 1437 * 1438 * Callers should query the results of the consistency check by calling 1439 * SBMLDocument::getError(@if java long@endif). 1440 * 1441 * @return the number of failed checks (errors) encountered. 1442 */ public checkL3v2Compatibility()1443 long checkL3v2Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL3v2Compatibility(swigCPtr); } 1444 1445 1446 /** 1447 * Returns the nth error or warning encountered during parsing, 1448 * consistency checking, or attempted translation of this model. 1449 * 1450 * Callers can use method XMLError::getSeverity() on the result to assess 1451 * the severity of the problem. The possible severity levels range from 1452 * informational messages to fatal errors. 1453 * 1454 * @return the error or warning indexed by integer @p n, or return 1455 * @c null if <code>n > (getNumErrors() - 1)</code>. 1456 * 1457 * @param n the integer index of the error sought. 1458 * 1459 * @see SBMLDocument::getNumErrors() 1460 */ public getError(long n)1461 SBMLError getError(long n) { 1462 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getError(swigCPtr, n); 1463 SBMLError ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLError(cPtr, false); 1464 return ret; 1465 } 1466 1467 1468 /** 1469 * Returns the nth error or warning with the given severity 1470 * encountered during parsing, consistency checking, or attempted 1471 * translation of this model. 1472 * 1473 * @return the error or warning indexed by integer @p n, or return 1474 * @c null if <code>n > (getNumErrors(severity) - 1)</code>. 1475 * 1476 * @param n the integer index of the error sought. 1477 * @param severity the severity of the error sought. 1478 * 1479 * @see SBMLDocument::getNumErrors() 1480 */ public getErrorWithSeverity(long n, long severity)1481 SBMLError getErrorWithSeverity(long n, long severity) { 1482 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getErrorWithSeverity(swigCPtr, n, severity); 1483 SBMLError ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLError(cPtr, false); 1484 return ret; 1485 } 1486 1487 1488 /** 1489 * Returns the number of errors or warnings encountered during parsing, 1490 * consistency checking, or attempted translation of this model. 1491 * 1492 * @return the number of errors or warnings encountered. 1493 * 1494 * @see SBMLDocument::getError(unsigned int n) 1495 */ public getNumErrors()1496 long getNumErrors() { return (long)libsbmlPINVOKE.SBMLDocument_getNumErrors__SWIG_0(swigCPtr); } 1497 1498 1499 /** 1500 * Returns the number of errors or warnings encountered with the given 1501 * severity during parsing, 1502 * consistency checking, or attempted translation of this model. 1503 * 1504 * @param severity the severity of the error sought. 1505 * 1506 * @return the number of errors or warnings encountered. 1507 * 1508 * @see SBMLDocument::getError(unsigned int n) 1509 */ public getNumErrors(long severity)1510 long getNumErrors(long severity) { return (long)libsbmlPINVOKE.SBMLDocument_getNumErrors__SWIG_1(swigCPtr, severity); } 1511 1512 1513 /** 1514 * Prints all the errors or warnings encountered trying to parse, 1515 * check, or translate this SBML document. 1516 * 1517 * It prints the text to the stream given by the optional parameter @p 1518 * stream. If no parameter is given, it prints the output to the 1519 * standard error stream. 1520 * 1521 * If no errors have occurred, i.e., <code>getNumErrors() == 0</code>, no 1522 * output will be sent to the stream. 1523 * 1524 * The format of the output is: 1525 * @verbatim 1526 N error(s): 1527 line NNN: (id) message 1528 @endverbatim 1529 * 1530 * @param stream the ostream or ostringstream object indicating where 1531 * the output should be printed. 1532 * 1533 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 1534 * 1535 * @see getNumErrors() 1536 * @see getErrorLog() 1537 * @see SBMLDocument::getError(unsigned int n) 1538 */ public printErrors(OStream stream)1539 void printErrors(OStream stream) { 1540 libsbmlPINVOKE.SBMLDocument_printErrors__SWIG_0(swigCPtr, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream())); 1541 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 1542 } 1543 1544 1545 /** 1546 * Prints all the errors or warnings encountered trying to parse, 1547 * check, or translate this SBML document. 1548 * 1549 * It prints the text to the stream given by the optional parameter @p 1550 * stream. If no parameter is given, it prints the output to the 1551 * standard error stream. 1552 * 1553 * If no errors have occurred, i.e., <code>getNumErrors() == 0</code>, no 1554 * output will be sent to the stream. 1555 * 1556 * The format of the output is: 1557 * @verbatim 1558 N error(s): 1559 line NNN: (id) message 1560 @endverbatim 1561 * 1562 * @param stream the ostream or ostringstream object indicating where 1563 * the output should be printed. 1564 * 1565 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 1566 * 1567 * @see getNumErrors() 1568 * @see getErrorLog() 1569 * @see SBMLDocument::getError(unsigned int n) 1570 */ public printErrors()1571 void printErrors() { 1572 libsbmlPINVOKE.SBMLDocument_printErrors__SWIG_1(swigCPtr); 1573 } 1574 1575 1576 /** 1577 * Prints all the errors or warnings with the given severity encountered 1578 * trying to parse, check, or translate this SBML document. 1579 * 1580 * It prints the text to the stream given by the parameter @p 1581 * stream. 1582 * 1583 * If no errors have occurred, i.e., <code>getNumErrors(severity) == 0</code>, no 1584 * output will be sent to the stream. 1585 * 1586 * The format of the output is: 1587 * @verbatim 1588 N error(s): 1589 line NNN: (id) message 1590 @endverbatim 1591 * 1592 * @param stream the ostream or ostringstream object indicating where 1593 * the output should be printed. 1594 * @param severity of the errors sought. 1595 * 1596 * @see getNumErrors(unsigned int severity) 1597 * @see getErrorLog() 1598 * @see SBMLDocument::getErrorWithSeverity(unsigned int n, unsigned int severity) 1599 */ public printErrors(OStream stream, long severity)1600 void printErrors(OStream stream, long severity) { 1601 libsbmlPINVOKE.SBMLDocument_printErrors__SWIG_2(swigCPtr, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), severity); 1602 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 1603 } 1604 connectToChild()1605 public override void connectToChild() { 1606 libsbmlPINVOKE.SBMLDocument_connectToChild(swigCPtr); 1607 } 1608 1609 1610 /** 1611 * Converts this document using the converter that best matches 1612 * the given conversion properties. 1613 * 1614 * @param props the conversion properties to use. 1615 * 1616 * 1617 * @return integer value indicating success/failure of the 1618 * function. @if clike The value is drawn from the 1619 * enumeration #OperationReturnValues_t. @endif The possible values 1620 * returned by this function are: 1621 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1622 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 1623 * @li @link libsbml#LIBSBML_CONV_CONVERSION_NOT_AVAILABLE LIBSBML_CONV_CONVERSION_NOT_AVAILABLE@endlink 1624 */ public new convert(ConversionProperties props)1625 int convert(ConversionProperties props) { 1626 int ret = libsbmlPINVOKE.SBMLDocument_convert(swigCPtr, ConversionProperties.getCPtr(props)); 1627 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 1628 return ret; 1629 } 1630 1631 1632 /** */ /* libsbml-internal */ public new enablePackageInternal(string pkgURI, string pkgPrefix, bool flag)1633 void enablePackageInternal(string pkgURI, string pkgPrefix, bool flag) { 1634 libsbmlPINVOKE.SBMLDocument_enablePackageInternal(swigCPtr, pkgURI, pkgPrefix, flag); 1635 } 1636 1637 1638 /** 1639 * Returns the libSBML type code for this %SBML object. 1640 * 1641 * 1642 * 1643 * LibSBML attaches an identifying code to every kind of SBML object. These 1644 * are integer constants known as <em>SBML type codes</em>. The names of all 1645 * the codes begin with the characters <code>SBML_</code>. 1646 * @if clike The set of possible type codes for core elements is defined in 1647 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for 1648 * SBML Level 3 packages define their own extra enumerations of type 1649 * codes (e.g., #SBMLLayoutTypeCode_t for the Level 3 Layout 1650 * package).@endif@if java In the Java language interface for libSBML, the 1651 * type codes are defined as static integer constants in the interface class 1652 * {@link libsbmlConstants}. @endif@if python In the Python language 1653 * interface for libSBML, the type codes are defined as static integer 1654 * constants in the interface class @link libsbml@endlink.@endif@if csharp In 1655 * the C# language interface for libSBML, the type codes are defined as 1656 * static integer constants in the interface class 1657 * @link libsbmlcs.libsbml@endlink.@endif Note that different Level 3 1658 * package plug-ins may use overlapping type codes; to identify the package 1659 * to which a given object belongs, call the 1660 * <code>@if conly SBase_getPackageName() 1661 * @else SBase::getPackageName() 1662 * @endif</code> 1663 * method on the object. 1664 * 1665 * The exception to this is lists: all SBML-style list elements have the type 1666 * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they 1667 * are from. 1668 * 1669 * 1670 * 1671 * @return the SBML type code for this object: 1672 * @link libsbml#SBML_DOCUMENT SBML_DOCUMENT@endlink (default). 1673 * 1674 * 1675 * @warning <span class='warning'>The specific integer values of the possible 1676 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 1677 * packages, To fully identify the correct code, <strong>it is necessary to 1678 * invoke both getPackageName() and getTypeCode()</strong> (or 1679 * ListOf::getItemTypeCode()).</span> 1680 * 1681 * 1682 * 1683 * @see SBMLDocument::getElementName() 1684 * @see getPackageName() 1685 */ public new getTypeCode()1686 int getTypeCode() { 1687 int ret = libsbmlPINVOKE.SBMLDocument_getTypeCode(swigCPtr); 1688 return ret; 1689 } 1690 1691 1692 /** 1693 * Returns the XML element name of this object, which for SBMLDocument, 1694 * is always @c 'sbml'. 1695 * 1696 * @return the name of this element, i.e., @c 'sbml'. 1697 */ public new getElementName()1698 string getElementName() { 1699 string ret = libsbmlPINVOKE.SBMLDocument_getElementName(swigCPtr); 1700 return ret; 1701 } 1702 1703 1704 /** 1705 * Returns the list of errors or warnings logged during parsing, 1706 * consistency checking, or attempted translation of this model. 1707 * 1708 * @return the SBMLErrorLog used for this SBMLDocument. 1709 * 1710 * @see SBMLDocument::getNumErrors() 1711 */ public getErrorLog()1712 SBMLErrorLog getErrorLog() { 1713 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getErrorLog__SWIG_0(swigCPtr); 1714 SBMLErrorLog ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLErrorLog(cPtr, false); 1715 return ret; 1716 } 1717 1718 1719 /** 1720 * Returns a list of XML Namespaces associated with the XML content 1721 * of this SBML document. 1722 * 1723 * @return the XML Namespaces associated with this SBML object. 1724 */ public new getNamespaces()1725 XMLNamespaces getNamespaces() { 1726 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getNamespaces(swigCPtr); 1727 XMLNamespaces ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNamespaces(cPtr, false); 1728 return ret; 1729 } 1730 1731 1732 /** 1733 * Set/unset default namespace to each top-level element defined in the 1734 * given package extension. 1735 * 1736 * This works by adding a <code>xmlns="..."</code> attribute. No 1737 * prefix will be written when writing elements defined in the given 1738 * package extension if @c true is given as second argument. 1739 * 1740 * @param package the name or URI of the package extension. 1741 * @param flag boolean value to indicate whether to write a namespace 1742 * prefix. 1743 * 1744 * 1745 * @return integer value indicating success/failure of the 1746 * function. @if clike The value is drawn from the 1747 * enumeration #OperationReturnValues_t. @endif The possible values 1748 * returned by this function are: 1749 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1750 * @li @link libsbml#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION@endlink 1751 */ public enableDefaultNS(string package, bool flag)1752 int enableDefaultNS(string package, bool flag) { 1753 int ret = libsbmlPINVOKE.SBMLDocument_enableDefaultNS(swigCPtr, package, flag); 1754 return ret; 1755 } 1756 1757 1758 /** 1759 * Returns @c true if a default namespace is added to each top-level 1760 * element defined in the given package extension, otherwise returns 1761 * @c false. 1762 * 1763 * This basically checks if the attribute 1764 * <code>xmlns="..."</code> is present. 1765 * 1766 * @param package the name or URI of the package extension. 1767 * 1768 * @return a boolean indicating whether the given package's default namespace is enabled. 1769 */ public isEnabledDefaultNS(string package)1770 bool isEnabledDefaultNS(string package) { 1771 bool ret = libsbmlPINVOKE.SBMLDocument_isEnabledDefaultNS(swigCPtr, package); 1772 return ret; 1773 } 1774 1775 1776 /** 1777 * Sets the <code>required</code> attribute value of the given package 1778 * extension. 1779 * 1780 * @param package the name or URI of the package extension. 1781 * @param flag Boolean value indicating whether the package is required. 1782 * 1783 * 1784 * @return integer value indicating success/failure of the 1785 * function. @if clike The value is drawn from the 1786 * enumeration #OperationReturnValues_t. @endif The possible values 1787 * returned by this function are: 1788 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1789 * @li @link libsbml#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION@endlink 1790 */ public setPackageRequired(string package, bool flag)1791 int setPackageRequired(string package, bool flag) { 1792 int ret = libsbmlPINVOKE.SBMLDocument_setPackageRequired(swigCPtr, package, flag); 1793 return ret; 1794 } 1795 1796 1797 /** 1798 * Returns the <code>required</code> attribute of the given package 1799 * extension. 1800 * 1801 * @param package the name or URI of the package extension. 1802 * 1803 * @return Boolean flag indicating whether the package is flagged as 1804 * being required. 1805 */ public getPackageRequired(string package)1806 bool getPackageRequired(string package) { 1807 bool ret = libsbmlPINVOKE.SBMLDocument_getPackageRequired(swigCPtr, package); 1808 return ret; 1809 } 1810 1811 1812 /** 1813 * Returns @c true if the required attribute of the given package extension 1814 * is defined, otherwise returns @c false. 1815 * 1816 * @param package the name or URI of the package extension. 1817 * 1818 * @return a Boolean indicating whether the package's 'required' flag is set. 1819 */ public isSetPackageRequired(string package)1820 bool isSetPackageRequired(string package) { 1821 bool ret = libsbmlPINVOKE.SBMLDocument_isSetPackageRequired(swigCPtr, package); 1822 return ret; 1823 } 1824 1825 1826 /** 1827 * Returns @c true if the given package extension is one of an ignored 1828 * packages, otherwise returns @c false. 1829 * 1830 * An ignored package is one that is defined to be used in this SBML 1831 * document, but the package is not enabled in this copy of libSBML. 1832 * 1833 * @param pkgURI the URI of the package extension. 1834 * 1835 * @return a Boolean, @c true if the package is being ignored and 1836 * @c false otherwise. 1837 */ public isIgnoredPackage(string pkgURI)1838 bool isIgnoredPackage(string pkgURI) { 1839 bool ret = libsbmlPINVOKE.SBMLDocument_isIgnoredPackage(swigCPtr, pkgURI); 1840 return ret; 1841 } 1842 1843 1844 /** 1845 * Returns @c true if the given package extension is one of an ignored 1846 * packages that has been disabled, otherwise returns @c false. 1847 * 1848 * An ignored package is one that is defined to be used in this SBML 1849 * document, but the package is not enabled in this copy of libSBML. 1850 * It may have been disabled to avoid reproducing the package 1851 * information when writing out the file. 1852 * 1853 * @param pkgURI the URI of the package extension. 1854 * 1855 * @return a Boolean, @c true if the package is being ignored and 1856 * @c false otherwise. 1857 */ public isDisabledIgnoredPackage(string pkgURI)1858 bool isDisabledIgnoredPackage(string pkgURI) { 1859 bool ret = libsbmlPINVOKE.SBMLDocument_isDisabledIgnoredPackage(swigCPtr, pkgURI); 1860 return ret; 1861 } 1862 1863 1864 /** 1865 * Sets the value of the <code>required</code> attribute for the given 1866 * package. 1867 * 1868 * @param package the name or URI of the package extension. 1869 * @param flag a Boolean value. 1870 * 1871 * 1872 * @return integer value indicating success/failure of the 1873 * function. @if clike The value is drawn from the 1874 * enumeration #OperationReturnValues_t. @endif The possible values 1875 * returned by this function are: 1876 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1877 * @li @link libsbml#LIBSBML_PKG_UNKNOWN_VERSION LIBSBML_PKG_UNKNOWN_VERSION@endlink 1878 * 1879 * @deprecated Replaced in libSBML 5.2.0 by 1880 * setPackageRequired(@if java String, boolean@endif) 1881 */ public setPkgRequired(string package, bool flag)1882 int setPkgRequired(string package, bool flag) { 1883 int ret = libsbmlPINVOKE.SBMLDocument_setPkgRequired(swigCPtr, package, flag); 1884 return ret; 1885 } 1886 1887 1888 /** 1889 * Returns the <code>required</code> attribute of the given package 1890 * extension. 1891 * 1892 * @param package the name or URI of the package extension. 1893 * 1894 * @return a Boolean value indicating whether the package is flagged as 1895 * being required in this SBML document. 1896 * 1897 * @deprecated Replaced in libSBML 5.2.0 by 1898 * getPackageRequired(@if java String@endif) 1899 */ public getPkgRequired(string package)1900 bool getPkgRequired(string package) { 1901 bool ret = libsbmlPINVOKE.SBMLDocument_getPkgRequired(swigCPtr, package); 1902 return ret; 1903 } 1904 1905 1906 /** 1907 * Returns @c true if the required attribute of the given package extension 1908 * is defined, otherwise returns @c false. 1909 * 1910 * @param package the name or URI of the package extension. 1911 * 1912 * @return a Boolean value. 1913 * 1914 * @deprecated Replaced in libSBML 5.2.0 by 1915 * isSetPackageRequired(@if java String@endif) 1916 */ public isSetPkgRequired(string package)1917 bool isSetPkgRequired(string package) { 1918 bool ret = libsbmlPINVOKE.SBMLDocument_isSetPkgRequired(swigCPtr, package); 1919 return ret; 1920 } 1921 1922 1923 /** 1924 * Returns @c true if the given package extension is one of ignored 1925 * packages, otherwise returns @c false. 1926 * 1927 * An ignored package is one that is defined to be used in this SBML 1928 * document, but the package is not enabled in this copy of libSBML. 1929 * 1930 * @param pkgURI the URI of the package extension. 1931 * 1932 * @return a boolean indicating whether the given package is being ignored. 1933 * 1934 * @deprecated Replaced in libSBML 5.2.0 by 1935 * isIgnoredPackage(@if java String@endif) 1936 */ public isIgnoredPkg(string pkgURI)1937 bool isIgnoredPkg(string pkgURI) { 1938 bool ret = libsbmlPINVOKE.SBMLDocument_isIgnoredPkg(swigCPtr, pkgURI); 1939 return ret; 1940 } 1941 1942 1943 /** */ /* libsbml-internal */ public getApplicableValidators()1944 byte getApplicableValidators() { 1945 byte ret = libsbmlPINVOKE.SBMLDocument_getApplicableValidators(swigCPtr); 1946 return ret; 1947 } 1948 1949 1950 /** */ /* libsbml-internal */ public getConversionValidators()1951 byte getConversionValidators() { 1952 byte ret = libsbmlPINVOKE.SBMLDocument_getConversionValidators(swigCPtr); 1953 return ret; 1954 } 1955 1956 1957 /** */ /* libsbml-internal */ public setApplicableValidators(byte appl)1958 void setApplicableValidators(byte appl) { 1959 libsbmlPINVOKE.SBMLDocument_setApplicableValidators(swigCPtr, appl); 1960 } 1961 1962 1963 /** */ /* libsbml-internal */ public setConversionValidators(byte appl)1964 void setConversionValidators(byte appl) { 1965 libsbmlPINVOKE.SBMLDocument_setConversionValidators(swigCPtr, appl); 1966 } 1967 1968 1969 /** */ /* libsbml-internal */ public getNumValidators()1970 long getNumValidators() { return (long)libsbmlPINVOKE.SBMLDocument_getNumValidators(swigCPtr); } 1971 1972 1973 /** */ /* libsbml-internal */ public clearValidators()1974 int clearValidators() { 1975 int ret = libsbmlPINVOKE.SBMLDocument_clearValidators(swigCPtr); 1976 return ret; 1977 } 1978 1979 1980 /** */ /* libsbml-internal */ public addValidator(SBMLValidator validator)1981 int addValidator(SBMLValidator validator) { 1982 int ret = libsbmlPINVOKE.SBMLDocument_addValidator(swigCPtr, SBMLValidator.getCPtr(validator)); 1983 return ret; 1984 } 1985 1986 1987 /** */ /* libsbml-internal */ public getValidator(long index)1988 SBMLValidator getValidator(long index) { 1989 global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getValidator(swigCPtr, index); 1990 SBMLValidator ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLValidator(cPtr, false); 1991 return ret; 1992 } 1993 1994 1995 /** */ /* libsbml-internal */ public addUnknownPackageRequired(string pkgURI, string prefix, bool flag)1996 int addUnknownPackageRequired(string pkgURI, string prefix, bool flag) { 1997 int ret = libsbmlPINVOKE.SBMLDocument_addUnknownPackageRequired(swigCPtr, pkgURI, prefix, flag); 1998 return ret; 1999 } 2000 2001 2002 /** */ /* libsbml-internal */ public hasUnknownPackage(string pkgURI)2003 bool hasUnknownPackage(string pkgURI) { 2004 bool ret = libsbmlPINVOKE.SBMLDocument_hasUnknownPackage(swigCPtr, pkgURI); 2005 return ret; 2006 } 2007 2008 2009 /** */ /* libsbml-internal */ public getNumUnknownPackages()2010 int getNumUnknownPackages() { 2011 int ret = libsbmlPINVOKE.SBMLDocument_getNumUnknownPackages(swigCPtr); 2012 return ret; 2013 } 2014 2015 2016 /** */ /* libsbml-internal */ public getUnknownPackageURI(int index)2017 string getUnknownPackageURI(int index) { 2018 string ret = libsbmlPINVOKE.SBMLDocument_getUnknownPackageURI(swigCPtr, index); 2019 return ret; 2020 } 2021 2022 2023 /** */ /* libsbml-internal */ public getUnknownPackagePrefix(int index)2024 string getUnknownPackagePrefix(int index) { 2025 string ret = libsbmlPINVOKE.SBMLDocument_getUnknownPackagePrefix(swigCPtr, index); 2026 return ret; 2027 } 2028 2029 } 2030 2031 } 2032