001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.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 * Implementation of SBML Level 3's 013 * ListOfLocalParameters construct. 014 <p> 015 * <p> 016 * The various ListOf___ classes in SBML 017 * are merely containers used for organizing the main components of an SBML 018 * model. In libSBML's implementation, ListOf___ 019 * classes are derived from the 020 * intermediate utility class {@link ListOf}, which 021 * is not defined by the SBML specifications but serves as a useful 022 * programmatic construct. {@link ListOf} is itself is in turn derived from {@link SBase}, 023 * which provides all of the various ListOf___ 024 * classes with common features 025 * defined by the SBML specification, such as 'metaid' attributes and 026 * annotations. 027 <p> 028 * The relationship between the lists and the rest of an SBML model is 029 * illustrated by the following (for SBML Level 2 Version 4): 030 <p> 031 * <figure> 032 <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object> 033</figure> 034 035 <p> 036 * Readers may wonder about the motivations for using the ListOf___ 037 * containers in SBML. A simpler approach in XML might be to place the 038 * components all directly at the top level of the model definition. The 039 * choice made in SBML is to group them within XML elements named after 040 * ListOf<em>Classname</em>, in part because it helps organize the 041 * components. More importantly, the fact that the container classes are 042 * derived from {@link SBase} means that software tools can add information <em>about</em> 043 * the lists themselves into each list container's 'annotation'. 044 <p> 045 * @see ListOfFunctionDefinitions 046 * @see ListOfUnitDefinitions 047 * @see ListOfCompartmentTypes 048 * @see ListOfSpeciesTypes 049 * @see ListOfCompartments 050 * @see ListOfSpecies 051 * @see ListOfParameters 052 * @see ListOfInitialAssignments 053 * @see ListOfRules 054 * @see ListOfConstraints 055 * @see ListOfReactions 056 * @see ListOfEvents 057 */ 058 059public class ListOfLocalParameters extends ListOfParameters { 060 private long swigCPtr; 061 062 protected ListOfLocalParameters(long cPtr, boolean cMemoryOwn) 063 { 064 super(libsbmlJNI.ListOfLocalParameters_SWIGUpcast(cPtr), cMemoryOwn); 065 swigCPtr = cPtr; 066 } 067 068 protected static long getCPtr(ListOfLocalParameters obj) 069 { 070 return (obj == null) ? 0 : obj.swigCPtr; 071 } 072 073 protected static long getCPtrAndDisown (ListOfLocalParameters obj) 074 { 075 long ptr = 0; 076 077 if (obj != null) 078 { 079 ptr = obj.swigCPtr; 080 obj.swigCMemOwn = false; 081 } 082 083 return ptr; 084 } 085 086 protected void finalize() { 087 delete(); 088 } 089 090 public synchronized void delete() { 091 if (swigCPtr != 0) { 092 if (swigCMemOwn) { 093 swigCMemOwn = false; 094 libsbmlJNI.delete_ListOfLocalParameters(swigCPtr); 095 } 096 swigCPtr = 0; 097 } 098 super.delete(); 099 } 100 101 102/** 103 * Creates a new {@link ListOfLocalParameters} object. 104 <p> 105 * The object is constructed such that it is valid for the given SBML 106 * Level and Version combination. 107 <p> 108 * @param level the SBML Level 109 <p> 110 * @param version the Version within the SBML Level 111 */ public 112 ListOfLocalParameters(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 113 this(libsbmlJNI.new_ListOfLocalParameters__SWIG_0(level, version), true); 114 } 115 116 117/** 118 * Creates a new {@link ListOfLocalParameters} object. 119 <p> 120 * The object is constructed such that it is valid for the SBML Level and 121 * Version combination determined by the {@link SBMLNamespaces} object in 122 * <code>sbmlns</code>. 123 <p> 124 * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the 125 * characteristics of the {@link ListOfLocalParameters} object to be created. 126 */ public 127 ListOfLocalParameters(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 128 this(libsbmlJNI.new_ListOfLocalParameters__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 129 } 130 131 132/** 133 * Creates and returns a deep copy of this {@link ListOfLocalParameters} object. 134 <p> 135 * @return a (deep) copy of this {@link ListOfLocalParameters}. 136 */ public 137 ListOfLocalParameters cloneObject() { 138 long cPtr = libsbmlJNI.ListOfLocalParameters_cloneObject(swigCPtr, this); 139 return (cPtr == 0) ? null : new ListOfLocalParameters(cPtr, true); 140 } 141 142 143/** 144 * Returns the libSBML type code for the objects contained in this {@link ListOf} 145 * (i.e., {@link LocalParameter} objects, if the list is non-empty). 146 <p> 147 * <p> 148 * LibSBML attaches an identifying code to every kind of SBML object. These 149 * are integer constants known as <em>SBML type codes</em>. The names of all 150 * the codes begin with the characters “<code>SBML_</code>”. 151 * In the Java language interface for libSBML, the 152 * type codes are defined as static integer constants in the interface class 153 * {@link libsbmlConstants}. Note that different Level 3 154 * package plug-ins may use overlapping type codes; to identify the package 155 * to which a given object belongs, call the <code>getPackageName()</code> 156 * method on the object. 157 <p> 158 * @return the SBML type code for the objects contained in this ListOf: 159 * {@link libsbmlConstants#SBML_LOCAL_PARAMETER SBML_LOCAL_PARAMETER} (default). 160 <p> 161 * @see #getElementName() 162 * @see #getPackageName() 163 */ public 164 int getItemTypeCode() { 165 return libsbmlJNI.ListOfLocalParameters_getItemTypeCode(swigCPtr, this); 166 } 167 168 169/** 170 * Returns the XML element name of this object. 171 <p> 172 * For {@link ListOfLocalParameters}, the XML element name is <code>'listOfLocalParameters'.</code> 173 <p> 174 * @return the name of this element, i.e., <code>'listOfLocalParameters'.</code> 175 */ public 176 String getElementName() { 177 return libsbmlJNI.ListOfLocalParameters_getElementName(swigCPtr, this); 178 } 179 180 181/** 182 * Returns the {@link LocalParameter} object located at position <code>n</code> within this 183 * {@link ListOfLocalParameters} instance. 184 <p> 185 * @param n the index number of the {@link LocalParameter} to get. 186 <p> 187 * @return the nth {@link LocalParameter} in this {@link ListOfLocalParameters}. If the 188 * index <code>n</code> is out of bounds for the length of the list, then <code>null</code> 189 * is returned. 190 <p> 191 * @see #size() 192 * @see #get(String sid) 193 */ public 194 LocalParameter get(long n) { 195 long cPtr = libsbmlJNI.ListOfLocalParameters_get__SWIG_0(swigCPtr, this, n); 196 return (cPtr == 0) ? null : new LocalParameter(cPtr, false); 197 } 198 199 200/** 201 * Returns the first {@link LocalParameter} object matching the given identifier. 202 <p> 203 * @param sid a string, the identifier of the {@link LocalParameter} to get. 204 <p> 205 * @return the {@link LocalParameter} object found. The caller owns the returned 206 * object and is responsible for deleting it. If none of the items have 207 * an identifier matching <code>sid</code>, then <code>null</code> is returned. 208 <p> 209 * @see #get(long n) 210 * @see #size() 211 */ public 212 LocalParameter get(String sid) { 213 long cPtr = libsbmlJNI.ListOfLocalParameters_get__SWIG_2(swigCPtr, this, sid); 214 return (cPtr == 0) ? null : new LocalParameter(cPtr, false); 215 } 216 217 218/** 219 * Returns the first child element found that has the given <code>id</code> in the 220 * model-wide SId namespace, or <code>null</code> if no such object is found. 221 <p> 222 * Note that LocalParameters, while they use the SId namespace, are not in 223 * the model-wide SId namespace, so no {@link LocalParameter} object will be 224 * returned from this function (and is the reason we override the base 225 * ListOf.getElementBySId function here). 226 <p> 227 * @param id string representing the id of objects to find 228 <p> 229 * @return pointer to the first element found with the given <code>id</code>. 230 */ public 231 SBase getElementBySId(String id) { 232 return libsbml.DowncastSBase(libsbmlJNI.ListOfLocalParameters_getElementBySId(swigCPtr, this, id), false); 233} 234 235 236/** 237 * Removes the nth item from this {@link ListOfLocalParameters}, and returns a 238 * pointer to it. 239 <p> 240 * @param n the index of the item to remove. 241 <p> 242 * @return the item removed. The caller owns the returned object and is 243 * responsible for deleting it. If the index number <code>n</code> is out of 244 * bounds for the length of the list, then <code>null</code> is returned. 245 <p> 246 * @see #size() 247 * @see #remove(String sid) 248 */ public 249 LocalParameter remove(long n) { 250 long cPtr = libsbmlJNI.ListOfLocalParameters_remove__SWIG_0(swigCPtr, this, n); 251 return (cPtr == 0) ? null : new LocalParameter(cPtr, true); 252 } 253 254 255/** 256 * Removes the first {@link LocalParameter} object in this {@link ListOfLocalParameters} 257 * matching the given identifier, and returns a pointer to it. 258 <p> 259 * @param sid the identifier of the item to remove. 260 <p> 261 * @return the item removed. The caller owns the returned object and is 262 * responsible for deleting it. If none of the items have an identifier 263 * matching <code>sid</code>, then <code>null</code> is returned. 264 */ public 265 LocalParameter remove(String sid) { 266 long cPtr = libsbmlJNI.ListOfLocalParameters_remove__SWIG_1(swigCPtr, this, sid); 267 return (cPtr == 0) ? null : new LocalParameter(cPtr, true); 268 } 269 270}