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