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