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 SBaseRef construct from the 014 * “comp” package. 015 <p> 016 * The {@link SBaseRef} class was introduced by the SBML Level 3 017 * 'Hierarchical Model Composition' package 018 * (“comp”) as the principle way by which submodel elements may 019 * be referenced. The {@link SBaseRef} class is usually found as the base class of a 020 * {@link Port}, {@link Deletion}, {@link ReplacedElement}, or {@link ReplacedBy} class, but may appear as an 021 * child of one of the above classes if the parent object references a 022 * {@link Submodel}. 023 <p> 024 * An {@link SBaseRef} object must reference an element using exactly one of the 025 * optional attributes of the class. Subclasses of {@link SBaseRef} may define 026 * additional optional attributes that are legal ways to reference an element. 027 <p> 028 * {@link SBaseRef} objects may reference elements that do not live in the {@link Model} parent 029 * of the {@link SBaseRef} object. However, the {@link SBaseRef} class itself does not 030 * provide a method of determining which {@link Model} or {@link Submodel} is being referenced. 031 * The subclasses of {@link SBaseRef} provide methods for this instead. 032 <p> 033 * Once the {@link Model} to which the {@link SBaseRef} object is referencing has been established, 034 * there are four optional attributes defined in the {@link SBaseRef} class that 035 * are each methods of referencing an element: 036 <p> 037 * <ul> 038 * <li> 'portRef' (type PortSIdRef): As its name implies, this attribute is used to 039 * refer to a port identifier, in the case when the reference being 040 * constructed with the {@link SBaseRef} is intended to refer to a port on a 041 * submodel. The namespace of the PortSIdRef value is the set 042 * of identifiers of type PortSId defined in the submodel, not 043 * the parent model. 044 * <li> 'idRef' (type SIdRef): As its name implies, this attribute is used to 045 * refer to a regular identifier (i.e., the value of an 'id' 046 * attribute on some other object), in the case when the reference being 047 * constructed with the {@link SBaseRef} is intended to refer to an object that 048 * does not have a port identifier. The namespace of the SIdRef 049 * value is the set of identifiers of type SId defined in the 050 * submodel, not the parent model. 051 * <li> 'unitRef' (type UnitSIdRef): This attribute is used to refer to the identifier 052 * of a {@link UnitDefinition} object. The namespace of the UnitSIdRef 053 * value is the set of unit identifiers defined in the submodel, not the 054 * parent model. (Note that even though this attribute is of type UnitSIdRef, 055 * the reserved unit identifiers that are defined by SBML Level 3 (see 056 * Section 3.1.10 of the core specification) are 057 * *not* permitted as values of 'unitRef'. Reserved unit 058 * identifiers may not be replaced or deleted.) 059 * <li> 'metaIdRef' (type IDREF): This attribute is used to refer to a 'metaid' 060 * attribute value on some other object, in the case when the reference 061 * being constructed with the {@link SBaseRef} is intended to refer to an object 062 * that does not have a port identifier. The namespace of the 'metaIdRef' 063 * value is the entire document in which the referenced model resides, but 064 * must refer to a subelement of the referenced model. Since meta identifiers are 065 * optional attributes of {@link SBase}, all SBML objects have the potential to 066 * have a meta identifier value. 067 * 068 * </ul> <p> 069 * An {@link SBaseRef} object may have up to one subcomponent named 'sBaseRef', of 070 * type {@link SBaseRef}. This permits recursive structures to be constructed so 071 * that objects inside submodels can be referenced. 072 <p> 073 * The form of such recursive references must be as follows. The 074 * highest-level {@link SBaseRef} object of such a chain (which will necessarily 075 * be an object of class {@link Port}, {@link Deletion}, {@link ReplacedElement} or {@link ReplacedBy}, 076 * because they are the only classes derived from the class {@link SBaseRef}) must 077 * refer to a {@link Submodel} object in the containing model. All child 078 * {@link SBaseRef} objects in the chain must refer to components inside the 079 * {@link Model} instance to which the {@link Submodel} refers. 080 */ 081 082public class SBaseRef extends CompBase { 083 private long swigCPtr; 084 085 protected SBaseRef(long cPtr, boolean cMemoryOwn) 086 { 087 super(libsbmlJNI.SBaseRef_SWIGUpcast(cPtr), cMemoryOwn); 088 swigCPtr = cPtr; 089 } 090 091 protected static long getCPtr(SBaseRef obj) 092 { 093 return (obj == null) ? 0 : obj.swigCPtr; 094 } 095 096 protected static long getCPtrAndDisown (SBaseRef 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_SBaseRef(swigCPtr); 118 } 119 swigCPtr = 0; 120 } 121 super.delete(); 122 } 123 124 125/** 126 * Creates a new {@link SBaseRef} with the given level, version, and package 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 SBaseRef(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 133 this(libsbmlJNI.new_SBaseRef__SWIG_0(level, version, pkgVersion), true); 134 } 135 136 137/** 138 * Creates a new {@link SBaseRef} with the given level, version, and package 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 SBaseRef(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 145 this(libsbmlJNI.new_SBaseRef__SWIG_1(level, version), true); 146 } 147 148 149/** 150 * Creates a new {@link SBaseRef} with the given level, version, and package version. 151 <p> 152 * @param level the SBML Level 153 * @param version the Version within the SBML Level 154 * @param pkgVersion the version of the package 155 */ public 156 SBaseRef(long level) throws org.sbml.libsbml.SBMLConstructorException { 157 this(libsbmlJNI.new_SBaseRef__SWIG_2(level), true); 158 } 159 160 161/** 162 * Creates a new {@link SBaseRef} with the given level, version, and package version. 163 <p> 164 * @param level the SBML Level 165 * @param version the Version within the SBML Level 166 * @param pkgVersion the version of the package 167 */ public 168 SBaseRef() throws org.sbml.libsbml.SBMLConstructorException { 169 this(libsbmlJNI.new_SBaseRef__SWIG_3(), true); 170 } 171 172 173/** 174 * Creates a new {@link SBaseRef} with the given {@link CompPkgNamespaces} object. 175 <p> 176 * @param compns the namespace to use 177 */ public 178 SBaseRef(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 179 this(libsbmlJNI.new_SBaseRef__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 180 } 181 182 183/** 184 * Copy constructor. 185 */ public 186 SBaseRef(SBaseRef source) throws org.sbml.libsbml.SBMLConstructorException { 187 this(libsbmlJNI.new_SBaseRef__SWIG_5(SBaseRef.getCPtr(source), source), true); 188 } 189 190 191/** 192 * Creates and returns a deep copy of this {@link SBaseRef} object. 193 <p> 194 * @return a (deep) copy of this {@link SBaseRef} object 195 */ public 196 SBase cloneObject() { 197 long cPtr = libsbmlJNI.SBaseRef_cloneObject(swigCPtr, this); 198 return (cPtr == 0) ? null : new SBaseRef(cPtr, true); 199 } 200 201 202/** 203 * Returns the first child element found that has the given <code>id</code> in the 204 * model-wide SId namespace, or <code>null</code> if no such object is found. 205 <p> 206 * @param id string representing the id of objects to find 207 <p> 208 * @return a pointer to the {@link SBase} element with the given <code>id</code>. 209 */ public 210 SBase getElementBySId(String id) { 211 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getElementBySId(swigCPtr, this, id), false); 212} 213 214 215/** 216 * Returns the first child element it can find with the given <code>metaid</code>, or 217 * itself if it has the given <code>metaid</code>, or <code>null</code> if no such object is found. 218 <p> 219 * @param metaid string representing the metaid of objects to find 220 <p> 221 * @return a pointer to the {@link SBase} element with the given <code>metaid</code>. 222 */ public 223 SBase getElementByMetaId(String metaid) { 224 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getElementByMetaId(swigCPtr, this, metaid), false); 225} 226 227 228/** 229 * Returns the value of the 'metaIdRef' attribute of this {@link SBaseRef}. 230 <p> 231 * @return the value of the 'metaIdRef' attribute of this {@link SBaseRef}. 232 */ public 233 String getMetaIdRef() { 234 return libsbmlJNI.SBaseRef_getMetaIdRef(swigCPtr, this); 235 } 236 237 238/** 239 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 240 * {@link SBaseRef}'s 'metaIdRef' attribute has been set. 241 <p> 242 * @return <code>true</code> if this {@link SBaseRef}'s 'metaIdRef' attribute has been set, 243 * otherwise <code>false</code> is returned. 244 */ public 245 boolean isSetMetaIdRef() { 246 return libsbmlJNI.SBaseRef_isSetMetaIdRef(swigCPtr, this); 247 } 248 249 250/** 251 * Sets the value of the 'metaIdRef' attribute of this {@link SBaseRef}. 252 <p> 253 * This method fails if the id is not a valid syntax for an IDREF ({@link 254 * libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE 255 * LIBSBML_INVALID_ATTRIBUTE_VALUE }), or if the {@link SBaseRef} already 256 * points to an element of the submodel using a different interface ({@link 257 * libsbmlConstants#LIBSBML_OPERATION_FAILED 258 * LIBSBML_OPERATION_FAILED }). An sBaseRef must use exactly one 259 * method to point to a submodel element. 260 <p> 261 * @return integer value indicating success/failure of the 262 * operation. The possible return values are: 263 * <ul> 264 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 265 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 266 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 267 * </ul> 268 */ public 269 int setMetaIdRef(String id) { 270 return libsbmlJNI.SBaseRef_setMetaIdRef(swigCPtr, this, id); 271 } 272 273 274/** 275 * Unsets the value of the 'metaIdRef' attribute of this {@link SBaseRef}. 276 <p> 277 * @return integer value indicating success/failure of the 278 * operation. The possible return values are: 279 * <ul> 280 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 281 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 282 * </ul> 283 */ public 284 int unsetMetaIdRef() { 285 return libsbmlJNI.SBaseRef_unsetMetaIdRef(swigCPtr, this); 286 } 287 288 289/** 290 * Returns the value of the 'portRef' attribute of this {@link SBaseRef}. 291 <p> 292 * @return the value of the 'portRef' attribute of this {@link SBaseRef}. 293 */ public 294 String getPortRef() { 295 return libsbmlJNI.SBaseRef_getPortRef(swigCPtr, this); 296 } 297 298 299/** 300 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 301 * {@link SBaseRef}'s 'portRef' attribute has been set. 302 <p> 303 * @return <code>true</code> if this {@link SBaseRef}'s 'portRef' attribute has been set, 304 * otherwise <code>false</code> is returned. 305 */ public 306 boolean isSetPortRef() { 307 return libsbmlJNI.SBaseRef_isSetPortRef(swigCPtr, this); 308 } 309 310 311/** 312 * Sets the value of the 'portRef' attribute of this {@link SBaseRef}. Fails if 313 * the id is not a valid syntax for a PortSIdRef ({@link 314 * libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE 315 * LIBSBML_INVALID_ATTRIBUTE_VALUE }), or if the {@link SBaseRef} already 316 * points to an element of the submodel using a different interface ({@link 317 * libsbmlConstants#LIBSBML_OPERATION_FAILED 318 * LIBSBML_OPERATION_FAILED }). An {@link SBaseRef} must use exactly one 319 * method to point to a submodel element. 320 <p> 321 * @return integer value indicating success/failure of the 322 * operation. The possible return values are: 323 * <ul> 324 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 325 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 326 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 327 * </ul> 328 */ public 329 int setPortRef(String id) { 330 return libsbmlJNI.SBaseRef_setPortRef(swigCPtr, this, id); 331 } 332 333 334/** 335 * Unsets the value of the 'portRef' attribute of this {@link SBaseRef}. 336 <p> 337 * @return integer value indicating success/failure of the 338 * operation. The possible return values are: 339 * <ul> 340 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 341 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 342 * </ul> 343 */ public 344 int unsetPortRef() { 345 return libsbmlJNI.SBaseRef_unsetPortRef(swigCPtr, this); 346 } 347 348 349/** 350 * Returns the value of the 'idRef' attribute of this {@link SBaseRef}. 351 <p> 352 * @return the value of the 'idRef' attribute of this {@link SBaseRef}. 353 */ public 354 String getIdRef() { 355 return libsbmlJNI.SBaseRef_getIdRef(swigCPtr, this); 356 } 357 358 359/** 360 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 361 * {@link SBaseRef}'s 'idRef' attribute has been set. 362 <p> 363 * @return <code>true</code> if this {@link SBaseRef}'s 'idRef' attribute has been set, 364 * otherwise <code>false</code> is returned. 365 */ public 366 boolean isSetIdRef() { 367 return libsbmlJNI.SBaseRef_isSetIdRef(swigCPtr, this); 368 } 369 370 371/** 372 * Sets the value of the 'idRef' attribute of this {@link SBaseRef}. 373 <p> 374 * This method fails if the id is not a valid syntax for an SIdRef ({@link 375 * libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE 376 * LIBSBML_INVALID_ATTRIBUTE_VALUE }), or if the {@link SBaseRef} already 377 * points to an element of the submodel using a different interface ({@link 378 * libsbmlConstants#LIBSBML_OPERATION_FAILED 379 * LIBSBML_OPERATION_FAILED }). A sBaseRef must use exactly one 380 * method to point to a submodel element. 381 <p> 382 * @return integer value indicating success/failure of the 383 * operation. The possible return values are: 384 * <ul> 385 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 386 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 387 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 388 * </ul> 389 */ public 390 int setIdRef(String id) { 391 return libsbmlJNI.SBaseRef_setIdRef(swigCPtr, this, id); 392 } 393 394 395/** 396 * Unsets the value of the 'idRef' attribute of this {@link SBaseRef}. 397 <p> 398 * @return integer value indicating success/failure of the 399 * operation. The possible return values are: 400 * <ul> 401 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 402 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 403 * </ul> 404 */ public 405 int unsetIdRef() { 406 return libsbmlJNI.SBaseRef_unsetIdRef(swigCPtr, this); 407 } 408 409 410/** 411 * Returns the value of the 'unitRef' attribute of this {@link SBaseRef}. 412 <p> 413 * @return the value of the 'unitRef' attribute of this {@link SBaseRef}. 414 */ public 415 String getUnitRef() { 416 return libsbmlJNI.SBaseRef_getUnitRef(swigCPtr, this); 417 } 418 419 420/** 421 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 422 * {@link SBaseRef}'s 'unitRef' attribute has been set. 423 <p> 424 * @return <code>true</code> if this {@link SBaseRef}'s 'unitRef' attribute has been set, 425 * otherwise <code>false</code> is returned. 426 */ public 427 boolean isSetUnitRef() { 428 return libsbmlJNI.SBaseRef_isSetUnitRef(swigCPtr, this); 429 } 430 431 432/** 433 * Sets the value of the 'unitRef' attribute of this {@link SBaseRef}. 434 <p> 435 * This method fails if the id is not a valid syntax for a UnitSIdRef ({@link 436 * libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE 437 * LIBSBML_INVALID_ATTRIBUTE_VALUE }), or if the {@link SBaseRef} already 438 * points to an element of the submodel using a different interface ({@link 439 * libsbmlConstants#LIBSBML_OPERATION_FAILED 440 * LIBSBML_OPERATION_FAILED }). A sBaseRef must use exactly one 441 * method to point to a submodel element. 442 <p> 443 * @return integer value indicating success/failure of the 444 * operation. The possible return values are: 445 * <ul> 446 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 447 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 448 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 449 * </ul> 450 */ public 451 int setUnitRef(String id) { 452 return libsbmlJNI.SBaseRef_setUnitRef(swigCPtr, this, id); 453 } 454 455 456/** 457 * Unsets the value of the 'unitRef' attribute of this {@link SBaseRef}. 458 <p> 459 * @return integer value indicating success/failure of the 460 * operation. The possible return values are: 461 * <ul> 462 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 463 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 464 * </ul> 465 */ public 466 int unsetUnitRef() { 467 return libsbmlJNI.SBaseRef_unsetUnitRef(swigCPtr, this); 468 } 469 470 471/** 472 * Get the child sBaseRef of this sBaseRef. 473 <p> 474 * @return the const {@link SBaseRef} child of this {@link SBaseRef}, or null if none exists. 475 */ public 476 SBaseRef getSBaseRef() { 477 long cPtr = libsbmlJNI.SBaseRef_getSBaseRef__SWIG_0(swigCPtr, this); 478 return (cPtr == 0) ? null : new SBaseRef(cPtr, false); 479 } 480 481 482/** 483 * Predicate for testing whether the sBaseRef for this {@link SBaseRef} is set. 484 <p> 485 * @return <code>true</code> if the sBaseRef of this {@link SBaseRef} is set, <code>false</code> 486 * otherwise. 487 */ public 488 boolean isSetSBaseRef() { 489 return libsbmlJNI.SBaseRef_isSetSBaseRef(swigCPtr, this); 490 } 491 492 493/** 494 * Sets the sBaseRef definition of this {@link SBaseRef} to a copy of the given 495 * {@link SBaseRef} object instance. 496 <p> 497 * This method fails if the added sBaseRef does not match the 498 * level/version/package of the parent object or if the added sBaseRef cannot 499 * be copied. 500 <p> 501 * @param sBaseRef the {@link SBaseRef} object instance to use. 502 <p> 503 * @return integer value indicating success/failure of the 504 * operation. The possible return values are: 505 * <ul> 506 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 507 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 508 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH } 509 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH } 510 * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH } 511 * </ul> 512 */ public 513 int setSBaseRef(SBaseRef sBaseRef) { 514 return libsbmlJNI.SBaseRef_setSBaseRef(swigCPtr, this, SBaseRef.getCPtr(sBaseRef), sBaseRef); 515 } 516 517 518/** 519 * Creates a new, empty {@link SBaseRef}, adds it to this {@link SBaseRef} and 520 * returns the created {@link SBaseRef}. 521 <p> 522 * @return the newly created {@link SBaseRef} object instance. 523 */ public 524 SBaseRef createSBaseRef() { 525 long cPtr = libsbmlJNI.SBaseRef_createSBaseRef(swigCPtr, this); 526 return (cPtr == 0) ? null : new SBaseRef(cPtr, false); 527 } 528 529 530/** 531 * Unsets the child {@link SBaseRef} of this {@link SBaseRef}. Deletes the former {@link SBaseRef} child, 532 * if one existed. 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 unsetSBaseRef() { 542 return libsbmlJNI.SBaseRef_unsetSBaseRef(swigCPtr, this); 543 } 544 545 546/** 547 * Returns how many elements are being referred to by this {@link SBaseRef}. A 548 * valid {@link SBaseRef} will have exactly one. Possible referents are portRef, 549 * idRef, unitRef, and metaIdRef. 550 <p> 551 * @return integer value between 0 and 4: the number of different ways this element points to its referent. 552 */ public 553 int getNumReferents() { 554 return libsbmlJNI.SBaseRef_getNumReferents(swigCPtr, this); 555 } 556 557 558/** 559 * Returns true if getNumReferents() is exactly 1. 560 <p> 561 * @return boolean: 'true' if the attributes are correctly set; 'false' if not. 562 */ public 563 boolean hasRequiredAttributes() { 564 return libsbmlJNI.SBaseRef_hasRequiredAttributes(swigCPtr, this); 565 } 566 567 568/** 569 * Renames all the SIdRef attributes on this element if they match 570 * <code>oldid</code>, but not any found in child or plugin elements. 571 */ public 572 void renameSIdRefs(String oldid, String newid) { 573 libsbmlJNI.SBaseRef_renameSIdRefs(swigCPtr, this, oldid, newid); 574 } 575 576 577/** 578 * Returns the XML element name of 579 * this SBML object. 580 <p> 581 * @return the string of the name of this element. 582 */ public 583 String getElementName() { 584 return libsbmlJNI.SBaseRef_getElementName(swigCPtr, this); 585 } 586 587 588/** 589 * Returns the libSBML type code of this object instance. 590 <p> 591 * <p> 592 * LibSBML attaches an identifying code to every kind of SBML object. These 593 * are integer constants known as <em>SBML type codes</em>. The names of all 594 * the codes begin with the characters “<code>SBML_</code>”. 595 * In the Java language interface for libSBML, the 596 * type codes are defined as static integer constants in the interface class 597 * {@link libsbmlConstants}. Note that different Level 3 598 * package plug-ins may use overlapping type codes; to identify the package 599 * to which a given object belongs, call the <code>getPackageName()</code> 600 * method on the object. 601 <p> 602 * @return the SBML type code for this object: 603 * {@link libsbmlConstants#SBML_COMP_SBASEREF SBML_COMP_SBASEREF} 604 <p> 605 * <p> 606 * @warning <span class='warning'>The specific integer values of the possible 607 * type codes may be reused by different Level 3 package plug-ins. 608 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 609 * both getTypeCode() and getPackageName()</strong>.</span> 610 <p> 611 * @see #getElementName() 612 * @see #getPackageName() 613 */ public 614 int getTypeCode() { 615 return libsbmlJNI.SBaseRef_getTypeCode(swigCPtr, this); 616 } 617 618 619/** 620 * Sets this SBML object to child SBML objects (if any). 621 * (Creates a child-parent relationship by the parent) 622 <p> 623 * Subclasses must override this function if they define 624 * one ore more child elements. 625 * Basically, this function needs to be called in 626 * constructor, copy constructor, assignment operator. 627 <p> 628 * @see setSBMLDocument 629 * @see enablePackageInternal 630 * @internal 631 */ public 632 void connectToChild() { 633 libsbmlJNI.SBaseRef_connectToChild(swigCPtr, this); 634 } 635 636 637/** 638 * Examines the referenced {@link Model} for the referenced object, and returns it, if found. 639 <p> 640 * @param model the {@link Model} in which to look for the object referenced by 641 * this {@link SBaseRef}. 642 <p> 643 * @return the element in the referenced {@link Model} to which this {@link SBaseRef} 644 * refers. If this object references an object in a {@link Submodel}, the returned 645 * object will be in the instantiated {@link Model} in that {@link Submodel}. 646 */ public 647 SBase getReferencedElementFrom(Model model) { 648 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getReferencedElementFrom(swigCPtr, this, Model.getCPtr(model), model), false); 649} 650 651 652/** 653 * Finds and stores the referenced object by finding the {@link Model} it needs to 654 * point to, calling 'saveReferencedElement' on its parent (which will also 655 * be a {@link SBaseRef} or one of its subclasses), and the storing the result. 656 <p> 657 * @return integer value indicating success/failure of the 658 * operation. The possible return values are: 659 * <ul> 660 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 661 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 662 * </ul> 663 */ public 664 int saveReferencedElement() { 665 return libsbmlJNI.SBaseRef_saveReferencedElement(swigCPtr, this); 666 } 667 668 669/** 670 * Returns the object pointed to by this element. If that element was 671 * previously found and set with 'saveReferencedElement', that element is 672 * returned; otherwise, 'saveReferencedElement' is called first, and the 673 * found element is returned. 674 */ public 675 SBase getReferencedElement() { 676 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getReferencedElement(swigCPtr, this), false); 677} 678 679 680/** 681 * Removes the saved referenced element, if it had been saved earlier. 682 */ public 683 void clearReferencedElement() { 684 libsbmlJNI.SBaseRef_clearReferencedElement(swigCPtr, this); 685 } 686 687 688/** 689 * DEPRECATED FUNCTION: DO NOT USE 690 <p> 691 * Deletes the referenced object, 692 * plus any other elements that element points to through {@link ReplacedElement} 693 * or {@link ReplacedBy} children. Instead of calling this function directly, use 694 * 'CompModelPlugin.instantiateSubmodels' instead, which deals with all the 695 * intricacies of replacements and deletions, and gives you access to the 696 * non-flattened hierarchical form of the model. 697 */ public 698 int performDeletion() { 699 return libsbmlJNI.SBaseRef_performDeletion(swigCPtr, this); 700 } 701 702 703/** 704 * Finds this {@link SBaseRef}'s parent, which can either be a List or can be 705 * another {@link SBaseRef}, and tells it to remove this. 706 <p> 707 * @return integer value indicating success/failure of the 708 * operation. The possible return values are: 709 * <ul> 710 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 711 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 712 * </ul> 713 */ public 714 int removeFromParentAndDelete() { 715 return libsbmlJNI.SBaseRef_removeFromParentAndDelete(swigCPtr, this); 716 } 717 718}