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