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