001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.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 * <span class="pkg-marker pkg-color-fbc"><a href="group__fbc.html">fbc</a></span> 013 Base class for {@link FbcAnd}, {@link FbcOr}, and {@link GeneProductRef} 014 <p> 015 * The {@link FbcAssociation} class is the abstract base class for the classes that 016 * can be used as children of the {@link GeneProductAssociation} child of a {@link Reaction}. 017 * The {@link FbcAnd} class is used when all of its children are definitely associated 018 * with the {@link Reaction}; the {@link FbcOr} class is used when at least one of its children 019 * are associated with the {@link Reaction}; and the {@link GeneProductRef} class is used to 020 * denote a particular {@link GeneProduct}. 021 <p> 022 * <p> 023 * @note This class of objects was introduced in Version 2 of the 024 * SBML Level 3 Flux Balance Constraints (“fbc”) 025 * specification. In Version 1 of “fbc”, the information 026 * encoded by this class can be stored instead using the {@link Association} and 027 * {@link GeneAssociation} annotation classes. Please see the Version 1 and 028 * Version 2 “fbc” specifications for more details. 029 <p> 030 * @see ListOfFbcAssociations 031 * @see FbcAnd 032 * @see FbcOr 033 * @see GeneProductRef 034 */ 035 036public class FbcAssociation extends SBase { 037 private long swigCPtr; 038 039 protected FbcAssociation(long cPtr, boolean cMemoryOwn) 040 { 041 super(libsbmlJNI.FbcAssociation_SWIGUpcast(cPtr), cMemoryOwn); 042 swigCPtr = cPtr; 043 } 044 045 protected static long getCPtr(FbcAssociation obj) 046 { 047 return (obj == null) ? 0 : obj.swigCPtr; 048 } 049 050 protected static long getCPtrAndDisown (FbcAssociation obj) 051 { 052 long ptr = 0; 053 054 if (obj != null) 055 { 056 ptr = obj.swigCPtr; 057 obj.swigCMemOwn = false; 058 } 059 060 return ptr; 061 } 062 063 protected void finalize() { 064 delete(); 065 } 066 067 public synchronized void delete() { 068 if (swigCPtr != 0) { 069 if (swigCMemOwn) { 070 swigCMemOwn = false; 071 libsbmlJNI.delete_FbcAssociation(swigCPtr); 072 } 073 swigCPtr = 0; 074 } 075 super.delete(); 076 } 077 078 079/** 080 * Creates a new {@link FbcAssociation} with the given SBML Level, Version, and 081 * “fbc”package version. 082 <p> 083 * @param level a long integer, the SBML Level to assign to this 084 * {@link FbcAssociation}. 085 <p> 086 * @param version a long integer, the SBML Version to assign to this 087 * {@link FbcAssociation}. 088 <p> 089 * @param pkgVersion a long integer, the SBML “fbc” package 090 * Version to assign to this {@link FbcAssociation}. 091 <p> 092 * <p> 093 * @note Attempting to add an object to an {@link SBMLDocument} having a different 094 * combination of SBML Level, Version and XML namespaces than the object 095 * itself will result in an error at the time a caller attempts to make the 096 * addition. A parent object must have compatible Level, Version and XML 097 * namespaces. (Strictly speaking, a parent may also have more XML 098 * namespaces than a child, but the reverse is not permitted.) The 099 * restriction is necessary to ensure that an SBML model has a consistent 100 * overall structure. This requires callers to manage their objects 101 * carefully, but the benefit is increased flexibility in how models can be 102 * created by permitting callers to create objects bottom-up if desired. In 103 * situations where objects are not yet attached to parents (e.g., 104 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 105 * libSBML determine such things as whether it is valid to assign a 106 * particular value to an attribute. For packages, this means that the 107 * parent object to which this package element is being added must have 108 * been created with the package namespace, or that the package namespace 109 * was added to it, even if that parent is not a package object itself. 110 */ public 111 FbcAssociation(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 112 this(libsbmlJNI.new_FbcAssociation__SWIG_0(level, version, pkgVersion), true); 113 } 114 115 116/** 117 * Creates a new {@link FbcAssociation} with the given SBML Level, Version, and 118 * “fbc”package version. 119 <p> 120 * @param level a long integer, the SBML Level to assign to this 121 * {@link FbcAssociation}. 122 <p> 123 * @param version a long integer, the SBML Version to assign to this 124 * {@link FbcAssociation}. 125 <p> 126 * @param pkgVersion a long integer, the SBML “fbc” package 127 * Version to assign to this {@link FbcAssociation}. 128 <p> 129 * <p> 130 * @note Attempting to add an object to an {@link SBMLDocument} having a different 131 * combination of SBML Level, Version and XML namespaces than the object 132 * itself will result in an error at the time a caller attempts to make the 133 * addition. A parent object must have compatible Level, Version and XML 134 * namespaces. (Strictly speaking, a parent may also have more XML 135 * namespaces than a child, but the reverse is not permitted.) The 136 * restriction is necessary to ensure that an SBML model has a consistent 137 * overall structure. This requires callers to manage their objects 138 * carefully, but the benefit is increased flexibility in how models can be 139 * created by permitting callers to create objects bottom-up if desired. In 140 * situations where objects are not yet attached to parents (e.g., 141 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 142 * libSBML determine such things as whether it is valid to assign a 143 * particular value to an attribute. For packages, this means that the 144 * parent object to which this package element is being added must have 145 * been created with the package namespace, or that the package namespace 146 * was added to it, even if that parent is not a package object itself. 147 */ public 148 FbcAssociation(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 149 this(libsbmlJNI.new_FbcAssociation__SWIG_1(level, version), true); 150 } 151 152 153/** 154 * Creates a new {@link FbcAssociation} with the given SBML Level, Version, and 155 * “fbc”package version. 156 <p> 157 * @param level a long integer, the SBML Level to assign to this 158 * {@link FbcAssociation}. 159 <p> 160 * @param version a long integer, the SBML Version to assign to this 161 * {@link FbcAssociation}. 162 <p> 163 * @param pkgVersion a long integer, the SBML “fbc” package 164 * Version to assign to this {@link FbcAssociation}. 165 <p> 166 * <p> 167 * @note Attempting to add an object to an {@link SBMLDocument} having a different 168 * combination of SBML Level, Version and XML namespaces than the object 169 * itself will result in an error at the time a caller attempts to make the 170 * addition. A parent object must have compatible Level, Version and XML 171 * namespaces. (Strictly speaking, a parent may also have more XML 172 * namespaces than a child, but the reverse is not permitted.) The 173 * restriction is necessary to ensure that an SBML model has a consistent 174 * overall structure. This requires callers to manage their objects 175 * carefully, but the benefit is increased flexibility in how models can be 176 * created by permitting callers to create objects bottom-up if desired. In 177 * situations where objects are not yet attached to parents (e.g., 178 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 179 * libSBML determine such things as whether it is valid to assign a 180 * particular value to an attribute. For packages, this means that the 181 * parent object to which this package element is being added must have 182 * been created with the package namespace, or that the package namespace 183 * was added to it, even if that parent is not a package object itself. 184 */ public 185 FbcAssociation(long level) throws org.sbml.libsbml.SBMLConstructorException { 186 this(libsbmlJNI.new_FbcAssociation__SWIG_2(level), true); 187 } 188 189 190/** 191 * Creates a new {@link FbcAssociation} with the given SBML Level, Version, and 192 * “fbc”package version. 193 <p> 194 * @param level a long integer, the SBML Level to assign to this 195 * {@link FbcAssociation}. 196 <p> 197 * @param version a long integer, the SBML Version to assign to this 198 * {@link FbcAssociation}. 199 <p> 200 * @param pkgVersion a long integer, the SBML “fbc” package 201 * Version to assign to this {@link FbcAssociation}. 202 <p> 203 * <p> 204 * @note Attempting to add an object to an {@link SBMLDocument} having a different 205 * combination of SBML Level, Version and XML namespaces than the object 206 * itself will result in an error at the time a caller attempts to make the 207 * addition. A parent object must have compatible Level, Version and XML 208 * namespaces. (Strictly speaking, a parent may also have more XML 209 * namespaces than a child, but the reverse is not permitted.) The 210 * restriction is necessary to ensure that an SBML model has a consistent 211 * overall structure. This requires callers to manage their objects 212 * carefully, but the benefit is increased flexibility in how models can be 213 * created by permitting callers to create objects bottom-up if desired. In 214 * situations where objects are not yet attached to parents (e.g., 215 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 216 * libSBML determine such things as whether it is valid to assign a 217 * particular value to an attribute. For packages, this means that the 218 * parent object to which this package element is being added must have 219 * been created with the package namespace, or that the package namespace 220 * was added to it, even if that parent is not a package object itself. 221 */ public 222 FbcAssociation() throws org.sbml.libsbml.SBMLConstructorException { 223 this(libsbmlJNI.new_FbcAssociation__SWIG_3(), true); 224 } 225 226 227/** 228 * Creates a new {@link FbcAssociation} with the given {@link FbcPkgNamespaces} object. 229 <p> 230 * <p> 231 * The package namespaces object used in this constructor is derived from a 232 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 233 * information. It is used to communicate the SBML Level, Version, and 234 * package version and name information used in addition to SBML Level 3 Core. A 235 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 236 * package namespace object somewhere in a program once, then hand that object 237 * as needed to object constructors of that package that accept it as and 238 * argument, such as this one. 239 <p> 240 * @param fbcns the {@link FbcPkgNamespaces} object. 241 <p> 242 * <p> 243 * @note Attempting to add an object to an {@link SBMLDocument} having a different 244 * combination of SBML Level, Version and XML namespaces than the object 245 * itself will result in an error at the time a caller attempts to make the 246 * addition. A parent object must have compatible Level, Version and XML 247 * namespaces. (Strictly speaking, a parent may also have more XML 248 * namespaces than a child, but the reverse is not permitted.) The 249 * restriction is necessary to ensure that an SBML model has a consistent 250 * overall structure. This requires callers to manage their objects 251 * carefully, but the benefit is increased flexibility in how models can be 252 * created by permitting callers to create objects bottom-up if desired. In 253 * situations where objects are not yet attached to parents (e.g., 254 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 255 * libSBML determine such things as whether it is valid to assign a 256 * particular value to an attribute. For packages, this means that the 257 * parent object to which this package element is being added must have 258 * been created with the package namespace, or that the package namespace 259 * was added to it, even if that parent is not a package object itself. 260 */ public 261 FbcAssociation(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 262 this(libsbmlJNI.new_FbcAssociation__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 263 } 264 265 266/** 267 * Copy constructor for {@link FbcAssociation}. 268 <p> 269 * @param orig the {@link FbcAssociation} instance to copy. 270 */ public 271 FbcAssociation(FbcAssociation orig) throws org.sbml.libsbml.SBMLConstructorException { 272 this(libsbmlJNI.new_FbcAssociation__SWIG_5(FbcAssociation.getCPtr(orig), orig), true); 273 } 274 275 276/** 277 * Creates and returns a deep copy of this {@link FbcAssociation} object. 278 <p> 279 * @return a (deep) copy of this {@link FbcAssociation} object. 280 */ public 281 FbcAssociation cloneObject() { 282 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_cloneObject(swigCPtr, this), true); 283} 284 285 286/** 287 * Returns <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcAnd}. 288 <p> 289 * @return <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcAnd}. 290 */ public 291 boolean isFbcAnd() { 292 return libsbmlJNI.FbcAssociation_isFbcAnd(swigCPtr, this); 293 } 294 295 296/** 297 * Returns <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcOr}. 298 <p> 299 * @return <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcOr}. 300 */ public 301 boolean isFbcOr() { 302 return libsbmlJNI.FbcAssociation_isFbcOr(swigCPtr, this); 303 } 304 305 306/** 307 * Returns <code>true</code>, if this abstract {@link FbcAssociation} is of type 308 * {@link GeneProductRef}. 309 <p> 310 * @return <code>true</code>, if this abstract {@link FbcAssociation} is of type 311 * {@link GeneProductRef}. 312 */ public 313 boolean isGeneProductRef() { 314 return libsbmlJNI.FbcAssociation_isGeneProductRef(swigCPtr, this); 315 } 316 317 318/** 319 * Returns the XML element name of this object. 320 <p> 321 * For {@link FbcAssociation}, the XML element name is always <code>'fbcAssociation'.</code> 322 <p> 323 * @return the name of this element, i.e. <code>'fbcAssociation'.</code> 324 */ public 325 String getElementName() { 326 return libsbmlJNI.FbcAssociation_getElementName(swigCPtr, this); 327 } 328 329 330/** 331 * Returns the libSBML type code for this SBML object. 332 <p> 333 * <p> 334 * LibSBML attaches an identifying code to every kind of SBML object. These 335 * are integer constants known as <em>SBML type codes</em>. The names of all 336 * the codes begin with the characters <code>SBML_</code>. 337 * In the Java language interface for libSBML, the 338 * type codes are defined as static integer constants in the interface class 339 * {@link libsbmlConstants}. Note that different Level 3 340 * package plug-ins may use overlapping type codes; to identify the package 341 * to which a given object belongs, call the 342 * <code>{@link SBase#getPackageName()} 343 * </code> 344 * method on the object. 345 <p> 346 * @return the SBML type code for this object: 347 * {@link libsbmlConstants#SBML_FBC_ASSOCIATION SBML_FBC_ASSOCIATION} (default). 348 <p> 349 * <p> 350 * @warning <span class='warning'>The specific integer values of the possible 351 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 352 * packages, To fully identify the correct code, <strong>it is necessary to 353 * invoke both getTypeCode() and getPackageName()</strong>.</span> 354 <p> 355 * @see #getElementName() 356 * @see #getPackageName() 357 */ public 358 int getTypeCode() { 359 return libsbmlJNI.FbcAssociation_getTypeCode(swigCPtr, this); 360 } 361 362 363/** 364 * Predicate returning <code>true</code> if all the required attributes 365 * for this {@link FbcAssociation} object have been set. 366 <p> 367 * @note {@link FbcAssociation} has no required attributes, so this 368 * method always returns <code>true.</code> 369 <p> 370 * @return a boolean value indicating whether all the required 371 * attributes for this object have been defined. 372 */ public 373 boolean hasRequiredAttributes() { 374 return libsbmlJNI.FbcAssociation_hasRequiredAttributes(swigCPtr, this); 375 } 376 377 378/** 379 * Parses a gene association in infix format and returns a corresponding 380 * {@link Association} object. 381 <p> 382 * This parses a string that has a list of gene names and conjunctions 383 * or disjunctions. For example: 384 * <pre class='fragment'> 385 (b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917) 386</pre> 387 <p> 388 * The 'and' operator takes precedence over the 'or' operator, meaning that 389 * the above input string would turn into two groups of gene names: either 390 * 'b2422, b2425, b2423, and b2424' or 'b2422, b2423, b2424, b2413, and b3917'. 391 * Parentheses may be added to make things more clear, and to encode 392 * alternative schemes. 393 <p> 394 * This method also creates missing {@link GeneProduct} objects, in case the unique 395 * reference does not yet exist. 396 <p> 397 * @param association the string to parse. 398 * @param plugin the {@link FbcModelPlugin} on which to add the geneProduct elements. 399 * @param usingId boolean indicating whether the infix assumes identifiers (<code>true</code>) 400 * or labels (<code>false</code> default). 401 * @param addMissingGP boolean indicating whether to add missing geneProducts 402 * (<code>true</code> default) or not (<code>false</code>). 403 <p> 404 * @return the parsed association, or <code>null</code> in case of an error. 405 <p> 406 * 407 */ public 408 static FbcAssociation parseFbcInfixAssociation(String association, FbcModelPlugin plugin, boolean usingId, boolean addMissingGP) { 409 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_parseFbcInfixAssociation__SWIG_0(association, FbcModelPlugin.getCPtr(plugin), plugin, usingId, addMissingGP), false); 410} 411 412 413/** 414 * Parses a gene association in infix format and returns a corresponding 415 * {@link Association} object. 416 <p> 417 * This parses a string that has a list of gene names and conjunctions 418 * or disjunctions. For example: 419 * <pre class='fragment'> 420 (b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917) 421</pre> 422 <p> 423 * The 'and' operator takes precedence over the 'or' operator, meaning that 424 * the above input string would turn into two groups of gene names: either 425 * 'b2422, b2425, b2423, and b2424' or 'b2422, b2423, b2424, b2413, and b3917'. 426 * Parentheses may be added to make things more clear, and to encode 427 * alternative schemes. 428 <p> 429 * This method also creates missing {@link GeneProduct} objects, in case the unique 430 * reference does not yet exist. 431 <p> 432 * @param association the string to parse. 433 * @param plugin the {@link FbcModelPlugin} on which to add the geneProduct elements. 434 * @param usingId boolean indicating whether the infix assumes identifiers (<code>true</code>) 435 * or labels (<code>false</code> default). 436 * @param addMissingGP boolean indicating whether to add missing geneProducts 437 * (<code>true</code> default) or not (<code>false</code>). 438 <p> 439 * @return the parsed association, or <code>null</code> in case of an error. 440 <p> 441 * 442 */ public 443 static FbcAssociation parseFbcInfixAssociation(String association, FbcModelPlugin plugin, boolean usingId) { 444 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_parseFbcInfixAssociation__SWIG_1(association, FbcModelPlugin.getCPtr(plugin), plugin, usingId), false); 445} 446 447 448/** 449 * Parses a gene association in infix format and returns a corresponding 450 * {@link Association} object. 451 <p> 452 * This parses a string that has a list of gene names and conjunctions 453 * or disjunctions. For example: 454 * <pre class='fragment'> 455 (b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917) 456</pre> 457 <p> 458 * The 'and' operator takes precedence over the 'or' operator, meaning that 459 * the above input string would turn into two groups of gene names: either 460 * 'b2422, b2425, b2423, and b2424' or 'b2422, b2423, b2424, b2413, and b3917'. 461 * Parentheses may be added to make things more clear, and to encode 462 * alternative schemes. 463 <p> 464 * This method also creates missing {@link GeneProduct} objects, in case the unique 465 * reference does not yet exist. 466 <p> 467 * @param association the string to parse. 468 * @param plugin the {@link FbcModelPlugin} on which to add the geneProduct elements. 469 * @param usingId boolean indicating whether the infix assumes identifiers (<code>true</code>) 470 * or labels (<code>false</code> default). 471 * @param addMissingGP boolean indicating whether to add missing geneProducts 472 * (<code>true</code> default) or not (<code>false</code>). 473 <p> 474 * @return the parsed association, or <code>null</code> in case of an error. 475 <p> 476 * 477 */ public 478 static FbcAssociation parseFbcInfixAssociation(String association, FbcModelPlugin plugin) { 479 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_parseFbcInfixAssociation__SWIG_2(association, FbcModelPlugin.getCPtr(plugin), plugin), false); 480} 481 482 483/** 484 * Converts this {@link FbcAssociation} object into an infix string representation. 485 <p> 486 * @return the association as infix string. 487 */ public 488 String toInfix(boolean usingId) { 489 return libsbmlJNI.FbcAssociation_toInfix__SWIG_0(swigCPtr, this, usingId); 490 } 491 492 493/** 494 * Converts this {@link FbcAssociation} object into an infix string representation. 495 <p> 496 * @return the association as infix string. 497 */ public 498 String toInfix() { 499 return libsbmlJNI.FbcAssociation_toInfix__SWIG_1(swigCPtr, this); 500 } 501 502 503/** * @internal */ public 504 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 505 libsbmlJNI.FbcAssociation_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 506 } 507 508}