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