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-comp"><a href="group__comp.html">comp</a></span>
013 A list of {@link ModelDefinition} objects.
014 <p>
015 * The {@link ListOfModelDefinitions} is a container for the extended 
016 * {@link SBMLDocument} that allows one to define multiple Models in a single file
017 * for use in {@link Submodel} objects.
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 * Readers may wonder about the motivations for using the ListOf___
033 * containers in SBML.  A simpler approach in XML might be to place the
034 * components all directly at the top level of the model definition.  The
035 * choice made in SBML is to group them within XML elements named after
036 * ListOf<em>Classname</em>, in part because it helps organize the
037 * components.  More importantly, the fact that the container classes are
038 * derived from {@link SBase} means that software tools can add information <em>about</em>
039 * the lists themselves into each list container's 'annotation'.
040 <p>
041 * @see ListOfFunctionDefinitions
042 * @see ListOfUnitDefinitions
043 * @see ListOfCompartmentTypes
044 * @see ListOfSpeciesTypes
045 * @see ListOfCompartments
046 * @see ListOfSpecies
047 * @see ListOfParameters
048 * @see ListOfInitialAssignments
049 * @see ListOfRules
050 * @see ListOfConstraints
051 * @see ListOfReactions
052 * @see ListOfEvents
053 <p>
054 * @see ModelDefinition
055 * @see ListOfDeletions
056 * @see ListOfExternalModelDefinitions
057 * @see ListOfPorts
058 * @see ListOfReplacedElements
059 * @see ListOfSubmodels
060 */
061
062public class ListOfModelDefinitions extends ListOf {
063   private long swigCPtr;
064
065   protected ListOfModelDefinitions(long cPtr, boolean cMemoryOwn)
066   {
067     super(libsbmlJNI.ListOfModelDefinitions_SWIGUpcast(cPtr), cMemoryOwn);
068     swigCPtr = cPtr;
069   }
070
071   protected static long getCPtr(ListOfModelDefinitions obj)
072   {
073     return (obj == null) ? 0 : obj.swigCPtr;
074   }
075
076   protected static long getCPtrAndDisown (ListOfModelDefinitions obj)
077   {
078     long ptr = 0;
079
080     if (obj != null)
081     {
082       ptr             = obj.swigCPtr;
083       obj.swigCMemOwn = false;
084     }
085
086     return ptr;
087   }
088
089  protected void finalize() {
090    delete();
091  }
092
093  public synchronized void delete() {
094    if (swigCPtr != 0) {
095      if (swigCMemOwn) {
096        swigCMemOwn = false;
097        libsbmlJNI.delete_ListOfModelDefinitions(swigCPtr);
098      }
099      swigCPtr = 0;
100    }
101    super.delete();
102  }
103
104  
105/**
106   * Creates and returns a deep copy of this {@link ListOfModelDefinitions} object.
107   <p>
108   * @return a (deep) copy of this {@link ListOfModelDefinitions}.
109   */ public
110 ListOfModelDefinitions cloneObject() {
111    long cPtr = libsbmlJNI.ListOfModelDefinitions_cloneObject(swigCPtr, this);
112    return (cPtr == 0) ? null : new ListOfModelDefinitions(cPtr, true);
113  }
114
115  
116/**
117   * Creates a new {@link ListOfModelDefinitions} with the given level, version, and
118   * package version.
119   <p>
120   * @param level the SBML Level
121   * @param version the Version within the SBML Level
122   * @param pkgVersion the version of the package
123   */ public
124 ListOfModelDefinitions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
125    this(libsbmlJNI.new_ListOfModelDefinitions__SWIG_0(level, version, pkgVersion), true);
126  }
127
128  
129/**
130   * Creates a new {@link ListOfModelDefinitions} with the given level, version, and
131   * package version.
132   <p>
133   * @param level the SBML Level
134   * @param version the Version within the SBML Level
135   * @param pkgVersion the version of the package
136   */ public
137 ListOfModelDefinitions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
138    this(libsbmlJNI.new_ListOfModelDefinitions__SWIG_1(level, version), true);
139  }
140
141  
142/**
143   * Creates a new {@link ListOfModelDefinitions} with the given level, version, and
144   * package version.
145   <p>
146   * @param level the SBML Level
147   * @param version the Version within the SBML Level
148   * @param pkgVersion the version of the package
149   */ public
150 ListOfModelDefinitions(long level) throws org.sbml.libsbml.SBMLConstructorException {
151    this(libsbmlJNI.new_ListOfModelDefinitions__SWIG_2(level), true);
152  }
153
154  
155/**
156   * Creates a new {@link ListOfModelDefinitions} with the given level, version, and
157   * package version.
158   <p>
159   * @param level the SBML Level
160   * @param version the Version within the SBML Level
161   * @param pkgVersion the version of the package
162   */ public
163 ListOfModelDefinitions() throws org.sbml.libsbml.SBMLConstructorException {
164    this(libsbmlJNI.new_ListOfModelDefinitions__SWIG_3(), true);
165  }
166
167  
168/**
169   * Creates a new {@link ListOfModelDefinitions} with the given {@link CompPkgNamespaces}
170   * object.
171   */ public
172 ListOfModelDefinitions(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException {
173    this(libsbmlJNI.new_ListOfModelDefinitions__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true);
174  }
175
176  
177/**
178   * Get a {@link ModelDefinition} from the {@link ListOfModelDefinitions}.
179   <p>
180   * @param n the index number of the {@link ModelDefinition} to get.
181   <p>
182   * @return the nth {@link ModelDefinition} in this {@link ListOfModelDefinitions}.
183   <p>
184   * @see #size()
185   */ public
186 SBase get(long n) {
187    long cPtr = libsbmlJNI.ListOfModelDefinitions_get__SWIG_0(swigCPtr, this, n);
188    return (cPtr == 0) ? null : new ModelDefinition(cPtr, false);
189  }
190
191  
192/**
193   * Get a {@link Model} from the {@link ListOfModelDefinitions}
194   * based on its identifier.
195   <p>
196   * @param sid a string representing the identifier 
197   * of the {@link Model} to get.
198   <p>
199   * @return {@link Model} in this {@link ListOfModelDefinitions}
200   * with the given <code>sid</code> or <code>null</code> if no such
201   * {@link Member} exists.
202   <p>
203   * @see #get(long n)
204   * @see #size()
205   */ public
206 ModelDefinition get(String sid) {
207    long cPtr = libsbmlJNI.ListOfModelDefinitions_get__SWIG_2(swigCPtr, this, sid);
208    return (cPtr == 0) ? null : new ModelDefinition(cPtr, false);
209  }
210
211  
212/**
213   * Removes the nth item from this {@link ListOfModelDefinitions} items and returns
214   * a pointer to it.
215   <p>
216   * The caller owns the returned item and is responsible for deleting it.
217   <p>
218   * @param n the index of the item to remove
219   <p>
220   * @see #size()
221   */ public
222 SBase remove(long n) {
223    long cPtr = libsbmlJNI.ListOfModelDefinitions_remove__SWIG_0(swigCPtr, this, n);
224    return (cPtr == 0) ? null : new ModelDefinition(cPtr, true);
225  }
226
227  
228/**
229   * Removes the item with given identifer from this {@link ListOfModelDefinitions}
230   * items and returns a pointer to it.
231   <p>
232   * The caller owns the returned item and is responsible for deleting it.
233   <p>
234   * @param sid the id of the item to remove
235   <p>
236   * @see #size()
237   */ public
238 ModelDefinition remove(String sid) {
239    long cPtr = libsbmlJNI.ListOfModelDefinitions_remove__SWIG_1(swigCPtr, this, sid);
240    return (cPtr == 0) ? null : new ModelDefinition(cPtr, true);
241  }
242
243  
244/**
245   * Returns the libSBML type code for the objects contained in this {@link ListOf}
246   * (i.e., {@link ModelDefinition} objects, if the list is non-empty).
247   <p>
248   * <p>
249 * LibSBML attaches an identifying code to every kind of SBML object.  These
250 * are integer constants known as <em>SBML type codes</em>.  The names of all
251 * the codes begin with the characters <code>SBML_</code>.
252 * In the Java language interface for libSBML, the
253 * type codes are defined as static integer constants in the interface class
254 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
255 * package plug-ins may use overlapping type codes; to identify the package
256 * to which a given object belongs, call the <code>getPackageName()</code>
257 * method on the object.
258   <p>
259   * @return the SBML type code for objects contained in this list:
260   * {@link libsbmlConstants#SBML_COMP_MODELDEFINITION SBML_COMP_MODELDEFINITION} (default).
261   <p>
262   * @see #getElementName()
263   * @see #getPackageName()
264   */ public
265 int getItemTypeCode() {
266    return libsbmlJNI.ListOfModelDefinitions_getItemTypeCode(swigCPtr, this);
267  }
268
269  
270/**
271   * Returns the XML element name of
272   * this SBML object.
273   <p>
274   * @return the name of this element, as a text string.
275   */ public
276 String getElementName() {
277    return libsbmlJNI.ListOfModelDefinitions_getElementName(swigCPtr, this);
278  }
279
280}