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