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