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 * a container class that holds a list of gradient definitions. 013 * There are two types of gradient definitions: {@link LinearGradient} and 014 * {@link RadialGradient} 015 <p> 016 * Each RenderInformation object can have it's own list of gradient definitions. 017 */ 018 019public class ListOfGradientDefinitions extends ListOf { 020 private long swigCPtr; 021 022 protected ListOfGradientDefinitions(long cPtr, boolean cMemoryOwn) 023 { 024 super(libsbmlJNI.ListOfGradientDefinitions_SWIGUpcast(cPtr), cMemoryOwn); 025 swigCPtr = cPtr; 026 } 027 028 protected static long getCPtr(ListOfGradientDefinitions obj) 029 { 030 return (obj == null) ? 0 : obj.swigCPtr; 031 } 032 033 protected static long getCPtrAndDisown (ListOfGradientDefinitions 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_ListOfGradientDefinitions(swigCPtr); 055 } 056 swigCPtr = 0; 057 } 058 super.delete(); 059 } 060 061 062/** 063 * Creates a new {@link ListOfGradientDefinitions} object from the given {@link XMLNode} object. 064 * The {@link XMLNode} object has to contain a valid XML representation of a 065 * {@link ListOfGradientDefinitions} object as defined in the render extension specification. 066 * This method is normally called when render information is read from a file and 067 * should normally not have to be called explicitly. 068 <p> 069 * @param node the {@link XMLNode} object reference that describes the {@link ListOfGradientDefinitions} 070 * object to be instantiated. 071 */ public 072 ListOfGradientDefinitions(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 073 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_0(XMLNode.getCPtr(node), node, l2version), true); 074 } 075 076 077/** 078 * Creates a new {@link ListOfGradientDefinitions} object from the given {@link XMLNode} object. 079 * The {@link XMLNode} object has to contain a valid XML representation of a 080 * {@link ListOfGradientDefinitions} object as defined in the render extension specification. 081 * This method is normally called when render information is read from a file and 082 * should normally not have to be called explicitly. 083 <p> 084 * @param node the {@link XMLNode} object reference that describes the {@link ListOfGradientDefinitions} 085 * object to be instantiated. 086 */ public 087 ListOfGradientDefinitions(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 088 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_1(XMLNode.getCPtr(node), node), true); 089 } 090 091 092/** 093 * Creates and returns a deep copy of the {@link ListOfGradientDefinitions} object. 094 <p> 095 * @return a (deep) copy of this {@link ListOfGradientDefinitions} 096 */ public 097 ListOfGradientDefinitions cloneObject() { 098 long cPtr = libsbmlJNI.ListOfGradientDefinitions_cloneObject(swigCPtr, this); 099 return (cPtr == 0) ? null : new ListOfGradientDefinitions(cPtr, true); 100 } 101 102 103/** 104 * Constructor which instantiates an empty {@link ListOfGradientDefinitions} object. 105 */ public 106 ListOfGradientDefinitions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 107 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_2(level, version, pkgVersion), true); 108 } 109 110 111/** 112 * Constructor which instantiates an empty {@link ListOfGradientDefinitions} object. 113 */ public 114 ListOfGradientDefinitions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 115 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_3(level, version), true); 116 } 117 118 119/** 120 * Constructor which instantiates an empty {@link ListOfGradientDefinitions} object. 121 */ public 122 ListOfGradientDefinitions(long level) throws org.sbml.libsbml.SBMLConstructorException { 123 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_4(level), true); 124 } 125 126 127/** 128 * Constructor which instantiates an empty {@link ListOfGradientDefinitions} object. 129 */ public 130 ListOfGradientDefinitions() throws org.sbml.libsbml.SBMLConstructorException { 131 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_5(), true); 132 } 133 134 135/** 136 * Ctor. 137 */ public 138 ListOfGradientDefinitions(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException { 139 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_6(RenderPkgNamespaces.getCPtr(renderns), renderns), true); 140 } 141 142 143/** 144 * Copy constructor. Creates a copy of this {@link ListOfGradientDefinitions} object. 145 */ public 146 ListOfGradientDefinitions(ListOfGradientDefinitions source) throws org.sbml.libsbml.SBMLConstructorException { 147 this(libsbmlJNI.new_ListOfGradientDefinitions__SWIG_7(ListOfGradientDefinitions.getCPtr(source), source), true); 148 } 149 150 151/** 152 * Get the type code of the objects contained in this {@link ListOf}. 153 <p> 154 * LibSBML attaches an identifying code to every 155 * kind of SBML object. These are known as <em>SBML type codes</em>. In 156 * other languages, the set of type codes is stored in an enumeration; in 157 * the Java language interface for libSBML, the type codes are defined as 158 * static integer constants in the interface class {@link 159 * libsbmlConstants}. The names of the type codes all begin with the 160 * characters <code>SBML_.</code> 161 <p> 162 * @return the SBML type code for the objects contained in this {@link ListOf} 163 * instance, or {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default). 164 */ public 165 int getItemTypeCode() { 166 return libsbmlJNI.ListOfGradientDefinitions_getItemTypeCode(swigCPtr, this); 167 } 168 169 170/** */ public 171 boolean isValidTypeForList(SBase item) { 172 return libsbmlJNI.ListOfGradientDefinitions_isValidTypeForList(swigCPtr, this, SBase.getCPtrAndDisown(item), item); 173 } 174 175 176/** 177 * Creates an {@link XMLNode} object from this {@link ListOfGradientDefinitions} object. 178 <p> 179 * @return the {@link XMLNode} with the XML representation for the 180 * {@link ListOfGradientDefinitions} object. 181 */ public 182 XMLNode toXML() { 183 return new XMLNode(libsbmlJNI.ListOfGradientDefinitions_toXML(swigCPtr, this), true); 184 } 185 186 187/** 188 * Returns the XML element name of this object, which for 189 * {@link ListOfGradientDefinitions}, is always <code>'listOfGradientDefinitions'.</code> 190 <p> 191 * @return the name of this element, i.e., <code>'listOfGradientDefinitions'.</code> 192 */ public 193 String getElementName() { 194 return libsbmlJNI.ListOfGradientDefinitions_getElementName(swigCPtr, this); 195 } 196 197 198/** 199 * Returns a pointer to the {@link GradientBase} with the given index or null if 200 * the index is invalid. 201 <p> 202 * @param i index of the {@link GradientBase} object to be returned 203 <p> 204 * @return pointer to the {@link GradientBase} at the given index or null. 205 */ public 206 SBase get(long i) { 207 return (GradientBase) libsbml.DowncastSBase(libsbmlJNI.ListOfGradientDefinitions_get__SWIG_0(swigCPtr, this, i), false); 208} 209 210 211/** 212 * Returns a pointer to the {@link GradientBase} with the given <code>id</code> or <code>null</code> if 213 * the id is invalid. 214 <p> 215 * @param id id of the {@link GradientBase} object to be returned 216 <p> 217 * @return pointer to the {@link GradientBase} at the given <code>id</code> or <code>null.</code> 218 */ public 219 GradientBase get(String id) { 220 return (GradientBase) libsbml.DowncastSBase(libsbmlJNI.ListOfGradientDefinitions_get__SWIG_2(swigCPtr, this, id), false); 221} 222 223 224/** 225 * Removes the nth item from this {@link ListOfGradientDefinitions} items and returns a pointer to 226 * it. 227 <p> 228 * The caller owns the returned item and is responsible for deleting it. 229 <p> 230 * @param n the index of the item to remove 231 <p> 232 * @see #size() 233 */ public 234 SBase remove(long n) { 235 return (GradientBase) libsbml.DowncastSBase(libsbmlJNI.ListOfGradientDefinitions_remove__SWIG_0(swigCPtr, this, n), true); 236} 237 238 239/** 240 * Removes item in this {@link ListOfGradientDefinitions} items with the given identifier. 241 <p> 242 * The caller owns the returned item and is responsible for deleting it. 243 * If none of the items in this list have the identifier <code>sid</code>, then @c 244 * null is returned. 245 <p> 246 * @param sid the identifier of the item to remove 247 <p> 248 * @return the item removed. As mentioned above, the caller owns the 249 * returned item. 250 */ public 251 GradientBase remove(String sid) { 252 return (GradientBase) libsbml.DowncastSBase(libsbmlJNI.ListOfGradientDefinitions_remove__SWIG_1(swigCPtr, this, sid), true); 253} 254 255}