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 * <span class="pkg-marker pkg-color-fbc"><a href="group__fbc.html">fbc</a></span> 013 A list of {@link FbcAssociation} objects. 014 <p> 015 * The {@link ListOfFbcAssociations} is a container of {@link FbcAssociation} objects 016 * for the {@link FbcAnd} and {@link FbcOr} classes. Unlike the ListOf___ classes in 017 * SBML, the {@link ListOfFbcAssociations} is not a class that appears in the 018 * “fbc” specification, and instead is used in libsbml 019 * as a convenience class to store arbitrary numbers of {@link FbcAssociation} 020 * objects. Also unlike other ListOf___ classes, the {@link FbcAnd} and {@link FbcOr} 021 * classes require at least two child {@link FbcAssociation} objects, so valid 022 * {@link ListOfFbcAssociations} libsbml objects will always contain two or more 023 * children. 024 <p> 025 * In addition, these children will have element names associated with 026 * their derived class, not the base {@link FbcAssociation} class: 027 * “fbc:and”, “fbc:or”, and “fbc:geneProductRef”. 028 <p> 029 * <p> 030 * @note This class of objects was introduced in Version 2 of the 031 * SBML Level 3 Flux Balance Constraints (“fbc”) 032 * specification. In Version 1 of “fbc”, the information 033 * encoded by this class can be stored instead using the {@link Association} and 034 * {@link GeneAssociation} annotation classes. Please see the Version 1 and 035 * Version 2 “fbc” specifications for more details. 036 <p> 037 * @see FbcAssociation 038 * @see FbcAnd 039 * @see FbcOr 040 * @see GeneProductRef 041 */ 042 043public class ListOfFbcAssociations extends ListOf { 044 private long swigCPtr; 045 046 protected ListOfFbcAssociations(long cPtr, boolean cMemoryOwn) 047 { 048 super(libsbmlJNI.ListOfFbcAssociations_SWIGUpcast(cPtr), cMemoryOwn); 049 swigCPtr = cPtr; 050 } 051 052 protected static long getCPtr(ListOfFbcAssociations obj) 053 { 054 return (obj == null) ? 0 : obj.swigCPtr; 055 } 056 057 protected static long getCPtrAndDisown (ListOfFbcAssociations obj) 058 { 059 long ptr = 0; 060 061 if (obj != null) 062 { 063 ptr = obj.swigCPtr; 064 obj.swigCMemOwn = false; 065 } 066 067 return ptr; 068 } 069 070 protected void finalize() { 071 delete(); 072 } 073 074 public synchronized void delete() { 075 if (swigCPtr != 0) { 076 if (swigCMemOwn) { 077 swigCMemOwn = false; 078 libsbmlJNI.delete_ListOfFbcAssociations(swigCPtr); 079 } 080 swigCPtr = 0; 081 } 082 super.delete(); 083 } 084 085 086/** 087 * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version, 088 * and “fbc”package version. 089 <p> 090 * @param level a long integer, the SBML Level to assign to this 091 * {@link ListOfFbcAssociations} 092 <p> 093 * @param version a long integer, the SBML Version to assign to this 094 * {@link ListOfFbcAssociations} 095 <p> 096 * @param pkgVersion a long integer, the SBML “fbc” package 097 * Version to assign to this {@link ListOfFbcAssociations} 098 */ public 099 ListOfFbcAssociations(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 100 this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_0(level, version, pkgVersion), true); 101 } 102 103 104/** 105 * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version, 106 * and “fbc”package version. 107 <p> 108 * @param level a long integer, the SBML Level to assign to this 109 * {@link ListOfFbcAssociations} 110 <p> 111 * @param version a long integer, the SBML Version to assign to this 112 * {@link ListOfFbcAssociations} 113 <p> 114 * @param pkgVersion a long integer, the SBML “fbc” package 115 * Version to assign to this {@link ListOfFbcAssociations} 116 */ public 117 ListOfFbcAssociations(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 118 this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_1(level, version), true); 119 } 120 121 122/** 123 * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version, 124 * and “fbc”package version. 125 <p> 126 * @param level a long integer, the SBML Level to assign to this 127 * {@link ListOfFbcAssociations} 128 <p> 129 * @param version a long integer, the SBML Version to assign to this 130 * {@link ListOfFbcAssociations} 131 <p> 132 * @param pkgVersion a long integer, the SBML “fbc” package 133 * Version to assign to this {@link ListOfFbcAssociations} 134 */ public 135 ListOfFbcAssociations(long level) throws org.sbml.libsbml.SBMLConstructorException { 136 this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_2(level), true); 137 } 138 139 140/** 141 * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version, 142 * and “fbc”package version. 143 <p> 144 * @param level a long integer, the SBML Level to assign to this 145 * {@link ListOfFbcAssociations} 146 <p> 147 * @param version a long integer, the SBML Version to assign to this 148 * {@link ListOfFbcAssociations} 149 <p> 150 * @param pkgVersion a long integer, the SBML “fbc” package 151 * Version to assign to this {@link ListOfFbcAssociations} 152 */ public 153 ListOfFbcAssociations() throws org.sbml.libsbml.SBMLConstructorException { 154 this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_3(), true); 155 } 156 157 158/** 159 * Creates a new {@link ListOfFbcAssociations} with the given {@link FbcPkgNamespaces} 160 * object. 161 <p> 162 * @param fbcns the {@link FbcPkgNamespaces} object 163 */ public 164 ListOfFbcAssociations(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 165 this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 166 } 167 168 169/** 170 * Creates and returns a deep copy of this {@link ListOfFbcAssociations} object. 171 <p> 172 * @return a (deep) copy of this {@link ListOfFbcAssociations} object. 173 */ public 174 ListOfFbcAssociations cloneObject() { 175 long cPtr = libsbmlJNI.ListOfFbcAssociations_cloneObject(swigCPtr, this); 176 return (cPtr == 0) ? null : new ListOfFbcAssociations(cPtr, true); 177 } 178 179 180/** 181 * Get a {@link FbcAssociation} from the {@link ListOfFbcAssociations}. 182 <p> 183 * @param n the index number of the {@link FbcAssociation} to get. 184 <p> 185 * @return the nth {@link FbcAssociation} in this {@link ListOfFbcAssociations}. 186 <p> 187 * @see #size() 188 * @see #getNumFbcAssociations() 189 */ public 190 FbcAssociation get(long n) { 191 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_get__SWIG_0(swigCPtr, this, n), false); 192} 193 194 195/** 196 * Get a {@link FbcAssociation} from the {@link ListOfFbcAssociations} based on its 197 * identifier. 198 <p> 199 * @param sid a string representing the identifier of the {@link FbcAssociation} to 200 * get. 201 <p> 202 * @return {@link FbcAssociation} in this {@link ListOfFbcAssociations} with the given id 203 * or null if no such {@link FbcAssociation} exists. 204 <p> 205 * @see #get(long n) 206 * @see #size() 207 */ public 208 FbcAssociation get(String sid) { 209 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_get__SWIG_2(swigCPtr, this, sid), false); 210} 211 212 213/** 214 * Adds a copy the given {@link FbcAssociation} object to this 215 * {@link ListOfFbcAssociations}. 216 <p> 217 * @param fa; the {@link FbcAssociation} object to add 218 <p> 219 * @return integer value indicating success/failure of the 220 * function. The possible values 221 * returned by this function are: 222 * <ul> 223 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 224 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 225 * </ul> 226 */ public 227 int addFbcAssociation(FbcAssociation fa) { 228 return libsbmlJNI.ListOfFbcAssociations_addFbcAssociation(swigCPtr, this, FbcAssociation.getCPtr(fa), fa); 229 } 230 231 232/** 233 * Get the number of {@link FbcAssociation} objects in this {@link ListOfFbcAssociations}. 234 <p> 235 * @return the number of {@link FbcAssociation} objects in this 236 * {@link ListOfFbcAssociations} 237 */ public 238 long getNumFbcAssociations() { 239 return libsbmlJNI.ListOfFbcAssociations_getNumFbcAssociations(swigCPtr, this); 240 } 241 242 243/** 244 * Creates a new {@link FbcAnd} object. 245 <p> 246 * This method creates a new {@link FbcAssociation} object of subclass {@link FbcAnd}, adds 247 * it to the {@link ListOfFbcAssociations}, and returns the {@link FbcAssociation} object 248 * created. 249 <p> 250 * @return a new {@link FbcAssociation} object instance 251 <p> 252 * @see #createOr() 253 * @see #createGeneProductRef() 254 * @see #addFbcAssociation(FbcAssociation fa) 255 */ public 256 FbcAnd createAnd() { 257 long cPtr = libsbmlJNI.ListOfFbcAssociations_createAnd(swigCPtr, this); 258 return (cPtr == 0) ? null : new FbcAnd(cPtr, false); 259 } 260 261 262/** 263 * Creates a new {@link FbcOr} object. 264 <p> 265 * This method creates a new {@link FbcAssociation} object of subclass {@link FbcOr}, adds 266 * it to the {@link ListOfFbcAssociations}, and returns the {@link FbcAssociation} object 267 * created. 268 <p> 269 * @return a new {@link FbcAssociation} object instance 270 <p> 271 * @see #createAnd() 272 * @see #createGeneProductRef() 273 * @see #addFbcAssociation(FbcAssociation fa) 274 */ public 275 FbcOr createOr() { 276 long cPtr = libsbmlJNI.ListOfFbcAssociations_createOr(swigCPtr, this); 277 return (cPtr == 0) ? null : new FbcOr(cPtr, false); 278 } 279 280 281/** 282 * Creates a new {@link GeneProductRef} object. 283 <p> 284 * This method creates a new {@link FbcAssociation} object of subclass 285 * {@link GeneProductRef}, adds it to the {@link ListOfFbcAssociations}, and returns the 286 * {@link FbcAssociation} object created. 287 <p> 288 * @return a new {@link FbcAssociation} object instance 289 <p> 290 * @see #createOr() 291 * @see #createAnd() 292 * @see #addFbcAssociation(FbcAssociation fa) 293 */ public 294 GeneProductRef createGeneProductRef() { 295 long cPtr = libsbmlJNI.ListOfFbcAssociations_createGeneProductRef(swigCPtr, this); 296 return (cPtr == 0) ? null : new GeneProductRef(cPtr, false); 297 } 298 299 300/** 301 * Removes the nth {@link FbcAssociation} 302 <p> 303 * This method removes the nth object from this {@link ListOfFbcAssociations} and 304 * returns a pointer to it. 305 <p> 306 * @param n the index of the {@link FbcAssociation} to remove. 307 <p> 308 * @see #size() 309 */ public 310 FbcAssociation remove(long n) { 311 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_remove__SWIG_0(swigCPtr, this, n), true); 312} 313 314 315/** 316 * Removes the {@link FbcAssociation} with the given identifier 317 <p> 318 * This method searches for and removes the {@link FbcAssociation} object with the 319 * given identifier <code>sid</code>, and returns a pointer to it. The caller owns 320 * the returned item and is responsible for deleting it. If none of the 321 * items in this list have the identifier <code>sid</code>, then <code>null</code> is returned. 322 <p> 323 * @param sid the identifier of the {@link FbcAssociation} to remove. 324 <p> 325 * @return the {@link FbcAssociation} removed. As mentioned above, the caller owns 326 * the returned item. 327 */ public 328 FbcAssociation remove(String sid) { 329 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_remove__SWIG_1(swigCPtr, this, sid), true); 330} 331 332 333/** 334 * Returns the XML element name of this object. 335 <p> 336 * For {@link ListOfFbcAssociations}, the XML element name is always 337 * <code>'listOfFbcAssociations'.</code> 338 <p> 339 * @return the name of this element. 340 */ public 341 String getElementName() { 342 return libsbmlJNI.ListOfFbcAssociations_getElementName(swigCPtr, this); 343 } 344 345 346/** 347 * Returns the libSBML type code for this SBML object. 348 <p> 349 * <p> 350 * LibSBML attaches an identifying code to every kind of SBML object. These 351 * are integer constants known as <em>SBML type codes</em>. The names of all 352 * the codes begin with the characters <code>SBML_</code>. 353 * In the Java language interface for libSBML, the 354 * type codes are defined as static integer constants in the interface class 355 * {@link libsbmlConstants}. Note that different Level 3 356 * package plug-ins may use overlapping type codes; to identify the package 357 * to which a given object belongs, call the <code>getPackageName()</code> 358 * method on the object. 359 <p> 360 * @return the SBML type code for this object: 361 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default). 362 <p> 363 * <p> 364 * @warning <span class='warning'>The specific integer values of the possible 365 * type codes may be reused by different Level 3 package plug-ins. 366 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 367 * both getTypeCode() and getPackageName()</strong>.</span> 368 <p> 369 * @see #getElementName() 370 * @see #getPackageName() 371 */ public 372 int getTypeCode() { 373 return libsbmlJNI.ListOfFbcAssociations_getTypeCode(swigCPtr, this); 374 } 375 376 377/** 378 * Returns the libSBML type code for the objects contained in this {@link ListOf}. 379 <p> 380 * <p> 381 * LibSBML attaches an identifying code to every kind of SBML object. These 382 * are integer constants known as <em>SBML type codes</em>. The names of all 383 * the codes begin with the characters <code>SBML_</code>. 384 * In the Java language interface for libSBML, the 385 * type codes are defined as static integer constants in the interface class 386 * {@link libsbmlConstants}. Note that different Level 3 387 * package plug-ins may use overlapping type codes; to identify the package 388 * to which a given object belongs, call the <code>getPackageName()</code> 389 * method on the object. 390 <p> 391 * @return the SBML type code for the objects contained in this {@link ListOf} 392 * instance: {@link libsbmlConstants#SBML_FBC_ASSOCIATION SBML_FBC_ASSOCIATION} (default). 393 <p> 394 * @see #getElementName() 395 * @see #getPackageName() 396 */ public 397 int getItemTypeCode() { 398 return libsbmlJNI.ListOfFbcAssociations_getItemTypeCode(swigCPtr, this); 399 } 400 401}