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 *  A list of {@link Parameter} objects.
013 <p>
014 * <p>
015 * The various ListOf___ classes in SBML
016 * are merely containers used for organizing the main components of an SBML
017 * model.  In libSBML's implementation, ListOf___
018 * classes are derived from the
019 * intermediate utility class {@link ListOf}, which
020 * is not defined by the SBML specifications but serves as a useful
021 * programmatic construct.  {@link ListOf} is itself is in turn derived from {@link SBase},
022 * which provides all of the various ListOf___
023 * classes with common features
024 * defined by the SBML specification, such as 'metaid' attributes and
025 * annotations.
026 <p>
027 * Readers may wonder about the motivations for using the ListOf___
028 * containers in SBML.  A simpler approach in XML might be to place the
029 * components all directly at the top level of the model definition.  The
030 * choice made in SBML is to group them within XML elements named after
031 * ListOf<em>Classname</em>, in part because it helps organize the
032 * components.  More importantly, the fact that the container classes are
033 * derived from {@link SBase} means that software tools can add information <em>about</em>
034 * the lists themselves into each list container's 'annotation'.
035 <p>
036 * @see ListOfFunctionDefinitions
037 * @see ListOfUnitDefinitions
038 * @see ListOfCompartmentTypes
039 * @see ListOfSpeciesTypes
040 * @see ListOfCompartments
041 * @see ListOfSpecies
042 * @see ListOfParameters
043 * @see ListOfInitialAssignments
044 * @see ListOfRules
045 * @see ListOfConstraints
046 * @see ListOfReactions
047 * @see ListOfEvents
048 */
049
050public class ListOfParameters extends ListOf {
051   private long swigCPtr;
052
053   protected ListOfParameters(long cPtr, boolean cMemoryOwn)
054   {
055     super(libsbmlJNI.ListOfParameters_SWIGUpcast(cPtr), cMemoryOwn);
056     swigCPtr = cPtr;
057   }
058
059   protected static long getCPtr(ListOfParameters obj)
060   {
061     return (obj == null) ? 0 : obj.swigCPtr;
062   }
063
064   protected static long getCPtrAndDisown (ListOfParameters obj)
065   {
066     long ptr = 0;
067
068     if (obj != null)
069     {
070       ptr             = obj.swigCPtr;
071       obj.swigCMemOwn = false;
072     }
073
074     return ptr;
075   }
076
077  protected void finalize() {
078    delete();
079  }
080
081  public synchronized void delete() {
082    if (swigCPtr != 0) {
083      if (swigCMemOwn) {
084        swigCMemOwn = false;
085        libsbmlJNI.delete_ListOfParameters(swigCPtr);
086      }
087      swigCPtr = 0;
088    }
089    super.delete();
090  }
091
092  
093/**
094   * Creates a new {@link ListOfParameters} object.
095   <p>
096   * The object is constructed such that it is valid for the given SBML
097   * Level and Version combination.
098   <p>
099   * @param level the SBML Level
100   <p>
101   * @param version the Version within the SBML Level
102   <p>
103   * <p>
104 * @throws SBMLConstructorException
105 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid
106 * or if this object is incompatible with the given level and version.
107   <p>
108   * <p>
109 * @note Attempting to add an object to an {@link SBMLDocument} having a different
110 * combination of SBML Level, Version and XML namespaces than the object
111 * itself will result in an error at the time a caller attempts to make the
112 * addition.  A parent object must have compatible Level, Version and XML
113 * namespaces.  (Strictly speaking, a parent may also have more XML
114 * namespaces than a child, but the reverse is not permitted.)  The
115 * restriction is necessary to ensure that an SBML model has a consistent
116 * overall structure.  This requires callers to manage their objects
117 * carefully, but the benefit is increased flexibility in how models can be
118 * created by permitting callers to create objects bottom-up if desired.  In
119 * situations where objects are not yet attached to parents (e.g.,
120 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
121 * libSBML determine such things as whether it is valid to assign a
122 * particular value to an attribute.
123   */ public
124 ListOfParameters(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
125    this(libsbmlJNI.new_ListOfParameters__SWIG_0(level, version), true);
126  }
127
128  
129/**
130   * Creates a new {@link ListOfParameters} object.
131   <p>
132   * The object is constructed such that it is valid for the SBML Level and
133   * Version combination determined by the {@link SBMLNamespaces} object in 
134   * <code>sbmlns</code>.
135   <p>
136   * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the
137   * characteristics of the {@link ListOfParameters} object to be created.
138   <p>
139   * <p>
140 * @throws SBMLConstructorException
141 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible
142 * with this object.
143   <p>
144   * <p>
145 * @note Attempting to add an object to an {@link SBMLDocument} having a different
146 * combination of SBML Level, Version and XML namespaces than the object
147 * itself will result in an error at the time a caller attempts to make the
148 * addition.  A parent object must have compatible Level, Version and XML
149 * namespaces.  (Strictly speaking, a parent may also have more XML
150 * namespaces than a child, but the reverse is not permitted.)  The
151 * restriction is necessary to ensure that an SBML model has a consistent
152 * overall structure.  This requires callers to manage their objects
153 * carefully, but the benefit is increased flexibility in how models can be
154 * created by permitting callers to create objects bottom-up if desired.  In
155 * situations where objects are not yet attached to parents (e.g.,
156 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
157 * libSBML determine such things as whether it is valid to assign a
158 * particular value to an attribute.
159   */ public
160 ListOfParameters(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
161    this(libsbmlJNI.new_ListOfParameters__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
162  }
163
164  
165/**
166   * Creates and returns a deep copy of this {@link ListOfParameters} object.
167   <p>
168   * @return the (deep) copy of this {@link ListOfParameters} object.
169   */ public
170 ListOfParameters cloneObject() {
171    long cPtr = libsbmlJNI.ListOfParameters_cloneObject(swigCPtr, this);
172    return (cPtr == 0) ? null : new ListOfParameters(cPtr, true);
173  }
174
175  
176/**
177   * Returns the libSBML type code for the objects contained in this {@link ListOf}
178   * (i.e., {@link Parameter} objects, if the list is non-empty).
179   <p>
180   * <p>
181 * LibSBML attaches an identifying code to every kind of SBML object.  These
182 * are integer constants known as <em>SBML type codes</em>.  The names of all
183 * the codes begin with the characters <code>SBML_</code>.
184 * In the Java language interface for libSBML, the
185 * type codes are defined as static integer constants in the interface class
186 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
187 * package plug-ins may use overlapping type codes; to identify the package
188 * to which a given object belongs, call the <code>getPackageName()</code>
189 * method on the object.
190   <p>
191   * @return the SBML type code for this objects contained in this list:
192   * {@link libsbmlConstants#SBML_PARAMETER SBML_PARAMETER} (default).
193   <p>
194   * @see #getElementName()
195   * @see #getPackageName()
196   */ public
197 int getItemTypeCode() {
198    return libsbmlJNI.ListOfParameters_getItemTypeCode(swigCPtr, this);
199  }
200
201  
202/**
203   * Returns the XML element name of this object.
204   <p>
205   * For {@link ListOfParameters}, the XML element name is <code>'listOfParameters'.</code>
206   <p>
207   * @return the name of this element, i.e., <code>'listOfParameters'.</code>
208   */ public
209 String getElementName() {
210    return libsbmlJNI.ListOfParameters_getElementName(swigCPtr, this);
211  }
212
213  
214/**
215   * Returns the {@link Parameter} object located at position <code>n</code> within this
216   * {@link ListOfParameters} instance.
217   <p>
218   * @param n the index number of the {@link Parameter} to get.
219   <p>
220   * @return the nth {@link Parameter} in this {@link ListOfParameters}.  If the index <code>n</code>
221   * is out of bounds for the length of the list, then <code>null</code> is returned.
222   <p>
223   * @see #size()
224   * @see #get(String sid)
225   */ public
226 Parameter get(long n) {
227    long cPtr = libsbmlJNI.ListOfParameters_get__SWIG_0(swigCPtr, this, n);
228    return (cPtr == 0) ? null : new Parameter(cPtr, false);
229  }
230
231  
232/**
233   * Returns the first {@link Parameter} object matching the given identifier.
234   <p>
235   * @param sid a string, the identifier of the {@link Parameter} to get.
236   <p>
237   * @return the {@link Parameter} object found.  The caller owns the returned
238   * object and is responsible for deleting it.  If none of the items have
239   * an identifier matching <code>sid</code>, then <code>null</code> is returned.
240   <p>
241   * @see #get(long n)
242   * @see #size()
243   */ public
244 Parameter get(String sid) {
245    long cPtr = libsbmlJNI.ListOfParameters_get__SWIG_2(swigCPtr, this, sid);
246    return (cPtr == 0) ? null : new Parameter(cPtr, false);
247  }
248
249  
250/**
251   * Removes the nth item from this {@link ListOfParameters}, and returns a pointer
252   * to it.
253   <p>
254   * @param n the index of the item to remove
255   <p>
256   * @return the item removed.  The caller owns the returned object and is
257   * responsible for deleting it.  If the index number <code>n</code> is out of
258   * bounds for the length of the list, then <code>null</code> is returned.
259   <p>
260   * @see #size()
261   */ public
262 Parameter remove(long n) {
263    long cPtr = libsbmlJNI.ListOfParameters_remove__SWIG_0(swigCPtr, this, n);
264    return (cPtr == 0) ? null : new Parameter(cPtr, true);
265  }
266
267  
268/**
269   * Removes the first {@link Parameter} object in this {@link ListOfParameters}
270   * matching the given identifier, and returns a pointer to it.
271   <p>
272   * @param sid the identifier of the item to remove.
273   <p>
274   * @return the item removed.  The caller owns the returned object and is
275   * responsible for deleting it.  If none of the items have an identifier
276   * matching <code>sid</code>, then <code>null</code> is returned.
277   */ public
278 Parameter remove(String sid) {
279    long cPtr = libsbmlJNI.ListOfParameters_remove__SWIG_1(swigCPtr, this, sid);
280    return (cPtr == 0) ? null : new Parameter(cPtr, true);
281  }
282
283}