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 ExternalModelDefinition} objects.
014 <p>
015 * The {@link ListOfExternalModelDefinitions} is a container for the extended 
016 * {@link SBMLDocument} that defines references to Models defined in external
017 * files.
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 ExternalModelDefinition
063 * @see ListOfDeletions
064 * @see ListOfModelDefinitions
065 * @see ListOfPorts
066 * @see ListOfReplacedElements
067 * @see ListOfSubmodels
068 */
069
070public class ListOfExternalModelDefinitions extends ListOf {
071   private long swigCPtr;
072
073   protected ListOfExternalModelDefinitions(long cPtr, boolean cMemoryOwn)
074   {
075     super(libsbmlJNI.ListOfExternalModelDefinitions_SWIGUpcast(cPtr), cMemoryOwn);
076     swigCPtr = cPtr;
077   }
078
079   protected static long getCPtr(ListOfExternalModelDefinitions obj)
080   {
081     return (obj == null) ? 0 : obj.swigCPtr;
082   }
083
084   protected static long getCPtrAndDisown (ListOfExternalModelDefinitions 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_ListOfExternalModelDefinitions(swigCPtr);
106      }
107      swigCPtr = 0;
108    }
109    super.delete();
110  }
111
112  
113/**
114   * Creates and returns a deep copy of this {@link ListOfExternalModelDefinitions} object.
115   <p>
116   * @return a (deep) copy of this {@link ListOfExternalModelDefinitions}.
117   */ public
118 ListOfExternalModelDefinitions cloneObject() {
119    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_cloneObject(swigCPtr, this);
120    return (cPtr == 0) ? null : new ListOfExternalModelDefinitions(cPtr, true);
121  }
122
123  
124/**
125   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
126   * version, and 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 ListOfExternalModelDefinitions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
133    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_0(level, version, pkgVersion), true);
134  }
135
136  
137/**
138   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
139   * version, and 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 ListOfExternalModelDefinitions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
146    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_1(level, version), true);
147  }
148
149  
150/**
151   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
152   * version, and 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 ListOfExternalModelDefinitions(long level) throws org.sbml.libsbml.SBMLConstructorException {
159    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_2(level), true);
160  }
161
162  
163/**
164   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
165   * version, and 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 ListOfExternalModelDefinitions() throws org.sbml.libsbml.SBMLConstructorException {
172    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_3(), true);
173  }
174
175  
176/**
177   * Creates a new {@link ListOfExternalModelDefinitions} with the given
178   * {@link CompPkgNamespaces} object.
179   <p>
180   * @param compns the namespace to use
181   */ public
182 ListOfExternalModelDefinitions(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException {
183    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true);
184  }
185
186  
187/**
188   * Get a {@link ExternalModelDefinition} from the {@link ListOfExternalModelDefinitions}.
189   <p>
190   * @param n the index number of the {@link ExternalModelDefinition} to get.
191   <p>
192   * @return the nth {@link ExternalModelDefinition} in this
193   * {@link ListOfExternalModelDefinitions}.
194   <p>
195   * @see #size()
196   */ public
197 SBase get(long n) {
198    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_get__SWIG_0(swigCPtr, this, n);
199    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
200  }
201
202  
203/**
204   * Get a {@link Model} from the {@link ListOfExternalModelDefinitions}
205   * based on its identifier.
206   <p>
207   * @param sid a string representing the identifier 
208   * of the {@link Model} to get.
209   <p>
210   * @return {@link Model} in this {@link ListOfExternalModelDefinitions}
211   * with the given <code>sid</code> or <code>null</code> if no such
212   * Member exists.
213   <p>
214   * @see #get(long n)
215   * @see #size()
216   */ public
217 ExternalModelDefinition get(String sid) {
218    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_get__SWIG_2(swigCPtr, this, sid);
219    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
220  }
221
222  
223/**
224   * Removes the nth item from this {@link ListOfExternalModelDefinitions} items and
225   * returns a pointer to it.
226   <p>
227   * The caller owns the returned item and is responsible for deleting it.
228   <p>
229   * @param n the index of the item to remove
230   <p>
231   * @see #size()
232   */ public
233 SBase remove(long n) {
234    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_remove__SWIG_0(swigCPtr, this, n);
235    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, true);
236  }
237
238  
239/**
240   * Removes the item with given <code>sid</code> from this {@link ListOfModelDefinitions} items
241   * and returns a pointer to it.
242   <p>
243   * The caller owns the returned item and is responsible for deleting it.
244   <p>
245   * @param sid the id of the item to remove
246   <p>
247   * @see #size()
248   */ public
249 ExternalModelDefinition remove(String sid) {
250    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_remove__SWIG_1(swigCPtr, this, sid);
251    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, true);
252  }
253
254  
255/**
256   * Returns the libSBML type code for the objects contained in this {@link ListOf}
257   * (i.e., {@link Model} objects, if the list is non-empty).
258   <p>
259   * <p>
260 * LibSBML attaches an identifying code to every kind of SBML object.  These
261 * are integer constants known as <em>SBML type codes</em>.  The names of all
262 * the codes begin with the characters <code>SBML_</code>.
263 * In the Java language interface for libSBML, the
264 * type codes are defined as static integer constants in the interface class
265 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
266 * package plug-ins may use overlapping type codes; to identify the package
267 * to which a given object belongs, call the <code>getPackageName()</code>
268 * method on the object.
269   <p>
270   * @return the SBML type code for objects contained in this list:
271   * {@link libsbmlConstants#SBML_COMP_EXTERNALMODELDEFINITION SBML_COMP_EXTERNALMODELDEFINITION} (default).
272   <p>
273   * @see #getElementName()
274   * @see #getPackageName()
275   */ public
276 int getItemTypeCode() {
277    return libsbmlJNI.ListOfExternalModelDefinitions_getItemTypeCode(swigCPtr, this);
278  }
279
280  
281/**
282   * Returns the XML element name of
283   * this SBML object.
284   <p>
285   * @return the name of this element, as a text string.
286   */ public
287 String getElementName() {
288    return libsbmlJNI.ListOfExternalModelDefinitions_getElementName(swigCPtr, this);
289  }
290
291}