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 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)? 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 arguments: 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.12.0 117: 118 <p> 119 * <p> 120 * <ul> 121 * <li> {@link CobraToFbcConverter} 122 * <li> {@link CompFlatteningConverter} 123 * <li> {@link FbcToCobraConverter} 124 * <li> {@link FbcV1ToV2Converter} 125 * <li> {@link FbcV2ToV1Converter} 126 * <li> {@link SBMLFunctionDefinitionConverter} 127 * <li> {@link SBMLIdConverter} 128 * <li> {@link SBMLInferUnitsConverter} 129 * <li> {@link SBMLInitialAssignmentConverter} 130 * <li> {@link SBMLLevel1Version1Converter} 131 * <li> {@link SBMLLevelVersionConverter} 132 * <li> {@link SBMLLocalParameterConverter} 133 * <li> {@link SBMLReactionConverter} 134 * <li> {@link SBMLRuleConverter} 135 * <li> {@link SBMLStripPackageConverter} 136 * <li> {@link SBMLUnitsConverter} 137 * 138 * </ul> 139 */ 140 141public class FbcV1ToV2Converter extends SBMLConverter { 142 private long swigCPtr; 143 144 protected FbcV1ToV2Converter(long cPtr, boolean cMemoryOwn) 145 { 146 super(libsbmlJNI.FbcV1ToV2Converter_SWIGUpcast(cPtr), cMemoryOwn); 147 swigCPtr = cPtr; 148 } 149 150 protected static long getCPtr(FbcV1ToV2Converter obj) 151 { 152 return (obj == null) ? 0 : obj.swigCPtr; 153 } 154 155 protected static long getCPtrAndDisown (FbcV1ToV2Converter obj) 156 { 157 long ptr = 0; 158 159 if (obj != null) 160 { 161 ptr = obj.swigCPtr; 162 obj.swigCMemOwn = false; 163 } 164 165 return ptr; 166 } 167 168 protected void finalize() { 169 delete(); 170 } 171 172 public synchronized void delete() { 173 if (swigCPtr != 0) { 174 if (swigCMemOwn) { 175 swigCMemOwn = false; 176 libsbmlJNI.delete_FbcV1ToV2Converter(swigCPtr); 177 } 178 swigCPtr = 0; 179 } 180 super.delete(); 181 } 182 183 184/** * @internal */ public 185 static void init() { 186 libsbmlJNI.FbcV1ToV2Converter_init(); 187 } 188 189 190/** 191 * Creates a new {@link FbcV1ToV2Converter} object. 192 */ public 193 FbcV1ToV2Converter() { 194 this(libsbmlJNI.new_FbcV1ToV2Converter__SWIG_0(), true); 195 } 196 197 198/** 199 * Copy constructor; creates a copy of an {@link FbcV1ToV2Converter} 200 * object. 201 <p> 202 * @param orig the {@link FbcV1ToV2Converter} object to copy. 203 */ public 204 FbcV1ToV2Converter(FbcV1ToV2Converter orig) { 205 this(libsbmlJNI.new_FbcV1ToV2Converter__SWIG_1(FbcV1ToV2Converter.getCPtr(orig), orig), true); 206 } 207 208 209/** 210 * Creates and returns a deep copy of this {@link FbcV1ToV2Converter}. 211 <p> 212 * @return a (deep) copy of this {@link FbcV1ToV2Converter}. 213 */ public 214 SBMLConverter cloneObject() { 215 long cPtr = libsbmlJNI.FbcV1ToV2Converter_cloneObject(swigCPtr, this); 216 return (cPtr == 0) ? null : new FbcV1ToV2Converter(cPtr, true); 217 } 218 219 220/** 221 * Returns <code>true</code> if this converter object's properties match the given 222 * properties. 223 <p> 224 * A typical use of this method involves creating a {@link ConversionProperties} 225 * object, setting the options desired, and then calling this method on 226 * an {@link FbcV1ToV2Converter} object to find out if the object's 227 * property values match the given ones. This method is also used by 228 * {@link SBMLConverterRegistry#getConverterFor(ConversionProperties)} 229 * to search across all registered converters for one matching particular 230 * properties. 231 <p> 232 * @param props the properties to match. 233 <p> 234 * @return <code>true</code> if this converter's properties match, <code>false</code> 235 * otherwise. 236 */ public 237 boolean matchesProperties(ConversionProperties props) { 238 return libsbmlJNI.FbcV1ToV2Converter_matchesProperties(swigCPtr, this, ConversionProperties.getCPtr(props), props); 239 } 240 241 242/** 243 * Perform the conversion. 244 <p> 245 * This method causes the converter to do the actual conversion work, 246 * that is, to convert the {@link SBMLDocument} object set by 247 * {@link SBMLConverter#setDocument(SBMLDocument)} and 248 * with the configuration options set by 249 * {@link SBMLConverter#setProperties(ConversionProperties)}. 250 <p> 251 * <p> 252 * @return integer value indicating success/failure of the 253 * function. The possible values 254 * returned by this function are: 255 * <ul> 256 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 257 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 258 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 259 * </ul> 260 */ public 261 int convert() { 262 return libsbmlJNI.FbcV1ToV2Converter_convert(swigCPtr, this); 263 } 264 265 266/** 267 * @return a boolean, indicating whether the converter should create 268 * a 'strict' model, i.e.: a model with all default bounds specified. 269 */ public 270 boolean getStrict() { 271 return libsbmlJNI.FbcV1ToV2Converter_getStrict(swigCPtr, this); 272 } 273 274 275/** 276 * Returns the default properties of this converter. 277 <p> 278 * A given converter exposes one or more properties that can be adjusted 279 * in order to influence the behavior of the converter. This method 280 * returns the <em>default</em> property settings for this converter. It is 281 * meant to be called in order to discover all the settings for the 282 * converter object. 283 <p> 284 * @return the {@link ConversionProperties} object describing the default properties 285 * for this converter. 286 */ public 287 ConversionProperties getDefaultProperties() { 288 return new ConversionProperties(libsbmlJNI.FbcV1ToV2Converter_getDefaultProperties(swigCPtr, this), true); 289 } 290 291}