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