001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 2.0.11
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 * 
013 * Implementation of SBML's ListOfEventAssignments construct.
014 * <p>
015 * The various ListOf___ classes in SBML are merely containers used for
016 * organizing the main components of an SBML model.  All are derived from
017 * the abstract class {@link SBase}, and inherit the various attributes and
018 * subelements of {@link SBase}, such as 'metaid' as and 'annotation'.  The
019 * ListOf___ classes do not add any attributes of their own.
020 * <p>
021 * {@link ListOfEventAssignments} is entirely contained within {@link Event}.
022 */
023
024public class ListOfEventAssignments extends ListOf {
025   private long swigCPtr;
026
027   protected ListOfEventAssignments(long cPtr, boolean cMemoryOwn)
028   {
029     super(libsbmlJNI.ListOfEventAssignments_SWIGUpcast(cPtr), cMemoryOwn);
030     swigCPtr = cPtr;
031   }
032
033   protected static long getCPtr(ListOfEventAssignments obj)
034   {
035     return (obj == null) ? 0 : obj.swigCPtr;
036   }
037
038   protected static long getCPtrAndDisown (ListOfEventAssignments obj)
039   {
040     long ptr = 0;
041
042     if (obj != null)
043     {
044       ptr             = obj.swigCPtr;
045       obj.swigCMemOwn = false;
046     }
047
048     return ptr;
049   }
050
051  protected void finalize() {
052    delete();
053  }
054
055  public synchronized void delete() {
056    if (swigCPtr != 0) {
057      if (swigCMemOwn) {
058        swigCMemOwn = false;
059        libsbmlJNI.delete_ListOfEventAssignments(swigCPtr);
060      }
061      swigCPtr = 0;
062    }
063    super.delete();
064  }
065
066  
067/**
068   * Creates a new {@link ListOfEventAssignments} object.
069   * <p>
070   * The object is constructed such that it is valid for the given SBML
071   * Level and Version combination.
072   * <p>
073   * @param level the SBML Level
074   * <p>
075   * @param version the Version within the SBML Level
076   */ public
077 ListOfEventAssignments(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
078    this(libsbmlJNI.new_ListOfEventAssignments__SWIG_0(level, version), true);
079  }
080
081  
082/**
083   * Creates a new {@link ListOfEventAssignments} object.
084   * <p>
085   * The object is constructed such that it is valid for the SBML Level and
086   * Version combination determined by the {@link SBMLNamespaces} object in 
087   * <code>sbmlns</code>.
088   * <p>
089   * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the
090   * characteristics of the {@link ListOfEventAssignments} object to be created.
091   */ public
092 ListOfEventAssignments(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
093    this(libsbmlJNI.new_ListOfEventAssignments__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
094  }
095
096  
097/**
098   * Creates and returns a deep copy of this {@link ListOfEventAssignments}.
099   * <p>
100   * @return a (deep) copy of this {@link ListOfEventAssignments}.
101   */ public
102 ListOfEventAssignments cloneObject() {
103    long cPtr = libsbmlJNI.ListOfEventAssignments_cloneObject(swigCPtr, this);
104    return (cPtr == 0) ? null : new ListOfEventAssignments(cPtr, true);
105  }
106
107  
108/**
109   * Returns the libSBML type code for this SBML object.
110   * <p>
111   * LibSBML attaches an identifying code to every
112   * kind of SBML object.  These are known as <em>SBML type codes</em>.  In
113   * other languages, the set of type codes is stored in an enumeration; in
114   * the Java language interface for libSBML, the type codes are defined as
115   * static integer constants in the interface class {@link
116   * libsbmlConstants}.  The names of the type codes all begin with the
117   * characters <code>SBML_.</code> 
118   * <p>
119   * @return the SBML type code for this object, or {@link  libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default).
120   * <p>
121   * @see #getElementName()
122   */ public
123 int getTypeCode() {
124    return libsbmlJNI.ListOfEventAssignments_getTypeCode(swigCPtr, this);
125  }
126
127  
128/**
129   * Returns the libSBML type code for the objects contained in this {@link ListOf}
130   * (i.e., {@link EventAssignment} objects, if the list is non-empty).
131   * <p>
132   * LibSBML attaches an identifying code to every
133   * kind of SBML object.  These are known as <em>SBML type codes</em>.  In
134   * other languages, the set of type codes is stored in an enumeration; in
135   * the Java language interface for libSBML, the type codes are defined as
136   * static integer constants in the interface class {@link
137   * libsbmlConstants}.  The names of the type codes all begin with the
138   * characters <code>SBML_.</code> 
139   * <p>
140   * @return the SBML type code for the objects contained in this {@link ListOf}
141   * instance, or {@link  libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default).
142   * <p>
143   * @see #getElementName()
144   */ public
145 int getItemTypeCode() {
146    return libsbmlJNI.ListOfEventAssignments_getItemTypeCode(swigCPtr, this);
147  }
148
149  
150/**
151   * Returns the XML element name of this object.
152   * <p>
153   * For {@link ListOfEventAssignments}, the XML element name is 
154   * <code>'listOfEventAssignments'.</code>
155   * <p>
156   * @return the name of this element, i.e., <code>'listOfEventAssignments'.</code>
157   */ public
158 String getElementName() {
159    return libsbmlJNI.ListOfEventAssignments_getElementName(swigCPtr, this);
160  }
161
162  
163/**
164   * Get a {@link EventAssignment} from the {@link ListOfEventAssignments}.
165   * <p>
166   * @param n the index number of the {@link EventAssignment} to get.
167   * <p>
168   * @return the nth {@link EventAssignment} in this {@link ListOfEventAssignments}.
169   * <p>
170   * @see #size()
171   */ public
172 EventAssignment get(long n) {
173    long cPtr = libsbmlJNI.ListOfEventAssignments_get__SWIG_0(swigCPtr, this, n);
174    return (cPtr == 0) ? null : new EventAssignment(cPtr, false);
175  }
176
177  
178/**
179   * Get a {@link EventAssignment} from the {@link ListOfEventAssignments}
180   * based on its identifier.
181   * <p>
182   * @param sid a string representing the identifier 
183   * of the {@link EventAssignment} to get.
184   * <p>
185   * @return {@link EventAssignment} in this {@link ListOfEventAssignments}
186   * with the given <code>sid</code> or <code>null</code> if no such
187   * {@link EventAssignment} exists.
188   * <p>
189   * @see #get(long n)
190   * @see #size()
191   */ public
192 EventAssignment get(String sid) {
193    long cPtr = libsbmlJNI.ListOfEventAssignments_get__SWIG_2(swigCPtr, this, sid);
194    return (cPtr == 0) ? null : new EventAssignment(cPtr, false);
195  }
196
197  
198/**
199   * Removes the nth item from this {@link ListOfEventAssignments} items and returns a pointer to
200   * it.
201   * <p>
202   * The caller owns the returned item and is responsible for deleting it.
203   * <p>
204   * @param n the index of the item to remove
205   * <p>
206   * @see #size()
207   */ public
208 EventAssignment remove(long n) {
209    long cPtr = libsbmlJNI.ListOfEventAssignments_remove__SWIG_0(swigCPtr, this, n);
210    return (cPtr == 0) ? null : new EventAssignment(cPtr, true);
211  }
212
213  
214/**
215   * Removes item in this {@link ListOfEventAssignments} items with the given identifier.
216   * <p>
217   * The caller owns the returned item and is responsible for deleting it.
218   * If none of the items in this list have the identifier <code>sid</code>, then 
219   * <code>null</code> is returned.
220   * <p>
221   * @param sid the identifier of the item to remove
222   * <p>
223   * @return the item removed.  As mentioned above, the caller owns the
224   * returned item.
225   */ public
226 EventAssignment remove(String sid) {
227    long cPtr = libsbmlJNI.ListOfEventAssignments_remove__SWIG_1(swigCPtr, this, sid);
228    return (cPtr == 0) ? null : new EventAssignment(cPtr, true);
229  }
230
231  
232/**
233   * Returns the first child element found that has the given <code>id</code> in the model-wide SId namespace, or <code>null</code> if no such object is found.  Note that EventAssignments do not actually have IDs, but the {@link libsbml} interface pretends that they do:  no event assignment is returned by this function.
234   * <p>
235   * @param id string representing the id of objects to find
236   * <p>
237   * @return pointer to the first element found with the given <code>id</code>.
238   */ public
239 SBase getElementBySId(String id) {
240  return libsbml.DowncastSBase(libsbmlJNI.ListOfEventAssignments_getElementBySId(swigCPtr, this, id), false);
241}
242
243}