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