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