001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 2.0.11
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 * 
013 * Implementation of SBML Level 3's ListOfLocalParameters construct.
014 * <p>
015 * The various ListOf___ classes in SBML are merely containers used for
016 * organizing the main components of an SBML model.  All are derived from
017 * the abstract class {@link SBase}, and inherit the various attributes and
018 * subelements of {@link SBase}, such as 'metaid' as and 'annotation'.  The
019 * ListOf___ classes do not add any attributes of their own.
020 * <p>
021 * {@link ListOfLocalParameters} is a subsidiary object class used only within
022 * {@link KineticLaw} in SBML Level&nbsp;3.  It is not defined in SBML Levels
023 * 1&ndash;2.  In Level&nbsp;3, a {@link KineticLaw} object can have a single
024 * object of class {@link ListOfLocalParameters} containing a set of local
025 * parameters used in that kinetic law definition.
026 * <p>
027 * Readers may wonder about the motivations for using the ListOf___
028 * containers.  A simpler approach in XML might be to place the components
029 * all directly at the top level of the model definition.  The choice made
030 * in SBML is to group them within XML elements named after
031 * {@link 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 ListOfLocalParameters extends ListOfParameters {
051   private long swigCPtr;
052
053   protected ListOfLocalParameters(long cPtr, boolean cMemoryOwn)
054   {
055     super(libsbmlJNI.ListOfLocalParameters_SWIGUpcast(cPtr), cMemoryOwn);
056     swigCPtr = cPtr;
057   }
058
059   protected static long getCPtr(ListOfLocalParameters obj)
060   {
061     return (obj == null) ? 0 : obj.swigCPtr;
062   }
063
064   protected static long getCPtrAndDisown (ListOfLocalParameters 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_ListOfLocalParameters(swigCPtr);
086      }
087      swigCPtr = 0;
088    }
089    super.delete();
090  }
091
092  
093/**
094   * Creates a new {@link ListOfLocalParameters} 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   */ public
103 ListOfLocalParameters(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
104    this(libsbmlJNI.new_ListOfLocalParameters__SWIG_0(level, version), true);
105  }
106
107  
108/**
109   * Creates a new {@link ListOfLocalParameters} object.
110   * <p>
111   * The object is constructed such that it is valid for the SBML Level and
112   * Version combination determined by the {@link SBMLNamespaces} object in 
113   * <code>sbmlns</code>.
114   * <p>
115   * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the
116   * characteristics of the {@link ListOfLocalParameters} object to be created.
117   */ public
118 ListOfLocalParameters(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
119    this(libsbmlJNI.new_ListOfLocalParameters__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
120  }
121
122  
123/**
124   * Creates and returns a deep copy of this {@link ListOfLocalParameters} object.
125   * <p>
126   * @return a (deep) copy of this {@link ListOfLocalParameters}.
127   */ public
128 ListOfLocalParameters cloneObject() {
129    long cPtr = libsbmlJNI.ListOfLocalParameters_cloneObject(swigCPtr, this);
130    return (cPtr == 0) ? null : new ListOfLocalParameters(cPtr, true);
131  }
132
133  
134/**
135   * Returns the libSBML type code for this SBML object.
136   * <p>
137   * LibSBML attaches an identifying code to every
138   * kind of SBML object.  These are known as <em>SBML type codes</em>.  In
139   * other languages, the set of type codes is stored in an enumeration; in
140   * the Java language interface for libSBML, the type codes are defined as
141   * static integer constants in the interface class {@link
142   * libsbmlConstants}.  The names of the type codes all begin with the
143   * characters <code>SBML_.</code> 
144   * <p>
145   * @return the SBML type code for this object, or {@link 
146   * libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default).
147   * <p>
148   * @see #getElementName()
149   */ public
150 int getTypeCode() {
151    return libsbmlJNI.ListOfLocalParameters_getTypeCode(swigCPtr, this);
152  }
153
154  
155/**
156   * Returns the libSBML type code for the objects contained in this {@link ListOf}
157   * (i.e., {@link LocalParameter} objects, if the list is non-empty).
158   * <p>
159   * LibSBML attaches an identifying code to every
160   * kind of SBML object.  These are known as <em>SBML type codes</em>.  In
161   * other languages, the set of type codes is stored in an enumeration; in
162   * the Java language interface for libSBML, the type codes are defined as
163   * static integer constants in the interface class {@link
164   * libsbmlConstants}.  The names of the type codes all begin with the
165   * characters <code>SBML_.</code> 
166   * <p>
167   * @return the SBML type code for the objects contained in this {@link ListOf}
168   * instance, or {@link  libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN}
169   * (default).
170   * <p>
171   * @see #getElementName()
172   */ public
173 int getItemTypeCode() {
174    return libsbmlJNI.ListOfLocalParameters_getItemTypeCode(swigCPtr, this);
175  }
176
177  
178/**
179   * Returns the XML element name of this object.
180   * <p>
181   * For {@link ListOfLocalParameters}, the XML element name is <code>'listOfLocalParameters'.</code>
182   * <p>
183   * @return the name of this element, i.e., <code>'listOfLocalParameters'.</code>
184   */ public
185 String getElementName() {
186    return libsbmlJNI.ListOfLocalParameters_getElementName(swigCPtr, this);
187  }
188
189  
190/**
191   * Returns the {@link LocalParameter} object located at position <code>n</code> within this
192   * {@link ListOfLocalParameters} instance.
193   * <p>
194   * @param n the index number of the {@link LocalParameter} to get.
195   * <p>
196   * @return the nth {@link LocalParameter} in this {@link ListOfLocalParameters}.  If the
197   * index <code>n</code> is out of bounds for the length of the list, then <code>null</code>
198   * is returned.
199   * <p>
200   * @see #size()
201   * @see #get(String sid)
202   */ public
203 LocalParameter get(long n) {
204    long cPtr = libsbmlJNI.ListOfLocalParameters_get__SWIG_0(swigCPtr, this, n);
205    return (cPtr == 0) ? null : new LocalParameter(cPtr, false);
206  }
207
208  
209/**
210   * Returns the first {@link LocalParameter} object matching the given identifier.
211   * <p>
212   * @param sid a string, the identifier of the {@link LocalParameter} to get.
213   * <p>
214   * @return the {@link LocalParameter} object found.  The caller owns the returned
215   * object and is responsible for deleting it.  If none of the items have
216   * an identifier matching <code>sid</code>, then <code>null</code> is returned.
217   * <p>
218   * @see #get(long n)
219   * @see #size()
220   */ public
221 LocalParameter get(String sid) {
222    long cPtr = libsbmlJNI.ListOfLocalParameters_get__SWIG_2(swigCPtr, this, sid);
223    return (cPtr == 0) ? null : new LocalParameter(cPtr, false);
224  }
225
226  
227/**
228   * 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.  Note that LocalParameters, while they use the SId namespace, are not in the model-wide SId namespace, so no {@link LocalParameter} object will be returned from this function (and is the reason we override the base ListOf.getElementBySId function here).
229   * <p>
230   * @param id string representing the id of objects to find
231   * <p>
232   * @return pointer to the first element found with the given <code>id</code>.
233   */ public
234 SBase getElementBySId(String id) {
235  return libsbml.DowncastSBase(libsbmlJNI.ListOfLocalParameters_getElementBySId(swigCPtr, this, id), false);
236}
237
238  
239/**
240   * Removes the nth item from this {@link ListOfLocalParameters}, and returns a
241   * pointer to it.
242   * <p>
243   * @param n the index of the item to remove.  
244   * <p>
245   * @return the item removed.  The caller owns the returned object and is
246   * responsible for deleting it.  If the index number <code>n</code> is out of
247   * bounds for the length of the list, then <code>null</code> is returned.
248   * <p>
249   * @see #size()
250   * @see #remove(String sid)
251   */ public
252 LocalParameter remove(long n) {
253    long cPtr = libsbmlJNI.ListOfLocalParameters_remove__SWIG_0(swigCPtr, this, n);
254    return (cPtr == 0) ? null : new LocalParameter(cPtr, true);
255  }
256
257  
258/**
259   * Removes the first {@link LocalParameter} object in this {@link ListOfLocalParameters}
260   * matching the given identifier, and returns a pointer to it.
261   * <p>
262   * @param sid the identifier of the item to remove.
263   * <p>
264   * @return the item removed.  The caller owns the returned object and is
265   * responsible for deleting it.  If none of the items have an identifier
266   * matching <code>sid</code>, then <code>null</code> is returned.
267   */ public
268 LocalParameter remove(String sid) {
269    long cPtr = libsbmlJNI.ListOfLocalParameters_remove__SWIG_1(swigCPtr, this, sid);
270    return (cPtr == 0) ? null : new LocalParameter(cPtr, true);
271  }
272
273}