001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 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 011public class Submodel extends CompBase { 012 private long swigCPtr; 013 014 protected Submodel(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.Submodel_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(Submodel obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (Submodel obj) 026 { 027 long ptr = 0; 028 029 if (obj != null) 030 { 031 ptr = obj.swigCPtr; 032 obj.swigCMemOwn = false; 033 } 034 035 return ptr; 036 } 037 038 protected void finalize() { 039 delete(); 040 } 041 042 public synchronized void delete() { 043 if (swigCPtr != 0) { 044 if (swigCMemOwn) { 045 swigCMemOwn = false; 046 libsbmlJNI.delete_Submodel(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 public Submodel(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 054 this(libsbmlJNI.new_Submodel__SWIG_0(level, version, pkgVersion), true); 055 } 056 057 public Submodel(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 058 this(libsbmlJNI.new_Submodel__SWIG_1(level, version), true); 059 } 060 061 public Submodel(long level) throws org.sbml.libsbml.SBMLConstructorException { 062 this(libsbmlJNI.new_Submodel__SWIG_2(level), true); 063 } 064 065 public Submodel() throws org.sbml.libsbml.SBMLConstructorException { 066 this(libsbmlJNI.new_Submodel__SWIG_3(), true); 067 } 068 069 public Submodel(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 070 this(libsbmlJNI.new_Submodel__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 071 } 072 073 public Submodel(Submodel source) throws org.sbml.libsbml.SBMLConstructorException { 074 this(libsbmlJNI.new_Submodel__SWIG_5(Submodel.getCPtr(source), source), true); 075 } 076 077 078/** 079 * Creates and returns a deep copy of this {@link SBase} object. 080 * <p> 081 * @return a (deep) copy of this {@link SBase} object. 082 */ public 083 SBase cloneObject() { 084 long cPtr = libsbmlJNI.Submodel_cloneObject(swigCPtr, this); 085 return (cPtr == 0) ? null : new Submodel(cPtr, true); 086 } 087 088 089/** 090 * Returns the first child element found that has the given <code>id</code> in the 091 * model-wide <code>SId</code> namespace, or <code>null</code> if no such object is found. 092 * <p> 093 * @param id string representing the 'id' attribute value of the object 094 * to find. 095 * <p> 096 * @return pointer to the first element found with the given identifier. 097 */ public 098 SBase getElementBySId(String id) { 099 return libsbml.DowncastSBase(libsbmlJNI.Submodel_getElementBySId(swigCPtr, this, id), false); 100} 101 102 103/** 104 * Returns the first child element it can find with a specific 'metaid' 105 * attribute value, or <code>null</code> if no such object is found. 106 * <p> 107 * @param metaid string representing the 'metaid' attribute value of the 108 * object to find. 109 * <p> 110 * @return pointer to the first element found with the given meta-identifier. 111 */ public 112 SBase getElementByMetaId(String metaid) { 113 return libsbml.DowncastSBase(libsbmlJNI.Submodel_getElementByMetaId(swigCPtr, this, metaid), false); 114} 115 116 117/** 118 * Returns the value of the 'metaid' attribute of this object. 119 * <p> 120 * The optional attribute named 'metaid', present on every major SBML 121 * component type, is for supporting metadata annotations using RDF 122 * (Resource Description Format). The attribute value has the data type 123 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 124 * identifier type, which means each 'metaid' value must be globally 125 * unique within an SBML file. (Importantly, this uniqueness criterion 126 * applies across any attribute with type <a 127 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 128 * 'metaid' attribute used by SBML—something to be aware of if your 129 * application-specific XML content inside the 'annotation' subelement 130 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 131 * The 'metaid' value serves to identify a model 132 * component for purposes such as referencing that component from 133 * metadata placed within 'annotation' subelements. 134 * <p> 135 * @return the meta-identifier of this SBML object, as a string. 136 * <p> 137 * @see #isSetMetaId() 138 * @see #setMetaId(String metaid) 139 * @internal 140 */ public 141 String getId() { 142 return libsbmlJNI.Submodel_getId(swigCPtr, this); 143 } 144 145 146/** 147 * Predicate returning <code>true</code> if this object's 'metaid' attribute is set. 148 * <p> 149 * The optional attribute named 'metaid', present on every major SBML 150 * component type, is for supporting metadata annotations using RDF 151 * (Resource Description Format). The attribute value has the data type 152 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 153 * identifier type, which means each 'metaid' value must be globally 154 * unique within an SBML file. (Importantly, this uniqueness criterion 155 * applies across any attribute with type <a 156 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 157 * 'metaid' attribute used by SBML—something to be aware of if your 158 * application-specific XML content inside the 'annotation' subelement 159 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 160 * The 'metaid' value serves to identify a model component for purposes 161 * such as referencing that component from metadata placed within 162 * 'annotation' subelements. 163 * <p> 164 * @return <code>true</code> if the 'metaid' attribute of this SBML object is 165 * set, <code>false</code> otherwise. 166 * <p> 167 * @see #getMetaId() 168 * @see #setMetaId(String metaid) 169 * @internal 170 */ public 171 boolean isSetId() { 172 return libsbmlJNI.Submodel_isSetId(swigCPtr, this); 173 } 174 175 176/** 177 * Predicate returning <code>true</code> if this 178 * object has a {@link ModelHistory} object attached to it. 179 * <p> 180 * @return <code>true</code> if the {@link ModelHistory} of this object is set, 181 * <code>false</code> otherwise. 182 * <p> 183 * @note In SBML Level 2, model history annotations were only 184 * permitted on the {@link Model} element. In SBML Level 3, they are 185 * permitted on all SBML components derived from {@link SBase}. 186 * @internal 187 */ public 188 int setId(String id) { 189 return libsbmlJNI.Submodel_setId(swigCPtr, this, id); 190 } 191 192 193/** 194 * Unsets the value of the 'id' attribute of this SBML object. 195 * <p> 196 * Most (but not all) objects in SBML include two common attributes: 'id' 197 * and 'name'. The identifier given by an object's 'id' attribute value 198 * is used to identify the object within the SBML model definition. 199 * Other objects can refer to the component using this identifier. The 200 * data type of 'id' is always either <code>Sid</code> or 201 * <code>UnitSId</code>, depending on the object in question. Both 202 * data types are defined as follows: 203 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 204 * letter .= 'a'..'z','A'..'Z' 205 * digit .= '0'..'9' 206 * idChar .= letter | digit | '_' 207 * SId .= ( letter | '_' ) idChar* 208 * </pre> 209 * <p> 210 * The equality of <code>SId</code> and <code>UnitSId</code> type values 211 * in SBML is determined by an exact character sequence match; i.e., 212 * comparisons of these identifiers must be performed in a case-sensitive 213 * manner. This applies to all uses of <code>SId</code> and 214 * <code>UnitSId</code>. 215 * <p> 216 * @return integer value indicating success/failure of the 217 * function. The possible values returned by this function are: 218 * <ul> 219 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 220 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 221 * </ul> 222 */ public 223 int unsetId() { 224 return libsbmlJNI.Submodel_unsetId(swigCPtr, this); 225 } 226 227 228/** 229 * Returns the value of the 'metaid' attribute of this object. 230 * <p> 231 * The optional attribute named 'metaid', present on every major SBML 232 * component type, is for supporting metadata annotations using RDF 233 * (Resource Description Format). The attribute value has the data type 234 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 235 * identifier type, which means each 'metaid' value must be globally 236 * unique within an SBML file. (Importantly, this uniqueness criterion 237 * applies across any attribute with type <a 238 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 239 * 'metaid' attribute used by SBML—something to be aware of if your 240 * application-specific XML content inside the 'annotation' subelement 241 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 242 * The 'metaid' value serves to identify a model 243 * component for purposes such as referencing that component from 244 * metadata placed within 'annotation' subelements. 245 * <p> 246 * @return the meta-identifier of this SBML object, as a string. 247 * <p> 248 * @see #isSetMetaId() 249 * @see #setMetaId(String metaid) 250 * @internal 251 */ public 252 String getName() { 253 return libsbmlJNI.Submodel_getName(swigCPtr, this); 254 } 255 256 257/** 258 * Predicate returning <code>true</code> if this object's 'metaid' attribute is set. 259 * <p> 260 * The optional attribute named 'metaid', present on every major SBML 261 * component type, is for supporting metadata annotations using RDF 262 * (Resource Description Format). The attribute value has the data type 263 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 264 * identifier type, which means each 'metaid' value must be globally 265 * unique within an SBML file. (Importantly, this uniqueness criterion 266 * applies across any attribute with type <a 267 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 268 * 'metaid' attribute used by SBML—something to be aware of if your 269 * application-specific XML content inside the 'annotation' subelement 270 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 271 * The 'metaid' value serves to identify a model component for purposes 272 * such as referencing that component from metadata placed within 273 * 'annotation' subelements. 274 * <p> 275 * @return <code>true</code> if the 'metaid' attribute of this SBML object is 276 * set, <code>false</code> otherwise. 277 * <p> 278 * @see #getMetaId() 279 * @see #setMetaId(String metaid) 280 * @internal 281 */ public 282 boolean isSetName() { 283 return libsbmlJNI.Submodel_isSetName(swigCPtr, this); 284 } 285 286 287/** 288 * Predicate returning <code>true</code> if this 289 * object has a {@link ModelHistory} object attached to it. 290 * <p> 291 * @return <code>true</code> if the {@link ModelHistory} of this object is set, 292 * <code>false</code> otherwise. 293 * <p> 294 * @note In SBML Level 2, model history annotations were only 295 * permitted on the {@link Model} element. In SBML Level 3, they are 296 * permitted on all SBML components derived from {@link SBase}. 297 * @internal 298 */ public 299 int setName(String name) { 300 return libsbmlJNI.Submodel_setName(swigCPtr, this, name); 301 } 302 303 304/** 305 * Unsets the value of the 'name' attribute of this SBML object. 306 * <p> 307 * Most (but not all) objects in SBML include two common attributes: 'id' 308 * and 'name'. In contrast to the 'id' attribute, the 'name' attribute is 309 * optional and is not intended to be used for cross-referencing purposes 310 * within a model. Its purpose instead is to provide a human-readable 311 * label for the component. The data type of 'name' is the type 312 * <code>string</code> defined in XML Schema. SBML imposes no 313 * restrictions as to the content of 'name' attributes beyond those 314 * restrictions defined by the <code>string</code> type in XML Schema. 315 * <p> 316 * The recommended practice for handling 'name' is as follows. If a 317 * software tool has the capability for displaying the content of 'name' 318 * attributes, it should display this content to the user as a 319 * component's label instead of the component's 'id'. If the user 320 * interface does not have this capability (e.g., because it cannot 321 * display or use special characters in symbol names), or if the 'name' 322 * attribute is missing on a given component, then the user interface 323 * should display the value of the 'id' attribute instead. (Script 324 * language interpreters are especially likely to display 'id' instead of 325 * 'name'.) 326 * <p> 327 * As a consequence of the above, authors of systems that automatically 328 * generate the values of 'id' attributes should be aware some systems 329 * may display the 'id''s to the user. Authors therefore may wish to 330 * take some care to have their software create 'id' values that are: (a) 331 * reasonably easy for humans to type and read; and (b) likely to be 332 * meaningful, for example by making the 'id' attribute be an abbreviated 333 * form of the name attribute value. 334 * <p> 335 * An additional point worth mentioning is although there are 336 * restrictions on the uniqueness of 'id' values, there are no 337 * restrictions on the uniqueness of 'name' values in a model. This 338 * allows software applications leeway in assigning component identifiers. 339 * <p> 340 * @return integer value indicating success/failure of the 341 * function. The possible values returned by this function are: 342 * <ul> 343 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 344 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 345 * </ul> 346 */ public 347 int unsetName() { 348 return libsbmlJNI.Submodel_unsetName(swigCPtr, this); 349 } 350 351 public String getModelRef() { 352 return libsbmlJNI.Submodel_getModelRef(swigCPtr, this); 353 } 354 355 public boolean isSetModelRef() { 356 return libsbmlJNI.Submodel_isSetModelRef(swigCPtr, this); 357 } 358 359 public int setModelRef(String modelRef) { 360 return libsbmlJNI.Submodel_setModelRef(swigCPtr, this, modelRef); 361 } 362 363 public int unsetModelRef() { 364 return libsbmlJNI.Submodel_unsetModelRef(swigCPtr, this); 365 } 366 367 public String getSubstanceConversionFactor() { 368 return libsbmlJNI.Submodel_getSubstanceConversionFactor(swigCPtr, this); 369 } 370 371 public boolean isSetSubstanceConversionFactor() { 372 return libsbmlJNI.Submodel_isSetSubstanceConversionFactor(swigCPtr, this); 373 } 374 375 public int setSubstanceConversionFactor(String id) { 376 return libsbmlJNI.Submodel_setSubstanceConversionFactor(swigCPtr, this, id); 377 } 378 379 public int unsetSubstanceConversionFactor() { 380 return libsbmlJNI.Submodel_unsetSubstanceConversionFactor(swigCPtr, this); 381 } 382 383 public String getTimeConversionFactor() { 384 return libsbmlJNI.Submodel_getTimeConversionFactor(swigCPtr, this); 385 } 386 387 public boolean isSetTimeConversionFactor() { 388 return libsbmlJNI.Submodel_isSetTimeConversionFactor(swigCPtr, this); 389 } 390 391 public int setTimeConversionFactor(String id) { 392 return libsbmlJNI.Submodel_setTimeConversionFactor(swigCPtr, this, id); 393 } 394 395 public int unsetTimeConversionFactor() { 396 return libsbmlJNI.Submodel_unsetTimeConversionFactor(swigCPtr, this); 397 } 398 399 public String getExtentConversionFactor() { 400 return libsbmlJNI.Submodel_getExtentConversionFactor(swigCPtr, this); 401 } 402 403 public boolean isSetExtentConversionFactor() { 404 return libsbmlJNI.Submodel_isSetExtentConversionFactor(swigCPtr, this); 405 } 406 407 public int setExtentConversionFactor(String id) { 408 return libsbmlJNI.Submodel_setExtentConversionFactor(swigCPtr, this, id); 409 } 410 411 public int unsetExtentConversionFactor() { 412 return libsbmlJNI.Submodel_unsetExtentConversionFactor(swigCPtr, this); 413 } 414 415 public ListOfDeletions getListOfDeletions() { 416 long cPtr = libsbmlJNI.Submodel_getListOfDeletions__SWIG_0(swigCPtr, this); 417 return (cPtr == 0) ? null : new ListOfDeletions(cPtr, false); 418 } 419 420 public Deletion getDeletion(long n) { 421 long cPtr = libsbmlJNI.Submodel_getDeletion__SWIG_0(swigCPtr, this, n); 422 return (cPtr == 0) ? null : new Deletion(cPtr, false); 423 } 424 425 public Deletion getDeletion(String id) { 426 long cPtr = libsbmlJNI.Submodel_getDeletion__SWIG_2(swigCPtr, this, id); 427 return (cPtr == 0) ? null : new Deletion(cPtr, false); 428 } 429 430 public int addDeletion(Deletion deletion) { 431 return libsbmlJNI.Submodel_addDeletion(swigCPtr, this, Deletion.getCPtr(deletion), deletion); 432 } 433 434 public long getNumDeletions() { 435 return libsbmlJNI.Submodel_getNumDeletions(swigCPtr, this); 436 } 437 438 public Deletion createDeletion() { 439 long cPtr = libsbmlJNI.Submodel_createDeletion(swigCPtr, this); 440 return (cPtr == 0) ? null : new Deletion(cPtr, false); 441 } 442 443 public Deletion removeDeletion(long index) { 444 long cPtr = libsbmlJNI.Submodel_removeDeletion__SWIG_0(swigCPtr, this, index); 445 return (cPtr == 0) ? null : new Deletion(cPtr, false); 446 } 447 448 public Deletion removeDeletion(String sid) { 449 long cPtr = libsbmlJNI.Submodel_removeDeletion__SWIG_1(swigCPtr, this, sid); 450 return (cPtr == 0) ? null : new Deletion(cPtr, false); 451 } 452 453 454/** 455 * Subclasses should override this method to write out their contained 456 * SBML objects as XML elements. Be sure to call your parents 457 * implementation of this method as well. For example: 458 * @internal 459 */ public 460 boolean hasRequiredAttributes() { 461 return libsbmlJNI.Submodel_hasRequiredAttributes(swigCPtr, this); 462 } 463 464 465/** 466 * Returns the XML element name of this object. 467 * <p> 468 * This is overridden by subclasses to return a string appropriate to the 469 * SBML component. For example, {@link Model} defines it as returning 470 * <code>'model'</code>, {@link CompartmentType} defines it as returning <code>'compartmentType'</code>, 471 * and so on. 472 */ public 473 String getElementName() { 474 return libsbmlJNI.Submodel_getElementName(swigCPtr, this); 475 } 476 477 478/** 479 * Renames all the <code>SIdRef</code> attributes on this element, including any 480 * found in MathML content (if such exists). 481 * <p> 482 * This method works by looking at all attributes and (if appropriate) 483 * mathematical formulas, comparing the identifiers to the value of 484 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 485 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 486 * <p> 487 * @param oldid the old identifier 488 * @param newid the new identifier 489 */ public 490 void renameSIdRefs(String oldid, String newid) { 491 libsbmlJNI.Submodel_renameSIdRefs(swigCPtr, this, oldid, newid); 492 } 493 494 495/** 496 * Returns the libSBML type code for this object. 497 * <p> 498 * This method may return the type code of this SBML object, or it may 499 * return {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN}. This 500 * is because subclasses of {@link SBase} are not required to implement this 501 * method to return a type code. This method is meant primarily for the 502 * LibSBML C interface, in which class and subclass information is not 503 * readily available. 504 * <p> 505 * @return the SBML object type code 506 * of this SBML object or 507 * {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (the default). 508 * <p> 509 * @see #getElementName() 510 * @see #getPackageName() 511 */ public 512 int getTypeCode() { 513 return libsbmlJNI.Submodel_getTypeCode(swigCPtr, this); 514 } 515 516 public boolean acceptComp(SWIGTYPE_p_CompVisitor v) { 517 return libsbmlJNI.Submodel_acceptComp(swigCPtr, this, SWIGTYPE_p_CompVisitor.getCPtr(v)); 518 } 519 520 521/** 522 * Sets this SBML object to child SBML objects (if any). 523 * (Creates a child-parent relationship by the parent) 524 * <p> 525 * Subclasses must override this function if they define 526 * one ore more child elements. 527 * Basically, this function needs to be called in 528 * constructor, copy constructor, assignment operator. 529 * <p> 530 * <p> 531 * @internal 532 */ public 533 void connectToChild() { 534 libsbmlJNI.Submodel_connectToChild(swigCPtr, this); 535 } 536 537 538/** 539 * Subclasses should override this method to create, store, and then 540 * return an SBML object corresponding to the next {@link XMLToken} in the 541 * XMLInputStream. 542 * <p> 543 * @return the SBML object corresponding to next {@link XMLToken} in the 544 * XMLInputStream or <code>null</code> if the token was not recognized. 545 * @internal 546 */ public 547 SBase createObject(XMLInputStream stream) { 548 return libsbml.DowncastSBase(libsbmlJNI.Submodel_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false); 549} 550 551 public int instantiate() { 552 return libsbmlJNI.Submodel_instantiate(swigCPtr, this); 553 } 554 555 public int performDeletions() { 556 return libsbmlJNI.Submodel_performDeletions(swigCPtr, this); 557 } 558 559 public int replaceElement(SBase toReplace, SBase replacement) { 560 return libsbmlJNI.Submodel_replaceElement(swigCPtr, this, SBase.getCPtr(toReplace), toReplace, SBase.getCPtr(replacement), replacement); 561 } 562 563 public Model getInstantiation() { 564 long cPtr = libsbmlJNI.Submodel_getInstantiation__SWIG_0(swigCPtr, this); 565 return (cPtr == 0) ? null : new Model(cPtr, false); 566 } 567 568 public void clearInstantiation() { 569 libsbmlJNI.Submodel_clearInstantiation(swigCPtr, this); 570 } 571 572 public int convertTimeAndExtent() { 573 return libsbmlJNI.Submodel_convertTimeAndExtent(swigCPtr, this); 574 } 575 576 public SBaseList getListOfAllInstantiatedElements() { 577 long cPtr = libsbmlJNI.Submodel_getListOfAllInstantiatedElements(swigCPtr, this); 578 return (cPtr == 0) ? null : new SBaseList(cPtr, false); 579 } 580 581}