001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.8 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 * <span class="pkg-marker pkg-color-comp"><a href="group__comp.html">comp</a></span> 013 A reference to an externally-defined model. 014 <p> 015 * The {@link ExternalModelDefinition} class was introduced by the SBML Level 3 016 * 'Hierarchical Model Composition' 017 * package (“comp”) to define references to {@link Model} 018 * objects defined in other files. 019 <p> 020 * {@link ExternalModelDefinition} objects are model definitions—in and of 021 * themselves, they are definitions of models but not uses of those models. 022 * The class provides a way to declare and identify them so that {@link Model} 023 * objects in the present SBML document can use them in {@link Submodel} objects. 024 <p> 025 * {@link ExternalModelDefinition} contains two required attributes 026 * ('source' and 'id') and three optional attributes 027 * ('modelRef', 'md5' and 'name'). 028 <p> 029 * The 'id' attribute serves to provide a handle for the external 030 * model reference so that {@link Submodel} objects can refer to it. Crucially, 031 * it is not the identifier of the model being referenced; rather, 032 * it is an identifier for this {@link ExternalModelDefinition} object within the 033 * current SBML document. The 'id' attribute takes a required value 034 * of type SId, and must be unique across all {@link Model} and {@link ExternalModelDefinition} 035 * objects present in the document. 036 <p> 037 * {@link ExternalModelDefinition} also has an optional 'name' attribute, of 038 * type 'string'. The 'name' attribute may be used to provide 039 * a human-readable description of the ExternalModelDefintion object. 040 <p> 041 * The required attribute 'source' is used to locate the SBML document 042 * containing an external model definition. The value of this attribute must 043 * be of type anyURI. Since URIs may be either URLs, URNs, or relative or 044 * absolute file locations, this offers flexibility in referencing SBML 045 * documents. In all cases, the 'source' attribute value must refer 046 * specifically to an SBML Level 3 Version 1 document; prior 047 * Levels/Versions of SBML are not supported by this package. The entire 048 * file at the given location is referenced. The 'source' attribute must 049 * have a value for every {@link ExternalModelDefinition} instance. 050 <p> 051 * {@link ExternalModelDefinition}'s optional attribute 'modelRef', of type 052 * SIdRef, is used to identify a {@link Model} or 053 * {@link ExternalModelDefinition} object within the SBML document located at 054 * 'source'. The object referenced may be the main model in the 055 * document, or it may be a model definition contained in the SBML 056 * document's {@link ListOfModelDefinitions} or 057 * {@link ListOfExternalModelDefinitions} lists. Loops are not allowed: it 058 * must be possible to follow a chain of {@link ExternalModelDefinition} objects 059 * to its end in a {@link Model} object. 060 <p> 061 * In core SBML, the 'id' on {@link Model} is an optional attribute, and therefore, 062 * it is possible that the {@link Model} object in a given SBML document does not 063 * have an identifier. In that case, there is no value to give to the 064 * 'modelRef' attribute in {@link ExternalModelDefinition}. If 'modelRef' does not 065 * have a value, then the main model (i.e., the <code><model></code> 066 * element within the <code><sbml></code> element) in the referenced 067 * file is interpreted as being the model referenced by this 068 * {@link ExternalModelDefinition} instance. 069 <p> 070 * Finally, the optional 'md5' attribute takes a string value. If 071 * set, it must be an MD5 checksum value computed over the document 072 * referenced by 'source'. This checksum can serve as a data 073 * integrity check over the contents of the 'source'. Applications 074 * may use this to verify that the contents have not changed since the time 075 * that the {@link ExternalModelDefinition} reference was constructed. 076 */ 077 078public class ExternalModelDefinition extends CompBase { 079 private long swigCPtr; 080 081 protected ExternalModelDefinition(long cPtr, boolean cMemoryOwn) 082 { 083 super(libsbmlJNI.ExternalModelDefinition_SWIGUpcast(cPtr), cMemoryOwn); 084 swigCPtr = cPtr; 085 } 086 087 protected static long getCPtr(ExternalModelDefinition obj) 088 { 089 return (obj == null) ? 0 : obj.swigCPtr; 090 } 091 092 protected static long getCPtrAndDisown (ExternalModelDefinition obj) 093 { 094 long ptr = 0; 095 096 if (obj != null) 097 { 098 ptr = obj.swigCPtr; 099 obj.swigCMemOwn = false; 100 } 101 102 return ptr; 103 } 104 105 protected void finalize() { 106 delete(); 107 } 108 109 public synchronized void delete() { 110 if (swigCPtr != 0) { 111 if (swigCMemOwn) { 112 swigCMemOwn = false; 113 libsbmlJNI.delete_ExternalModelDefinition(swigCPtr); 114 } 115 swigCPtr = 0; 116 } 117 super.delete(); 118 } 119 120 121/** 122 * Creates a new {@link ExternalModelDefinition} with the given level, version, and 123 * package version. 124 <p> 125 * @param level the SBML Level 126 * @param version the Version within the SBML Level 127 * @param pkgVersion the version of the package 128 */ public 129 ExternalModelDefinition(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 130 this(libsbmlJNI.new_ExternalModelDefinition__SWIG_0(level, version, pkgVersion), true); 131 } 132 133 134/** 135 * Creates a new {@link ExternalModelDefinition} with the given level, version, and 136 * package version. 137 <p> 138 * @param level the SBML Level 139 * @param version the Version within the SBML Level 140 * @param pkgVersion the version of the package 141 */ public 142 ExternalModelDefinition(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 143 this(libsbmlJNI.new_ExternalModelDefinition__SWIG_1(level, version), true); 144 } 145 146 147/** 148 * Creates a new {@link ExternalModelDefinition} with the given level, version, and 149 * package version. 150 <p> 151 * @param level the SBML Level 152 * @param version the Version within the SBML Level 153 * @param pkgVersion the version of the package 154 */ public 155 ExternalModelDefinition(long level) throws org.sbml.libsbml.SBMLConstructorException { 156 this(libsbmlJNI.new_ExternalModelDefinition__SWIG_2(level), true); 157 } 158 159 160/** 161 * Creates a new {@link ExternalModelDefinition} with the given level, version, and 162 * package version. 163 <p> 164 * @param level the SBML Level 165 * @param version the Version within the SBML Level 166 * @param pkgVersion the version of the package 167 */ public 168 ExternalModelDefinition() throws org.sbml.libsbml.SBMLConstructorException { 169 this(libsbmlJNI.new_ExternalModelDefinition__SWIG_3(), true); 170 } 171 172 173/** 174 * Creates a new {@link ExternalModelDefinition} with the given {@link CompPkgNamespaces} 175 * object. 176 <p> 177 * @param compns the namespace to use. 178 */ public 179 ExternalModelDefinition(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 180 this(libsbmlJNI.new_ExternalModelDefinition__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 181 } 182 183 184/** 185 * Copy constructor. 186 <p> 187 * @param source the object to copy. 188 */ public 189 ExternalModelDefinition(ExternalModelDefinition source) throws org.sbml.libsbml.SBMLConstructorException { 190 this(libsbmlJNI.new_ExternalModelDefinition__SWIG_5(ExternalModelDefinition.getCPtr(source), source), true); 191 } 192 193 194/** 195 * Creates and returns a deep copy of this {@link ExternalModelDefinition} object. 196 <p> 197 * @return a (deep) copy of this {@link ExternalModelDefinition} object 198 */ public 199 SBase cloneObject() { 200 long cPtr = libsbmlJNI.ExternalModelDefinition_cloneObject(swigCPtr, this); 201 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, true); 202 } 203 204 205/** 206 * Sets the value of the 'id' attribute of this {@link ExternalModelDefinition}. 207 <p> 208 * This method fails if the <code>id</code> is not a valid syntax for an SId. 209 <p> 210 * @param id the identifier to use 211 <p> 212 * <p> 213 * @return integer value indicating success/failure of the 214 * function. The possible values 215 * returned by this function are: 216 * <ul> 217 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 218 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 219 * </ul> 220 */ public 221 int setId(String id) { 222 return libsbmlJNI.ExternalModelDefinition_setId(swigCPtr, this, id); 223 } 224 225 226/** 227 * Returns the value of the 'id' attribute of this {@link ExternalModelDefinition}. 228 <p> 229 * @return the name of this {@link ExternalModelDefinition}. 230 */ public 231 String getId() { 232 return libsbmlJNI.ExternalModelDefinition_getId(swigCPtr, this); 233 } 234 235 236/** 237 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 238 * object's 'id' attribute has been set. 239 <p> 240 * <em>Some words of explanation about the</em> 241<code>set</code>/<code>unset</code>/<code>isSet</code> <em>methods</em>: 242The SBML specifications define certain attributes on some classes of 243objects as being optional. This requires an application to be careful 244about the distinction between two cases when reading a model: (1) a given 245attribute has <em>never</em> been set to a value, and therefore should be 246assumed to have the SBML-defined default value if one exists, and (2) a 247given attribute has been set to a value, but the value happens to be an 248empty string. The situation can be ambiguous when reading a model from a 249file or data stream and then examining the data objects that libSBML 250constructs as a result. LibSBML supports these distinctions by providing 251methods to set, unset, and query the status of attributes that are 252optional. The methods have names of the form <code>set</code><em><span 253class="placeholder">Attribute</span></em><code>(...)</code>, 254<code>unset</code><em><span 255class="placeholder">Attribute</span></em><code>()</code>, and 256<code>isSet</code><em><span 257class="placeholder">Attribute</span></em><code>()</code>, where <em><span 258class="placeholder">Attribute</span></em> is the the name of the optional 259attribute in question. 260 261 <p> 262 * @return <code>true</code> if the 'id' attribute of this object has been 263 * set, <code>false</code> otherwise. 264 */ public 265 boolean isSetId() { 266 return libsbmlJNI.ExternalModelDefinition_isSetId(swigCPtr, this); 267 } 268 269 270/** 271 * Unsets the value of the 'id' attribute of this {@link ExternalModelDefinition}. 272 <p> 273 * <p> 274 * @return integer value indicating success/failure of the 275 * function. The possible values 276 * returned by this function are: 277 * <ul> 278 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 279 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 280 * </ul> 281 */ public 282 int unsetId() { 283 return libsbmlJNI.ExternalModelDefinition_unsetId(swigCPtr, this); 284 } 285 286 287/** 288 * Sets the value of the 'name' attribute of this {@link ExternalModelDefinition}. 289 <p> 290 * The string in <code>name</code> is copied. 291 <p> 292 * @param name the new name for the {@link ExternalModelDefinition} 293 <p> 294 * <p> 295 * @return integer value indicating success/failure of the 296 * function. The possible values 297 * returned by this function are: 298 * <ul> 299 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 300 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 301 * </ul> 302 */ public 303 int setName(String name) { 304 return libsbmlJNI.ExternalModelDefinition_setName(swigCPtr, this, name); 305 } 306 307 308/** 309 * Returns the value of the 'name' attribute of this 310 * {@link ExternalModelDefinition}. 311 <p> 312 * @return the name of this {@link ExternalModelDefinition}. 313 */ public 314 String getName() { 315 return libsbmlJNI.ExternalModelDefinition_getName(swigCPtr, this); 316 } 317 318 319/** 320 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 321 * object's 'name' attribute has been set. 322 <p> 323 * <em>Some words of explanation about the</em> 324<code>set</code>/<code>unset</code>/<code>isSet</code> <em>methods</em>: 325The SBML specifications define certain attributes on some classes of 326objects as being optional. This requires an application to be careful 327about the distinction between two cases when reading a model: (1) a given 328attribute has <em>never</em> been set to a value, and therefore should be 329assumed to have the SBML-defined default value if one exists, and (2) a 330given attribute has been set to a value, but the value happens to be an 331empty string. The situation can be ambiguous when reading a model from a 332file or data stream and then examining the data objects that libSBML 333constructs as a result. LibSBML supports these distinctions by providing 334methods to set, unset, and query the status of attributes that are 335optional. The methods have names of the form <code>set</code><em><span 336class="placeholder">Attribute</span></em><code>(...)</code>, 337<code>unset</code><em><span 338class="placeholder">Attribute</span></em><code>()</code>, and 339<code>isSet</code><em><span 340class="placeholder">Attribute</span></em><code>()</code>, where <em><span 341class="placeholder">Attribute</span></em> is the the name of the optional 342attribute in question. 343 344 <p> 345 * @return <code>true</code> if the 'name' attribute of this object has been 346 * set, <code>false</code> otherwise. 347 */ public 348 boolean isSetName() { 349 return libsbmlJNI.ExternalModelDefinition_isSetName(swigCPtr, this); 350 } 351 352 353/** 354 * Unsets the value of the 'name' attribute of this 355 * {@link ExternalModelDefinition}. 356 <p> 357 * <p> 358 * @return integer value indicating success/failure of the 359 * function. The possible values 360 * returned by this function are: 361 * <ul> 362 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 363 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 364 * </ul> 365 */ public 366 int unsetName() { 367 return libsbmlJNI.ExternalModelDefinition_unsetName(swigCPtr, this); 368 } 369 370 371/** 372 * Returns the value of the 'modelRef' attribute of this 373 * {@link ExternalModelDefinition}. 374 <p> 375 * @return the value of the 'modelRef' attribute of this 376 * {@link ExternalModelDefinition}. 377 */ public 378 String getModelRef() { 379 return libsbmlJNI.ExternalModelDefinition_getModelRef(swigCPtr, this); 380 } 381 382 383/** 384 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 385 * {@link ExternalModelDefinition}'s 'modelRef' attribute has been set. 386 <p> 387 * @return <code>true</code> if this {@link ExternalModelDefinition}'s 'modelRef' attribute 388 * has been set, otherwise <code>false</code> is returned. 389 */ public 390 boolean isSetModelRef() { 391 return libsbmlJNI.ExternalModelDefinition_isSetModelRef(swigCPtr, this); 392 } 393 394 395/** 396 * Sets the value of the 'modelRef' attribute of this 397 * {@link ExternalModelDefinition}. Fails if the <code>id</code> is not a valid syntax for an 398 * SIdRef. 399 <p> 400 * <p> 401 * @return integer value indicating success/failure of the 402 * function. The possible values 403 * returned by this function are: 404 * <ul> 405 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 406 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 407 * </ul> 408 */ public 409 int setModelRef(String id) { 410 return libsbmlJNI.ExternalModelDefinition_setModelRef(swigCPtr, this, id); 411 } 412 413 414/** 415 * Unsets the value of the 'modelRef' attribute of this 416 * {@link ExternalModelDefinition}. 417 <p> 418 * <p> 419 * @return integer value indicating success/failure of the 420 * function. The possible values 421 * returned by this function are: 422 * <ul> 423 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 424 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 425 * </ul> 426 */ public 427 int unsetModelRef() { 428 return libsbmlJNI.ExternalModelDefinition_unsetModelRef(swigCPtr, this); 429 } 430 431 432/** 433 * Returns the value of the 'md5' attribute of this 434 * {@link ExternalModelDefinition}. 435 <p> 436 * @return the value of the 'md5' attribute of this 437 * {@link ExternalModelDefinition}. 438 */ public 439 String getMd5() { 440 return libsbmlJNI.ExternalModelDefinition_getMd5(swigCPtr, this); 441 } 442 443 444/** 445 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 446 * {@link ExternalModelDefinition}'s 'md5' attribute has been set. 447 <p> 448 * @return <code>true</code> if this {@link ExternalModelDefinition}'s 'md5' attribute has 449 * been set, otherwise <code>false</code> is returned. 450 */ public 451 boolean isSetMd5() { 452 return libsbmlJNI.ExternalModelDefinition_isSetMd5(swigCPtr, this); 453 } 454 455 456/** 457 * Sets the value of the 'md5' attribute of this {@link ExternalModelDefinition}. 458 <p> 459 * <p> 460 * @return integer value indicating success/failure of the 461 * function. The possible values 462 * returned by this function are: 463 * <ul> 464 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 465 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 466 * </ul> 467 */ public 468 int setMd5(String md5) { 469 return libsbmlJNI.ExternalModelDefinition_setMd5(swigCPtr, this, md5); 470 } 471 472 473/** 474 * Unsets the value of the 'md5' attribute of this {@link ExternalModelDefinition}. 475 <p> 476 * <p> 477 * @return integer value indicating success/failure of the 478 * function. The possible values 479 * returned by this function are: 480 * <ul> 481 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 482 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 483 * </ul> 484 */ public 485 int unsetMd5() { 486 return libsbmlJNI.ExternalModelDefinition_unsetMd5(swigCPtr, this); 487 } 488 489 490/** 491 * Returns the value of the 'source' attribute of this 492 * {@link ExternalModelDefinition}. 493 <p> 494 * @return the value of the 'source' attribute of this 495 * {@link ExternalModelDefinition}. 496 */ public 497 String getSource() { 498 return libsbmlJNI.ExternalModelDefinition_getSource(swigCPtr, this); 499 } 500 501 502/** 503 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 504 * {@link ExternalModelDefinition}'s 'source' attribute has been set. 505 <p> 506 * @return <code>true</code> if this {@link ExternalModelDefinition}'s 'source' attribute has 507 * been set, otherwise <code>false</code> is returned. 508 */ public 509 boolean isSetSource() { 510 return libsbmlJNI.ExternalModelDefinition_isSetSource(swigCPtr, this); 511 } 512 513 514/** 515 * Sets the value of the 'source' attribute of this 516 * {@link ExternalModelDefinition}. 517 <p> 518 * @param source the value to use for the 'source' attribute. 519 <p> 520 * <p> 521 * @return integer value indicating success/failure of the 522 * function. The possible values 523 * returned by this function are: 524 * <ul> 525 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 526 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 527 * </ul> 528 */ public 529 int setSource(String source) { 530 return libsbmlJNI.ExternalModelDefinition_setSource(swigCPtr, this, source); 531 } 532 533 534/** 535 * Unsets the value of the 'source' attribute of this 536 * {@link ExternalModelDefinition}. 537 <p> 538 * <p> 539 * @return integer value indicating success/failure of the 540 * function. The possible values 541 * returned by this function are: 542 * <ul> 543 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 544 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 545 * </ul> 546 */ public 547 int unsetSource() { 548 return libsbmlJNI.ExternalModelDefinition_unsetSource(swigCPtr, this); 549 } 550 551 552/** 553 * Returns true if the 'modelRef' and 'id' attributes are set, and false if not. 554 <p> 555 * This method does not check to see if the referred-to model actually 556 * exists. 557 <p> 558 * @return boolean: <code>true</code> if the attributes are correctly set; <code>false</code> 559 * if not. 560 */ public 561 boolean hasRequiredAttributes() { 562 return libsbmlJNI.ExternalModelDefinition_hasRequiredAttributes(swigCPtr, this); 563 } 564 565 566/** 567 * Returns the XML element name of this SBML object. 568 <p> 569 * @return the name of this element, as a text string. 570 */ public 571 String getElementName() { 572 return libsbmlJNI.ExternalModelDefinition_getElementName(swigCPtr, this); 573 } 574 575 576/** 577 * Returns the libSBML type code of this object instance. 578 <p> 579 * <p> 580 * LibSBML attaches an identifying code to every kind of SBML object. These 581 * are integer constants known as <em>SBML type codes</em>. The names of all 582 * the codes begin with the characters <code>SBML_</code>. 583 * In the Java language interface for libSBML, the 584 * type codes are defined as static integer constants in the interface class 585 * {@link libsbmlConstants}. Note that different Level 3 586 * package plug-ins may use overlapping type codes; to identify the package 587 * to which a given object belongs, call the <code>getPackageName()</code> 588 * method on the object. 589 <p> 590 * @return the SBML type code for this object: 591 * {@link libsbmlConstants#SBML_COMP_EXTERNALMODELDEFINITION SBML_COMP_EXTERNALMODELDEFINITION} 592 <p> 593 * <p> 594 * @warning <span class='warning'>The specific integer values of the possible 595 * type codes may be reused by different Level 3 package plug-ins. 596 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 597 * both getTypeCode() and getPackageName()</strong>.</span> 598 <p> 599 * @see #getElementName() 600 * @see #getPackageName() 601 */ public 602 int getTypeCode() { 603 return libsbmlJNI.ExternalModelDefinition_getTypeCode(swigCPtr, this); 604 } 605 606 607/** 608 * Resolves and returns the referenced {@link Model} object of this {@link ExternalModelDefinition}. 609 * If none can be found, an error is set and null is returned. The 610 * returned {@link Model} is a non-owning pointer to the model; the original 611 * {@link Model} is saved (along with the {@link SBMLDocument} from which it comes) as 612 * a child of the {@link CompSBMLDocumentPlugin} of the {@link SBMLDocument} to which this 613 * {@link Model} belongs. If this {@link ExternalModelDefinition} is not part of any 614 * {@link SBMLDocument}, null will be returned. 615 */ public 616 Model getReferencedModel() { 617 long cPtr = libsbmlJNI.ExternalModelDefinition_getReferencedModel(swigCPtr, this); 618 return (cPtr == 0) ? null : new Model(cPtr, false); 619 } 620 621}