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