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 Submodel construct from the 014 * “comp” package. 015 <p> 016 * The {@link Submodel} class was introduced by the SBML Level 3 017 * 'Hierarchical Model Composition' package 018 * (“comp”) as the principle way by which models are structured 019 * hierarchically. Submodels are instantiations of models contained within 020 * other models. They reference another {@link Model} that is to be instantiated 021 * within its parent {@link Model}, and additionally define how that {@link Model} is to be 022 * modified before instantiation. 023 <p> 024 * The {@link Submodel} object class has a required attribute 'modelRef', which must 025 * reference another {@link Model} or {@link ExternalModelDefinition} object present in the 026 * SBML Document. This referenced {@link Model} is the model to be instantiated. 027 <p> 028 * It also has a required attribute, 'id', to give the submodel a unique 029 * identifier by which other parts of an SBML model definition can refer to 030 * it, and an optional 'name' attribute of type <code>string.</code> Identifiers and 031 * names must be used according to the guidelines described in the SBML 032 * specification. 033 <p> 034 * The {@link Submodel} class also provides constructs that define how the referenced 035 * {@link Model} object is to be modified before it is instantiated in the enclosing 036 * model. If numerical values in the referenced model must be changed in order 037 * to fit them into their new context as part of the submodel, the changes can 038 * be handled through conversion factors. If one or more structural features 039 * in the referenced model are undesirable and should be removed, the changes 040 * can be handled through deletions. (For example, an initial assignment or 041 * reaction may not be relevant in its new context and should be removed.) 042 <p> 043 * In some cases, the referenced {@link Model} may have been written with different 044 * units than the containing model. For most model elements, this is not a 045 * problem: it is already possible to have {@link Species} and {@link Parameter} objects with 046 * different units in a single model, for example, so in this case the 047 * resulting hierarchical model would be treated in exactly the same way as 048 * any other model with {@link Species} and Parameters with different units. 049 <p> 050 * However, two units in SBML models are fixed and must not vary between SBML 051 * elements: time and extent. The units of time are set once per model, and 052 * affect the core elements of {@link RateRule}, {@link KineticLaw}, {@link Delay}, and the 053 * csymbols 'time' and 'delay'. Even if the model does not explicitly state 054 * what the units of time actually are, they are defined to be consistent 055 * across the model, and therefore might differ from the units of time across 056 * a parent model. To correct this imbalance, the optional attribute 057 * 'timeConversionFactor' may be used, which, if defined, must reference a 058 * constant parameter in the parent model. The value of the time conversion 059 * factor should be defined such that a single unit of time in the {@link Submodel} 060 * multiplied by the time conversion factor should equal a single unit of 061 * time in the parent model. 062 <p> 063 * Extent is the unit in SBML that defines how the {@link KineticLaw} of a {@link Reaction} 064 * affects species quantities: kinetic laws are defined to be in units of 065 * extent/time. No other SBML core construct is defined in terms of extent. 066 * If the effective units of extent in a submodel differ from the effective 067 * units of extent in the parent model (regardless of whether either defined 068 * what those units actually are), the optional attribute 069 * 'extentConversionFactor' may be used, which, if defined, must reference a 070 * constant parameter in the parent model. The value of the extent conversion 071 * factor should be defined such that a single unit of extent in the {@link Submodel} 072 * multiplied by the extent conversion factor should equal a single unit of 073 * extent in the parent model. 074 <p> 075 * If features of the referenced model must be removed, a {@link Deletion} should be added 076 * to the {@link Submodel} object. A {@link Submodel} may contain a child {@link ListOfDeletions}, which 077 * in turn may contain one or more {@link Deletion} items. Each {@link Deletion} references a single 078 * element of the referenced {@link Model} that must be removed before instantiating that 079 * {@link Model} as a submodel of the parent {@link Model}. 080 */ 081 082public class Submodel extends CompBase { 083 private long swigCPtr; 084 085 protected Submodel(long cPtr, boolean cMemoryOwn) 086 { 087 super(libsbmlJNI.Submodel_SWIGUpcast(cPtr), cMemoryOwn); 088 swigCPtr = cPtr; 089 } 090 091 protected static long getCPtr(Submodel obj) 092 { 093 return (obj == null) ? 0 : obj.swigCPtr; 094 } 095 096 protected static long getCPtrAndDisown (Submodel obj) 097 { 098 long ptr = 0; 099 100 if (obj != null) 101 { 102 ptr = obj.swigCPtr; 103 obj.swigCMemOwn = false; 104 } 105 106 return ptr; 107 } 108 109 protected void finalize() { 110 delete(); 111 } 112 113 public synchronized void delete() { 114 if (swigCPtr != 0) { 115 if (swigCMemOwn) { 116 swigCMemOwn = false; 117 libsbmlJNI.delete_Submodel(swigCPtr); 118 } 119 swigCPtr = 0; 120 } 121 super.delete(); 122 } 123 124 125/** 126 * Creates a new {@link Submodel} with the given level, version, and package 127 * version. 128 <p> 129 * @param level the SBML Level 130 * @param version the Version within the SBML Level 131 * @param pkgVersion the version of the package 132 */ public 133 Submodel(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 134 this(libsbmlJNI.new_Submodel__SWIG_0(level, version, pkgVersion), true); 135 } 136 137 138/** 139 * Creates a new {@link Submodel} with the given level, version, and package 140 * version. 141 <p> 142 * @param level the SBML Level 143 * @param version the Version within the SBML Level 144 * @param pkgVersion the version of the package 145 */ public 146 Submodel(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 147 this(libsbmlJNI.new_Submodel__SWIG_1(level, version), true); 148 } 149 150 151/** 152 * Creates a new {@link Submodel} with the given level, version, and package 153 * version. 154 <p> 155 * @param level the SBML Level 156 * @param version the Version within the SBML Level 157 * @param pkgVersion the version of the package 158 */ public 159 Submodel(long level) throws org.sbml.libsbml.SBMLConstructorException { 160 this(libsbmlJNI.new_Submodel__SWIG_2(level), true); 161 } 162 163 164/** 165 * Creates a new {@link Submodel} with the given level, version, and package 166 * version. 167 <p> 168 * @param level the SBML Level 169 * @param version the Version within the SBML Level 170 * @param pkgVersion the version of the package 171 */ public 172 Submodel() throws org.sbml.libsbml.SBMLConstructorException { 173 this(libsbmlJNI.new_Submodel__SWIG_3(), true); 174 } 175 176 177/** 178 * Creates a new {@link Submodel} with the given {@link CompPkgNamespaces} object. 179 <p> 180 * @param compns the namespace to use 181 */ public 182 Submodel(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 183 this(libsbmlJNI.new_Submodel__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 184 } 185 186 187/** 188 * Copy constructor. 189 */ public 190 Submodel(Submodel source) throws org.sbml.libsbml.SBMLConstructorException { 191 this(libsbmlJNI.new_Submodel__SWIG_5(Submodel.getCPtr(source), source), true); 192 } 193 194 195/** 196 * Creates and returns a deep copy of this {@link Submodel} object. 197 <p> 198 * @return a (deep) copy of this {@link Submodel} object 199 */ public 200 SBase cloneObject() { 201 long cPtr = libsbmlJNI.Submodel_cloneObject(swigCPtr, this); 202 return (cPtr == 0) ? null : new Submodel(cPtr, true); 203 } 204 205 206/** 207 * Returns the first child element found that has the given <code>id</code> in the 208 * model-wide SId namespace, or <code>null</code> if no such object is found. 209 <p> 210 * @param id string representing the id of objects to find 211 <p> 212 * @return a pointer to the {@link SBase} element with the given <code>id</code>. 213 */ public 214 SBase getElementBySId(String id) { 215 return libsbml.DowncastSBase(libsbmlJNI.Submodel_getElementBySId(swigCPtr, this, id), false); 216} 217 218 219/** 220 * Returns the first child element it can find with the given <code>metaid</code>, or 221 * itself if it has the given <code>metaid</code>, or <code>null</code> if no such object is found. 222 <p> 223 * @param metaid string representing the metaid of objects to find 224 <p> 225 * @return a pointer to the {@link SBase} element with the given <code>metaid</code>. 226 */ public 227 SBase getElementByMetaId(String metaid) { 228 return libsbml.DowncastSBase(libsbmlJNI.Submodel_getElementByMetaId(swigCPtr, this, metaid), false); 229} 230 231 232/** 233 * Returns the value of the 'id' attribute of this {@link Submodel}. 234 <p> 235 * @return the value of the 'id' attribute of this {@link Submodel}. 236 */ public 237 String getId() { 238 return libsbmlJNI.Submodel_getId(swigCPtr, this); 239 } 240 241 242/** 243 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 244 * {@link Submodel}'s 'id' attribute has been set. 245 <p> 246 * @return <code>true</code> if this {@link Submodel}'s 'id' attribute has been set, 247 * otherwise <code>false</code> is returned. 248 */ public 249 boolean isSetId() { 250 return libsbmlJNI.Submodel_isSetId(swigCPtr, this); 251 } 252 253 254/** 255 * Sets the value of the 'id' attribute of this {@link Submodel}. Fails if the id 256 * is not a valid syntax for an SId. 257 <p> 258 * @return integer value indicating success/failure of the 259 * operation. The possible return values are: 260 * <ul> 261 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 262 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 263 * </ul> 264 */ public 265 int setId(String id) { 266 return libsbmlJNI.Submodel_setId(swigCPtr, this, id); 267 } 268 269 270/** 271 * Unsets the value of the 'id' attribute of this {@link Submodel}. 272 <p> 273 * @return integer value indicating success/failure of the 274 * operation. The possible return values are: 275 * <ul> 276 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 277 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 278 * </ul> 279 */ public 280 int unsetId() { 281 return libsbmlJNI.Submodel_unsetId(swigCPtr, this); 282 } 283 284 285/** 286 * Returns the value of the 'name' attribute of this {@link Submodel}. 287 <p> 288 * @return the value of the 'name' attribute of this {@link Submodel}. 289 */ public 290 String getName() { 291 return libsbmlJNI.Submodel_getName(swigCPtr, this); 292 } 293 294 295/** 296 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 297 * {@link Submodel}'s 'name' attribute has been set. 298 <p> 299 * @return <code>true</code> if this {@link Submodel}'s 'name' attribute has been set, 300 * otherwise <code>false</code> is returned. 301 */ public 302 boolean isSetName() { 303 return libsbmlJNI.Submodel_isSetName(swigCPtr, this); 304 } 305 306 307/** 308 * Sets the value of the 'name' attribute of this {@link Submodel}. Fails if the 309 * name is empty. 310 <p> 311 * @return integer value indicating success/failure of the 312 * operation. The possible return values are: 313 * <ul> 314 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 315 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 316 * </ul> 317 */ public 318 int setName(String name) { 319 return libsbmlJNI.Submodel_setName(swigCPtr, this, name); 320 } 321 322 323/** 324 * Unsets the value of the 'name' attribute of this {@link Submodel}. 325 <p> 326 * @return integer value indicating success/failure of the 327 * operation. The possible return values are: 328 * <ul> 329 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 330 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 331 * </ul> 332 */ public 333 int unsetName() { 334 return libsbmlJNI.Submodel_unsetName(swigCPtr, this); 335 } 336 337 338/** 339 * Returns the value of the 'modelRef' attribute of this {@link Submodel}. 340 <p> 341 * @return the value of the 'modelRef' attribute of this {@link Submodel}. 342 */ public 343 String getModelRef() { 344 return libsbmlJNI.Submodel_getModelRef(swigCPtr, this); 345 } 346 347 348/** 349 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 350 * {@link Submodel}'s 'modelRef' attribute has been set. 351 <p> 352 * @return <code>true</code> if this {@link Submodel}'s 'modelRef' attribute has been set, 353 * otherwise <code>false</code> is returned. 354 */ public 355 boolean isSetModelRef() { 356 return libsbmlJNI.Submodel_isSetModelRef(swigCPtr, this); 357 } 358 359 360/** 361 * Sets the value of the 'modelRef' attribute of this {@link Submodel}. Fails if 362 * the modelRef is not a valid syntax for an SIdRef. 363 <p> 364 * @return integer value indicating success/failure of the 365 * operation. The possible return values are: 366 * <ul> 367 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 368 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 369 * </ul> 370 */ public 371 int setModelRef(String modelRef) { 372 return libsbmlJNI.Submodel_setModelRef(swigCPtr, this, modelRef); 373 } 374 375 376/** 377 * Unsets the value of the 'modelRef' attribute of this {@link Submodel}. 378 <p> 379 * @return integer value indicating success/failure of the 380 * operation. The possible return values are: 381 * <ul> 382 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 383 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 384 * </ul> 385 */ public 386 int unsetModelRef() { 387 return libsbmlJNI.Submodel_unsetModelRef(swigCPtr, this); 388 } 389 390 391/** 392 * Returns an empty string, since 'substanceConversionFactor' is not a part of the comp spec. 393 <p> 394 * @return an empty string 395 */ public 396 String getSubstanceConversionFactor() { 397 return libsbmlJNI.Submodel_getSubstanceConversionFactor(swigCPtr, this); 398 } 399 400 401/** 402 * Returns <code>false</code>, since 'substanceConversionFactor' is not a part of the comp spec. 403 <p> 404 * @return <code>false.</code> 405 */ public 406 boolean isSetSubstanceConversionFactor() { 407 return libsbmlJNI.Submodel_isSetSubstanceConversionFactor(swigCPtr, this); 408 } 409 410 411/** 412 * Automatically fails, since 'substanceConversionFactor' is not a part of the comp spec. 413 <p> 414 * @return integer value indicating success/failure of the 415 * operation. The possible return value is: 416 * <ul> 417 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 418 * </ul> 419 */ public 420 int setSubstanceConversionFactor(String id) { 421 return libsbmlJNI.Submodel_setSubstanceConversionFactor(swigCPtr, this, id); 422 } 423 424 425/** 426 * Automatically fails, since 'substanceConversionFactor' is not a part of the comp spec. 427 <p> 428 * @return integer value indicating success/failure of the 429 * operation. The possible return value is: 430 * <ul> 431 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 432 * </ul> 433 */ public 434 int unsetSubstanceConversionFactor() { 435 return libsbmlJNI.Submodel_unsetSubstanceConversionFactor(swigCPtr, this); 436 } 437 438 439/** 440 * Returns the value of the 'timeConversionFactor' attribute of this {@link Submodel}. 441 <p> 442 * @return the value of the 'timeConversionFactor' attribute of this {@link Submodel}. 443 */ public 444 String getTimeConversionFactor() { 445 return libsbmlJNI.Submodel_getTimeConversionFactor(swigCPtr, this); 446 } 447 448 449/** 450 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 451 * {@link Submodel}'s 'timeConversionFactor' attribute has been set. 452 <p> 453 * @return <code>true</code> if this {@link Submodel}'s 'timeConversionFactor' attribute has been set, 454 * otherwise <code>false</code> is returned. 455 */ public 456 boolean isSetTimeConversionFactor() { 457 return libsbmlJNI.Submodel_isSetTimeConversionFactor(swigCPtr, this); 458 } 459 460 461/** 462 * Sets the value of the 'timeConversionFactor' attribute of this {@link Submodel}. 463 * Fails if the id is not a valid syntax for an SIdRef. 464 <p> 465 * @return integer value indicating success/failure of the 466 * operation. The possible return values are: 467 * <ul> 468 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 469 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 470 * </ul> 471 */ public 472 int setTimeConversionFactor(String id) { 473 return libsbmlJNI.Submodel_setTimeConversionFactor(swigCPtr, this, id); 474 } 475 476 477/** 478 * Unsets the value of the 'timeConversionFactor' attribute of this {@link Submodel}. 479 <p> 480 * @return integer value indicating success/failure of the 481 * operation. The possible return values are: 482 * <ul> 483 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 484 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 485 * </ul> 486 */ public 487 int unsetTimeConversionFactor() { 488 return libsbmlJNI.Submodel_unsetTimeConversionFactor(swigCPtr, this); 489 } 490 491 492/** 493 * Returns the value of the 'extentConversionFactor' attribute of this {@link Submodel}. 494 <p> 495 * @return the value of the 'extentConversionFactor' attribute of this {@link Submodel}. 496 */ public 497 String getExtentConversionFactor() { 498 return libsbmlJNI.Submodel_getExtentConversionFactor(swigCPtr, this); 499 } 500 501 502/** 503 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 504 * {@link Submodel}'s 'extentConversionFactor' attribute has been set. 505 <p> 506 * @return <code>true</code> if this {@link Submodel}'s 'extentConversionFactor' attribute has been set, 507 * otherwise <code>false</code> is returned. 508 */ public 509 boolean isSetExtentConversionFactor() { 510 return libsbmlJNI.Submodel_isSetExtentConversionFactor(swigCPtr, this); 511 } 512 513 514/** 515 * Sets the value of the 'extentConversionFactor' attribute of this 516 * {@link Submodel}. Fails if the id is not a valid syntax for an SIdRef. 517 <p> 518 * @return integer value indicating success/failure of the 519 * operation. The possible return values are: 520 * <ul> 521 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 522 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 523 * </ul> 524 */ public 525 int setExtentConversionFactor(String id) { 526 return libsbmlJNI.Submodel_setExtentConversionFactor(swigCPtr, this, id); 527 } 528 529 530/** 531 * Unsets the value of the 'extentConversionFactor' attribute of this 532 * {@link Submodel}. 533 <p> 534 * @return integer value indicating success/failure of the 535 * operation. The possible return values are: 536 * <ul> 537 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 538 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 539 * </ul> 540 */ public 541 int unsetExtentConversionFactor() { 542 return libsbmlJNI.Submodel_unsetExtentConversionFactor(swigCPtr, this); 543 } 544 545 546/** 547 * Returns the {@link ListOf} object that holds all deletions. 548 <p> 549 * @return the {@link ListOf} object that holds all deletions. 550 */ public 551 ListOfDeletions getListOfDeletions() { 552 long cPtr = libsbmlJNI.Submodel_getListOfDeletions__SWIG_0(swigCPtr, this); 553 return (cPtr == 0) ? null : new ListOfDeletions(cPtr, false); 554 } 555 556 557/** 558 * Returns the deletion with the given index. 559 * If the index is invalid, <code>null</code> is returned. 560 <p> 561 * @param n the index number of the {@link Deletion} to get. 562 <p> 563 * @return the nth {@link Deletion} in the {@link ListOfDeletions}. 564 */ public 565 Deletion getDeletion(long n) { 566 long cPtr = libsbmlJNI.Submodel_getDeletion__SWIG_0(swigCPtr, this, n); 567 return (cPtr == 0) ? null : new Deletion(cPtr, false); 568 } 569 570 571/** 572 * Returns the deletion with the given <code>id</code>. 573 * If the id is invalid, <code>null</code> is returned. 574 <p> 575 * @param id the id of the {@link Deletion} to get. 576 <p> 577 * @return the {@link Deletion} in the {@link ListOfDeletions} with the given <code>id</code>. 578 */ public 579 Deletion getDeletion(String id) { 580 long cPtr = libsbmlJNI.Submodel_getDeletion__SWIG_2(swigCPtr, this, id); 581 return (cPtr == 0) ? null : new Deletion(cPtr, false); 582 } 583 584 585/** 586 * Adds a copy of the given {@link Deletion} object to the list of deletions. 587 <p> 588 * @param deletion the {@link Deletion} object to be added to the list of 589 * deletions. Fails if the added deletion is null, does not match the 590 * level/version/package of the parent object, or cannot be added to the 591 * list of deletions. 592 <p> 593 * @return integer value indicating success/failure of the 594 * operation. The possible return values are: 595 * <ul> 596 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 597 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT } 598 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH } 599 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH } 600 * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH } 601 * </ul> 602 */ public 603 int addDeletion(Deletion deletion) { 604 return libsbmlJNI.Submodel_addDeletion(swigCPtr, this, Deletion.getCPtr(deletion), deletion); 605 } 606 607 608/** 609 * Returns the number of deletions for this {@link Submodel}. 610 <p> 611 * @return the number of deletions for this {@link Submodel}. 612 */ public 613 long getNumDeletions() { 614 return libsbmlJNI.Submodel_getNumDeletions(swigCPtr, this); 615 } 616 617 618/** 619 * Creates a {@link Deletion} object, adds it to the end of the 620 * deletion objects list and returns a pointer to the newly 621 * created object. 622 <p> 623 * @return a newly created {@link Deletion} object 624 */ public 625 Deletion createDeletion() { 626 long cPtr = libsbmlJNI.Submodel_createDeletion(swigCPtr, this); 627 return (cPtr == 0) ? null : new Deletion(cPtr, false); 628 } 629 630 631/** 632 * Removes the deletion with the given index from the {@link Submodel}. 633 * A pointer to the deletion that was removed is returned. 634 * If no deletion has been removed, <code>null</code> is returned. 635 <p> 636 * @param index the index of the {@link Deletion} object to remove 637 <p> 638 * @return the {@link Deletion} object removed. As mentioned above, 639 * the caller owns the returned object. <code>null</code> is returned if 640 * the given index is out of range. 641 */ public 642 Deletion removeDeletion(long index) { 643 long cPtr = libsbmlJNI.Submodel_removeDeletion__SWIG_0(swigCPtr, this, index); 644 return (cPtr == 0) ? null : new Deletion(cPtr, false); 645 } 646 647 648/** 649 * Removes the deletion with the given identifier from the {@link Submodel}. 650 * A pointer to the deletion that was removed is returned. 651 * If no deletion has been removed, <code>null</code> is returned. 652 <p> 653 * @param sid string representing the identifier 654 * of the {@link Deletion} object to remove 655 <p> 656 * @return the {@link Deletion} object removed. As mentioned above, 657 * the caller owns the returned object. <code>null</code> is returned if 658 * the given <code>sid</code> is not found. 659 */ public 660 Deletion removeDeletion(String sid) { 661 long cPtr = libsbmlJNI.Submodel_removeDeletion__SWIG_1(swigCPtr, this, sid); 662 return (cPtr == 0) ? null : new Deletion(cPtr, false); 663 } 664 665 666/** 667 * Returns true if the 'submodel' attribute is set, and if getNumReferents() is exactly 1. 668 <p> 669 * @return boolean: 'true' if the attributes are correctly set; 'false' if not. 670 */ public 671 boolean hasRequiredAttributes() { 672 return libsbmlJNI.Submodel_hasRequiredAttributes(swigCPtr, this); 673 } 674 675 676/** 677 * Returns the XML element name of 678 * this SBML object. 679 <p> 680 * @return the string of the name of this element. 681 */ public 682 String getElementName() { 683 return libsbmlJNI.Submodel_getElementName(swigCPtr, this); 684 } 685 686 687/** 688 * Renames the conversion factor attributes on this element if <code>oldid</code> matches. 689 */ public 690 void renameSIdRefs(String oldid, String newid) { 691 libsbmlJNI.Submodel_renameSIdRefs(swigCPtr, this, oldid, newid); 692 } 693 694 695/** 696 * Returns the libSBML type code of this object instance. 697 <p> 698 * <p> 699 * LibSBML attaches an identifying code to every kind of SBML object. These 700 * are integer constants known as <em>SBML type codes</em>. The names of all 701 * the codes begin with the characters “<code>SBML_</code>”. 702 * In the Java language interface for libSBML, the 703 * type codes are defined as static integer constants in the interface class 704 * {@link libsbmlConstants}. Note that different Level 3 705 * package plug-ins may use overlapping type codes; to identify the package 706 * to which a given object belongs, call the <code>getPackageName()</code> 707 * method on the object. 708 <p> 709 * @return the SBML type code for this object: 710 * {@link libsbmlConstants#SBML_COMP_SUBMODEL SBML_COMP_SUBMODEL} 711 <p> 712 * <p> 713 * @warning <span class='warning'>The specific integer values of the possible 714 * type codes may be reused by different Level 3 package plug-ins. 715 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 716 * both getTypeCode() and getPackageName()</strong>.</span> 717 <p> 718 * @see #getElementName() 719 * @see #getPackageName() 720 */ public 721 int getTypeCode() { 722 return libsbmlJNI.Submodel_getTypeCode(swigCPtr, this); 723 } 724 725 726/** 727 * Sets this SBML object to child SBML objects (if any). 728 * (Creates a child-parent relationship by the parent) 729 <p> 730 * Subclasses must override this function if they define 731 * one ore more child elements. 732 * Basically, this function needs to be called in 733 * constructor, copy constructor, assignment operator. 734 <p> 735 * @see setSBMLDocument 736 * @see enablePackageInternal 737 * @internal 738 */ public 739 void connectToChild() { 740 libsbmlJNI.Submodel_connectToChild(swigCPtr, this); 741 } 742 743 744/** 745 * Create and return an SBML object of this class, if present. 746 <p> 747 * @return the SBML object corresponding to next {@link XMLToken} in the 748 * {@link XMLInputStream} or null if the token was not recognized. 749 * @internal 750 */ public 751 SBase createObject(XMLInputStream stream) { 752 return libsbml.DowncastSBase(libsbmlJNI.Submodel_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false); 753} 754 755 756/** 757 * Find and create a local copy of the {@link Model} object referenced by this 758 * {@link Submodel}. Is recursive, in that if the instantiated {@link Model} contains any 759 * {@link Submodel} objects, those Submodels will themselves be instantiated. If 760 * an instantiated model previously existed, it is deleted and a new one is 761 * created. For this reason, call this function only once, or 762 * call {@link Submodel#getInstantiation()}. 763 <p> 764 * @return an integer value indicating success/failure of the operation. 765 * Possible return values from this function are: 766 * <ul> 767 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 768 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT } 769 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 770 * In this case, 'invalid object' means that this {@link Submodel} itself is invalid, and no {@link Model} can be instantiated from it. 771 * </ul> 772 */ public 773 int instantiate() { 774 return libsbmlJNI.Submodel_instantiate(swigCPtr, this); 775 } 776 777 778/** 779 * Delete elements in the instantiated submodel, based on any Deletions 780 * from this {@link Submodel}'s listOfDeletions. 781 <p> 782 * @return an integer value indicating success/failure of the operation. 783 * Possible return values from this function are: 784 * <ul> 785 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 786 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT } 787 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 788 * In this case, 'invalid object' means that this {@link Submodel} itself is invalid, and no {@link Model} can be instantiated from it. 789 * </ul> 790 */ public 791 int performDeletions() { 792 return libsbmlJNI.Submodel_performDeletions(swigCPtr, this); 793 } 794 795 796/** 797 * Delete the element in question from the stored instantiated {@link Model}, and 798 * replace all references to it with references to the replacement object. 799 * {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT } 800 * means that this {@link Submodel} itself or one of the passed-in objects are invalid. 801 * {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 802 * means that the routine failed for some othe reason. 803 <p> 804 * @return an integer value indicating success/failure of the operation. 805 * Possible return values from this function are: 806 * <ul> 807 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 808 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT } 809 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 810 * </ul> 811 */ public 812 int replaceElement(SBase toReplace, SBase replacement) { 813 return libsbmlJNI.Submodel_replaceElement(swigCPtr, this, SBase.getCPtr(toReplace), toReplace, SBase.getCPtr(replacement), replacement); 814 } 815 816 817/** 818 * Get the instantiated {@link Model} this {@link Submodel} contains rules to create. 819 * Calls instantiate() automatically if this operation has not yet been 820 * performed, and/or if the operation failed the last time it was called. 821 * Any modifictions that have been performed with performDeletions(), 822 * replaceElement(), or convertTimeAndExtent() function calls will be included. 823 <p> 824 * @return the instantiated {@link Model} object: a clone of the original, modified 825 * according to the performDeletions() and replaceElement() functions that 826 * have been called. Returns null if any error is encountered. 827 */ public 828 Model getInstantiation() { 829 long cPtr = libsbmlJNI.Submodel_getInstantiation__SWIG_0(swigCPtr, this); 830 return (cPtr == 0) ? null : new Model(cPtr, false); 831 } 832 833 834/** 835 * Delete the instantiated {@link Model}, if it exists. 836 */ public 837 void clearInstantiation() { 838 libsbmlJNI.Submodel_clearInstantiation(swigCPtr, this); 839 } 840 841 842/** 843 * Convert all references to time and extent in the instantiated 844 * {@link Model}, according to the 845 * timeConversionFactor and extentConversionFactor attributes. 846 */ public 847 int convertTimeAndExtent() { 848 return libsbmlJNI.Submodel_convertTimeAndExtent(swigCPtr, this); 849 } 850 851 public SBaseList getListOfAllInstantiatedElements() { 852 long cPtr = libsbmlJNI.Submodel_getListOfAllInstantiatedElements(swigCPtr, this); 853 return (cPtr == 0) ? null : new SBaseList(cPtr, false); 854 } 855 856}