001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 2.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-fbc"><a href="group__fbc.html">fbc</a></span>
013 Implementation of the 'fbc' package suggested
014 * ListOfGeneAssociations annotation construct.
015 <p>
016 * The {@link ListOfGeneAssociations} is a container for the {@link GeneAssociation} elements of the proposed {@link Model} annotation, and is not part of the official FBC specification.
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 * Readers may wonder about the motivations for using the ListOf___
040 * containers in SBML.  A simpler approach in XML might be to place the
041 * components all directly at the top level of the model definition.  The
042 * choice made in SBML is to group them within XML elements named after
043 * ListOf<em>Classname</em>, in part because it helps organize the
044 * components.  More importantly, the fact that the container classes are
045 * derived from {@link SBase} means that software tools can add information <em>about</em>
046 * the lists themselves into each list container's 'annotation'.
047 <p>
048 * @see ListOfFunctionDefinitions
049 * @see ListOfUnitDefinitions
050 * @see ListOfCompartmentTypes
051 * @see ListOfSpeciesTypes
052 * @see ListOfCompartments
053 * @see ListOfSpecies
054 * @see ListOfParameters
055 * @see ListOfInitialAssignments
056 * @see ListOfRules
057 * @see ListOfConstraints
058 * @see ListOfReactions
059 * @see ListOfEvents
060 <p>
061 * @see GeneAssociation
062 */
063
064public class ListOfGeneAssociations extends ListOf {
065   private long swigCPtr;
066
067   protected ListOfGeneAssociations(long cPtr, boolean cMemoryOwn)
068   {
069     super(libsbmlJNI.ListOfGeneAssociations_SWIGUpcast(cPtr), cMemoryOwn);
070     swigCPtr = cPtr;
071   }
072
073   protected static long getCPtr(ListOfGeneAssociations obj)
074   {
075     return (obj == null) ? 0 : obj.swigCPtr;
076   }
077
078   protected static long getCPtrAndDisown (ListOfGeneAssociations obj)
079   {
080     long ptr = 0;
081
082     if (obj != null)
083     {
084       ptr             = obj.swigCPtr;
085       obj.swigCMemOwn = false;
086     }
087
088     return ptr;
089   }
090
091  protected void finalize() {
092    delete();
093  }
094
095  public synchronized void delete() {
096    if (swigCPtr != 0) {
097      if (swigCMemOwn) {
098        swigCMemOwn = false;
099        libsbmlJNI.delete_ListOfGeneAssociations(swigCPtr);
100      }
101      swigCPtr = 0;
102    }
103    super.delete();
104  }
105
106  
107/**
108   * Creates and returns a deep copy of this {@link ListOfGeneAssociations}.
109   <p>
110   * @return a (deep) copy of this {@link ListOfGeneAssociations}.
111   */ public
112 ListOfGeneAssociations cloneObject() {
113    long cPtr = libsbmlJNI.ListOfGeneAssociations_cloneObject(swigCPtr, this);
114    return (cPtr == 0) ? null : new ListOfGeneAssociations(cPtr, true);
115  }
116
117  
118/**
119   * Creates a new {@link ListOfGeneAssociations} with the given level, version, and package version.
120   */ public
121 ListOfGeneAssociations(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
122    this(libsbmlJNI.new_ListOfGeneAssociations__SWIG_0(level, version, pkgVersion), true);
123  }
124
125  
126/**
127   * Creates a new {@link ListOfGeneAssociations} with the given level, version, and package version.
128   */ public
129 ListOfGeneAssociations(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
130    this(libsbmlJNI.new_ListOfGeneAssociations__SWIG_1(level, version), true);
131  }
132
133  
134/**
135   * Creates a new {@link ListOfGeneAssociations} with the given level, version, and package version.
136   */ public
137 ListOfGeneAssociations(long level) throws org.sbml.libsbml.SBMLConstructorException {
138    this(libsbmlJNI.new_ListOfGeneAssociations__SWIG_2(level), true);
139  }
140
141  
142/**
143   * Creates a new {@link ListOfGeneAssociations} with the given level, version, and package version.
144   */ public
145 ListOfGeneAssociations() throws org.sbml.libsbml.SBMLConstructorException {
146    this(libsbmlJNI.new_ListOfGeneAssociations__SWIG_3(), true);
147  }
148
149  
150/**
151   * Creates a new {@link ListOfGeneAssociations} with the given {@link FbcPkgNamespaces} object.
152   */ public
153 ListOfGeneAssociations(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
154    this(libsbmlJNI.new_ListOfGeneAssociations__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
155  }
156
157  
158/**
159   * Get a {@link GeneAssociation} from the {@link ListOfGeneAssociations}.
160   <p>
161   * @param n the index number of the {@link GeneAssociation} to get.
162   <p>
163   * @return the nth {@link GeneAssociation} in this {@link ListOfGeneAssociations}.
164   <p>
165   * @see #size()
166   */ public
167 GeneAssociation get(long n) {
168    long cPtr = libsbmlJNI.ListOfGeneAssociations_get__SWIG_0(swigCPtr, this, n);
169    return (cPtr == 0) ? null : new GeneAssociation(cPtr, false);
170  }
171
172  
173/**
174   * Get a {@link GeneAssociation} from the {@link ListOfGeneAssociations}
175   * based on its identifier.
176   <p>
177   * @param sid a string representing the identifier 
178   * of the {@link GeneAssociation} to get.
179   <p>
180   * @return {@link GeneAssociation} in this {@link ListOfGeneAssociations}
181   * with the given <code>sid</code> or <code>null</code> if no such
182   * {@link GeneAssociation} exists.
183   <p>
184   * @see #get(long n)
185   * @see #size()
186   */ public
187 GeneAssociation get(String sid) {
188    long cPtr = libsbmlJNI.ListOfGeneAssociations_get__SWIG_2(swigCPtr, this, sid);
189    return (cPtr == 0) ? null : new GeneAssociation(cPtr, false);
190  }
191
192  
193/**
194   * Removes the nth item from this {@link ListOfGeneAssociations} items and returns a pointer to
195   * it.
196   <p>
197   * The caller owns the returned item and is responsible for deleting it.
198   <p>
199   * @param n the index of the item to remove
200   * @return the item removed.  As mentioned above, the caller owns the
201   * returned item.
202   <p>
203   * @see #size()
204   */ public
205 GeneAssociation remove(long n) {
206    long cPtr = libsbmlJNI.ListOfGeneAssociations_remove__SWIG_0(swigCPtr, this, n);
207    return (cPtr == 0) ? null : new GeneAssociation(cPtr, true);
208  }
209
210  
211/**
212   * Removes item in this {@link ListOfGeneAssociations} items with the given identifier.
213   <p>
214   * The caller owns the returned item and is responsible for deleting it.
215   * If none of the items in this list have the identifier <code>sid</code>, then @c
216   * null is returned.
217   <p>
218   * @param sid the identifier of the item to remove
219   <p>
220   * @return the item removed.  As mentioned above, the caller owns the
221   * returned item.
222   */ public
223 GeneAssociation remove(String sid) {
224    long cPtr = libsbmlJNI.ListOfGeneAssociations_remove__SWIG_1(swigCPtr, this, sid);
225    return (cPtr == 0) ? null : new GeneAssociation(cPtr, true);
226  }
227
228  
229/**
230   * Returns the libSBML type code for the SBML objects
231   * contained in this {@link ListOf} object.
232   <p>
233   * <p>
234 * LibSBML attaches an identifying code to every kind of SBML object.  These
235 * are integer constants known as <em>SBML type codes</em>.  The names of all
236 * the codes begin with the characters &ldquo;<code>SBML_</code>&rdquo;. 
237 * In the Java language interface for libSBML, the
238 * type codes are defined as static integer constants in the interface class
239 * {@link libsbmlConstants}.    Note that different Level&nbsp;3 
240 * package plug-ins may use overlapping type codes; to identify the package
241 * to which a given object belongs, call the <code>getPackageName()</code>
242 * method on the object.
243   <p>
244   * @return the SBML type code for objects contained in this list:
245   * {@link  libsbmlConstants#SBML_FBC_GENEASSOCIATION SBML_FBC_GENEASSOCIATION} (default).
246   <p>
247   * @see #getElementName()
248   * @see #getPackageName()
249   */ public
250 int getItemTypeCode() {
251    return libsbmlJNI.ListOfGeneAssociations_getItemTypeCode(swigCPtr, this);
252  }
253
254  
255/**
256   * Returns the XML element name of
257   * this SBML object.
258   <p>
259   * @return the string of the name of this element.
260   */ public
261 String getElementName() {
262    return libsbmlJNI.ListOfGeneAssociations_getElementName(swigCPtr, this);
263  }
264
265}