001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
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 * a container that holds zero or more {@link GradientStop} objects.
013 <p>
014 * The {@link ListOfGradientStops} is used in linear and radial gradient objects to store the 
015 * {@link GradientStop} objects that define the gradient. A valid gradient should have two or more 
016 * gradient stops. 
017 */
018
019public class ListOfGradientStops extends ListOf {
020   private long swigCPtr;
021
022   protected ListOfGradientStops(long cPtr, boolean cMemoryOwn)
023   {
024     super(libsbmlJNI.ListOfGradientStops_SWIGUpcast(cPtr), cMemoryOwn);
025     swigCPtr = cPtr;
026   }
027
028   protected static long getCPtr(ListOfGradientStops obj)
029   {
030     return (obj == null) ? 0 : obj.swigCPtr;
031   }
032
033   protected static long getCPtrAndDisown (ListOfGradientStops obj)
034   {
035     long ptr = 0;
036
037     if (obj != null)
038     {
039       ptr             = obj.swigCPtr;
040       obj.swigCMemOwn = false;
041     }
042
043     return ptr;
044   }
045
046  protected void finalize() {
047    delete();
048  }
049
050  public synchronized void delete() {
051    if (swigCPtr != 0) {
052      if (swigCMemOwn) {
053        swigCMemOwn = false;
054        libsbmlJNI.delete_ListOfGradientStops(swigCPtr);
055      }
056      swigCPtr = 0;
057    }
058    super.delete();
059  }
060
061  
062/**
063   * Creates a deep copy of the {@link ListOfGradientStops} object.
064   <p>
065   * @return a (deep) copy of this {@link ListOfGradientStops}
066   */ public
067 ListOfGradientStops cloneObject() {
068    long cPtr = libsbmlJNI.ListOfGradientStops_cloneObject(swigCPtr, this);
069    return (cPtr == 0) ? null : new ListOfGradientStops(cPtr, true);
070  }
071
072  
073/**
074   * Creates a new {@link ListOfGradientStops} object from the given {@link XMLNode} object.
075   * The {@link XMLNode} object has to contain a valid XML representation of a 
076   * {@link ListOfGradientStops} object as defined in the render extension specification.
077   * This method is normally called when render information is read from a file and 
078   * should normally not have to be called explicitly.
079   <p>
080   * @param node the {@link XMLNode} object reference that describes the {@link ListOfGradientStops}
081   * object to be instantiated.
082   */ public
083 ListOfGradientStops(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
084    this(libsbmlJNI.new_ListOfGradientStops__SWIG_0(XMLNode.getCPtr(node), node, l2version), true);
085  }
086
087  
088/**
089   * Creates a new {@link ListOfGradientStops} object from the given {@link XMLNode} object.
090   * The {@link XMLNode} object has to contain a valid XML representation of a 
091   * {@link ListOfGradientStops} object as defined in the render extension specification.
092   * This method is normally called when render information is read from a file and 
093   * should normally not have to be called explicitly.
094   <p>
095   * @param node the {@link XMLNode} object reference that describes the {@link ListOfGradientStops}
096   * object to be instantiated.
097   */ public
098 ListOfGradientStops(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
099    this(libsbmlJNI.new_ListOfGradientStops__SWIG_1(XMLNode.getCPtr(node), node), true);
100  }
101
102  
103/**
104   * Constructor which instantiated an empty {@link ListOfGradientStops} object. 
105   */ public
106 ListOfGradientStops(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
107    this(libsbmlJNI.new_ListOfGradientStops__SWIG_2(level, version, pkgVersion), true);
108  }
109
110  
111/**
112   * Constructor which instantiated an empty {@link ListOfGradientStops} object. 
113   */ public
114 ListOfGradientStops(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
115    this(libsbmlJNI.new_ListOfGradientStops__SWIG_3(level, version), true);
116  }
117
118  
119/**
120   * Constructor which instantiated an empty {@link ListOfGradientStops} object. 
121   */ public
122 ListOfGradientStops(long level) throws org.sbml.libsbml.SBMLConstructorException {
123    this(libsbmlJNI.new_ListOfGradientStops__SWIG_4(level), true);
124  }
125
126  
127/**
128   * Constructor which instantiated an empty {@link ListOfGradientStops} object. 
129   */ public
130 ListOfGradientStops() throws org.sbml.libsbml.SBMLConstructorException {
131    this(libsbmlJNI.new_ListOfGradientStops__SWIG_5(), true);
132  }
133
134  
135/**
136   * Ctor.
137   */ public
138 ListOfGradientStops(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
139    this(libsbmlJNI.new_ListOfGradientStops__SWIG_6(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
140  }
141
142  
143/**
144   * Copy constructor; creates a copy of the given {@link ListOfGradientStops} object.
145   <p>
146   * @param the {@link ListOfGradientStops} object to be copied.
147   */ public
148 ListOfGradientStops(ListOfGradientStops source) throws org.sbml.libsbml.SBMLConstructorException {
149    this(libsbmlJNI.new_ListOfGradientStops__SWIG_7(ListOfGradientStops.getCPtr(source), source), true);
150  }
151
152  
153/**
154   * Returns the XML element name of this object, which for
155   * {@link ListOfGradientStops}, is always <code>'listOfGradientStops'.</code>
156   <p>
157   * @return the name of this element, i.e., <code>'listOfGradientStops'.</code>
158   */ public
159 String getElementName() {
160    return libsbmlJNI.ListOfGradientStops_getElementName(swigCPtr, this);
161  }
162
163  
164/**
165   * Creates an {@link XMLNode} object from this {@link ListOfGradientStops} object.
166   <p>
167   * @return the {@link XMLNode} with the XML representation for the 
168   * {@link ListOfGradientStops} object.
169   */ public
170 XMLNode toXML() {
171    return new XMLNode(libsbmlJNI.ListOfGradientStops_toXML(swigCPtr, this), true);
172  }
173
174  
175/**
176   * Returns a pointer to the {@link GradientStop} with the given index or null if
177   * the index is invalid.
178   <p>
179   * @param i index of the {@link GradientStop} object to be returned
180   <p>
181   * @return pointer to the {@link GradientStop} at the given index or null.
182   */ public
183 SBase get(long i) {
184    long cPtr = libsbmlJNI.ListOfGradientStops_get__SWIG_0(swigCPtr, this, i);
185    return (cPtr == 0) ? null : new GradientStop(cPtr, false);
186  }
187
188  
189/**
190   * Removes the nth item from this {@link ListOfGradientStops} items and returns a pointer to
191   * it.
192   <p>
193   * The caller owns the returned item and is responsible for deleting it.
194   <p>
195   * @param n the index of the item to remove
196   <p>
197   * @see #size()
198   */ public
199 SBase remove(long n) {
200    long cPtr = libsbmlJNI.ListOfGradientStops_remove(swigCPtr, this, n);
201    return (cPtr == 0) ? null : new GradientStop(cPtr, true);
202  }
203
204  
205/**
206   * Get the type code of the objects contained in this {@link ListOf}.
207   <p>
208   * LibSBML attaches an identifying code to every
209   * kind of SBML object.  These are known as <em>SBML type codes</em>.  In
210   * other languages, the set of type codes is stored in an enumeration; in
211   * the Java language interface for libSBML, the type codes are defined as
212   * static integer constants in the interface class {@link
213   * libsbmlConstants}.  The names of the type codes all begin with the
214   * characters <code>SBML_.</code> 
215   <p>
216   * @return the SBML type code for the objects contained in this {@link ListOf}
217   * instance, or {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default).
218   */ public
219 int getItemTypeCode() {
220    return libsbmlJNI.ListOfGradientStops_getItemTypeCode(swigCPtr, this);
221  }
222
223}