001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.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 * {@link ListOfLocalStyles} is the container class that stores LocalStyles in {@link LocalRenderInformation} objects.
013 <p>
014 * Each {@link LocalRenderInformation} object contains a {@link ListOfLocalStyles} which contains zero or
015 * more local style objects. 
016 */
017
018public class ListOfLocalStyles extends ListOf {
019   private long swigCPtr;
020
021   protected ListOfLocalStyles(long cPtr, boolean cMemoryOwn)
022   {
023     super(libsbmlJNI.ListOfLocalStyles_SWIGUpcast(cPtr), cMemoryOwn);
024     swigCPtr = cPtr;
025   }
026
027   protected static long getCPtr(ListOfLocalStyles obj)
028   {
029     return (obj == null) ? 0 : obj.swigCPtr;
030   }
031
032   protected static long getCPtrAndDisown (ListOfLocalStyles obj)
033   {
034     long ptr = 0;
035
036     if (obj != null)
037     {
038       ptr             = obj.swigCPtr;
039       obj.swigCMemOwn = false;
040     }
041
042     return ptr;
043   }
044
045  protected void finalize() {
046    delete();
047  }
048
049  public synchronized void delete() {
050    if (swigCPtr != 0) {
051      if (swigCMemOwn) {
052        swigCMemOwn = false;
053        libsbmlJNI.delete_ListOfLocalStyles(swigCPtr);
054      }
055      swigCPtr = 0;
056    }
057    super.delete();
058  }
059
060  
061/**
062   * Creates and returns a deep copy of the {@link ListOfLocalStyles} object.
063   <p>
064   * @return a (deep) copy of this {@link ListOfLocalStyles}
065   */ public
066 ListOfLocalStyles cloneObject() {
067    long cPtr = libsbmlJNI.ListOfLocalStyles_cloneObject(swigCPtr, this);
068    return (cPtr == 0) ? null : new ListOfLocalStyles(cPtr, true);
069  }
070
071  
072/**
073   * Creates a new {@link ListOfLocalStyles} object from the given {@link XMLNode} object.
074   * The {@link XMLNode} object has to contain a valid XML representation of a 
075   * {@link ListOfLocalStyles} object as defined in the render extension specification.
076   * This method is normally called when render information is read from a file and 
077   * should normally not have to be called explicitly.
078   <p>
079   * @param node the {@link XMLNode} object reference that describes the {@link ListOfLocalStyles}
080   * object to be instantiated.
081   */ public
082 ListOfLocalStyles(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
083    this(libsbmlJNI.new_ListOfLocalStyles__SWIG_0(XMLNode.getCPtr(node), node), true);
084  }
085
086  
087/**
088   * Constructor which instantiates an empty {@link ListOfLocalStyles} object.
089   */ public
090 ListOfLocalStyles(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
091    this(libsbmlJNI.new_ListOfLocalStyles__SWIG_1(level, version, pkgVersion), true);
092  }
093
094  
095/**
096   * Constructor which instantiates an empty {@link ListOfLocalStyles} object.
097   */ public
098 ListOfLocalStyles(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
099    this(libsbmlJNI.new_ListOfLocalStyles__SWIG_2(level, version), true);
100  }
101
102  
103/**
104   * Constructor which instantiates an empty {@link ListOfLocalStyles} object.
105   */ public
106 ListOfLocalStyles(long level) throws org.sbml.libsbml.SBMLConstructorException {
107    this(libsbmlJNI.new_ListOfLocalStyles__SWIG_3(level), true);
108  }
109
110  
111/**
112   * Constructor which instantiates an empty {@link ListOfLocalStyles} object.
113   */ public
114 ListOfLocalStyles() throws org.sbml.libsbml.SBMLConstructorException {
115    this(libsbmlJNI.new_ListOfLocalStyles__SWIG_4(), true);
116  }
117
118  
119/**
120   * Ctor.
121   */ public
122 ListOfLocalStyles(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
123    this(libsbmlJNI.new_ListOfLocalStyles__SWIG_5(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
124  }
125
126  
127/**
128   * Copy constructor for {@link ListOfLocalStyles} objects.
129   */ public
130 ListOfLocalStyles(ListOfLocalStyles source) throws org.sbml.libsbml.SBMLConstructorException {
131    this(libsbmlJNI.new_ListOfLocalStyles__SWIG_6(ListOfLocalStyles.getCPtr(source), source), true);
132  }
133
134  
135/**
136   * Returns the libSBML type code for the objects contained in this {@link ListOf}
137   * (i.e., GradientDefinition objects, if the list is non-empty).
138   <p>
139   * LibSBML attaches an
140   * identifying code to every kind of SBML object.  These are known as
141   * <em>SBML type codes</em>.  In other languages, the set of type codes
142   * is stored in an enumeration; in the Java language interface for
143   * libSBML, the type codes are defined as static integer constants in
144   * interface class {@link libsbmlConstants}.  The names of the type codes
145   * all begin with the characters <code>SBML_.</code> 
146   <p>
147   * @return the SBML type code for the objects contained in this {@link ListOf}
148   * instance, or <code>SBML_UNKNOWN</code> (default).
149   <p>
150   * @see #getElementName()
151   */ public
152 int getTypeCode() {
153    return libsbmlJNI.ListOfLocalStyles_getTypeCode(swigCPtr, this);
154  }
155
156  
157/**
158   * Returns the XML element name of this object, which for
159   * {@link ListOfLocalStyles}, is always <code>'listOfLocalStyles'.</code>
160   <p>
161   * @return the name of this element, i.e., <code>'listOfLocalStyles'.</code>
162   */ public
163 String getElementName() {
164    return libsbmlJNI.ListOfLocalStyles_getElementName(swigCPtr, this);
165  }
166
167  
168/**
169   * Creates an {@link XMLNode} object from this {@link ListOfLocalStyles} object.
170   <p>
171   * @return the {@link XMLNode} with the XML representation for the 
172   * {@link ListOfLocalStyles} object.
173   */ public
174 XMLNode toXML() {
175    return new XMLNode(libsbmlJNI.ListOfLocalStyles_toXML(swigCPtr, this), true);
176  }
177
178  
179/**
180   * Returns a pointer to the {@link LocalStyle} with the given index or null if
181   * the index is invalid.
182   <p>
183   * @param i index of the {@link LocalStyle} object to be returned
184   <p>
185   * @return pointer to the {@link LocalStyle} at the given index or null.
186   */ public
187 LocalStyle get(long i) {
188    long cPtr = libsbmlJNI.ListOfLocalStyles_get__SWIG_0(swigCPtr, this, i);
189    return (cPtr == 0) ? null : new LocalStyle(cPtr, false);
190  }
191
192  
193/**
194   * Returns a pointer to the {@link LocalStyle} with the given <code>id</code> or <code>null</code> if
195   * the id is invalid.
196   <p>
197   * @param id id of the {@link LocalStyle} object to be returned
198   <p>
199   * @return pointer to the {@link LocalStyle} at the given <code>id</code> or <code>null.</code>
200   */ public
201 LocalStyle get(String id) {
202    long cPtr = libsbmlJNI.ListOfLocalStyles_get__SWIG_2(swigCPtr, this, id);
203    return (cPtr == 0) ? null : new LocalStyle(cPtr, false);
204  }
205
206  
207/**
208   * Removes the nth item from this {@link ListOfLocalStyles} items and returns a pointer to
209   * it.
210   <p>
211   * The caller owns the returned item and is responsible for deleting it.
212   <p>
213   * @param n the index of the item to remove
214   <p>
215   * @see #size()
216   */ public
217 LocalStyle remove(long n) {
218    long cPtr = libsbmlJNI.ListOfLocalStyles_remove__SWIG_0(swigCPtr, this, n);
219    return (cPtr == 0) ? null : new LocalStyle(cPtr, true);
220  }
221
222  
223/**
224   * Removes item in this {@link ListOfLocalStyles} items with the given identifier.
225   <p>
226   * The caller owns the returned item and is responsible for deleting it.
227   * If none of the items in this list have the identifier <code>sid</code>, then @c
228   * null is returned.
229   <p>
230   * @param sid the identifier of the item to remove
231   <p>
232   * @return the item removed.  As mentioned above, the caller owns the
233   * returned item.
234   */ public
235 LocalStyle remove(String sid) {
236    long cPtr = libsbmlJNI.ListOfLocalStyles_remove__SWIG_1(swigCPtr, this, sid);
237    return (cPtr == 0) ? null : new LocalStyle(cPtr, true);
238  }
239
240  
241/**
242   * Returns the libSBML type code for this SBML object.
243   <p>
244   * LibSBML attaches an
245   * identifying code to every kind of SBML object.  These are known as
246   * <em>SBML type codes</em>.  In other languages, the set of type codes
247   * is stored in an enumeration; in the Java language interface for
248   * libSBML, the type codes are defined as static integer constants in
249   * interface class {@link libsbmlConstants}.  The names of the type codes
250   * all begin with the characters <code>SBML_.</code> 
251   <p>
252   * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
253   <p>
254   * @see #getElementName()
255   */ public
256 int getItemTypeCode() {
257    return libsbmlJNI.ListOfLocalStyles_getItemTypeCode(swigCPtr, this);
258  }
259
260}