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