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