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-fbc"><a href="group__fbc.html">fbc</a></span> 013 Implementation of the 'fbc' package extention to the 014 * Model construct. 015 */ 016 017public class FbcModelPlugin extends SBasePlugin { 018 private long swigCPtr; 019 020 protected FbcModelPlugin(long cPtr, boolean cMemoryOwn) 021 { 022 super(libsbmlJNI.FbcModelPlugin_SWIGUpcast(cPtr), cMemoryOwn); 023 swigCPtr = cPtr; 024 } 025 026 protected static long getCPtr(FbcModelPlugin obj) 027 { 028 return (obj == null) ? 0 : obj.swigCPtr; 029 } 030 031 protected static long getCPtrAndDisown (FbcModelPlugin obj) 032 { 033 long ptr = 0; 034 035 if (obj != null) 036 { 037 ptr = obj.swigCPtr; 038 obj.swigCMemOwn = false; 039 } 040 041 return ptr; 042 } 043 044 protected void finalize() { 045 delete(); 046 } 047 048 public synchronized void delete() { 049 if (swigCPtr != 0) { 050 if (swigCMemOwn) { 051 swigCMemOwn = false; 052 libsbmlJNI.delete_FbcModelPlugin(swigCPtr); 053 } 054 swigCPtr = 0; 055 } 056 super.delete(); 057 } 058 059 060/** 061 * Constructor 062 */ public 063 FbcModelPlugin(String uri, String prefix, FbcPkgNamespaces fbcns) { 064 this(libsbmlJNI.new_FbcModelPlugin__SWIG_0(uri, prefix, FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 065 } 066 067 068/** 069 * Copy constructor. Creates a copy of this {@link FbcModelPlugin} object. 070 */ public 071 FbcModelPlugin(FbcModelPlugin orig) { 072 this(libsbmlJNI.new_FbcModelPlugin__SWIG_1(FbcModelPlugin.getCPtr(orig), orig), true); 073 } 074 075 076/** 077 * Creates and returns a deep copy of this {@link FbcModelPlugin} object. 078 <p> 079 * @return a (deep) copy of this {@link FbcModelPlugin} object 080 */ public 081 SBasePlugin cloneObject() { 082 long cPtr = libsbmlJNI.FbcModelPlugin_cloneObject(swigCPtr, this); 083 return (cPtr == 0) ? null : new FbcModelPlugin(cPtr, true); 084 } 085 086 087/** 088 * Subclasses must override this method to create, store, and then 089 * return an SBML object corresponding to the next {@link XMLToken} in the 090 * {@link XMLInputStream} if they have their specific elements. 091 <p> 092 * @return the SBML object corresponding to next {@link XMLToken} in the 093 * {@link XMLInputStream} or null if the token was not recognized. 094 * @internal 095 */ public 096 SBase createObject(XMLInputStream stream) { 097 return libsbml.DowncastSBase(libsbmlJNI.FbcModelPlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false); 098} 099 100 101/** 102 * This function is a bit tricky. 103 * This function is used only for setting annotation element in case 104 * gene associations are used. 105 * Thus, no attribute is written by this function. 106 * @internal 107 */ public 108 void writeAttributes(XMLOutputStream stream) { 109 libsbmlJNI.FbcModelPlugin_writeAttributes(swigCPtr, this, XMLOutputStream.getCPtr(stream), stream); 110 } 111 112 113/** 114 * Checks if this plugin object has all the required elements. 115 <p> 116 * Subclasses should override this function if they have their specific 117 * elements. 118 <p> 119 * @return true if this plugin object has all the required elements, 120 * otherwise false will be returned. 121 * @internal 122 */ public 123 boolean hasRequiredElements() { 124 return libsbmlJNI.FbcModelPlugin_hasRequiredElements(swigCPtr, this); 125 } 126 127 128/** 129 * Parses Gene Annotation Extension 130 * @internal 131 */ public 132 boolean readOtherXML(SBase parentObject, XMLInputStream stream) { 133 return libsbmlJNI.FbcModelPlugin_readOtherXML(swigCPtr, this, SBase.getCPtr(parentObject), parentObject, XMLInputStream.getCPtr(stream), stream); 134 } 135 136 137/** 138 * Returns the first child element found that has the given <code>id</code> in the model-wide SId namespace, or <code>null</code> if no such object is found. 139 <p> 140 * @param id string representing the id of objects to find 141 <p> 142 * @return a pointer to the {@link SBase} element with the given <code>id</code>. 143 */ public 144 SBase getElementBySId(String id) { 145 return libsbml.DowncastSBase(libsbmlJNI.FbcModelPlugin_getElementBySId(swigCPtr, this, id), false); 146} 147 148 149/** 150 * Returns the first child element it can find with the given <code>metaid</code>, or itself if it has the given <code>metaid</code>, or <code>null</code> if no such object is found. 151 <p> 152 * @param metaid string representing the metaid of objects to find 153 <p> 154 * @return a pointer to the {@link SBase} element with the given <code>metaid</code>. 155 */ public 156 SBase getElementByMetaId(String metaid) { 157 return libsbml.DowncastSBase(libsbmlJNI.FbcModelPlugin_getElementByMetaId(swigCPtr, this, metaid), false); 158} 159 160 161/** * @internal */ public 162 int appendFrom(Model model) { 163 return libsbmlJNI.FbcModelPlugin_appendFrom(swigCPtr, this, Model.getCPtr(model), model); 164 } 165 166 167/** 168 * Returns the {@link ListOfFluxBounds} in this plugin object. 169 <p> 170 * @return {@link ListOfFluxBounds} object in this plugin object. 171 */ public 172 ListOfFluxBounds getListOfFluxBounds() { 173 long cPtr = libsbmlJNI.FbcModelPlugin_getListOfFluxBounds__SWIG_0(swigCPtr, this); 174 return (cPtr == 0) ? null : new ListOfFluxBounds(cPtr, false); 175 } 176 177 178/** 179 * Returns the {@link FluxBound} object that belongs to the given index. If the 180 * index is invalid, <code>null</code> is returned. 181 <p> 182 * @param n the index number of the {@link FluxBound} to get. 183 <p> 184 * @return the nth {@link FluxBound} in the {@link ListOfFluxBounds}. 185 */ public 186 FluxBound getFluxBound(long n) { 187 long cPtr = libsbmlJNI.FbcModelPlugin_getFluxBound__SWIG_0(swigCPtr, this, n); 188 return (cPtr == 0) ? null : new FluxBound(cPtr, false); 189 } 190 191 192/** 193 * Returns the {@link FluxBound} object based on its identifier. 194 <p> 195 * @param sid a string representing the identifier 196 * of the {@link FluxBound} to get. 197 <p> 198 * @return {@link FluxBound} in the {@link ListOfFluxBounds} with the given <code>sid</code> 199 * or null if no such {@link FluxBound} exists. 200 <p> 201 * @see #getFluxBound(long n) 202 * @see #getListOfFluxBounds() 203 */ public 204 FluxBound getFluxBound(String sid) { 205 long cPtr = libsbmlJNI.FbcModelPlugin_getFluxBound__SWIG_2(swigCPtr, this, sid); 206 return (cPtr == 0) ? null : new FluxBound(cPtr, false); 207 } 208 209 210/** 211 * Adds a copy of the given {@link FluxBound} object to the list of FluxBounds. 212 <p> 213 * @param bound the {@link FluxBound} object to be added to the list of FluxBounds. 214 <p> 215 * @return integer value indicating success/failure of the 216 * operation. The possible return values are: 217 * <ul> 218 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 219 * </ul> 220 */ public 221 int addFluxBound(FluxBound bound) { 222 return libsbmlJNI.FbcModelPlugin_addFluxBound(swigCPtr, this, FluxBound.getCPtr(bound), bound); 223 } 224 225 226/** 227 * Creates a new {@link FluxBound} object and adds it to the list of {@link FluxBound} objects 228 * and returns it. 229 <p> 230 * @return a newly created {@link FluxBound} object 231 */ public 232 FluxBound createFluxBound() { 233 long cPtr = libsbmlJNI.FbcModelPlugin_createFluxBound(swigCPtr, this); 234 return (cPtr == 0) ? null : new FluxBound(cPtr, false); 235 } 236 237 238/** 239 * Removes the nth {@link FluxBound} object from this plugin object and 240 * returns a pointer to it. 241 <p> 242 * The caller owns the returned object and is responsible for 243 * deleting it. 244 <p> 245 * @param n the index of the {@link FluxBound} object to remove 246 <p> 247 * @return the {@link FluxBound} object removed. As mentioned above, the 248 * caller owns the returned object. <code>null</code> is returned if the 249 * given index is out of range. 250 */ public 251 FluxBound removeFluxBound(long n) { 252 long cPtr = libsbmlJNI.FbcModelPlugin_removeFluxBound__SWIG_0(swigCPtr, this, n); 253 return (cPtr == 0) ? null : new FluxBound(cPtr, false); 254 } 255 256 257/** 258 * Removes the {@link FluxBound} object with the given <code>sid</code> attribute from 259 * this plugin object and returns a pointer to it. 260 <p> 261 * The caller owns the returned object and is responsible for 262 * deleting it. 263 <p> 264 * @param sid the id attribute of the {@link FluxBound} object to remove 265 <p> 266 * @return the {@link FluxBound} object removed. As mentioned above, the 267 * caller owns the returned object. <code>null</code> is returned if the 268 * given index is out of range. 269 */ public 270 FluxBound removeFluxBound(String sid) { 271 long cPtr = libsbmlJNI.FbcModelPlugin_removeFluxBound__SWIG_1(swigCPtr, this, sid); 272 return (cPtr == 0) ? null : new FluxBound(cPtr, false); 273 } 274 275 276/** 277 * Returns the number of {@link FluxBound} object in this plugin object. 278 <p> 279 * @return the number of {@link FluxBound} object in this plugin object. 280 */ public 281 long getNumFluxBounds() { 282 return libsbmlJNI.FbcModelPlugin_getNumFluxBounds(swigCPtr, this); 283 } 284 285 286/** 287 * Returns the {@link ListOfObjectives} in this plugin object. 288 <p> 289 * @return {@link ListOfObjectives} object in this plugin object. 290 */ public 291 ListOfObjectives getListOfObjectives() { 292 long cPtr = libsbmlJNI.FbcModelPlugin_getListOfObjectives__SWIG_0(swigCPtr, this); 293 return (cPtr == 0) ? null : new ListOfObjectives(cPtr, false); 294 } 295 296 297/** 298 * Returns the {@link Objective} object that belongs to the given index. If the 299 * index is invalid, <code>null</code> is returned. 300 <p> 301 * @param n the index number of the {@link Objective} to get. 302 <p> 303 * @return the nth {@link Objective} in the {@link ListOfObjectives}. 304 */ public 305 Objective getObjective(long n) { 306 long cPtr = libsbmlJNI.FbcModelPlugin_getObjective__SWIG_0(swigCPtr, this, n); 307 return (cPtr == 0) ? null : new Objective(cPtr, false); 308 } 309 310 311/** 312 * Returns the {@link Objective} object based on its identifier. 313 <p> 314 * @param sid a string representing the identifier 315 * of the {@link Objective} to get. 316 <p> 317 * @return {@link Objective} in the {@link ListOfObjectives} with the given <code>id</code> 318 * or null if no such {@link Objective} exists. 319 <p> 320 * @see #getObjective(long n) 321 * @see #getListOfObjectives() 322 */ public 323 Objective getObjective(String sid) { 324 long cPtr = libsbmlJNI.FbcModelPlugin_getObjective__SWIG_2(swigCPtr, this, sid); 325 return (cPtr == 0) ? null : new Objective(cPtr, false); 326 } 327 328 329/** 330 * Adds a copy of the given {@link Objective} object to the list of Objectives. 331 <p> 332 * @param bound the {@link Objective} object to be added to the list of Objectives. 333 <p> 334 * @return integer value indicating success/failure of the 335 * operation. The possible return values are: 336 * <ul> 337 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 338 * </ul> 339 */ public 340 int addObjective(Objective bound) { 341 return libsbmlJNI.FbcModelPlugin_addObjective(swigCPtr, this, Objective.getCPtr(bound), bound); 342 } 343 344 345/** 346 * Creates a new {@link Objective} object and adds it to the list of {@link Objective} objects 347 * and returns it. 348 <p> 349 * @return a newly created {@link Objective} object 350 */ public 351 Objective createObjective() { 352 long cPtr = libsbmlJNI.FbcModelPlugin_createObjective(swigCPtr, this); 353 return (cPtr == 0) ? null : new Objective(cPtr, false); 354 } 355 356 357/** 358 * Removes the nth {@link Objective} object from this plugin object and 359 * returns a pointer to it. 360 <p> 361 * The caller owns the returned object and is responsible for 362 * deleting it. 363 <p> 364 * @param n the index of the {@link Objective} object to remove 365 <p> 366 * @return the {@link Objective} object removed. As mentioned above, the 367 * caller owns the returned object. <code>null</code> is returned if the 368 * given index is out of range. 369 */ public 370 Objective removeObjective(long n) { 371 long cPtr = libsbmlJNI.FbcModelPlugin_removeObjective__SWIG_0(swigCPtr, this, n); 372 return (cPtr == 0) ? null : new Objective(cPtr, false); 373 } 374 375 376/** 377 * Removes the {@link Objective} object with the given <code>sid</code> attribute from 378 * this plugin object and returns a pointer to it. 379 <p> 380 * The caller owns the returned object and is responsible for 381 * deleting it. 382 <p> 383 * @param sid the id attribute of the {@link Objective} object to remove 384 <p> 385 * @return the {@link Objective} object removed. As mentioned above, the 386 * caller owns the returned object. <code>null</code> is returned if the 387 * given index is out of range. 388 */ public 389 Objective removeObjective(String sid) { 390 long cPtr = libsbmlJNI.FbcModelPlugin_removeObjective__SWIG_1(swigCPtr, this, sid); 391 return (cPtr == 0) ? null : new Objective(cPtr, false); 392 } 393 394 395/** 396 * Returns the number of {@link Objective} object in this plugin object. 397 <p> 398 * @return the number of {@link Objective} object in this plugin object. 399 */ public 400 long getNumObjectives() { 401 return libsbmlJNI.FbcModelPlugin_getNumObjectives(swigCPtr, this); 402 } 403 404 405/** 406 * Returns the current active objective. 407 */ public 408 Objective getActiveObjective() { 409 long cPtr = libsbmlJNI.FbcModelPlugin_getActiveObjective__SWIG_0(swigCPtr, this); 410 return (cPtr == 0) ? null : new Objective(cPtr, false); 411 } 412 413 414/** 415 * Sets the id of the active objective. 416 */ public 417 int setActiveObjectiveId(String objectiveId) { 418 return libsbmlJNI.FbcModelPlugin_setActiveObjectiveId(swigCPtr, this, objectiveId); 419 } 420 421 422/** 423 * returns the id of the current active objective. 424 */ public 425 String getActiveObjectiveId() { 426 return libsbmlJNI.FbcModelPlugin_getActiveObjectiveId(swigCPtr, this); 427 } 428 429 430/** 431 * Unsets the active objective. 432 */ public 433 void unsetActiveObjectiveId() { 434 libsbmlJNI.FbcModelPlugin_unsetActiveObjectiveId(swigCPtr, this); 435 } 436 437 438/** 439 * Returns the {@link ListOfObjectives} in this plugin object. 440 <p> 441 * @return {@link ListOfObjectives} object in this plugin object. 442 */ public 443 ListOfGeneAssociations getListOfGeneAssociations() { 444 long cPtr = libsbmlJNI.FbcModelPlugin_getListOfGeneAssociations__SWIG_0(swigCPtr, this); 445 return (cPtr == 0) ? null : new ListOfGeneAssociations(cPtr, false); 446 } 447 448 449/** 450 * Returns the {@link GeneAssociation} object that belongs to the given index. If the 451 * index is invalid, <code>null</code> is returned. 452 <p> 453 * @param n the index number of the {@link GeneAssociation} to get. 454 <p> 455 * @return the nth {@link GeneAssociation} in the {@link ListOfGeneAssociations}. 456 */ public 457 GeneAssociation getGeneAssociation(long n) { 458 long cPtr = libsbmlJNI.FbcModelPlugin_getGeneAssociation__SWIG_0(swigCPtr, this, n); 459 return (cPtr == 0) ? null : new GeneAssociation(cPtr, false); 460 } 461 462 463/** 464 * Returns the {@link GeneAssociation} object based on its identifier. 465 <p> 466 * @param sid a string representing the identifier 467 * of the {@link GeneAssociation} to get. 468 <p> 469 * @return {@link GeneAssociation} in the {@link ListOfGeneAssociations} with the given <code>sid</code> 470 * or null if no such {@link GeneAssociation} exists. 471 <p> 472 * @see #getGeneAssociation(long n) 473 * @see #getListOfGeneAssociations() 474 */ public 475 GeneAssociation getGeneAssociation(String sid) { 476 long cPtr = libsbmlJNI.FbcModelPlugin_getGeneAssociation__SWIG_2(swigCPtr, this, sid); 477 return (cPtr == 0) ? null : new GeneAssociation(cPtr, false); 478 } 479 480 481/** 482 * Adds a copy of the given {@link GeneAssociation} object to the list of GeneAssociations. 483 <p> 484 * @param association the {@link GeneAssociation} object to be added to the list of GeneAssociations. 485 <p> 486 * @return integer value indicating success/failure of the 487 * operation. The possible return values are: 488 * <ul> 489 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 490 * </ul> 491 */ public 492 int addGeneAssociation(GeneAssociation association) { 493 return libsbmlJNI.FbcModelPlugin_addGeneAssociation(swigCPtr, this, GeneAssociation.getCPtr(association), association); 494 } 495 496 497/** 498 * Creates a new {@link GeneAssociation} object and adds it to the list of {@link GeneAssociation} objects 499 * and returns it. 500 <p> 501 * @return a newly created {@link GeneAssociation} object 502 */ public 503 GeneAssociation createGeneAssociation() { 504 long cPtr = libsbmlJNI.FbcModelPlugin_createGeneAssociation(swigCPtr, this); 505 return (cPtr == 0) ? null : new GeneAssociation(cPtr, false); 506 } 507 508 509/** 510 * Removes the nth {@link GeneAssociation} object from this plugin object and 511 * returns a pointer to it. 512 <p> 513 * The caller owns the returned object and is responsible for 514 * deleting it. 515 <p> 516 * @param n the index of the {@link GeneAssociation} object to remove 517 <p> 518 * @return the {@link GeneAssociation} object removed. As mentioned above, the 519 * caller owns the returned object. <code>null</code> is returned if the 520 * given index is out of range. 521 */ public 522 GeneAssociation removeGeneAssociation(long n) { 523 long cPtr = libsbmlJNI.FbcModelPlugin_removeGeneAssociation__SWIG_0(swigCPtr, this, n); 524 return (cPtr == 0) ? null : new GeneAssociation(cPtr, false); 525 } 526 527 528/** 529 * Removes the {@link GeneAssociation} object with the given <code>sid</code> attribute from 530 * this plugin object and returns a pointer to it. 531 <p> 532 * The caller owns the returned object and is responsible for 533 * deleting it. 534 <p> 535 * @param sid the id attribute of the {@link GeneAssociation} object to remove 536 <p> 537 * @return the {@link GeneAssociation} object removed. As mentioned above, the 538 * caller owns the returned object. <code>null</code> is returned if the 539 * given index is out of range. 540 */ public 541 GeneAssociation removeGeneAssociation(String sid) { 542 long cPtr = libsbmlJNI.FbcModelPlugin_removeGeneAssociation__SWIG_1(swigCPtr, this, sid); 543 return (cPtr == 0) ? null : new GeneAssociation(cPtr, false); 544 } 545 546 547/** 548 * Returns the number of {@link GeneAssociation} object in this plugin object. 549 <p> 550 * @return the number of {@link GeneAssociation} object in this plugin object. 551 */ public 552 int getNumGeneAssociations() { 553 return libsbmlJNI.FbcModelPlugin_getNumGeneAssociations(swigCPtr, this); 554 } 555 556 557/** 558 * Sets the *parent* of this SBML object to child SBML objects (if any). 559 * (Creates a child-parent relationship by the parent) 560 <p> 561 * @see setSBMLDocument 562 * @see enablePackageInternal 563 * @internal 564 */ public 565 void connectToChild() { 566 libsbmlJNI.FbcModelPlugin_connectToChild(swigCPtr, this); 567 } 568 569 570/** 571 * Sets the parent SBML object of this plugin object to 572 * this object and child elements (if any). 573 * (Creates a child-parent relationship by this plugin object) 574 <p> 575 * This function is called when this object is created by 576 * the parent element. 577 * Subclasses must override this this function if they have one 578 * or more child elements.Also, {@link SBasePlugin#connectToParent()} 579 * must be called in the overridden function. 580 <p> 581 * @param sbase the {@link SBase} object to use 582 <p> 583 * @see setSBMLDocument 584 * @see enablePackageInternal 585 * @internal 586 */ public 587 void connectToParent(SBase sbase) { 588 libsbmlJNI.FbcModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase); 589 } 590 591 592/** 593 * Enables/Disables the given package with child elements in this plugin 594 * object (if any). 595 * (This is an internal implementation invoked from 596 * {@link SBase#enablePackageInternal()} function) 597 <p> 598 * @note Subclasses in which one or more {@link SBase} derived elements are 599 * defined must override this function. 600 <p> 601 * @see setSBMLDocument 602 * @see connectToParent 603 * @internal 604 */ public 605 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 606 libsbmlJNI.FbcModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 607 } 608 609 610/** */ public 611 ListOfFluxBounds getFluxBoundsForReaction(String reaction) { 612 long cPtr = libsbmlJNI.FbcModelPlugin_getFluxBoundsForReaction(swigCPtr, this, reaction); 613 return (cPtr == 0) ? null : new ListOfFluxBounds(cPtr, false); 614 } 615 616}