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