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