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