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 An “and” relationship for gene products 014 <p> 015 * {@link FbcAnd} class is used in Version 2 of the SBML Level 3 <a href='../../../extensions-summary.html#fbc'>Flux Balance Constraints</a> 016 * (“fbc”) package to represent an 'and' relationship between two 017 * or more child {@link FbcAssociation} objects. In other words, it indicates that 018 * all of the child objects are included. Note that since the {@link FbcAssociation} 019 * class is the parent class of {@link GeneProductRef}, {@link FbcAnd} and {@link FbcOr}, a given 020 * {@link FbcAnd} can potentially include nested 'and'/'or' combinations of gene 021 * products. 022 <p> 023 * <p> 024 * @note This class of objects was introduced in Version 2 of the 025 * SBML Level 3 Flux Balance Constraints (“fbc”) 026 * specification. In Version 1 of “fbc”, the information 027 * encoded by this class can be stored instead using the {@link Association} and 028 * {@link GeneAssociation} annotation classes. Please see the Version 1 and 029 * Version 2 “fbc” specifications for more details. 030 <p> 031 * @see FbcAssociation 032 * @see FbcOr 033 * @see GeneProductRef 034 */ 035 036public class FbcAnd extends FbcAssociation { 037 private long swigCPtr; 038 039 protected FbcAnd(long cPtr, boolean cMemoryOwn) 040 { 041 super(libsbmlJNI.FbcAnd_SWIGUpcast(cPtr), cMemoryOwn); 042 swigCPtr = cPtr; 043 } 044 045 protected static long getCPtr(FbcAnd obj) 046 { 047 return (obj == null) ? 0 : obj.swigCPtr; 048 } 049 050 protected static long getCPtrAndDisown (FbcAnd 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_FbcAnd(swigCPtr); 072 } 073 swigCPtr = 0; 074 } 075 super.delete(); 076 } 077 078 079/** 080 * Creates a new {@link FbcAnd} 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 {@link FbcAnd} 084 <p> 085 * @param version a long integer, the SBML Version to assign to this 086 * {@link FbcAnd} 087 <p> 088 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 089 * this {@link FbcAnd} 090 */ public 091 FbcAnd(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 092 this(libsbmlJNI.new_FbcAnd__SWIG_0(level, version, pkgVersion), true); 093 } 094 095 096/** 097 * Creates a new {@link FbcAnd} with the given SBML Level, Version, and 098 * “fbc”package version. 099 <p> 100 * @param level a long integer, the SBML Level to assign to this {@link FbcAnd} 101 <p> 102 * @param version a long integer, the SBML Version to assign to this 103 * {@link FbcAnd} 104 <p> 105 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 106 * this {@link FbcAnd} 107 */ public 108 FbcAnd(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 109 this(libsbmlJNI.new_FbcAnd__SWIG_1(level, version), true); 110 } 111 112 113/** 114 * Creates a new {@link FbcAnd} with the given SBML Level, Version, and 115 * “fbc”package version. 116 <p> 117 * @param level a long integer, the SBML Level to assign to this {@link FbcAnd} 118 <p> 119 * @param version a long integer, the SBML Version to assign to this 120 * {@link FbcAnd} 121 <p> 122 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 123 * this {@link FbcAnd} 124 */ public 125 FbcAnd(long level) throws org.sbml.libsbml.SBMLConstructorException { 126 this(libsbmlJNI.new_FbcAnd__SWIG_2(level), true); 127 } 128 129 130/** 131 * Creates a new {@link FbcAnd} with the given SBML Level, Version, and 132 * “fbc”package version. 133 <p> 134 * @param level a long integer, the SBML Level to assign to this {@link FbcAnd} 135 <p> 136 * @param version a long integer, the SBML Version to assign to this 137 * {@link FbcAnd} 138 <p> 139 * @param pkgVersion a long integer, the SBML Fbc Version to assign to 140 * this {@link FbcAnd} 141 */ public 142 FbcAnd() throws org.sbml.libsbml.SBMLConstructorException { 143 this(libsbmlJNI.new_FbcAnd__SWIG_3(), true); 144 } 145 146 147/** 148 * Creates a new {@link FbcAnd} with the given {@link FbcPkgNamespaces} object. 149 <p> 150 * @param fbcns the {@link FbcPkgNamespaces} object 151 */ public 152 FbcAnd(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 153 this(libsbmlJNI.new_FbcAnd__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 154 } 155 156 157/** 158 * Copy constructor for {@link FbcAnd}. 159 <p> 160 * @param orig; the {@link FbcAnd} instance to copy. 161 */ public 162 FbcAnd(FbcAnd orig) throws org.sbml.libsbml.SBMLConstructorException { 163 this(libsbmlJNI.new_FbcAnd__SWIG_5(FbcAnd.getCPtr(orig), orig), true); 164 } 165 166 167/** 168 * Creates and returns a deep copy of this {@link FbcAnd} object. 169 <p> 170 * @return a (deep) copy of this {@link FbcAnd} object. 171 */ public 172 FbcAnd cloneObject() { 173 long cPtr = libsbmlJNI.FbcAnd_cloneObject(swigCPtr, this); 174 return (cPtr == 0) ? null : new FbcAnd(cPtr, true); 175 } 176 177 178/** 179 * Returns the 'ListOfFbcAssociations' in this {@link FbcAnd} object. 180 <p> 181 * @return the 'ListOfFbcAssociations' attribute of this {@link FbcAnd}. 182 */ public 183 ListOfFbcAssociations getListOfAssociations() { 184 long cPtr = libsbmlJNI.FbcAnd_getListOfAssociations__SWIG_0(swigCPtr, this); 185 return (cPtr == 0) ? null : new ListOfFbcAssociations(cPtr, false); 186 } 187 188 189/** 190 * Get the nth object from the {@link ListOfFbcAssociations}. 191 <p> 192 * @param n the index number of the {@link Association} to get. 193 <p> 194 * @return the nth {@link Association} in the {@link ListOfFbcAssociations} within this 195 * {@link FbcAnd}. 196 <p> 197 * @see #getNumAssociations() 198 */ public 199 FbcAssociation getAssociation(long n) { 200 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_getAssociation__SWIG_0(swigCPtr, this, n), false); 201} 202 203 204/** 205 * Get a {@link Association} from the {@link ListOfFbcAssociations} 206 * based on its identifier. 207 <p> 208 * @param sid a string representing the identifier 209 * of the {@link Association} to get. 210 <p> 211 * @return the {@link Association} in the {@link ListOfFbcAssociations} 212 * with the given id or null if no such 213 * {@link Association} exists. 214 <p> 215 * 216 * @see #getNumAssociations() 217 <p> 218 * @see #getAssociation(long n) 219 */ public 220 FbcAssociation getAssociation(String sid) { 221 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_getAssociation__SWIG_2(swigCPtr, this, sid), false); 222} 223 224 225/** 226 * Adds a copy the given 'FbcAssociation' to this {@link FbcAnd}. 227 <p> 228 * @param fa; the {@link FbcAssociation} object to add 229 <p> 230 * @return integer value indicating success/failure of the 231 * function. The possible values 232 * returned by this function are: 233 * <ul> 234 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 235 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 236 * </ul> 237 */ public 238 int addAssociation(FbcAssociation fa) { 239 return libsbmlJNI.FbcAnd_addAssociation(swigCPtr, this, FbcAssociation.getCPtr(fa), fa); 240 } 241 242 243/** 244 * Get the number of {@link FbcAssociation} objects in this {@link FbcAnd}. 245 <p> 246 * @return the number of {@link FbcAssociation} objects in this {@link FbcAnd} 247 */ public 248 long getNumAssociations() { 249 return libsbmlJNI.FbcAnd_getNumAssociations(swigCPtr, this); 250 } 251 252 253/** 254 * Converts this {@link FbcAssociation} object into an infix string representation. 255 <p> 256 * @return the association as infix string. 257 */ public 258 String toInfix() { 259 return libsbmlJNI.FbcAnd_toInfix(swigCPtr, this); 260 } 261 262 263/** 264 * Creates a new {@link FbcAnd} object, adds it to this FbcAnds 265 * {@link ListOfFbcAssociations} and returns the {@link FbcAnd} object created. 266 <p> 267 * @return a new {@link FbcAnd} object instance 268 <p> 269 * @see #addAssociation(FbcAssociation fa) 270 */ public 271 FbcAnd createAnd() { 272 long cPtr = libsbmlJNI.FbcAnd_createAnd(swigCPtr, this); 273 return (cPtr == 0) ? null : new FbcAnd(cPtr, false); 274 } 275 276 277/** 278 * Creates a new {@link FbcOr} object, adds it to this FbcAnds 279 * {@link ListOfFbcAssociations} and returns the {@link FbcOr} object created. 280 <p> 281 * @return a new {@link FbcOr} object instance 282 <p> 283 * @see #addAssociation(FbcAssociation fa) 284 */ public 285 FbcOr createOr() { 286 long cPtr = libsbmlJNI.FbcAnd_createOr(swigCPtr, this); 287 return (cPtr == 0) ? null : new FbcOr(cPtr, false); 288 } 289 290 291/** 292 * Creates a new {@link GeneProductRef} object, adds it to this FbcAnds 293 * {@link ListOfFbcAssociations} and returns the {@link GeneProductRef} object created. 294 <p> 295 * @return a new {@link GeneProductRef} object instance 296 <p> 297 * @see #addAssociation(FbcAssociation fa) 298 */ public 299 GeneProductRef createGeneProductRef() { 300 long cPtr = libsbmlJNI.FbcAnd_createGeneProductRef(swigCPtr, this); 301 return (cPtr == 0) ? null : new GeneProductRef(cPtr, false); 302 } 303 304 305/** 306 * Removes the nth {@link Association} from the {@link ListOfFbcAssociations} within this {@link FbcAnd}. 307 * and returns a pointer to it. 308 <p> 309 * The caller owns the returned item and is responsible for deleting it. 310 <p> 311 * @param n the index of the {@link Association} to remove. 312 <p> 313 * @see #getNumAssociations() 314 */ public 315 FbcAssociation removeAssociation(long n) { 316 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_removeAssociation__SWIG_0(swigCPtr, this, n), true); 317} 318 319 320/** 321 * Removes the {@link Association} with the given identifier from the {@link ListOfFbcAssociations} within this {@link FbcAnd} 322 * and returns a pointer to it. 323 <p> 324 * The caller owns the returned item and is responsible for deleting it. 325 * If none of the items in this list have the identifier <code>sid</code>, then 326 * <code>null</code> is returned. 327 <p> 328 * @param sid the identifier of the {@link Association} to remove. 329 <p> 330 * @return the {@link Association} removed. As mentioned above, the caller owns the 331 * returned item. 332 */ public 333 FbcAssociation removeAssociation(String sid) { 334 return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_removeAssociation__SWIG_1(swigCPtr, this, sid), true); 335} 336 337 338/** 339 * Returns the XML element name of this object. 340 <p> 341 * For {@link FbcAnd}, the XML element name is always <code>'fbcAnd'.</code> 342 <p> 343 * @return the name of this element, i.e. <code>'fbcAnd'.</code> 344 */ public 345 String getElementName() { 346 return libsbmlJNI.FbcAnd_getElementName(swigCPtr, this); 347 } 348 349 350/** 351 * Returns the libSBML type code for this SBML object. 352 <p> 353 * <p> 354 * LibSBML attaches an identifying code to every kind of SBML object. These 355 * are integer constants known as <em>SBML type codes</em>. The names of all 356 * the codes begin with the characters <code>SBML_</code>. 357 * In the Java language interface for libSBML, the 358 * type codes are defined as static integer constants in the interface class 359 * {@link libsbmlConstants}. Note that different Level 3 360 * package plug-ins may use overlapping type codes; to identify the package 361 * to which a given object belongs, call the <code>getPackageName()</code> 362 * method on the object. 363 <p> 364 * @return the SBML type code for this object: 365 * {@link libsbmlConstants#SBML_FBC_AND SBML_FBC_AND} (default). 366 <p> 367 * <p> 368 * @warning <span class='warning'>The specific integer values of the possible 369 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 370 * packages, To fully identify the correct code, <strong>it is necessary to 371 * invoke both getTypeCode() and getPackageName()</strong>.</span> 372 <p> 373 * @see #getElementName() 374 * @see #getPackageName() 375 */ public 376 int getTypeCode() { 377 return libsbmlJNI.FbcAnd_getTypeCode(swigCPtr, this); 378 } 379 380 381/** 382 * Predicate returning <code>true</code> if all the required attributes 383 * for this {@link FbcAnd} object have been set. 384 <p> 385 * @note The required attributes for a {@link FbcAnd} object are: 386 <p> 387 * @return a boolean value indicating whether all the required 388 * attributes for this object have been defined. 389 */ public 390 boolean hasRequiredAttributes() { 391 return libsbmlJNI.FbcAnd_hasRequiredAttributes(swigCPtr, this); 392 } 393 394 395/** 396 * Predicate returning <code>true</code> if all the required elements 397 * for this {@link FbcAnd} object have been set. 398 <p> 399 * @note The required elements for a {@link FbcAnd} object are: 400 * <ul> 401 * <li> two or more {@link FbcAssociation} children. 402 * 403 * </ul> <p> 404 * @return a boolean value indicating whether all the required 405 * elements for this object have been defined. 406 */ public 407 boolean hasRequiredElements() { 408 return libsbmlJNI.FbcAnd_hasRequiredElements(swigCPtr, this); 409 } 410 411 412/** * @internal */ public 413 void connectToChild() { 414 libsbmlJNI.FbcAnd_connectToChild(swigCPtr, this); 415 } 416 417 418/** * @internal */ public 419 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 420 libsbmlJNI.FbcAnd_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 421 } 422 423}