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