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 * <span class="pkg-marker pkg-color-fbc"><a href="group__fbc.html">fbc</a></span> 013 A list of {@link GeneProduct} objects. 014 <p> 015 * The {@link ListOfGeneProducts} is a container for the SBML extended {@link Model} 016 * that lists all the possible {@link GeneProduct} elements in the model. These 017 * {@link GeneProduct} elements are referenced in the {@link GeneProductAssociation} child 018 * of an extended {@link Reaction}. 019 <p> 020 * <p> 021 * The various ListOf___ classes in SBML 022 * are merely containers used for organizing the main components of an SBML 023 * model. In libSBML's implementation, ListOf___ 024 * classes are derived from the 025 * intermediate utility class {@link ListOf}, which 026 * is not defined by the SBML specifications but serves as a useful 027 * programmatic construct. {@link ListOf} is itself is in turn derived from {@link SBase}, 028 * which provides all of the various ListOf___ 029 * classes with common features 030 * defined by the SBML specification, such as 'metaid' attributes and 031 * annotations. 032 <p> 033 * Readers may wonder about the motivations for using the ListOf___ 034 * containers in SBML. A simpler approach in XML might be to place the 035 * components all directly at the top level of the model definition. The 036 * choice made in SBML is to group them within XML elements named after 037 * ListOf<em>Classname</em>, in part because it helps organize the 038 * components. More importantly, the fact that the container classes are 039 * derived from {@link SBase} means that software tools can add information <em>about</em> 040 * the lists themselves into each list container's 'annotation'. 041 <p> 042 * @see ListOfFunctionDefinitions 043 * @see ListOfUnitDefinitions 044 * @see ListOfCompartmentTypes 045 * @see ListOfSpeciesTypes 046 * @see ListOfCompartments 047 * @see ListOfSpecies 048 * @see ListOfParameters 049 * @see ListOfInitialAssignments 050 * @see ListOfRules 051 * @see ListOfConstraints 052 * @see ListOfReactions 053 * @see ListOfEvents 054 <p> 055 * 056 * <p> 057 * @note This class of objects was introduced in Version 2 of the 058 * SBML Level 3 Flux Balance Constraints (“fbc”) 059 * specification. In Version 1 of “fbc”, the information 060 * encoded by this class can be stored instead using the {@link Association} and 061 * {@link GeneAssociation} annotation classes. Please see the Version 1 and 062 * Version 2 “fbc” specifications for more details. 063 <p> 064 * @see GeneProduct 065 * @see FbcModelPlugin 066 */ 067 068public class ListOfGeneProducts extends ListOf { 069 private long swigCPtr; 070 071 protected ListOfGeneProducts(long cPtr, boolean cMemoryOwn) 072 { 073 super(libsbmlJNI.ListOfGeneProducts_SWIGUpcast(cPtr), cMemoryOwn); 074 swigCPtr = cPtr; 075 } 076 077 protected static long getCPtr(ListOfGeneProducts obj) 078 { 079 return (obj == null) ? 0 : obj.swigCPtr; 080 } 081 082 protected static long getCPtrAndDisown (ListOfGeneProducts obj) 083 { 084 long ptr = 0; 085 086 if (obj != null) 087 { 088 ptr = obj.swigCPtr; 089 obj.swigCMemOwn = false; 090 } 091 092 return ptr; 093 } 094 095 protected void finalize() { 096 delete(); 097 } 098 099 public synchronized void delete() { 100 if (swigCPtr != 0) { 101 if (swigCMemOwn) { 102 swigCMemOwn = false; 103 libsbmlJNI.delete_ListOfGeneProducts(swigCPtr); 104 } 105 swigCPtr = 0; 106 } 107 super.delete(); 108 } 109 110 111/** 112 * Creates a new {@link GeneProduct} with the given SBML Level, Version, and 113 * “fbc”package version. 114 <p> 115 * @param level a long integer, the SBML Level to assign to this 116 * {@link ListOfGeneProducts} 117 <p> 118 * @param version a long integer, the SBML Version to assign to this 119 * {@link ListOfGeneProducts} 120 <p> 121 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 122 * this {@link ListOfGeneProducts} 123 */ public 124 ListOfGeneProducts(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 125 this(libsbmlJNI.new_ListOfGeneProducts__SWIG_0(level, version, pkgVersion), true); 126 } 127 128 129/** 130 * Creates a new {@link GeneProduct} with the given SBML Level, Version, and 131 * “fbc”package version. 132 <p> 133 * @param level a long integer, the SBML Level to assign to this 134 * {@link ListOfGeneProducts} 135 <p> 136 * @param version a long integer, the SBML Version to assign to this 137 * {@link ListOfGeneProducts} 138 <p> 139 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 140 * this {@link ListOfGeneProducts} 141 */ public 142 ListOfGeneProducts(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 143 this(libsbmlJNI.new_ListOfGeneProducts__SWIG_1(level, version), true); 144 } 145 146 147/** 148 * Creates a new {@link GeneProduct} with the given SBML Level, Version, and 149 * “fbc”package version. 150 <p> 151 * @param level a long integer, the SBML Level to assign to this 152 * {@link ListOfGeneProducts} 153 <p> 154 * @param version a long integer, the SBML Version to assign to this 155 * {@link ListOfGeneProducts} 156 <p> 157 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 158 * this {@link ListOfGeneProducts} 159 */ public 160 ListOfGeneProducts(long level) throws org.sbml.libsbml.SBMLConstructorException { 161 this(libsbmlJNI.new_ListOfGeneProducts__SWIG_2(level), true); 162 } 163 164 165/** 166 * Creates a new {@link GeneProduct} with the given SBML Level, Version, and 167 * “fbc”package version. 168 <p> 169 * @param level a long integer, the SBML Level to assign to this 170 * {@link ListOfGeneProducts} 171 <p> 172 * @param version a long integer, the SBML Version to assign to this 173 * {@link ListOfGeneProducts} 174 <p> 175 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 176 * this {@link ListOfGeneProducts} 177 */ public 178 ListOfGeneProducts() throws org.sbml.libsbml.SBMLConstructorException { 179 this(libsbmlJNI.new_ListOfGeneProducts__SWIG_3(), true); 180 } 181 182 183/** 184 * Creates a new {@link ListOfGeneProducts} with the given {@link FbcPkgNamespaces} object. 185 <p> 186 * @param fbcns the {@link FbcPkgNamespaces} object 187 */ public 188 ListOfGeneProducts(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 189 this(libsbmlJNI.new_ListOfGeneProducts__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 190 } 191 192 193/** 194 * Creates and returns a deep copy of this {@link ListOfGeneProducts} object. 195 <p> 196 * @return a (deep) copy of this {@link ListOfGeneProducts} object. 197 */ public 198 ListOfGeneProducts cloneObject() { 199 long cPtr = libsbmlJNI.ListOfGeneProducts_cloneObject(swigCPtr, this); 200 return (cPtr == 0) ? null : new ListOfGeneProducts(cPtr, true); 201 } 202 203 204/** 205 * Get a {@link GeneProduct} from the {@link ListOfGeneProducts}. 206 <p> 207 * @param n the index number of the {@link GeneProduct} to get. 208 <p> 209 * @return the nth {@link GeneProduct} in this {@link ListOfGeneProducts}. 210 <p> 211 * @see #size() 212 */ public 213 GeneProduct get(long n) { 214 long cPtr = libsbmlJNI.ListOfGeneProducts_get__SWIG_0(swigCPtr, this, n); 215 return (cPtr == 0) ? null : new GeneProduct(cPtr, false); 216 } 217 218 219/** 220 * Get a {@link GeneProduct} from the {@link ListOfGeneProducts} based on its identifier. 221 <p> 222 * @param sid a string representing the identifier of the {@link GeneProduct} to 223 * get. 224 <p> 225 * @return {@link GeneProduct} in this {@link ListOfGeneProducts} with the given id or null 226 * if no such {@link GeneProduct} exists. 227 <p> 228 * @see #get(long n) 229 * @see #size() 230 */ public 231 GeneProduct get(String sid) { 232 long cPtr = libsbmlJNI.ListOfGeneProducts_get__SWIG_2(swigCPtr, this, sid); 233 return (cPtr == 0) ? null : new GeneProduct(cPtr, false); 234 } 235 236 237/** 238 * Adds a copy the given 'GeneProduct' to this {@link ListOfGeneProducts}. 239 <p> 240 * @param gp; the {@link GeneProduct} object to add 241 <p> 242 * @return integer value indicating success/failure of the 243 * function. The possible values 244 * returned by this function are: 245 * <ul> 246 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 247 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 248 * </ul> 249 */ public 250 int addGeneProduct(GeneProduct gp) { 251 return libsbmlJNI.ListOfGeneProducts_addGeneProduct(swigCPtr, this, GeneProduct.getCPtr(gp), gp); 252 } 253 254 255/** 256 * Get the number of {@link GeneProduct} objects in this {@link ListOfGeneProducts}. 257 <p> 258 * @return the number of {@link GeneProduct} objects in this {@link ListOfGeneProducts} 259 */ public 260 long getNumGeneProducts() { 261 return libsbmlJNI.ListOfGeneProducts_getNumGeneProducts(swigCPtr, this); 262 } 263 264 265/** 266 * Creates a new {@link GeneProduct} object, adds it to the {@link ListOfGeneProducts} and 267 * returns the {@link GeneProduct} object created. 268 <p> 269 * @return a new {@link GeneProduct} object instance 270 <p> 271 * @see #addGeneProduct(GeneProduct gp) 272 */ public 273 GeneProduct createGeneProduct() { 274 long cPtr = libsbmlJNI.ListOfGeneProducts_createGeneProduct(swigCPtr, this); 275 return (cPtr == 0) ? null : new GeneProduct(cPtr, false); 276 } 277 278 279/** 280 * Removes the nth {@link GeneProduct} from this {@link ListOfGeneProducts} 281 * and returns a pointer to it. 282 <p> 283 * The caller owns the returned item and is responsible for deleting it. 284 <p> 285 * @param n the index of the {@link GeneProduct} to remove. 286 <p> 287 * @see #size() 288 */ public 289 GeneProduct remove(long n) { 290 long cPtr = libsbmlJNI.ListOfGeneProducts_remove__SWIG_0(swigCPtr, this, n); 291 return (cPtr == 0) ? null : new GeneProduct(cPtr, true); 292 } 293 294 295/** 296 * Removes the {@link GeneProduct} from this {@link ListOfGeneProducts} with the given 297 * identifier and returns a pointer to it. 298 <p> 299 * The caller owns the returned item and is responsible for deleting it. 300 * If none of the items in this list have the identifier <code>sid</code>, then 301 * <code>null</code> is returned. 302 <p> 303 * @param sid the identifier of the {@link GeneProduct} to remove. 304 <p> 305 * @return the {@link GeneProduct} removed. As mentioned above, the caller owns the 306 * returned item. 307 */ public 308 GeneProduct remove(String sid) { 309 long cPtr = libsbmlJNI.ListOfGeneProducts_remove__SWIG_1(swigCPtr, this, sid); 310 return (cPtr == 0) ? null : new GeneProduct(cPtr, true); 311 } 312 313 314/** 315 * Returns the XML element name of this object. 316 <p> 317 * For {@link ListOfGeneProducts}, the XML element name is always 318 * <code>'listOfGeneProducts'.</code> 319 <p> 320 * @return the name of this element, i.e. <code>'listOfGeneProducts'.</code> 321 */ public 322 String getElementName() { 323 return libsbmlJNI.ListOfGeneProducts_getElementName(swigCPtr, this); 324 } 325 326 327/** 328 * Returns the libSBML type code for this SBML object. 329 <p> 330 * <p> 331 * LibSBML attaches an identifying code to every kind of SBML object. These 332 * are integer constants known as <em>SBML type codes</em>. The names of all 333 * the codes begin with the characters <code>SBML_</code>. 334 * In the Java language interface for libSBML, the 335 * type codes are defined as static integer constants in the interface class 336 * {@link libsbmlConstants}. Note that different Level 3 337 * package plug-ins may use overlapping type codes; to identify the package 338 * to which a given object belongs, call the <code>getPackageName()</code> 339 * method on the object. 340 <p> 341 * @return the SBML type code for this object: 342 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default). 343 <p> 344 * <p> 345 * @warning <span class='warning'>The specific integer values of the possible 346 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 347 * packages, To fully identify the correct code, <strong>it is necessary to 348 * invoke both getTypeCode() and getPackageName()</strong>.</span> 349 <p> 350 * @see #getElementName() 351 * @see #getPackageName() 352 */ public 353 int getTypeCode() { 354 return libsbmlJNI.ListOfGeneProducts_getTypeCode(swigCPtr, this); 355 } 356 357 358/** 359 * Returns the libSBML type code for the objects contained in this {@link ListOf}. 360 <p> 361 * <p> 362 * LibSBML attaches an identifying code to every kind of SBML object. These 363 * are integer constants known as <em>SBML type codes</em>. The names of all 364 * the codes begin with the characters <code>SBML_</code>. 365 * In the Java language interface for libSBML, the 366 * type codes are defined as static integer constants in the interface class 367 * {@link libsbmlConstants}. Note that different Level 3 368 * package plug-ins may use overlapping type codes; to identify the package 369 * to which a given object belongs, call the <code>getPackageName()</code> 370 * method on the object. 371 <p> 372 * @return the SBML type code for the objects contained in this {@link ListOf} 373 * instance: {@link libsbmlConstants#SBML_FBC_GENEPRODUCT SBML_FBC_GENEPRODUCT} (default). 374 <p> 375 * @see #getElementName() 376 * @see #getPackageName() 377 */ public 378 int getItemTypeCode() { 379 return libsbmlJNI.ListOfGeneProducts_getItemTypeCode(swigCPtr, this); 380 } 381 382}