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