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-qual"><a href="group__qual.html">qual</a></span>
013
014 Implementation of the ListOfFunctionTerms construct from
015 * the 'qual' package.
016 <p>
017 * The {@link ListOfFunctionTerms} is a container for the FunctionTerms of a {@link Transition}.
018 <p>
019 * <p>
020 * The various ListOf___ classes in SBML
021 * are merely containers used for organizing the main components of an SBML
022 * model.  In libSBML's implementation, ListOf___
023 * classes are derived from the
024 * intermediate utility class {@link ListOf}, which
025 * is not defined by the SBML specifications but serves as a useful
026 * programmatic construct.  {@link ListOf} is itself is in turn derived from {@link SBase},
027 * which provides all of the various ListOf___
028 * classes with common features
029 * defined by the SBML specification, such as 'metaid' attributes and
030 * annotations.
031 <p>
032 * The relationship between the lists and the rest of an SBML model is
033 * illustrated by the following (for SBML Level&nbsp;2 Version&nbsp;4):
034 <p>
035 * <figure>
036  <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object>
037</figure>
038
039 <p>
040 * Readers may wonder about the motivations for using the ListOf___
041 * containers in SBML.  A simpler approach in XML might be to place the
042 * components all directly at the top level of the model definition.  The
043 * choice made in SBML is to group them within XML elements named after
044 * ListOf<em>Classname</em>, in part because it helps organize the
045 * components.  More importantly, the fact that the container classes are
046 * derived from {@link SBase} means that software tools can add information <em>about</em>
047 * the lists themselves into each list container's 'annotation'.
048 <p>
049 * @see ListOfFunctionDefinitions
050 * @see ListOfUnitDefinitions
051 * @see ListOfCompartmentTypes
052 * @see ListOfSpeciesTypes
053 * @see ListOfCompartments
054 * @see ListOfSpecies
055 * @see ListOfParameters
056 * @see ListOfInitialAssignments
057 * @see ListOfRules
058 * @see ListOfConstraints
059 * @see ListOfReactions
060 * @see ListOfEvents
061 <p>
062 * @see Input
063 */
064
065public class ListOfFunctionTerms extends ListOf {
066   private long swigCPtr;
067
068   protected ListOfFunctionTerms(long cPtr, boolean cMemoryOwn)
069   {
070     super(libsbmlJNI.ListOfFunctionTerms_SWIGUpcast(cPtr), cMemoryOwn);
071     swigCPtr = cPtr;
072   }
073
074   protected static long getCPtr(ListOfFunctionTerms obj)
075   {
076     return (obj == null) ? 0 : obj.swigCPtr;
077   }
078
079   protected static long getCPtrAndDisown (ListOfFunctionTerms obj)
080   {
081     long ptr = 0;
082
083     if (obj != null)
084     {
085       ptr             = obj.swigCPtr;
086       obj.swigCMemOwn = false;
087     }
088
089     return ptr;
090   }
091
092  protected void finalize() {
093    delete();
094  }
095
096  public synchronized void delete() {
097    if (swigCPtr != 0) {
098      if (swigCMemOwn) {
099        swigCMemOwn = false;
100        libsbmlJNI.delete_ListOfFunctionTerms(swigCPtr);
101      }
102      swigCPtr = 0;
103    }
104    super.delete();
105  }
106
107  
108/**
109   * Creates a new {@link ListOfFunctionTerms} with the given level, version, and package version.
110   <p>
111   * @param level a long integer, the SBML Level to assign to this {@link ListOfFunctionTerms}
112   <p>
113   * @param version a long integer, the SBML Version to assign to this {@link ListOfFunctionTerms}
114   <p>
115   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfFunctionTerms}
116   */ public
117 ListOfFunctionTerms(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
118    this(libsbmlJNI.new_ListOfFunctionTerms__SWIG_0(level, version, pkgVersion), true);
119  }
120
121  
122/**
123   * Creates a new {@link ListOfFunctionTerms} with the given level, version, and package version.
124   <p>
125   * @param level a long integer, the SBML Level to assign to this {@link ListOfFunctionTerms}
126   <p>
127   * @param version a long integer, the SBML Version to assign to this {@link ListOfFunctionTerms}
128   <p>
129   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfFunctionTerms}
130   */ public
131 ListOfFunctionTerms(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
132    this(libsbmlJNI.new_ListOfFunctionTerms__SWIG_1(level, version), true);
133  }
134
135  
136/**
137   * Creates a new {@link ListOfFunctionTerms} with the given level, version, and package version.
138   <p>
139   * @param level a long integer, the SBML Level to assign to this {@link ListOfFunctionTerms}
140   <p>
141   * @param version a long integer, the SBML Version to assign to this {@link ListOfFunctionTerms}
142   <p>
143   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfFunctionTerms}
144   */ public
145 ListOfFunctionTerms(long level) throws org.sbml.libsbml.SBMLConstructorException {
146    this(libsbmlJNI.new_ListOfFunctionTerms__SWIG_2(level), true);
147  }
148
149  
150/**
151   * Creates a new {@link ListOfFunctionTerms} with the given level, version, and package version.
152   <p>
153   * @param level a long integer, the SBML Level to assign to this {@link ListOfFunctionTerms}
154   <p>
155   * @param version a long integer, the SBML Version to assign to this {@link ListOfFunctionTerms}
156   <p>
157   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfFunctionTerms}
158   */ public
159 ListOfFunctionTerms() throws org.sbml.libsbml.SBMLConstructorException {
160    this(libsbmlJNI.new_ListOfFunctionTerms__SWIG_3(), true);
161  }
162
163  
164/**
165   * Creates a new {@link ListOfFunctionTerms} with the given {@link QualPkgNamespaces} object.
166   <p>
167   * @param qualns the {@link QualPkgNamespaces} object
168   */ public
169 ListOfFunctionTerms(QualPkgNamespaces qualns) throws org.sbml.libsbml.SBMLConstructorException {
170    this(libsbmlJNI.new_ListOfFunctionTerms__SWIG_4(QualPkgNamespaces.getCPtr(qualns), qualns), true);
171  }
172
173  
174/** */ public
175 ListOfFunctionTerms(ListOfFunctionTerms orig) throws org.sbml.libsbml.SBMLConstructorException {
176    this(libsbmlJNI.new_ListOfFunctionTerms__SWIG_5(ListOfFunctionTerms.getCPtr(orig), orig), true);
177  }
178
179  
180/**
181   * Creates and returns a deep copy of this {@link ListOfFunctionTerms} object.
182   <p>
183   * @return a (deep) copy of this {@link ListOfFunctionTerms} object.
184   */ public
185 ListOfFunctionTerms cloneObject() {
186    long cPtr = libsbmlJNI.ListOfFunctionTerms_cloneObject(swigCPtr, this);
187    return (cPtr == 0) ? null : new ListOfFunctionTerms(cPtr, true);
188  }
189
190  
191/**
192   * Get a {@link FunctionTerm} from the {@link ListOfFunctionTerms}.
193   <p>
194   * @param n the index number of the {@link FunctionTerm} to get.
195   <p>
196   * @return the nth {@link FunctionTerm} in this {@link ListOfFunctionTerms}.
197   <p>
198   * @see #size()
199   */ public
200 FunctionTerm get(long n) {
201    long cPtr = libsbmlJNI.ListOfFunctionTerms_get__SWIG_0(swigCPtr, this, n);
202    return (cPtr == 0) ? null : new FunctionTerm(cPtr, false);
203  }
204
205  
206/**
207   * Get a {@link FunctionTerm} from the {@link ListOfFunctionTerms}
208   * based on its identifier.
209   <p>
210   * @param sid a string representing the identifier
211   * of the {@link FunctionTerm} to get.
212   <p>
213   * @return {@link FunctionTerm} in this {@link ListOfFunctionTerms}
214   * with the given id or null if no such
215   * {@link FunctionTerm} exists.
216   <p>
217   * @see #get(long n)   *
218   * @see #size()
219   */ public
220 FunctionTerm get(String sid) {
221    long cPtr = libsbmlJNI.ListOfFunctionTerms_get__SWIG_2(swigCPtr, this, sid);
222    return (cPtr == 0) ? null : new FunctionTerm(cPtr, false);
223  }
224
225  
226/**
227   * Removes the nth {@link FunctionTerm} from this {@link ListOfFunctionTerms}
228   * and returns a pointer to it.
229   <p>
230   * The caller owns the returned item and is responsible for deleting it.
231   <p>
232   * @param n the index of the {@link FunctionTerm} to remove.
233   <p>
234   * @see #size()
235   */ public
236 FunctionTerm remove(long n) {
237    long cPtr = libsbmlJNI.ListOfFunctionTerms_remove__SWIG_0(swigCPtr, this, n);
238    return (cPtr == 0) ? null : new FunctionTerm(cPtr, true);
239  }
240
241  
242/**
243   * Removes the {@link FunctionTerm} from this {@link ListOfFunctionTerms} with the given identifier
244   * and returns a pointer to it.
245   <p>
246   * The caller owns the returned item and is responsible for deleting it.
247   * If none of the items in this list have the identifier <code>sid</code>, then
248   * <code>null</code> is returned.
249   <p>
250   * @param sid the identifier of the {@link FunctionTerm} to remove.
251   <p>
252   * @return the {@link FunctionTerm} removed. As mentioned above, the caller owns the
253   * returned item.
254   */ public
255 FunctionTerm remove(String sid) {
256    long cPtr = libsbmlJNI.ListOfFunctionTerms_remove__SWIG_1(swigCPtr, this, sid);
257    return (cPtr == 0) ? null : new FunctionTerm(cPtr, true);
258  }
259
260  
261/**
262   * Returns the XML element name of this object, which for {@link ListOfFunctionTerms}, is
263   * always <code>'listOfFunctionTerms'.</code>
264   <p>
265   * @return the name of this element, i.e. <code>'listOfFunctionTerms'.</code>
266   */ public
267 String getElementName() {
268    return libsbmlJNI.ListOfFunctionTerms_getElementName(swigCPtr, this);
269  }
270
271  
272/**
273   * Returns the libSBML type code for the SBML objects
274   * contained in this {@link ListOf} object.
275   <p>
276   * <p>
277 * LibSBML attaches an identifying code to every kind of SBML object.  These
278 * are integer constants known as <em>SBML type codes</em>.  The names of all
279 * the codes begin with the characters &ldquo;<code>SBML_</code>&rdquo;. 
280 * In the Java language interface for libSBML, the
281 * type codes are defined as static integer constants in the interface class
282 * {@link libsbmlConstants}.    Note that different Level&nbsp;3 
283 * package plug-ins may use overlapping type codes; to identify the package
284 * to which a given object belongs, call the <code>getPackageName()</code>
285 * method on the object.
286   <p>
287   * @return the SBML type code for objects contained in this list:
288   * {@link  libsbmlConstants#SBML_QUAL_FUNCTION_TERM SBML_QUAL_FUNCTION_TERM} (default).
289   <p>
290   * @see #getElementName()
291   * @see #getPackageName()
292   */ public
293 int getItemTypeCode() {
294    return libsbmlJNI.ListOfFunctionTerms_getItemTypeCode(swigCPtr, this);
295  }
296
297  
298/**
299   * Get the {@link DefaultTerm} from this {@link ListOfFunctionTerms}.
300   <p>
301   * @return the {@link DefaultTerm} in this {@link ListOfFunctionTerms}, or null if no such value is set.
302   <p>
303   * @see Transition#getDefaultTerm
304   */ public
305 DefaultTerm getDefaultTerm() {
306    long cPtr = libsbmlJNI.ListOfFunctionTerms_getDefaultTerm__SWIG_0(swigCPtr, this);
307    return (cPtr == 0) ? null : new DefaultTerm(cPtr, false);
308  }
309
310  
311/**
312   * Sets the given {@link DefaultTerm} to this {@link Transition}.
313   <p>
314   * @param dt the {@link DefaultTerm} object to add
315   <p>
316   * @return integer value indicating success/failure of the
317   * operation. The possible return values are:
318   * <ul>
319   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
320   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
321   * </ul>
322   */ public
323 int setDefaultTerm(DefaultTerm dt) {
324    return libsbmlJNI.ListOfFunctionTerms_setDefaultTerm(swigCPtr, this, DefaultTerm.getCPtr(dt), dt);
325  }
326
327  
328/**
329   * Predicate returning <code>true</code> if the defaultTerm 
330   * for this {@link ListOfFunctionTerms} object has been set.
331   <p>
332   * @return a boolean value indicating whether the defaultTerm
333   * child for this object has been defined.
334   */ public
335 boolean isSetDefaultTerm() {
336    return libsbmlJNI.ListOfFunctionTerms_isSetDefaultTerm(swigCPtr, this);
337  }
338
339}