001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.8 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 An objective function. 014 <p> 015 * An integral component in a complete description of a steady-state model is 016 * the so-called <em>objective function</em>, which generally consists of a 017 * linear combination of model variables (fluxes) and a sense (direction). In 018 * the SBML Level 3 Flux Balance Constraints (“fbc”) 019 * package, this concept is succinctly captured in the {@link Objective} class. 020 <p> 021 * The {@link Objective} class is derived from the normal SBML {@link SBase} class and 022 * inherits the 'metaid' and 'sboTerm' attributes, as well as the 023 * subcomponents for Annotation and Notes. To these, the {@link Objective} class 024 * adds an optional attribute named 'type'. The type attribute can take one 025 * of two literal values: <code>'maximize'</code> or <code>'minimize.</code> The values 026 * represent the sense of the optimality constraint for the FBC model. 027 <p> 028 * The “fbc” package allows for the definition of multiple model 029 * objectives, with one being designated as active. Here is an example of 030 * the XML encoding of a model with a list of objective functions: 031 * <pre class='fragment'> 032<fbc:listOfObjectives fbc:activeObjective='obj1'> 033 <fbc:objective fbc:id='obj1' fbc:type='maximize'> 034 <fbc:listOfFluxObjectives> 035 <fbc:fluxObjective fbc:reaction='R101' fbc:coefficient='1'/> 036 </fbc:listOfFluxObjectives> 037 </fbc:objective> 038 <fbc:objective fbc:id='obj2' fbc:type='minimize'> 039 <fbc:listOfFluxObjectives> 040 <fbc:fluxObjective fbc:reaction='R102' fbc:coefficient='-2.5'/> 041 <fbc:fluxObjective fbc:reaction='R103' fbc:coefficient='1'/> 042 </fbc:listOfFluxObjectives> 043 </fbc:objective> 044</fbc:listOfObjectives> 045</pre> 046 <p> 047 * @see FluxObjective 048 */ 049 050public class Objective extends SBase { 051 private long swigCPtr; 052 053 protected Objective(long cPtr, boolean cMemoryOwn) 054 { 055 super(libsbmlJNI.Objective_SWIGUpcast(cPtr), cMemoryOwn); 056 swigCPtr = cPtr; 057 } 058 059 protected static long getCPtr(Objective obj) 060 { 061 return (obj == null) ? 0 : obj.swigCPtr; 062 } 063 064 protected static long getCPtrAndDisown (Objective obj) 065 { 066 long ptr = 0; 067 068 if (obj != null) 069 { 070 ptr = obj.swigCPtr; 071 obj.swigCMemOwn = false; 072 } 073 074 return ptr; 075 } 076 077 protected void finalize() { 078 delete(); 079 } 080 081 public synchronized void delete() { 082 if (swigCPtr != 0) { 083 if (swigCMemOwn) { 084 swigCMemOwn = false; 085 libsbmlJNI.delete_Objective(swigCPtr); 086 } 087 swigCPtr = 0; 088 } 089 super.delete(); 090 } 091 092 093/** 094 * Creates a new {@link Objective} with the given SBML Level, Version, and 095 * “fbc”package version. 096 <p> 097 * @param level a long integer, the SBML Level to assign to this {@link Objective} 098 <p> 099 * @param version a long integer, the SBML Version to assign to this 100 * {@link Objective} 101 <p> 102 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 103 * this {@link Objective} 104 */ public 105 Objective(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 106 this(libsbmlJNI.new_Objective__SWIG_0(level, version, pkgVersion), true); 107 } 108 109 110/** 111 * Creates a new {@link Objective} with the given SBML Level, Version, and 112 * “fbc”package version. 113 <p> 114 * @param level a long integer, the SBML Level to assign to this {@link Objective} 115 <p> 116 * @param version a long integer, the SBML Version to assign to this 117 * {@link Objective} 118 <p> 119 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 120 * this {@link Objective} 121 */ public 122 Objective(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 123 this(libsbmlJNI.new_Objective__SWIG_1(level, version), true); 124 } 125 126 127/** 128 * Creates a new {@link Objective} with the given SBML Level, Version, and 129 * “fbc”package version. 130 <p> 131 * @param level a long integer, the SBML Level to assign to this {@link Objective} 132 <p> 133 * @param version a long integer, the SBML Version to assign to this 134 * {@link Objective} 135 <p> 136 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 137 * this {@link Objective} 138 */ public 139 Objective(long level) throws org.sbml.libsbml.SBMLConstructorException { 140 this(libsbmlJNI.new_Objective__SWIG_2(level), true); 141 } 142 143 144/** 145 * Creates a new {@link Objective} with the given SBML Level, Version, and 146 * “fbc”package version. 147 <p> 148 * @param level a long integer, the SBML Level to assign to this {@link Objective} 149 <p> 150 * @param version a long integer, the SBML Version to assign to this 151 * {@link Objective} 152 <p> 153 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 154 * this {@link Objective} 155 */ public 156 Objective() throws org.sbml.libsbml.SBMLConstructorException { 157 this(libsbmlJNI.new_Objective__SWIG_3(), true); 158 } 159 160 161/** 162 * Creates a new {@link Objective} with the given {@link FbcPkgNamespaces} object. 163 <p> 164 * @param fbcns the {@link FbcPkgNamespaces} object 165 */ public 166 Objective(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 167 this(libsbmlJNI.new_Objective__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 168 } 169 170 171/** 172 * Copy constructor for {@link Objective}. 173 <p> 174 * @param orig; the {@link Objective} instance to copy. 175 */ public 176 Objective(Objective orig) throws org.sbml.libsbml.SBMLConstructorException { 177 this(libsbmlJNI.new_Objective__SWIG_5(Objective.getCPtr(orig), orig), true); 178 } 179 180 181/** 182 * Creates and returns a deep copy of this {@link Objective} object. 183 <p> 184 * @return a (deep) copy of this {@link Objective} object. 185 */ public 186 Objective cloneObject() { 187 long cPtr = libsbmlJNI.Objective_cloneObject(swigCPtr, this); 188 return (cPtr == 0) ? null : new Objective(cPtr, true); 189 } 190 191 192/** 193 * Returns the value of the 'id' attribute of this {@link Objective}. 194 <p> 195 * @return the value of the 'id' attribute of this {@link Objective} as a string. 196 */ public 197 String getId() { 198 return libsbmlJNI.Objective_getId(swigCPtr, this); 199 } 200 201 202/** 203 * Returns the value of the 'name' attribute of this {@link Objective}. 204 <p> 205 * @return the value of the 'name' attribute of this {@link Objective} as a string. 206 */ public 207 String getName() { 208 return libsbmlJNI.Objective_getName(swigCPtr, this); 209 } 210 211 212/** 213 * Returns the enumeration value of the 'type' attribute of this {@link Objective}. 214 <p> 215 * @return the enumeration value of the 'type' attribute of this {@link Objective}. 216 */ public 217 int getObjectiveType() { 218 return libsbmlJNI.Objective_getObjectiveType(swigCPtr, this); 219 } 220 221 222/** 223 * Returns the string of the 'type' attribute of this {@link Objective}. 224 <p> 225 * @return the string of the 'type' attribute of this {@link Objective}. 226 */ public 227 String getType() { 228 return libsbmlJNI.Objective_getType(swigCPtr, this); 229 } 230 231 232/** 233 * Predicate returning <code>true</code> if this {@link Objective}'s 'id' attribute is set. 234 <p> 235 * @return <code>true</code> if this {@link Objective}'s 'id' attribute has been set, 236 * otherwise <code>false</code> is returned. 237 */ public 238 boolean isSetId() { 239 return libsbmlJNI.Objective_isSetId(swigCPtr, this); 240 } 241 242 243/** 244 * Predicate returning <code>true</code> if this {@link Objective}'s 'name' attribute is set. 245 <p> 246 * @return <code>true</code> if this {@link Objective}'s 'name' attribute has been set, 247 * otherwise <code>false</code> is returned. 248 */ public 249 boolean isSetName() { 250 return libsbmlJNI.Objective_isSetName(swigCPtr, this); 251 } 252 253 254/** 255 * Predicate returning <code>true</code> if this {@link Objective}'s 'type' attribute is set. 256 <p> 257 * @return <code>true</code> if this {@link Objective}'s 'type' attribute has been set, 258 * otherwise <code>false</code> is returned. 259 */ public 260 boolean isSetType() { 261 return libsbmlJNI.Objective_isSetType(swigCPtr, this); 262 } 263 264 265/** 266 * Sets the value of the 'id' attribute of this {@link Objective}. 267 <p> 268 * @param id; String value of the 'id' attribute to be set 269 <p> 270 * @return integer value indicating success/failure of the 271 * function. The possible values 272 * returned by this function are: 273 * <ul> 274 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 275 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 276 * </ul> 277 */ public 278 int setId(String id) { 279 return libsbmlJNI.Objective_setId(swigCPtr, this, id); 280 } 281 282 283/** 284 * Sets the value of the 'name' attribute of this {@link Objective}. 285 <p> 286 * @param name; String value of the 'name' attribute to be set 287 <p> 288 * @return integer value indicating success/failure of the 289 * function. The possible values 290 * returned by this function are: 291 * <ul> 292 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 293 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 294 * </ul> 295 */ public 296 int setName(String name) { 297 return libsbmlJNI.Objective_setName(swigCPtr, this, name); 298 } 299 300 301/** 302 * Sets the SIdRef string of the 'type' attribute of this {@link Objective}. 303 <p> 304 * @param type a SIdRef string to be set. 305 <p> 306 * <p> 307 * @return integer value indicating success/failure of the 308 * function. The possible values 309 * returned by this function are: 310 * <ul> 311 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 312 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 313 * </ul> 314 */ public 315 int setType(int type) { 316 return libsbmlJNI.Objective_setType__SWIG_0(swigCPtr, this, type); 317 } 318 319 320/** 321 * Sets the value of the 'type' attribute of this {@link Objective}. 322 <p> 323 * @param type; string value of the 'type' attribute to be set 324 <p> 325 * @return integer value indicating success/failure of the 326 * function. The possible values 327 * returned by this function are: 328 * <ul> 329 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 330 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 331 * </ul> 332 */ public 333 int setType(String type) { 334 return libsbmlJNI.Objective_setType__SWIG_1(swigCPtr, this, type); 335 } 336 337 338/** 339 * Unsets the value of the 'id' attribute of this {@link Objective}. 340 <p> 341 * @return integer value indicating success/failure of the 342 * function. The possible values 343 * returned by this function are: 344 * <ul> 345 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 346 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 347 * </ul> 348 */ public 349 int unsetId() { 350 return libsbmlJNI.Objective_unsetId(swigCPtr, this); 351 } 352 353 354/** 355 * Unsets the value of the 'name' attribute of this {@link Objective}. 356 <p> 357 * @return integer value indicating success/failure of the 358 * function. The possible values 359 * returned by this function are: 360 * <ul> 361 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 362 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 363 * </ul> 364 */ public 365 int unsetName() { 366 return libsbmlJNI.Objective_unsetName(swigCPtr, this); 367 } 368 369 370/** 371 * Unsets the value of the 'type' attribute of this {@link Objective}. 372 <p> 373 * @return integer value indicating success/failure of the 374 * function. The possible values 375 * returned by this function are: 376 * <ul> 377 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 378 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 379 * </ul> 380 */ public 381 int unsetType() { 382 return libsbmlJNI.Objective_unsetType(swigCPtr, this); 383 } 384 385 386/** 387 * Returns the 'ListOfFluxObjectives' in this {@link Objective} object. 388 <p> 389 * @return the 'ListOfFluxObjectives' attribute of this {@link Objective}. 390 */ public 391 ListOfFluxObjectives getListOfFluxObjectives() { 392 long cPtr = libsbmlJNI.Objective_getListOfFluxObjectives__SWIG_0(swigCPtr, this); 393 return (cPtr == 0) ? null : new ListOfFluxObjectives(cPtr, false); 394 } 395 396 397/** 398 * Get a {@link FluxObjective} from the {@link ListOfFluxObjectives}. 399 <p> 400 * @param n the index number of the {@link FluxObjective} to get. 401 <p> 402 * @return the nth {@link FluxObjective} in the {@link ListOfFluxObjectives} within this 403 * {@link Objective}. 404 <p> 405 * @see #getNumFluxObjectives() 406 */ public 407 FluxObjective getFluxObjective(long n) { 408 long cPtr = libsbmlJNI.Objective_getFluxObjective__SWIG_0(swigCPtr, this, n); 409 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 410 } 411 412 413/** 414 * Get a {@link FluxObjective} from the {@link ListOfFluxObjectives} based on its 415 * identifier. 416 <p> 417 * @param sid a string representing the identifier of the {@link FluxObjective} to 418 * get. 419 <p> 420 * @return the {@link FluxObjective} in the {@link ListOfFluxObjectives} with the given id 421 * or null if no such {@link FluxObjective} exists. 422 <p> 423 * 424 * @see #getNumFluxObjectives() 425 <p> 426 * @see #getFluxObjective(long n) 427 */ public 428 FluxObjective getFluxObjective(String sid) { 429 long cPtr = libsbmlJNI.Objective_getFluxObjective__SWIG_2(swigCPtr, this, sid); 430 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 431 } 432 433 434/** 435 * Adds a copy the given 'FluxObjective' to this {@link Objective}. 436 <p> 437 * @param fo; the {@link FluxObjective} object to add 438 <p> 439 * @return integer value indicating success/failure of the 440 * function. The possible values 441 * returned by this function are: 442 * <ul> 443 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 444 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 445 * </ul> 446 */ public 447 int addFluxObjective(FluxObjective fo) { 448 return libsbmlJNI.Objective_addFluxObjective(swigCPtr, this, FluxObjective.getCPtr(fo), fo); 449 } 450 451 452/** 453 * Get the number of {@link FluxObjective} objects in this {@link Objective}. 454 <p> 455 * @return the number of {@link FluxObjective} objects in this {@link Objective} 456 */ public 457 long getNumFluxObjectives() { 458 return libsbmlJNI.Objective_getNumFluxObjectives(swigCPtr, this); 459 } 460 461 462/** 463 * Creates a new {@link FluxObjective} object. 464 <p> 465 * This method creates the {@link FluxObjective} object, adds it to this {@link Objective} 466 * object's {@link ListOfFluxObjectives}, and returns the {@link FluxObjective} object 467 * created. 468 <p> 469 * @return a new {@link FluxObjective} object instance 470 <p> 471 * @see #addFluxObjective(FluxObjective fo) 472 */ public 473 FluxObjective createFluxObjective() { 474 long cPtr = libsbmlJNI.Objective_createFluxObjective(swigCPtr, this); 475 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 476 } 477 478 479/** 480 * Removes the nth {@link FluxObjective} from the {@link ListOfFluxObjectives}. 481 <p> 482 * The caller owns the returned item and is responsible for deleting it. 483 <p> 484 * @param n the index of the {@link FluxObjective} to remove. 485 <p> 486 * @see #getNumFluxObjectives() 487 */ public 488 FluxObjective removeFluxObjective(long n) { 489 long cPtr = libsbmlJNI.Objective_removeFluxObjective__SWIG_0(swigCPtr, this, n); 490 return (cPtr == 0) ? null : new FluxObjective(cPtr, true); 491 } 492 493 494/** 495 * Removes the {@link FluxObjective} with the given identifier from the 496 * {@link ListOfFluxObjectives}. 497 <p> 498 * The caller owns the returned item and is responsible for deleting it. 499 * If none of the items in this list have the identifier <code>sid</code>, then 500 * <code>null</code> is returned. 501 <p> 502 * @param sid the identifier of the {@link FluxObjective} to remove. 503 <p> 504 * @return the {@link FluxObjective} removed. As mentioned above, the caller owns the 505 * returned item. 506 */ public 507 FluxObjective removeFluxObjective(String sid) { 508 long cPtr = libsbmlJNI.Objective_removeFluxObjective__SWIG_1(swigCPtr, this, sid); 509 return (cPtr == 0) ? null : new FluxObjective(cPtr, true); 510 } 511 512 513/** 514 * Returns the XML element name of this object. 515 <p> 516 * For {@link Objective}, the XML element name is always <code>'objective'.</code> 517 <p> 518 * @return the name of this element, i.e. <code>'objective'.</code> 519 */ public 520 String getElementName() { 521 return libsbmlJNI.Objective_getElementName(swigCPtr, this); 522 } 523 524 525/** 526 * Returns the libSBML type code for this SBML object. 527 <p> 528 * <p> 529 * LibSBML attaches an identifying code to every kind of SBML object. These 530 * are integer constants known as <em>SBML type codes</em>. The names of all 531 * the codes begin with the characters <code>SBML_</code>. 532 * In the Java language interface for libSBML, the 533 * type codes are defined as static integer constants in the interface class 534 * {@link libsbmlConstants}. Note that different Level 3 535 * package plug-ins may use overlapping type codes; to identify the package 536 * to which a given object belongs, call the <code>getPackageName()</code> 537 * method on the object. 538 <p> 539 * @return the SBML type code for this object: 540 * {@link libsbmlConstants#SBML_FBC_OBJECTIVE SBML_FBC_OBJECTIVE} (default). 541 <p> 542 * <p> 543 * @warning <span class='warning'>The specific integer values of the possible 544 * type codes may be reused by different Level 3 package plug-ins. 545 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 546 * both getTypeCode() and getPackageName()</strong>.</span> 547 <p> 548 * @see #getElementName() 549 * @see #getPackageName() 550 */ public 551 int getTypeCode() { 552 return libsbmlJNI.Objective_getTypeCode(swigCPtr, this); 553 } 554 555 556/** 557 * Predicate returning <code>true</code> if all the required attributes for this 558 * {@link Objective} object have been set. 559 <p> 560 * @note The required attributes for a {@link Objective} object are: 561 * <ul> 562 * <li> 'id' 563 * <li> 'type' 564 * 565 * </ul> <p> 566 * @return a boolean value indicating whether all the required 567 * attributes for this object have been defined. 568 */ public 569 boolean hasRequiredAttributes() { 570 return libsbmlJNI.Objective_hasRequiredAttributes(swigCPtr, this); 571 } 572 573 574/** 575 * Predicate returning <code>true</code> if all the required elements for this 576 * {@link Objective} object have been set. 577 <p> 578 * @note The required elements for a {@link Objective} object are: 579 <p> 580 * @return a boolean value indicating whether all the required 581 * elements for this object have been defined. 582 */ public 583 boolean hasRequiredElements() { 584 return libsbmlJNI.Objective_hasRequiredElements(swigCPtr, this); 585 } 586 587 588/** * @internal */ public 589 void connectToChild() { 590 libsbmlJNI.Objective_connectToChild(swigCPtr, this); 591 } 592 593 594/** * @internal */ public 595 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 596 libsbmlJNI.Objective_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 597 } 598 599 600/** * @internal */ public 601 boolean getIsSetListOfFluxObjectives() { 602 return libsbmlJNI.Objective_getIsSetListOfFluxObjectives(swigCPtr, this); 603 } 604 605}