001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.12 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 * SBML converter for replacing function definitions. 013 <p> 014 * <p style='color: #777; font-style: italic'> 015This class of objects is defined by libSBML only and has no direct 016equivalent in terms of SBML components. It is a class used in 017the implementation of extra functionality provided by libSBML. 018</p> 019 020 <p> 021 * This is an SBML converter for manipulating user-defined functions in an 022 * SBML file. When invoked on the current model, it performs the following 023 * operation: 024 * <ol> 025 * <li>Read the list of user-defined functions in the model (i.e., the 026 * list of {@link FunctionDefinition} objects); 027 * <li>Look for invocations of the function in mathematical expressions 028 * throughout the model; and 029 * <li>For each invocation found, replaces the invocation with a 030 * in-line copy of the function's body, similar to how macro expansions 031 * might be performed in scripting and programming languages. 032 * </ol> 033 <p> 034 * For example, suppose the model contains a function definition 035 * representing the function <i>f(x, y) = x * y</i>. Further 036 * suppose this functions invoked somewhere else in the model, in 037 * a mathematical formula, as <i>f(s, p)</i>. The outcome of running 038 * {@link SBMLFunctionDefinitionConverter} on the model will be to replace 039 * the call to <i>f</i> with the expression <i>s * p</i>. 040 <p> 041 * @see SBMLInitialAssignmentConverter 042 * @see SBMLLevelVersionConverter 043 * @see SBMLRuleConverter 044 * @see SBMLStripPackageConverter 045 * @see SBMLUnitsConverter 046 */ 047 048public class SBMLFunctionDefinitionConverter extends SBMLConverter { 049 private long swigCPtr; 050 051 protected SBMLFunctionDefinitionConverter(long cPtr, boolean cMemoryOwn) 052 { 053 super(libsbmlJNI.SBMLFunctionDefinitionConverter_SWIGUpcast(cPtr), cMemoryOwn); 054 swigCPtr = cPtr; 055 } 056 057 protected static long getCPtr(SBMLFunctionDefinitionConverter obj) 058 { 059 return (obj == null) ? 0 : obj.swigCPtr; 060 } 061 062 protected static long getCPtrAndDisown (SBMLFunctionDefinitionConverter obj) 063 { 064 long ptr = 0; 065 066 if (obj != null) 067 { 068 ptr = obj.swigCPtr; 069 obj.swigCMemOwn = false; 070 } 071 072 return ptr; 073 } 074 075 protected void finalize() { 076 delete(); 077 } 078 079 public synchronized void delete() { 080 if (swigCPtr != 0) { 081 if (swigCMemOwn) { 082 swigCMemOwn = false; 083 libsbmlJNI.delete_SBMLFunctionDefinitionConverter(swigCPtr); 084 } 085 swigCPtr = 0; 086 } 087 super.delete(); 088 } 089 090 public static void init() { 091 libsbmlJNI.SBMLFunctionDefinitionConverter_init(); 092 } 093 094 095/** 096 * Creates a new {@link SBMLFunctionDefinitionConverter} object. 097 */ public 098 SBMLFunctionDefinitionConverter() { 099 this(libsbmlJNI.new_SBMLFunctionDefinitionConverter__SWIG_0(), true); 100 } 101 102 103/** 104 * Copy constructor; creates a copy of an {@link SBMLFunctionDefinitionConverter} 105 * object. 106 <p> 107 * @param obj the {@link SBMLFunctionDefinitionConverter} object to copy. 108 */ public 109 SBMLFunctionDefinitionConverter(SBMLFunctionDefinitionConverter obj) { 110 this(libsbmlJNI.new_SBMLFunctionDefinitionConverter__SWIG_1(SBMLFunctionDefinitionConverter.getCPtr(obj), obj), true); 111 } 112 113 114/** 115 * Creates and returns a deep copy of this {@link SBMLFunctionDefinitionConverter} 116 * object. 117 <p> 118 * @return a (deep) copy of this converter. 119 */ public 120 SBMLConverter cloneObject() { 121 long cPtr = libsbmlJNI.SBMLFunctionDefinitionConverter_cloneObject(swigCPtr, this); 122 return (cPtr == 0) ? null : new SBMLConverter(cPtr, true); 123 } 124 125 126/** 127 * Returns <code>true</code> if this converter object's properties match the given 128 * properties. 129 <p> 130 * A typical use of this method involves creating a {@link ConversionProperties} 131 * object, setting the options desired, and then calling this method on 132 * an {@link SBMLFunctionDefinitionConverter} object to find out if the object's 133 * property values match the given ones. This method is also used by 134 * {@link SBMLConverterRegistry#getConverterFor(ConversionProperties props)} 135 * to search across all registered converters for one matching particular 136 * properties. 137 <p> 138 * @param props the properties to match. 139 <p> 140 * @return <code>true</code> if this converter's properties match, <code>false</code> 141 * otherwise. 142 */ public 143 boolean matchesProperties(ConversionProperties props) { 144 return libsbmlJNI.SBMLFunctionDefinitionConverter_matchesProperties(swigCPtr, this, ConversionProperties.getCPtr(props), props); 145 } 146 147 148/** 149 * Replaces invocations of each user-defined function with an in-line 150 * copy, similar to macro expansion. 151 <p> 152 * @return integer value indicating the success/failure of the operation. 153 * The possible values are: 154 * <ul> 155 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 156 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 157 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT } 158 * <li> {@link libsbmlConstants#LIBSBML_CONV_INVALID_SRC_DOCUMENT LIBSBML_CONV_INVALID_SRC_DOCUMENT } 159 * </ul> 160 */ public 161 int convert() { 162 return libsbmlJNI.SBMLFunctionDefinitionConverter_convert(swigCPtr, this); 163 } 164 165 166/** 167 * Returns the default properties of this converter. 168 <p> 169 * A given converter exposes one or more properties that can be adjusted 170 * in order to influence the behavior of the converter. This method 171 * returns the <em>default</em> property settings for this converter. It is 172 * meant to be called in order to discover all the settings for the 173 * converter object. 174 <p> 175 * @return the {@link ConversionProperties} object describing the default properties 176 * for this converter. 177 */ public 178 ConversionProperties getDefaultProperties() { 179 return new ConversionProperties(libsbmlJNI.SBMLFunctionDefinitionConverter_getDefaultProperties(swigCPtr, this), true); 180 } 181 182}