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 COBRA to SBML Level 3 “fbc” converter. 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. It is a class used in 018the implementation of extra functionality provided by libSBML. 019</p> 020 021 <p> 022 * This converter takes a model in COBRA format and converts it to the 023 * “fbc” Version 2 format. 024 <p> 025 * {@link CobraToFbcConverter} is enabled by creating a {@link ConversionProperties} object 026 * with the option <code>'convert cobra'</code> (literally that full string, 027 * including the spaces), and passing this properties object to 028 * {@link SBMLDocument#convert(ConversionProperties)}. The converter 029 * offers two options: 030 <p> 031 * <ul> 032 * <li> <code>'checkCompatibility':</code> whether to check the SBML Level/Version 033 * compatibility 034 * <li> <code>'removeUnits':</code> whether to remove unit definitions 035 * 036 * </ul> <p> 037 * <p> 038 * <h2>General information about the use of SBML converters</h2> 039 <p> 040 * The use of all the converters follows a similar approach. First, one 041 * creates a {@link ConversionProperties} object and calls 042 * {@link ConversionProperties#addOption(ConversionOption)} 043 * on this object with one argument: a text string that identifies the desired 044 * converter. (The text string is specific to each converter; consult the 045 * documentation for a given converter to find out how it should be enabled.) 046 <p> 047 * Next, for some converters, the caller can optionally set some 048 * converter-specific properties using additional calls to 049 * {@link ConversionProperties#addOption(ConversionOption)}. 050 * Many converters provide the ability to 051 * configure their behavior to some extent; this is realized through the use 052 * of properties that offer different options. The default property values 053 * for each converter can be interrogated using the method 054 * {@link SBMLConverter#getDefaultProperties()} on the converter class in question . 055 <p> 056 * Finally, the caller should invoke the method 057 * {@link SBMLDocument#convert(ConversionProperties)} 058 * with the {@link ConversionProperties} object as an argument. 059 <p> 060 * <h3>Example of invoking an SBML converter</h3> 061 <p> 062 * The following code fragment illustrates an example using 063 * {@link SBMLReactionConverter}, which is invoked using the option string 064 * <code>'replaceReactions':</code> 065 <p> 066<pre class='fragment'> 067{@link ConversionProperties} props = new {@link ConversionProperties}(); 068if (props != null) { 069 props.addOption('replaceReactions'); 070} else { 071 // Deal with error. 072} 073</pre> 074<p> 075 * In the case of {@link SBMLReactionConverter}, there are no options to affect 076 * its behavior, so the next step is simply to invoke the converter on 077 * an {@link SBMLDocument} object. Continuing the example code: 078 <p> 079<pre class='fragment'> 080 // Assume that the variable 'document' has been set to an {@link SBMLDocument} object. 081 status = document.convert(config); 082 if (status != libsbml.LIBSBML_OPERATION_SUCCESS) 083 { 084 // Handle error somehow. 085 System.out.println('Error: conversion failed due to the following:'); 086 document.printErrors(); 087 } 088</pre> 089<p> 090 * Here is an example of using a converter that offers an option. The 091 * following code invokes {@link SBMLStripPackageConverter} to remove the 092 * SBML Level 3 <em>Layout</em> package from a model. It sets the name 093 * of the package to be removed by adding a value for the option named 094 * <code>'package'</code> defined by that converter: 095 <p> 096<pre class='fragment'> 097{@link ConversionProperties} config = new {@link ConversionProperties}(); 098if (config != None) { 099 config.addOption('stripPackage'); 100 config.addOption('package', 'layout'); 101 status = document.convert(config); 102 if (status != LIBSBML_OPERATION_SUCCESS) { 103 // Handle error somehow. 104 System.out.println('Error: unable to strip the {@link Layout} package'); 105 document.printErrors(); 106 } 107} else { 108 // Handle error somehow. 109 System.out.println('Error: unable to create {@link ConversionProperties} object'); 110} 111</pre> 112<p> 113 * <h3>Available SBML converters in libSBML</h3> 114 <p> 115 * LibSBML provides a number of built-in converters; by convention, their 116 * names end in <em>Converter</em>. The following are the built-in converters 117 * provided by libSBML 5.15.2 118: 119 <p> 120 * <p> 121 * <ul> 122 * <li> ArraysFlatteningConverter 123 * <li> {@link CobraToFbcConverter} 124 * <li> {@link CompFlatteningConverter} 125 * <li> {@link FbcToCobraConverter} 126 * <li> {@link FbcV1ToV2Converter} 127 * <li> {@link FbcV2ToV1Converter} 128 * <li> {@link SBMLFunctionDefinitionConverter} 129 * <li> {@link SBMLIdConverter} 130 * <li> {@link SBMLInferUnitsConverter} 131 * <li> {@link SBMLInitialAssignmentConverter} 132 * <li> {@link SBMLLevel1Version1Converter} 133 * <li> {@link SBMLLevelVersionConverter} 134 * <li> {@link SBMLLocalParameterConverter} 135 * <li> SBMLRateOfConverter 136 * <li> {@link SBMLReactionConverter} 137 * <li> {@link SBMLRuleConverter} 138 * <li> {@link SBMLStripPackageConverter} 139 * <li> {@link SBMLUnitsConverter} 140 * 141 * </ul> 142 */ 143 144public class CobraToFbcConverter extends SBMLConverter { 145 private long swigCPtr; 146 147 protected CobraToFbcConverter(long cPtr, boolean cMemoryOwn) 148 { 149 super(libsbmlJNI.CobraToFbcConverter_SWIGUpcast(cPtr), cMemoryOwn); 150 swigCPtr = cPtr; 151 } 152 153 protected static long getCPtr(CobraToFbcConverter obj) 154 { 155 return (obj == null) ? 0 : obj.swigCPtr; 156 } 157 158 protected static long getCPtrAndDisown (CobraToFbcConverter obj) 159 { 160 long ptr = 0; 161 162 if (obj != null) 163 { 164 ptr = obj.swigCPtr; 165 obj.swigCMemOwn = false; 166 } 167 168 return ptr; 169 } 170 171 protected void finalize() { 172 delete(); 173 } 174 175 public synchronized void delete() { 176 if (swigCPtr != 0) { 177 if (swigCMemOwn) { 178 swigCMemOwn = false; 179 libsbmlJNI.delete_CobraToFbcConverter(swigCPtr); 180 } 181 swigCPtr = 0; 182 } 183 super.delete(); 184 } 185 186 187/** * @internal */ public 188 static void init() { 189 libsbmlJNI.CobraToFbcConverter_init(); 190 } 191 192 193/** 194 * Creates a new {@link CobraToFbcConverter} object. 195 */ public 196 CobraToFbcConverter() { 197 this(libsbmlJNI.new_CobraToFbcConverter__SWIG_0(), true); 198 } 199 200 201/** 202 * Copy constructor; creates a copy of an {@link CobraToFbcConverter} 203 * object. 204 <p> 205 * @param orig the {@link CobraToFbcConverter} object to copy. 206 */ public 207 CobraToFbcConverter(CobraToFbcConverter orig) { 208 this(libsbmlJNI.new_CobraToFbcConverter__SWIG_1(CobraToFbcConverter.getCPtr(orig), orig), true); 209 } 210 211 212/** 213 * Creates and returns a deep copy of this {@link CobraToFbcConverter} object. 214 <p> 215 * @return a (deep) copy of this {@link CobraToFbcConverter}. 216 */ public 217 SBMLConverter cloneObject() { 218 long cPtr = libsbmlJNI.CobraToFbcConverter_cloneObject(swigCPtr, this); 219 return (cPtr == 0) ? null : new CobraToFbcConverter(cPtr, true); 220 } 221 222 223/** 224 * Returns <code>true</code> if this converter object's properties match the given 225 * properties. 226 <p> 227 * A typical use of this method involves creating a {@link ConversionProperties} 228 * object, setting the options desired, and then calling this method on 229 * an {@link CobraToFbcConverter} object to find out if the object's 230 * property values match the given ones. This method is also used by 231 * {@link SBMLConverterRegistry#getConverterFor(ConversionProperties)} 232 * to search across all registered converters for one matching particular 233 * properties. 234 <p> 235 * @param props the properties to match. 236 <p> 237 * @return <code>true</code> if this converter's properties match, <code>false</code> 238 * otherwise. 239 */ public 240 boolean matchesProperties(ConversionProperties props) { 241 return libsbmlJNI.CobraToFbcConverter_matchesProperties(swigCPtr, this, ConversionProperties.getCPtr(props), props); 242 } 243 244 245/** 246 * Perform the conversion. 247 <p> 248 * This method causes the converter to do the actual conversion work, 249 * that is, to convert the {@link SBMLDocument} object set by 250 * {@link SBMLConverter#setDocument(SBMLDocument)} and 251 * with the configuration options set by 252 * {@link SBMLConverter#setProperties(ConversionProperties)}. 253 <p> 254 * <p> 255 * @return integer value indicating success/failure of the 256 * function. The possible values 257 * returned by this function are: 258 * <ul> 259 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 260 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 261 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 262 * </ul> 263 */ public 264 int convert() { 265 return libsbmlJNI.CobraToFbcConverter_convert(swigCPtr, this); 266 } 267 268 269/** 270 * Returns the default properties of this converter. 271 <p> 272 * A given converter exposes one or more properties that can be adjusted 273 * in order to influence the behavior of the converter. This method 274 * returns the <em>default</em> property settings for this converter. It is 275 * meant to be called in order to discover all the settings for the 276 * converter object. 277 <p> 278 * @return the {@link ConversionProperties} object describing the default properties 279 * for this converter. 280 */ public 281 ConversionProperties getDefaultProperties() { 282 return new ConversionProperties(libsbmlJNI.CobraToFbcConverter_getDefaultProperties(swigCPtr, this), true); 283 } 284 285 286/** 287 * Returns <code>true</code> if the option property to check Level and Version of the 288 * source document (<code>'checkCompatibility'</code>) is <code>true.</code> 289 <p> 290 * @return <code>true</code> if the option <code>'checkCompatibility'</code> has been set to 291 * <code>true</code>, <code>false</code> otherwise. 292 */ public 293 boolean checkCompatibility() { 294 return libsbmlJNI.CobraToFbcConverter_checkCompatibility(swigCPtr, this); 295 } 296 297}