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