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 initial assignments.
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 replacing {@link InitialAssignment} objects 
022 * (when possible) by setting the initial value attributes on the model
023 * objects being assigned.  In other words, for every object that is
024 * the target of an initial assignment in the model, it evaluates the
025 * mathematical expression of the assignment to get a numerical value,
026 * and then sets the corresponding attribute of the object to the
027 * value.  The effects for different kinds of SBML components are
028 * as follows:
029 <p>
030 * <center>
031 * <table border='0' class='text-table width80 normal-font alt-row-colors'>
032 *  <tr style='background: lightgray; font-size: 14px;'>
033 *      <th align='left' width='200'>Component</th>
034 *      <th align='left'>Effect</th>
035 *  </tr>
036 *  <tr>
037 *  <td>Compartment</td>
038 *  <td>Sets the value of the <code>size</code> attribute.</td>
039 *  </tr>
040 *  <tr>
041 *  <td>Species</td>
042 *  <td>Sets the value of either the <code>initialAmount</code>
043 *  or the <code>initialConcentration</code> attributes, depending
044 *  on the value of the {@link Species} object's
045 *  <code>hasOnlySubstanceUnits</code> attribute.</td>
046 *  </tr>
047 *  <tr>
048 *  <td>Parameter</td>
049 *  <td>Sets the value of the <code>value</code> attribute.</td>
050 *  </tr>
051 *  <tr>
052 *  <td>SpeciesReference</td>
053 *  <td>Sets the value of the <code>stoichiometry</code> attribute
054 *  in the {@link Reaction} object where the {@link SpeciesReference} object appears.</td>
055 *  </tr>
056 * </table>
057 * </center>
058 <p>
059 * @see SBMLFunctionDefinitionConverter
060 * @see SBMLLevelVersionConverter
061 * @see SBMLRuleConverter
062 * @see SBMLStripPackageConverter
063 * @see SBMLUnitsConverter
064 */
065
066public class SBMLInitialAssignmentConverter extends SBMLConverter {
067   private long swigCPtr;
068
069   protected SBMLInitialAssignmentConverter(long cPtr, boolean cMemoryOwn)
070   {
071     super(libsbmlJNI.SBMLInitialAssignmentConverter_SWIGUpcast(cPtr), cMemoryOwn);
072     swigCPtr = cPtr;
073   }
074
075   protected static long getCPtr(SBMLInitialAssignmentConverter obj)
076   {
077     return (obj == null) ? 0 : obj.swigCPtr;
078   }
079
080   protected static long getCPtrAndDisown (SBMLInitialAssignmentConverter obj)
081   {
082     long ptr = 0;
083
084     if (obj != null)
085     {
086       ptr             = obj.swigCPtr;
087       obj.swigCMemOwn = false;
088     }
089
090     return ptr;
091   }
092
093  protected void finalize() {
094    delete();
095  }
096
097  public synchronized void delete() {
098    if (swigCPtr != 0) {
099      if (swigCMemOwn) {
100        swigCMemOwn = false;
101        libsbmlJNI.delete_SBMLInitialAssignmentConverter(swigCPtr);
102      }
103      swigCPtr = 0;
104    }
105    super.delete();
106  }
107
108  public static void init() {
109    libsbmlJNI.SBMLInitialAssignmentConverter_init();
110  }
111
112  
113/**
114   * Creates a new {@link SBMLInitialAssignmentConverter} object.
115   */ public
116 SBMLInitialAssignmentConverter() {
117    this(libsbmlJNI.new_SBMLInitialAssignmentConverter__SWIG_0(), true);
118  }
119
120  
121/**
122   * Copy constructor; creates a copy of an {@link SBMLInitialAssignmentConverter}
123   * object.
124   <p>
125   * @param obj the {@link SBMLInitialAssignmentConverter} object to copy.
126   */ public
127 SBMLInitialAssignmentConverter(SBMLInitialAssignmentConverter obj) {
128    this(libsbmlJNI.new_SBMLInitialAssignmentConverter__SWIG_1(SBMLInitialAssignmentConverter.getCPtr(obj), obj), true);
129  }
130
131  
132/**
133   * Creates and returns a deep copy of this {@link SBMLInitialAssignmentConverter}
134   * object.
135   <p>
136   * @return a (deep) copy of this converter.
137   */ public
138 SBMLConverter cloneObject() {
139    long cPtr = libsbmlJNI.SBMLInitialAssignmentConverter_cloneObject(swigCPtr, this);
140    return (cPtr == 0) ? null : new SBMLConverter(cPtr, true);
141  }
142
143  
144/**
145   * Returns <code>true</code> if this converter object's properties match the given
146   * properties.
147   <p>
148   * A typical use of this method involves creating a {@link ConversionProperties}
149   * object, setting the options desired, and then calling this method on
150   * an {@link SBMLInitialAssignmentConverter} object to find out if the object's
151   * property values match the given ones.  This method is also used by
152   * {@link SBMLConverterRegistry#getConverterFor(ConversionProperties props)}
153   * to search across all registered converters for one matching particular
154   * properties.
155   <p>
156   * @param props the properties to match.
157   <p>
158   * @return <code>true</code> if this converter's properties match, <code>false</code>
159   * otherwise.
160   */ public
161 boolean matchesProperties(ConversionProperties props) {
162    return libsbmlJNI.SBMLInitialAssignmentConverter_matchesProperties(swigCPtr, this, ConversionProperties.getCPtr(props), props);
163  }
164
165  
166/** 
167   * Perform the conversion.
168   <p>
169   * This method causes the converter to do the actual conversion work,
170   * that is, to convert the {@link SBMLDocument} object set by
171   * {@link SBMLConverter#setDocument(SBMLDocument doc)} and
172   * with the configuration options set by
173   * {@link SBMLConverter#setProperties(ConversionProperties props)}.
174   <p>
175   * @return  integer value indicating the success/failure of the operation.
176   *  The possible values are:
177   * <ul>
178   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
179   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED }
180   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT }
181   * </ul>
182   */ public
183 int convert() {
184    return libsbmlJNI.SBMLInitialAssignmentConverter_convert(swigCPtr, this);
185  }
186
187  
188/**
189   * Returns the default properties of this converter.
190   <p>
191   * A given converter exposes one or more properties that can be adjusted
192   * in order to influence the behavior of the converter.  This method
193   * returns the <em>default</em> property settings for this converter.  It is
194   * meant to be called in order to discover all the settings for the
195   * converter object.
196   <p>
197   * @return the {@link ConversionProperties} object describing the default properties
198   * for this converter.
199   */ public
200 ConversionProperties getDefaultProperties() {
201    return new ConversionProperties(libsbmlJNI.SBMLInitialAssignmentConverter_getDefaultProperties(swigCPtr, this), true);
202  }
203
204}