001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.7
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-qual"><a href="group__qual.html">qual</a></span>
013
014 A list of {@link Transition} objects.
015 <p>
016 * The {@link ListOfTransitions} is a container for the {@link Transition} elements of a {@link Model}.
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 Transition
062 */
063
064public class ListOfTransitions extends ListOf {
065   private long swigCPtr;
066
067   protected ListOfTransitions(long cPtr, boolean cMemoryOwn)
068   {
069     super(libsbmlJNI.ListOfTransitions_SWIGUpcast(cPtr), cMemoryOwn);
070     swigCPtr = cPtr;
071   }
072
073   protected static long getCPtr(ListOfTransitions obj)
074   {
075     return (obj == null) ? 0 : obj.swigCPtr;
076   }
077
078   protected static long getCPtrAndDisown (ListOfTransitions 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_ListOfTransitions(swigCPtr);
100      }
101      swigCPtr = 0;
102    }
103    super.delete();
104  }
105
106  
107/**
108   * Creates a new {@link ListOfTransitions} with the given level, version, and package version.
109   <p>
110   * @param level a long integer, the SBML Level to assign to this {@link ListOfTransitions}
111   <p>
112   * @param version a long integer, the SBML Version to assign to this {@link ListOfTransitions}
113   <p>
114   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfTransitions}
115   */ public
116 ListOfTransitions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
117    this(libsbmlJNI.new_ListOfTransitions__SWIG_0(level, version, pkgVersion), true);
118  }
119
120  
121/**
122   * Creates a new {@link ListOfTransitions} with the given level, version, and package version.
123   <p>
124   * @param level a long integer, the SBML Level to assign to this {@link ListOfTransitions}
125   <p>
126   * @param version a long integer, the SBML Version to assign to this {@link ListOfTransitions}
127   <p>
128   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfTransitions}
129   */ public
130 ListOfTransitions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
131    this(libsbmlJNI.new_ListOfTransitions__SWIG_1(level, version), true);
132  }
133
134  
135/**
136   * Creates a new {@link ListOfTransitions} with the given level, version, and package version.
137   <p>
138   * @param level a long integer, the SBML Level to assign to this {@link ListOfTransitions}
139   <p>
140   * @param version a long integer, the SBML Version to assign to this {@link ListOfTransitions}
141   <p>
142   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfTransitions}
143   */ public
144 ListOfTransitions(long level) throws org.sbml.libsbml.SBMLConstructorException {
145    this(libsbmlJNI.new_ListOfTransitions__SWIG_2(level), true);
146  }
147
148  
149/**
150   * Creates a new {@link ListOfTransitions} with the given level, version, and package version.
151   <p>
152   * @param level a long integer, the SBML Level to assign to this {@link ListOfTransitions}
153   <p>
154   * @param version a long integer, the SBML Version to assign to this {@link ListOfTransitions}
155   <p>
156   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link ListOfTransitions}
157   */ public
158 ListOfTransitions() throws org.sbml.libsbml.SBMLConstructorException {
159    this(libsbmlJNI.new_ListOfTransitions__SWIG_3(), true);
160  }
161
162  
163/**
164   * Creates a new {@link ListOfTransitions} with the given {@link QualPkgNamespaces} object.
165   <p>
166   * @param qualns the {@link QualPkgNamespaces} object
167   */ public
168 ListOfTransitions(QualPkgNamespaces qualns) throws org.sbml.libsbml.SBMLConstructorException {
169    this(libsbmlJNI.new_ListOfTransitions__SWIG_4(QualPkgNamespaces.getCPtr(qualns), qualns), true);
170  }
171
172  
173/**
174   * Creates and returns a deep copy of this {@link ListOfTransitions} object.
175   <p>
176   * @return a (deep) copy of this {@link ListOfTransitions} object.
177   */ public
178 ListOfTransitions cloneObject() {
179    long cPtr = libsbmlJNI.ListOfTransitions_cloneObject(swigCPtr, this);
180    return (cPtr == 0) ? null : new ListOfTransitions(cPtr, true);
181  }
182
183  
184/**
185   * Get a {@link Transition} from the {@link ListOfTransitions}.
186   <p>
187   * @param n the index number of the {@link Transition} to get.
188   <p>
189   * @return the nth {@link Transition} in this {@link ListOfTransitions}.
190   <p>
191   * @see #size()
192   */ public
193 Transition get(long n) {
194    long cPtr = libsbmlJNI.ListOfTransitions_get__SWIG_0(swigCPtr, this, n);
195    return (cPtr == 0) ? null : new Transition(cPtr, false);
196  }
197
198  
199/**
200   * Get a {@link Transition} from the {@link ListOfTransitions}
201   * based on its identifier.
202   <p>
203   * @param sid a string representing the identifier
204   * of the {@link Transition} to get.
205   <p>
206   * @return {@link Transition} in this {@link ListOfTransitions}
207   * with the given id or null if no such
208   * {@link Transition} exists.
209   <p>
210   * @see #get(long n)   *
211   * @see #size()
212   */ public
213 Transition get(String sid) {
214    long cPtr = libsbmlJNI.ListOfTransitions_get__SWIG_2(swigCPtr, this, sid);
215    return (cPtr == 0) ? null : new Transition(cPtr, false);
216  }
217
218  
219/**
220   * Removes the nth {@link Transition} from this {@link ListOfTransitions}
221   * and returns a pointer to it.
222   <p>
223   * The caller owns the returned item and is responsible for deleting it.
224   <p>
225   * @param n the index of the {@link Transition} to remove.
226   <p>
227   * @see #size()
228   */ public
229 Transition remove(long n) {
230    long cPtr = libsbmlJNI.ListOfTransitions_remove__SWIG_0(swigCPtr, this, n);
231    return (cPtr == 0) ? null : new Transition(cPtr, true);
232  }
233
234  
235/**
236   * Removes the {@link Transition} from this {@link ListOfTransitions} with the given identifier
237   * and returns a pointer to it.
238   <p>
239   * The caller owns the returned item and is responsible for deleting it.
240   * If none of the items in this list have the identifier <code>sid</code>, then
241   * <code>null</code> is returned.
242   <p>
243   * @param sid the identifier of the {@link Transition} to remove.
244   <p>
245   * @return the {@link Transition} removed. As mentioned above, the caller owns the
246   * returned item.
247   */ public
248 Transition remove(String sid) {
249    long cPtr = libsbmlJNI.ListOfTransitions_remove__SWIG_1(swigCPtr, this, sid);
250    return (cPtr == 0) ? null : new Transition(cPtr, true);
251  }
252
253  
254/**
255   * Returns the XML name of this object.
256   <p>
257   * @return the name of this element.
258   */ public
259 String getElementName() {
260    return libsbmlJNI.ListOfTransitions_getElementName(swigCPtr, this);
261  }
262
263  
264/**
265   * Returns the libSBML type code for the SBML objects
266   * contained in this {@link ListOf} object.
267   <p>
268   * <p>
269 * LibSBML attaches an identifying code to every kind of SBML object.  These
270 * are integer constants known as <em>SBML type codes</em>.  The names of all
271 * the codes begin with the characters <code>SBML_</code>.
272 * In the Java language interface for libSBML, the
273 * type codes are defined as static integer constants in the interface class
274 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
275 * package plug-ins may use overlapping type codes; to identify the package
276 * to which a given object belongs, call the <code>getPackageName()</code>
277 * method on the object.
278   <p>
279   * @return the SBML type code for objects contained in this list:
280   * {@link libsbmlConstants#SBML_QUAL_TRANSITION SBML_QUAL_TRANSITION} (default).
281   <p>
282   * @see #getElementName()
283   * @see #getPackageName()
284   */ public
285 int getItemTypeCode() {
286    return libsbmlJNI.ListOfTransitions_getItemTypeCode(swigCPtr, this);
287  }
288
289}