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