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 Objective extends SBase { 012 private long swigCPtr; 013 014 protected Objective(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.Objective_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(Objective obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (Objective 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_Objective(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 public Objective(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 054 this(libsbmlJNI.new_Objective__SWIG_0(level, version, pkgVersion), true); 055 } 056 057 public Objective(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 058 this(libsbmlJNI.new_Objective__SWIG_1(level, version), true); 059 } 060 061 public Objective(long level) throws org.sbml.libsbml.SBMLConstructorException { 062 this(libsbmlJNI.new_Objective__SWIG_2(level), true); 063 } 064 065 public Objective() throws org.sbml.libsbml.SBMLConstructorException { 066 this(libsbmlJNI.new_Objective__SWIG_3(), true); 067 } 068 069 public Objective(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 070 this(libsbmlJNI.new_Objective__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 071 } 072 073 public Objective(Objective source) throws org.sbml.libsbml.SBMLConstructorException { 074 this(libsbmlJNI.new_Objective__SWIG_5(Objective.getCPtr(source), source), true); 075 } 076 077 078/** 079 * Returns the first child element found that has the given <code>id</code> in the 080 * model-wide <code>SId</code> namespace, or <code>null</code> if no such object is found. 081 * <p> 082 * @param id string representing the 'id' attribute value of the object 083 * to find. 084 * <p> 085 * @return pointer to the first element found with the given identifier. 086 */ public 087 SBase getElementBySId(String id) { 088 return libsbml.DowncastSBase(libsbmlJNI.Objective_getElementBySId(swigCPtr, this, id), false); 089} 090 091 092/** 093 * Returns the first child element it can find with a specific 'metaid' 094 * attribute value, or <code>null</code> if no such object is found. 095 * <p> 096 * @param metaid string representing the 'metaid' attribute value of the 097 * object to find. 098 * <p> 099 * @return pointer to the first element found with the given meta-identifier. 100 */ public 101 SBase getElementByMetaId(String metaid) { 102 return libsbml.DowncastSBase(libsbmlJNI.Objective_getElementByMetaId(swigCPtr, this, metaid), false); 103} 104 105 106/** 107 * Returns the value of the 'metaid' attribute of this object. 108 * <p> 109 * The optional attribute named 'metaid', present on every major SBML 110 * component type, is for supporting metadata annotations using RDF 111 * (Resource Description Format). The attribute value has the data type 112 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 113 * identifier type, which means each 'metaid' value must be globally 114 * unique within an SBML file. (Importantly, this uniqueness criterion 115 * applies across any attribute with type <a 116 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 117 * 'metaid' attribute used by SBML—something to be aware of if your 118 * application-specific XML content inside the 'annotation' subelement 119 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 120 * The 'metaid' value serves to identify a model 121 * component for purposes such as referencing that component from 122 * metadata placed within 'annotation' subelements. 123 * <p> 124 * @return the meta-identifier of this SBML object, as a string. 125 * <p> 126 * @see #isSetMetaId() 127 * @see #setMetaId(String metaid) 128 * @internal 129 */ public 130 String getName() { 131 return libsbmlJNI.Objective_getName(swigCPtr, this); 132 } 133 134 135/** 136 * Predicate returning <code>true</code> if this object's 'metaid' attribute is set. 137 * <p> 138 * The optional attribute named 'metaid', present on every major SBML 139 * component type, is for supporting metadata annotations using RDF 140 * (Resource Description Format). The attribute value has the data type 141 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 142 * identifier type, which means each 'metaid' value must be globally 143 * unique within an SBML file. (Importantly, this uniqueness criterion 144 * applies across any attribute with type <a 145 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 146 * 'metaid' attribute used by SBML—something to be aware of if your 147 * application-specific XML content inside the 'annotation' subelement 148 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 149 * The 'metaid' value serves to identify a model component for purposes 150 * such as referencing that component from metadata placed within 151 * 'annotation' subelements. 152 * <p> 153 * @return <code>true</code> if the 'metaid' attribute of this SBML object is 154 * set, <code>false</code> otherwise. 155 * <p> 156 * @see #getMetaId() 157 * @see #setMetaId(String metaid) 158 * @internal 159 */ public 160 boolean isSetName() { 161 return libsbmlJNI.Objective_isSetName(swigCPtr, this); 162 } 163 164 165/** 166 * Predicate returning <code>true</code> if this 167 * object has a {@link ModelHistory} object attached to it. 168 * <p> 169 * @return <code>true</code> if the {@link ModelHistory} of this object is set, 170 * <code>false</code> otherwise. 171 * <p> 172 * @note In SBML Level 2, model history annotations were only 173 * permitted on the {@link Model} element. In SBML Level 3, they are 174 * permitted on all SBML components derived from {@link SBase}. 175 * @internal 176 */ public 177 int setName(String name) { 178 return libsbmlJNI.Objective_setName(swigCPtr, this, name); 179 } 180 181 182/** 183 * Unsets the value of the 'name' attribute of this SBML object. 184 * <p> 185 * Most (but not all) objects in SBML include two common attributes: 'id' 186 * and 'name'. In contrast to the 'id' attribute, the 'name' attribute is 187 * optional and is not intended to be used for cross-referencing purposes 188 * within a model. Its purpose instead is to provide a human-readable 189 * label for the component. The data type of 'name' is the type 190 * <code>string</code> defined in XML Schema. SBML imposes no 191 * restrictions as to the content of 'name' attributes beyond those 192 * restrictions defined by the <code>string</code> type in XML Schema. 193 * <p> 194 * The recommended practice for handling 'name' is as follows. If a 195 * software tool has the capability for displaying the content of 'name' 196 * attributes, it should display this content to the user as a 197 * component's label instead of the component's 'id'. If the user 198 * interface does not have this capability (e.g., because it cannot 199 * display or use special characters in symbol names), or if the 'name' 200 * attribute is missing on a given component, then the user interface 201 * should display the value of the 'id' attribute instead. (Script 202 * language interpreters are especially likely to display 'id' instead of 203 * 'name'.) 204 * <p> 205 * As a consequence of the above, authors of systems that automatically 206 * generate the values of 'id' attributes should be aware some systems 207 * may display the 'id''s to the user. Authors therefore may wish to 208 * take some care to have their software create 'id' values that are: (a) 209 * reasonably easy for humans to type and read; and (b) likely to be 210 * meaningful, for example by making the 'id' attribute be an abbreviated 211 * form of the name attribute value. 212 * <p> 213 * An additional point worth mentioning is although there are 214 * restrictions on the uniqueness of 'id' values, there are no 215 * restrictions on the uniqueness of 'name' values in a model. This 216 * allows software applications leeway in assigning component identifiers. 217 * <p> 218 * @return integer value indicating success/failure of the 219 * function. The possible values returned by this function are: 220 * <ul> 221 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 222 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 223 * </ul> 224 */ public 225 int unsetName() { 226 return libsbmlJNI.Objective_unsetName(swigCPtr, this); 227 } 228 229 public String getType() { 230 return libsbmlJNI.Objective_getType(swigCPtr, this); 231 } 232 233 public int getObjectiveType() { 234 return libsbmlJNI.Objective_getObjectiveType(swigCPtr, this); 235 } 236 237 public boolean isSetType() { 238 return libsbmlJNI.Objective_isSetType(swigCPtr, this); 239 } 240 241 public int setType(String type) { 242 return libsbmlJNI.Objective_setType__SWIG_0(swigCPtr, this, type); 243 } 244 245 public int setType(int type) { 246 return libsbmlJNI.Objective_setType__SWIG_1(swigCPtr, this, type); 247 } 248 249 public int unsetType() { 250 return libsbmlJNI.Objective_unsetType(swigCPtr, this); 251 } 252 253 254/** 255 * Returns the value of the 'metaid' attribute of this object. 256 * <p> 257 * The optional attribute named 'metaid', present on every major SBML 258 * component type, is for supporting metadata annotations using RDF 259 * (Resource Description Format). The attribute value has the data type 260 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 261 * identifier type, which means each 'metaid' value must be globally 262 * unique within an SBML file. (Importantly, this uniqueness criterion 263 * applies across any attribute with type <a 264 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 265 * 'metaid' attribute used by SBML—something to be aware of if your 266 * application-specific XML content inside the 'annotation' subelement 267 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 268 * The 'metaid' value serves to identify a model 269 * component for purposes such as referencing that component from 270 * metadata placed within 'annotation' subelements. 271 * <p> 272 * @return the meta-identifier of this SBML object, as a string. 273 * <p> 274 * @see #isSetMetaId() 275 * @see #setMetaId(String metaid) 276 * @internal 277 */ public 278 String getId() { 279 return libsbmlJNI.Objective_getId(swigCPtr, this); 280 } 281 282 283/** 284 * Predicate returning <code>true</code> if this object's 'metaid' attribute is set. 285 * <p> 286 * The optional attribute named 'metaid', present on every major SBML 287 * component type, is for supporting metadata annotations using RDF 288 * (Resource Description Format). The attribute value has the data type 289 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 290 * identifier type, which means each 'metaid' value must be globally 291 * unique within an SBML file. (Importantly, this uniqueness criterion 292 * applies across any attribute with type <a 293 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 294 * 'metaid' attribute used by SBML—something to be aware of if your 295 * application-specific XML content inside the 'annotation' subelement 296 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 297 * The 'metaid' value serves to identify a model component for purposes 298 * such as referencing that component from metadata placed within 299 * 'annotation' subelements. 300 * <p> 301 * @return <code>true</code> if the 'metaid' attribute of this SBML object is 302 * set, <code>false</code> otherwise. 303 * <p> 304 * @see #getMetaId() 305 * @see #setMetaId(String metaid) 306 * @internal 307 */ public 308 boolean isSetId() { 309 return libsbmlJNI.Objective_isSetId(swigCPtr, this); 310 } 311 312 313/** 314 * Predicate returning <code>true</code> if this 315 * object has a {@link ModelHistory} object attached to it. 316 * <p> 317 * @return <code>true</code> if the {@link ModelHistory} of this object is set, 318 * <code>false</code> otherwise. 319 * <p> 320 * @note In SBML Level 2, model history annotations were only 321 * permitted on the {@link Model} element. In SBML Level 3, they are 322 * permitted on all SBML components derived from {@link SBase}. 323 * @internal 324 */ public 325 int setId(String id) { 326 return libsbmlJNI.Objective_setId(swigCPtr, this, id); 327 } 328 329 330/** 331 * Unsets the value of the 'id' attribute of this SBML object. 332 * <p> 333 * Most (but not all) objects in SBML include two common attributes: 'id' 334 * and 'name'. The identifier given by an object's 'id' attribute value 335 * is used to identify the object within the SBML model definition. 336 * Other objects can refer to the component using this identifier. The 337 * data type of 'id' is always either <code>Sid</code> or 338 * <code>UnitSId</code>, depending on the object in question. Both 339 * data types are defined as follows: 340 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 341 * letter .= 'a'..'z','A'..'Z' 342 * digit .= '0'..'9' 343 * idChar .= letter | digit | '_' 344 * SId .= ( letter | '_' ) idChar* 345 * </pre> 346 * <p> 347 * The equality of <code>SId</code> and <code>UnitSId</code> type values 348 * in SBML is determined by an exact character sequence match; i.e., 349 * comparisons of these identifiers must be performed in a case-sensitive 350 * manner. This applies to all uses of <code>SId</code> and 351 * <code>UnitSId</code>. 352 * <p> 353 * @return integer value indicating success/failure of the 354 * function. The possible values returned by this function are: 355 * <ul> 356 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 357 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 358 * </ul> 359 */ public 360 int unsetId() { 361 return libsbmlJNI.Objective_unsetId(swigCPtr, this); 362 } 363 364 public ListOfFluxObjectives getListOfFluxObjectives() { 365 long cPtr = libsbmlJNI.Objective_getListOfFluxObjectives(swigCPtr, this); 366 return (cPtr == 0) ? null : new ListOfFluxObjectives(cPtr, false); 367 } 368 369 public FluxObjective getFluxObjective(long n) { 370 long cPtr = libsbmlJNI.Objective_getFluxObjective__SWIG_0(swigCPtr, this, n); 371 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 372 } 373 374 public FluxObjective getFluxObjective(String symbol) { 375 long cPtr = libsbmlJNI.Objective_getFluxObjective__SWIG_2(swigCPtr, this, symbol); 376 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 377 } 378 379 public int addFluxObjective(FluxObjective member) { 380 return libsbmlJNI.Objective_addFluxObjective(swigCPtr, this, FluxObjective.getCPtr(member), member); 381 } 382 383 public long getNumFluxObjectives() { 384 return libsbmlJNI.Objective_getNumFluxObjectives(swigCPtr, this); 385 } 386 387 public FluxObjective createFluxObjective() { 388 long cPtr = libsbmlJNI.Objective_createFluxObjective(swigCPtr, this); 389 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 390 } 391 392 public FluxObjective removeFluxObjective(long index) { 393 long cPtr = libsbmlJNI.Objective_removeFluxObjective__SWIG_0(swigCPtr, this, index); 394 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 395 } 396 397 public FluxObjective removeFluxObjective(String symbol) { 398 long cPtr = libsbmlJNI.Objective_removeFluxObjective__SWIG_1(swigCPtr, this, symbol); 399 return (cPtr == 0) ? null : new FluxObjective(cPtr, false); 400 } 401 402 403/** 404 * Returns the XML element name of this object. 405 * <p> 406 * This is overridden by subclasses to return a string appropriate to the 407 * SBML component. For example, {@link Model} defines it as returning 408 * <code>'model'</code>, {@link CompartmentType} defines it as returning <code>'compartmentType'</code>, 409 * and so on. 410 */ public 411 String getElementName() { 412 return libsbmlJNI.Objective_getElementName(swigCPtr, this); 413 } 414 415 416/** 417 * Creates and returns a deep copy of this {@link SBase} object. 418 * <p> 419 * @return a (deep) copy of this {@link SBase} object. 420 */ public 421 Objective cloneObject() { 422 long cPtr = libsbmlJNI.Objective_cloneObject(swigCPtr, this); 423 return (cPtr == 0) ? null : new Objective(cPtr, true); 424 } 425 426 427/** 428 * Returns the libSBML type code for this object. 429 * <p> 430 * This method may return the type code of this SBML object, or it may 431 * return {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN}. This 432 * is because subclasses of {@link SBase} are not required to implement this 433 * method to return a type code. This method is meant primarily for the 434 * LibSBML C interface, in which class and subclass information is not 435 * readily available. 436 * <p> 437 * @return the SBML object type code 438 * of this SBML object or 439 * {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (the default). 440 * <p> 441 * @see #getElementName() 442 * @see #getPackageName() 443 */ public 444 int getTypeCode() { 445 return libsbmlJNI.Objective_getTypeCode(swigCPtr, this); 446 } 447 448 449/** 450 * Sets this SBML object to child SBML objects (if any). 451 * (Creates a child-parent relationship by the parent) 452 * <p> 453 * Subclasses must override this function if they define 454 * one ore more child elements. 455 * Basically, this function needs to be called in 456 * constructor, copy constructor, assignment operator. 457 * <p> 458 * <p> 459 * @internal 460 */ public 461 void connectToChild() { 462 libsbmlJNI.Objective_connectToChild(swigCPtr, this); 463 } 464 465 466/** 467 * Enables/Disables the given package with this element and child 468 * elements (if any). 469 * (This is an internal implementation for enablePackage function) 470 * <p> 471 * @note Subclasses in which one or more child elements are defined 472 * must override this function. 473 * <p> 474 * <p> 475 * @see #connectToChild() 476 * @internal 477 */ public 478 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 479 libsbmlJNI.Objective_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 480 } 481 482 483/** 484 * Subclasses should override this method to write out their contained 485 * SBML objects as XML elements. Be sure to call your parents 486 * implementation of this method as well. For example: 487 * @internal 488 */ public 489 boolean hasRequiredElements() { 490 return libsbmlJNI.Objective_hasRequiredElements(swigCPtr, this); 491 } 492 493 public boolean acceptFbc(SWIGTYPE_p_FbcVisitor v) { 494 return libsbmlJNI.Objective_acceptFbc(swigCPtr, this, SWIGTYPE_p_FbcVisitor.getCPtr(v)); 495 } 496 497 public boolean getIsSetListOfFluxObjectives() { 498 return libsbmlJNI.Objective_getIsSetListOfFluxObjectives(swigCPtr, this); 499 } 500 501}