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 ListOfGlobalStyles} is the container class that stores GlobalStyles in {@link GlobalRenderInformation} objects. 013 <p> 014 * Each {@link GlobalRenderInformation} object contains a {@link ListOfGlobalStyles} which contains zero or 015 * more global style objects. 016 */ 017 018public class ListOfGlobalStyles extends ListOf { 019 private long swigCPtr; 020 021 protected ListOfGlobalStyles(long cPtr, boolean cMemoryOwn) 022 { 023 super(libsbmlJNI.ListOfGlobalStyles_SWIGUpcast(cPtr), cMemoryOwn); 024 swigCPtr = cPtr; 025 } 026 027 protected static long getCPtr(ListOfGlobalStyles obj) 028 { 029 return (obj == null) ? 0 : obj.swigCPtr; 030 } 031 032 protected static long getCPtrAndDisown (ListOfGlobalStyles 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_ListOfGlobalStyles(swigCPtr); 054 } 055 swigCPtr = 0; 056 } 057 super.delete(); 058 } 059 060 061/** 062 * Creates and returns a deep copy of the {@link ListOfGlobalStyles} object. 063 <p> 064 * @return a (deep) copy of this {@link ListOfGlobalStyles} 065 */ public 066 ListOfGlobalStyles cloneObject() { 067 long cPtr = libsbmlJNI.ListOfGlobalStyles_cloneObject(swigCPtr, this); 068 return (cPtr == 0) ? null : new ListOfGlobalStyles(cPtr, true); 069 } 070 071 072/** 073 * Creates a new {@link ListOfGlobalStyles} object from the given {@link XMLNode} object. 074 * The {@link XMLNode} object has to contain a valid XML representation of a 075 * {@link ListOfGlobalStyles} 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 ListOfGlobalStyles} 080 * object to be instantiated. 081 */ public 082 ListOfGlobalStyles(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 083 this(libsbmlJNI.new_ListOfGlobalStyles__SWIG_0(XMLNode.getCPtr(node), node), true); 084 } 085 086 087/** 088 * Constructor which instantiates an empty {@link ListOfGlobalStyles} object. 089 */ public 090 ListOfGlobalStyles(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 091 this(libsbmlJNI.new_ListOfGlobalStyles__SWIG_1(level, version, pkgVersion), true); 092 } 093 094 095/** 096 * Constructor which instantiates an empty {@link ListOfGlobalStyles} object. 097 */ public 098 ListOfGlobalStyles(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 099 this(libsbmlJNI.new_ListOfGlobalStyles__SWIG_2(level, version), true); 100 } 101 102 103/** 104 * Constructor which instantiates an empty {@link ListOfGlobalStyles} object. 105 */ public 106 ListOfGlobalStyles(long level) throws org.sbml.libsbml.SBMLConstructorException { 107 this(libsbmlJNI.new_ListOfGlobalStyles__SWIG_3(level), true); 108 } 109 110 111/** 112 * Constructor which instantiates an empty {@link ListOfGlobalStyles} object. 113 */ public 114 ListOfGlobalStyles() throws org.sbml.libsbml.SBMLConstructorException { 115 this(libsbmlJNI.new_ListOfGlobalStyles__SWIG_4(), true); 116 } 117 118 119/** 120 * Ctor. 121 */ public 122 ListOfGlobalStyles(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException { 123 this(libsbmlJNI.new_ListOfGlobalStyles__SWIG_5(RenderPkgNamespaces.getCPtr(renderns), renderns), true); 124 } 125 126 127/** 128 * Copy constructor for {@link ListOfGlobalStyles} objects. 129 */ public 130 ListOfGlobalStyles(ListOfGlobalStyles source) throws org.sbml.libsbml.SBMLConstructorException { 131 this(libsbmlJNI.new_ListOfGlobalStyles__SWIG_6(ListOfGlobalStyles.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.ListOfGlobalStyles_getTypeCode(swigCPtr, this); 154 } 155 156 157/** 158 * Get the type code of the objects contained in this {@link ListOf}. 159 <p> 160 * LibSBML attaches an identifying code to every 161 * kind of SBML object. These are known as <em>SBML type codes</em>. In 162 * other languages, the set of type codes is stored in an enumeration; in 163 * the Java language interface for libSBML, the type codes are defined as 164 * static integer constants in the interface class {@link 165 * libsbmlConstants}. The names of the type codes all begin with the 166 * characters <code>SBML_.</code> 167 <p> 168 * @return the SBML type code for the objects contained in this {@link ListOf} 169 * instance, or {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default). 170 */ public 171 int getItemTypeCode() { 172 return libsbmlJNI.ListOfGlobalStyles_getItemTypeCode(swigCPtr, this); 173 } 174 175 176/** 177 * Returns the XML element name of this object, which for 178 * {@link ListOfGlobalStyles}, is always <code>'listOfStyles'.</code> 179 <p> 180 * @return the name of this element, i.e., <code>'listOfStyles'.</code> 181 */ public 182 String getElementName() { 183 return libsbmlJNI.ListOfGlobalStyles_getElementName(swigCPtr, this); 184 } 185 186 187/** 188 * Creates an {@link XMLNode} object from this {@link ListOfGlobalStyles} object. 189 <p> 190 * @return the {@link XMLNode} with the XML representation for the 191 * {@link ListOfGlobalStyles} object. 192 */ public 193 XMLNode toXML() { 194 return new XMLNode(libsbmlJNI.ListOfGlobalStyles_toXML(swigCPtr, this), true); 195 } 196 197 198/** 199 * Returns a pointer to the {@link GlobalStyle} with the given index or null if 200 * the index is invalid. 201 <p> 202 * @param i index of the {@link GlobalStyle} object to be returned 203 <p> 204 * @return pointer to the {@link GlobalStyle} at the given index or null. 205 */ public 206 GlobalStyle get(long i) { 207 long cPtr = libsbmlJNI.ListOfGlobalStyles_get__SWIG_0(swigCPtr, this, i); 208 return (cPtr == 0) ? null : new GlobalStyle(cPtr, false); 209 } 210 211 212/** 213 * Returns a pointer to the {@link GlobalStyle} with the given <code>id</code> or <code>null</code> if 214 * the id is invalid. 215 <p> 216 * @param id id of the {@link GlobalStyle} object to be returned 217 <p> 218 * @return pointer to the {@link GlobalStyle} at the given <code>id</code> or <code>null.</code> 219 */ public 220 GlobalStyle get(String id) { 221 long cPtr = libsbmlJNI.ListOfGlobalStyles_get__SWIG_2(swigCPtr, this, id); 222 return (cPtr == 0) ? null : new GlobalStyle(cPtr, false); 223 } 224 225 226/** 227 * Removes the nth item from this {@link ListOfGlobalStyles} items and returns a pointer to 228 * it. 229 <p> 230 * The caller owns the returned item and is responsible for deleting it. 231 <p> 232 * @param n the index of the item to remove 233 <p> 234 * @see #size() 235 */ public 236 GlobalStyle remove(long n) { 237 long cPtr = libsbmlJNI.ListOfGlobalStyles_remove__SWIG_0(swigCPtr, this, n); 238 return (cPtr == 0) ? null : new GlobalStyle(cPtr, true); 239 } 240 241 242/** 243 * Removes item in this {@link ListOfGlobalStyles} items with the given identifier. 244 <p> 245 * The caller owns the returned item and is responsible for deleting it. 246 * If none of the items in this list have the identifier <code>sid</code>, then @c 247 * null is returned. 248 <p> 249 * @param sid the identifier of the item to remove 250 <p> 251 * @return the item removed. As mentioned above, the caller owns the 252 * returned item. 253 */ public 254 GlobalStyle remove(String sid) { 255 long cPtr = libsbmlJNI.ListOfGlobalStyles_remove__SWIG_1(swigCPtr, this, sid); 256 return (cPtr == 0) ? null : new GlobalStyle(cPtr, true); 257 } 258 259}