001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.7 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 Annotation helper class for “fbc” Version 1. 014 <p> 015 * <p style='color: #777; font-style: italic'> 016This class of objects is defined by libSBML only and has no direct 017equivalent in terms of SBML components. This class is not prescribed by 018the SBML specifications, although it is used to implement features 019defined in SBML. 020</p> 021 022 <p> 023 * The {@link Association} class is a helper class for creating annotations to store 024 * gene association information in Version 1 of the SBML Level 3 025 * Flux Balance Constraints (“fbc”) package. In 026 * “fbc” Version 2, the equivalent capability is handled 027 * by the {@link FbcAssociation} class and this class (Association) is not used. 028 */ 029 030public class Association extends SBase { 031 private long swigCPtr; 032 033 protected Association(long cPtr, boolean cMemoryOwn) 034 { 035 super(libsbmlJNI.Association_SWIGUpcast(cPtr), cMemoryOwn); 036 swigCPtr = cPtr; 037 } 038 039 protected static long getCPtr(Association obj) 040 { 041 return (obj == null) ? 0 : obj.swigCPtr; 042 } 043 044 protected static long getCPtrAndDisown (Association obj) 045 { 046 long ptr = 0; 047 048 if (obj != null) 049 { 050 ptr = obj.swigCPtr; 051 obj.swigCMemOwn = false; 052 } 053 054 return ptr; 055 } 056 057 protected void finalize() { 058 delete(); 059 } 060 061 public synchronized void delete() { 062 if (swigCPtr != 0) { 063 if (swigCMemOwn) { 064 swigCMemOwn = false; 065 libsbmlJNI.delete_Association(swigCPtr); 066 } 067 swigCPtr = 0; 068 } 069 super.delete(); 070 } 071 072 073/** 074 * Creates a new {@link Association} objet with the given SBML Level, Version, and 075 * “fbc” package version. 076 */ public 077 Association(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 078 this(libsbmlJNI.new_Association__SWIG_0(level, version, pkgVersion), true); 079 } 080 081 082/** 083 * Creates a new {@link Association} objet with the given SBML Level, Version, and 084 * “fbc” package version. 085 */ public 086 Association(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 087 this(libsbmlJNI.new_Association__SWIG_1(level, version), true); 088 } 089 090 091/** 092 * Creates a new {@link Association} objet with the given SBML Level, Version, and 093 * “fbc” package version. 094 */ public 095 Association(long level) throws org.sbml.libsbml.SBMLConstructorException { 096 this(libsbmlJNI.new_Association__SWIG_2(level), true); 097 } 098 099 100/** 101 * Creates a new {@link Association} objet with the given SBML Level, Version, and 102 * “fbc” package version. 103 */ public 104 Association() throws org.sbml.libsbml.SBMLConstructorException { 105 this(libsbmlJNI.new_Association__SWIG_3(), true); 106 } 107 108 109/** */ public 110 Association(XMLNode node, FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 111 this(libsbmlJNI.new_Association__SWIG_4(XMLNode.getCPtr(node), node, FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 112 } 113 114 115/** 116 * Creates a new {@link Association} with the given {@link FbcPkgNamespaces} object. 117 */ public 118 Association(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 119 this(libsbmlJNI.new_Association__SWIG_5(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 120 } 121 122 123/** 124 * Copy constructor. 125 */ public 126 Association(Association source) throws org.sbml.libsbml.SBMLConstructorException { 127 this(libsbmlJNI.new_Association__SWIG_6(Association.getCPtr(source), source), true); 128 } 129 130 131/** 132 * Returns the string of the 'type' attribute of this {@link Association} object. 133 <p> 134 * @return the string of the 'type' attribute of this {@link Association} object. 135 */ public 136 int getType() { 137 return libsbmlJNI.Association_getType(swigCPtr, this); 138 } 139 140 141/** 142 * Predicate returning <code>true</code> if this {@link Association}'s 'type' attribute is 143 * set. 144 <p> 145 * @return <code>true</code> if this {@link Association} object's 'type' attribute has been set, 146 * otherwise <code>false</code> is returned. 147 */ public 148 boolean isSetType() { 149 return libsbmlJNI.Association_isSetType(swigCPtr, this); 150 } 151 152 153/** 154 * Sets the SIdRef string of the 'type' attribute of this {@link Association} object. 155 <p> 156 * @param type a SIdRef string to be set. 157 <p> 158 * <p> 159 * @return integer value indicating success/failure of the 160 * function. The possible values 161 * returned by this function are: 162 * <ul> 163 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 164 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 165 * </ul> 166 */ public 167 int setType(int type) { 168 return libsbmlJNI.Association_setType(swigCPtr, this, type); 169 } 170 171 172/** 173 * Unsets the value of the 'id' attribute of this {@link Association} object. 174 <p> 175 * <p> 176 * @return integer value indicating success/failure of the 177 * function. The possible values 178 * returned by this function are: 179 * <ul> 180 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 181 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 182 * </ul> 183 */ public 184 int unsetType() { 185 return libsbmlJNI.Association_unsetType(swigCPtr, this); 186 } 187 188 189/** 190 * Returns the string of the 'reference' attribute of this {@link Association} object. 191 <p> 192 * @return the string of the 'reference' attribute of this {@link Association} object. 193 */ public 194 String getReference() { 195 return libsbmlJNI.Association_getReference(swigCPtr, this); 196 } 197 198 199/** 200 * Predicate returning <code>true</code> if this {@link Association}'s 'reference' attribute 201 * has been set. 202 <p> 203 * @return <code>true</code> if this {@link Association} object's 'reference' attribute has been set, 204 * otherwise <code>false</code> is returned. 205 */ public 206 boolean isSetReference() { 207 return libsbmlJNI.Association_isSetReference(swigCPtr, this); 208 } 209 210 211/** 212 * Sets the SIdRef string of the 'reference' attribute of this {@link Association} object. 213 <p> 214 * @param reference a SIdRef string to be set. 215 <p> 216 * <p> 217 * @return integer value indicating success/failure of the 218 * function. The possible values 219 * returned by this function are: 220 * <ul> 221 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 222 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 223 * </ul> 224 */ public 225 int setReference(String reference) { 226 return libsbmlJNI.Association_setReference(swigCPtr, this, reference); 227 } 228 229 230/** 231 * Unsets the value of the 'id' attribute of this {@link Association} object. 232 <p> 233 * <p> 234 * @return integer value indicating success/failure of the 235 * function. The possible values 236 * returned by this function are: 237 * <ul> 238 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 239 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 240 * </ul> 241 */ public 242 int unsetReference() { 243 return libsbmlJNI.Association_unsetReference(swigCPtr, this); 244 } 245 246 247/** 248 * Adds a gene with the given <code>id</code> to the association. 249 <p> 250 * @param id the gene name. 251 <p> 252 * <p> 253 * @return integer value indicating success/failure of the 254 * function. The possible values 255 * returned by this function are: 256 * <ul> 257 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 258 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 259 * </ul> 260 */ public 261 int addGene(String id) { 262 return libsbmlJNI.Association_addGene(swigCPtr, this, id); 263 } 264 265 266/** 267 * Returns the number of child Associations of this {@link Association} object. 268 <p> 269 * @return the number of associations. 270 */ public 271 long getNumAssociations() { 272 return libsbmlJNI.Association_getNumAssociations(swigCPtr, this); 273 } 274 275 276/** 277 * Adds a child {@link Association} to this {@link Association} object. 278 <p> 279 * @param association the {@link Association} object to add. 280 <p> 281 * <p> 282 * @return integer value indicating success/failure of the 283 * function. The possible values 284 * returned by this function are: 285 * <ul> 286 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 287 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 288 * </ul> 289 */ public 290 int addAssociation(Association association) { 291 return libsbmlJNI.Association_addAssociation(swigCPtr, this, Association.getCPtr(association), association); 292 } 293 294 295/** 296 * Removes the child Associations with the given <code>index</code> from this 297 * {@link Association} object. 298 <p> 299 * @param index the index number of the item to remove 300 <p> 301 * <p> 302 * @return integer value indicating success/failure of the 303 * function. The possible values 304 * returned by this function are: 305 * <ul> 306 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 307 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 308 * </ul> 309 */ public 310 int removeAssociation(int index) { 311 return libsbmlJNI.Association_removeAssociation(swigCPtr, this, index); 312 } 313 314 315/** 316 * Removes all children of this {@link Association} object. 317 <p> 318 * <p> 319 * @return integer value indicating success/failure of the 320 * function. The possible values 321 * returned by this function are: 322 * <ul> 323 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 324 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 325 * </ul> 326 */ public 327 int clearAssociations() { 328 return libsbmlJNI.Association_clearAssociations(swigCPtr, this); 329 } 330 331 332/** 333 * Creates a new {@link Association} of type 'and'. 334 <p> 335 * This method does not actually add the created {@link Association} as a child of 336 * this {@link Association} object or do anything else with it—the returning 337 * pointer is now owned by the caller. 338 <p> 339 * @return a new 'and' type association. 340 */ public 341 Association createAnd() { 342 long cPtr = libsbmlJNI.Association_createAnd(swigCPtr, this); 343 return (cPtr == 0) ? null : new Association(cPtr, false); 344 } 345 346 347/** 348 * Creates a new {@link Association} of type 'or'. 349 <p> 350 * This method does not actually add the created {@link Association} as a child of 351 * this {@link Association} object or do anything else with it—the returning 352 * pointer is now owned by the caller. 353 <p> 354 * @return a new 'or' type association. 355 */ public 356 Association createOr() { 357 long cPtr = libsbmlJNI.Association_createOr(swigCPtr, this); 358 return (cPtr == 0) ? null : new Association(cPtr, false); 359 } 360 361 362/** 363 * Creates a new {@link Association} of type 'and' with a given gene reference. 364 <p> 365 * This method does not actually add the created {@link Association} as a child of 366 * this {@link Association} object or do anything else with it—the returning 367 * pointer is now owned by the caller. 368 <p> 369 * @param reference the gene reference, as a string 370 <p> 371 * @return a new {@link Association} object. 372 */ public 373 Association createGene(String reference) { 374 long cPtr = libsbmlJNI.Association_createGene__SWIG_0(swigCPtr, this, reference); 375 return (cPtr == 0) ? null : new Association(cPtr, false); 376 } 377 378 379/** 380 * Creates a new {@link Association} of type 'and' with a given gene reference. 381 <p> 382 * This method does not actually add the created {@link Association} as a child of 383 * this {@link Association} object or do anything else with it—the returning 384 * pointer is now owned by the caller. 385 <p> 386 * @param reference the gene reference, as a string 387 <p> 388 * @return a new {@link Association} object. 389 */ public 390 Association createGene() { 391 long cPtr = libsbmlJNI.Association_createGene__SWIG_1(swigCPtr, this); 392 return (cPtr == 0) ? null : new Association(cPtr, false); 393 } 394 395 396/** 397 * Creates an {@link XMLNode} object from this {@link Association} object. 398 */ public 399 XMLNode toXML() { 400 return new XMLNode(libsbmlJNI.Association_toXML(swigCPtr, this), true); 401 } 402 403 404/** 405 * Returns the XML element name of this SBML object. 406 <p> 407 * @return the name of this element, as a text string. 408 */ public 409 String getElementName() { 410 return libsbmlJNI.Association_getElementName(swigCPtr, this); 411 } 412 413 414/** 415 * Creates and returns a deep copy of this {@link Association} object. 416 <p> 417 * @return a (deep) copy of this {@link Association} object. 418 */ public 419 Association cloneObject() { 420 long cPtr = libsbmlJNI.Association_cloneObject(swigCPtr, this); 421 return (cPtr == 0) ? null : new Association(cPtr, true); 422 } 423 424 425/** 426 * Returns the libSBML type code of this object instance. 427 <p> 428 * <p> 429 * LibSBML attaches an identifying code to every kind of SBML object. These 430 * are integer constants known as <em>SBML type codes</em>. The names of all 431 * the codes begin with the characters <code>SBML_</code>. 432 * In the Java language interface for libSBML, the 433 * type codes are defined as static integer constants in the interface class 434 * {@link libsbmlConstants}. Note that different Level 3 435 * package plug-ins may use overlapping type codes; to identify the package 436 * to which a given object belongs, call the <code>getPackageName()</code> 437 * method on the object. 438 <p> 439 * @return the SBML type code for this object: 440 * {@link libsbmlConstants#SBML_FBC_ASSOCIATION SBML_FBC_ASSOCIATION} 441 <p> 442 * <p> 443 * @warning <span class='warning'>The specific integer values of the possible 444 * type codes may be reused by different Level 3 package plug-ins. 445 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 446 * both getTypeCode() and getPackageName()</strong>.</span> 447 <p> 448 * @see #getElementName() 449 * @see #getPackageName() 450 */ public 451 int getTypeCode() { 452 return libsbmlJNI.Association_getTypeCode(swigCPtr, this); 453 } 454 455 456/** 457 * Parses a gene association in infix format and returns a corresponding 458 * {@link Association} object. 459 <p> 460 * This parses a string that has a list of gene names and conjunctions 461 * or disjunctions. For example: 462 * <pre class='fragment'> 463(b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917) 464</pre> 465 <p> 466 * @param association the string to parse. 467 <p> 468 * @return the parsed association, or <code>null</code> in case of an error. 469 <p> 470 * 471 */ public 472 static Association parseInfixAssociation(String association) { 473 long cPtr = libsbmlJNI.Association_parseInfixAssociation(association); 474 return (cPtr == 0) ? null : new Association(cPtr, false); 475 } 476 477 478/** 479 * Converts this {@link Association} object into an infix string representation. 480 <p> 481 * @return the association as infix string. 482 */ public 483 String toInfix() { 484 return libsbmlJNI.Association_toInfix(swigCPtr, this); 485 } 486 487}