001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.12
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 * SBML Level&nbsp;3 Version&nbsp;1 has essentially the same structure as 
041 * Level&nbsp;2 Version&nbsp;4, depicted above, but SBML Level&nbsp;3 
042 * Version&nbsp;2 allows
043 * containers to contain zero or more of the relevant object, instead of 
044 * requiring at least one.  As such, libsbml will write out an 
045 * otherwise-empty ListOf___ element that has any optional attribute set 
046 * (such as 'id' or 'metaid'), that has an optional child (such 
047 * as a 'notes' or 'annotation'), or that has attributes or children set
048 * from any SBML Level&nbsp;3 package, whether or not the ListOf___ has 
049 * any other children.
050 <p>
051 * Readers may wonder about the motivations for using the ListOf___
052 * containers in SBML.  A simpler approach in XML might be to place the
053 * components all directly at the top level of the model definition.  The
054 * choice made in SBML is to group them within XML elements named after
055 * ListOf<em>Classname</em>, in part because it helps organize the
056 * components.  More importantly, the fact that the container classes are
057 * derived from {@link SBase} means that software tools can add information <em>about</em>
058 * the lists themselves into each list container's 'annotation'.
059 <p>
060 * @see ListOfFunctionDefinitions
061 * @see ListOfUnitDefinitions
062 * @see ListOfCompartmentTypes
063 * @see ListOfSpeciesTypes
064 * @see ListOfCompartments
065 * @see ListOfSpecies
066 * @see ListOfParameters
067 * @see ListOfInitialAssignments
068 * @see ListOfRules
069 * @see ListOfConstraints
070 * @see ListOfReactions
071 * @see ListOfEvents
072 <p>
073 * @see ExternalModelDefinition
074 * @see ListOfDeletions
075 * @see ListOfModelDefinitions
076 * @see ListOfPorts
077 * @see ListOfReplacedElements
078 * @see ListOfSubmodels
079 */
080
081public class ListOfExternalModelDefinitions extends ListOf {
082   private long swigCPtr;
083
084   protected ListOfExternalModelDefinitions(long cPtr, boolean cMemoryOwn)
085   {
086     super(libsbmlJNI.ListOfExternalModelDefinitions_SWIGUpcast(cPtr), cMemoryOwn);
087     swigCPtr = cPtr;
088   }
089
090   protected static long getCPtr(ListOfExternalModelDefinitions obj)
091   {
092     return (obj == null) ? 0 : obj.swigCPtr;
093   }
094
095   protected static long getCPtrAndDisown (ListOfExternalModelDefinitions obj)
096   {
097     long ptr = 0;
098
099     if (obj != null)
100     {
101       ptr             = obj.swigCPtr;
102       obj.swigCMemOwn = false;
103     }
104
105     return ptr;
106   }
107
108  protected void finalize() {
109    delete();
110  }
111
112  public synchronized void delete() {
113    if (swigCPtr != 0) {
114      if (swigCMemOwn) {
115        swigCMemOwn = false;
116        libsbmlJNI.delete_ListOfExternalModelDefinitions(swigCPtr);
117      }
118      swigCPtr = 0;
119    }
120    super.delete();
121  }
122
123  
124/**
125   * Creates and returns a deep copy of this {@link ListOfExternalModelDefinitions} object.
126   <p>
127   * @return a (deep) copy of this {@link ListOfExternalModelDefinitions}.
128   */ public
129 ListOfExternalModelDefinitions cloneObject() {
130    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_cloneObject(swigCPtr, this);
131    return (cPtr == 0) ? null : new ListOfExternalModelDefinitions(cPtr, true);
132  }
133
134  
135/**
136   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
137   * version, and package version.
138   <p>
139   * @param level the SBML Level.
140   * @param version the Version within the SBML Level.
141   * @param pkgVersion the version of the package.
142   <p>
143   * <p>
144 * @note Attempting to add an object to an {@link SBMLDocument} having a different
145 * combination of SBML Level, Version and XML namespaces than the object
146 * itself will result in an error at the time a caller attempts to make the
147 * addition.  A parent object must have compatible Level, Version and XML
148 * namespaces.  (Strictly speaking, a parent may also have more XML
149 * namespaces than a child, but the reverse is not permitted.)  The
150 * restriction is necessary to ensure that an SBML model has a consistent
151 * overall structure.  This requires callers to manage their objects
152 * carefully, but the benefit is increased flexibility in how models can be
153 * created by permitting callers to create objects bottom-up if desired.  In
154 * situations where objects are not yet attached to parents (e.g.,
155 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
156 * libSBML determine such things as whether it is valid to assign a
157 * particular value to an attribute.  For packages, this means that the 
158 * parent object to which this package element is being added must have
159 * been created with the package namespace, or that the package namespace
160 * was added to it, even if that parent is not a package object itself.
161   */ public
162 ListOfExternalModelDefinitions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
163    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_0(level, version, pkgVersion), true);
164  }
165
166  
167/**
168   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
169   * version, and package version.
170   <p>
171   * @param level the SBML Level.
172   * @param version the Version within the SBML Level.
173   * @param pkgVersion the version of the package.
174   <p>
175   * <p>
176 * @note Attempting to add an object to an {@link SBMLDocument} having a different
177 * combination of SBML Level, Version and XML namespaces than the object
178 * itself will result in an error at the time a caller attempts to make the
179 * addition.  A parent object must have compatible Level, Version and XML
180 * namespaces.  (Strictly speaking, a parent may also have more XML
181 * namespaces than a child, but the reverse is not permitted.)  The
182 * restriction is necessary to ensure that an SBML model has a consistent
183 * overall structure.  This requires callers to manage their objects
184 * carefully, but the benefit is increased flexibility in how models can be
185 * created by permitting callers to create objects bottom-up if desired.  In
186 * situations where objects are not yet attached to parents (e.g.,
187 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
188 * libSBML determine such things as whether it is valid to assign a
189 * particular value to an attribute.  For packages, this means that the 
190 * parent object to which this package element is being added must have
191 * been created with the package namespace, or that the package namespace
192 * was added to it, even if that parent is not a package object itself.
193   */ public
194 ListOfExternalModelDefinitions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
195    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_1(level, version), true);
196  }
197
198  
199/**
200   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
201   * version, and package version.
202   <p>
203   * @param level the SBML Level.
204   * @param version the Version within the SBML Level.
205   * @param pkgVersion the version of the package.
206   <p>
207   * <p>
208 * @note Attempting to add an object to an {@link SBMLDocument} having a different
209 * combination of SBML Level, Version and XML namespaces than the object
210 * itself will result in an error at the time a caller attempts to make the
211 * addition.  A parent object must have compatible Level, Version and XML
212 * namespaces.  (Strictly speaking, a parent may also have more XML
213 * namespaces than a child, but the reverse is not permitted.)  The
214 * restriction is necessary to ensure that an SBML model has a consistent
215 * overall structure.  This requires callers to manage their objects
216 * carefully, but the benefit is increased flexibility in how models can be
217 * created by permitting callers to create objects bottom-up if desired.  In
218 * situations where objects are not yet attached to parents (e.g.,
219 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
220 * libSBML determine such things as whether it is valid to assign a
221 * particular value to an attribute.  For packages, this means that the 
222 * parent object to which this package element is being added must have
223 * been created with the package namespace, or that the package namespace
224 * was added to it, even if that parent is not a package object itself.
225   */ public
226 ListOfExternalModelDefinitions(long level) throws org.sbml.libsbml.SBMLConstructorException {
227    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_2(level), true);
228  }
229
230  
231/**
232   * Creates a new {@link ListOfExternalModelDefinitions} with the given level,
233   * version, and package version.
234   <p>
235   * @param level the SBML Level.
236   * @param version the Version within the SBML Level.
237   * @param pkgVersion the version of the package.
238   <p>
239   * <p>
240 * @note Attempting to add an object to an {@link SBMLDocument} having a different
241 * combination of SBML Level, Version and XML namespaces than the object
242 * itself will result in an error at the time a caller attempts to make the
243 * addition.  A parent object must have compatible Level, Version and XML
244 * namespaces.  (Strictly speaking, a parent may also have more XML
245 * namespaces than a child, but the reverse is not permitted.)  The
246 * restriction is necessary to ensure that an SBML model has a consistent
247 * overall structure.  This requires callers to manage their objects
248 * carefully, but the benefit is increased flexibility in how models can be
249 * created by permitting callers to create objects bottom-up if desired.  In
250 * situations where objects are not yet attached to parents (e.g.,
251 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
252 * libSBML determine such things as whether it is valid to assign a
253 * particular value to an attribute.  For packages, this means that the 
254 * parent object to which this package element is being added must have
255 * been created with the package namespace, or that the package namespace
256 * was added to it, even if that parent is not a package object itself.
257   */ public
258 ListOfExternalModelDefinitions() throws org.sbml.libsbml.SBMLConstructorException {
259    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_3(), true);
260  }
261
262  
263/**
264   * Creates a new {@link ListOfExternalModelDefinitions} with the given
265   * {@link CompPkgNamespaces} object.
266   <p>
267   * <p>
268 * The package namespaces object used in this constructor is derived from a
269 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
270 * information.  It is used to communicate the SBML Level, Version, and 
271 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
272 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
273 * package namespace object somewhere in a program once, then hand that object
274 * as needed to object constructors of that package that accept it as and
275 * argument, such as this one.
276   <p>
277   * @param compns the {@link CompPkgNamespaces} object.
278   <p>
279   * <p>
280 * @note Attempting to add an object to an {@link SBMLDocument} having a different
281 * combination of SBML Level, Version and XML namespaces than the object
282 * itself will result in an error at the time a caller attempts to make the
283 * addition.  A parent object must have compatible Level, Version and XML
284 * namespaces.  (Strictly speaking, a parent may also have more XML
285 * namespaces than a child, but the reverse is not permitted.)  The
286 * restriction is necessary to ensure that an SBML model has a consistent
287 * overall structure.  This requires callers to manage their objects
288 * carefully, but the benefit is increased flexibility in how models can be
289 * created by permitting callers to create objects bottom-up if desired.  In
290 * situations where objects are not yet attached to parents (e.g.,
291 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
292 * libSBML determine such things as whether it is valid to assign a
293 * particular value to an attribute.  For packages, this means that the 
294 * parent object to which this package element is being added must have
295 * been created with the package namespace, or that the package namespace
296 * was added to it, even if that parent is not a package object itself.
297   */ public
298 ListOfExternalModelDefinitions(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException {
299    this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true);
300  }
301
302  
303/**
304   * Get a {@link ExternalModelDefinition} from the {@link ListOfExternalModelDefinitions}.
305   <p>
306   * @param n the index number of the {@link ExternalModelDefinition} to get.
307   <p>
308   * @return the nth {@link ExternalModelDefinition} in this
309   * {@link ListOfExternalModelDefinitions}.
310   <p>
311   * @see #size()
312   */ public
313 SBase get(long n) {
314    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_get__SWIG_0(swigCPtr, this, n);
315    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
316  }
317
318  
319/**
320   * Get a {@link Model} from the {@link ListOfExternalModelDefinitions}
321   * based on its identifier.
322   <p>
323   * @param sid a string representing the identifier 
324   * of the {@link Model} to get.
325   <p>
326   * @return {@link Model} in this {@link ListOfExternalModelDefinitions}
327   * with the given <code>sid</code> or <code>null</code> if no such
328   * {@link Member} exists.
329   <p>
330   * @see #get(long n)
331   * @see #size()
332   */ public
333 ExternalModelDefinition get(String sid) {
334    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_get__SWIG_2(swigCPtr, this, sid);
335    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
336  }
337
338  
339/**
340   * Removes the nth item from this {@link ListOfExternalModelDefinitions} items and
341   * returns a pointer to it.
342   <p>
343   * The caller owns the returned item and is responsible for deleting it.
344   <p>
345   * @param n the index of the item to remove.
346   <p>
347   * @see #size()
348   */ public
349 SBase remove(long n) {
350    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_remove__SWIG_0(swigCPtr, this, n);
351    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, true);
352  }
353
354  
355/**
356   * Removes the item with given <code>sid</code> from this {@link ListOfModelDefinitions} items
357   * and returns a pointer to it.
358   <p>
359   * The caller owns the returned item and is responsible for deleting it.
360   <p>
361   * @param sid the id of the item to remove.
362   <p>
363   * @see #size()
364   */ public
365 ExternalModelDefinition remove(String sid) {
366    long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_remove__SWIG_1(swigCPtr, this, sid);
367    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, true);
368  }
369
370  
371/**
372   * Returns the libSBML type code for the objects contained in this {@link ListOf}
373   * (i.e., {@link Model} objects, if the list is non-empty).
374   <p>
375   * <p>
376 * LibSBML attaches an identifying code to every kind of SBML object.  These
377 * are integer constants known as <em>SBML type codes</em>.  The names of all
378 * the codes begin with the characters <code>SBML_</code>.
379 * In the Java language interface for libSBML, the
380 * type codes are defined as static integer constants in the interface class
381 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
382 * package plug-ins may use overlapping type codes; to identify the package
383 * to which a given object belongs, call the 
384 * <code>{@link SBase#getPackageName()}
385 * </code>
386 * method on the object.
387   <p>
388   * @return the SBML type code for objects contained in this list:
389   * {@link libsbmlConstants#SBML_COMP_EXTERNALMODELDEFINITION SBML_COMP_EXTERNALMODELDEFINITION} (default).
390   <p>
391   * @see #getElementName()
392   * @see #getPackageName()
393   */ public
394 int getItemTypeCode() {
395    return libsbmlJNI.ListOfExternalModelDefinitions_getItemTypeCode(swigCPtr, this);
396  }
397
398  
399/**
400   * Returns the XML element name of
401   * this SBML object.
402   <p>
403   * @return the name of this element, as a text string.
404   */ public
405 String getElementName() {
406    return libsbmlJNI.ListOfExternalModelDefinitions_getElementName(swigCPtr, this);
407  }
408
409}