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