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 to convert a model's units to SI units.
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 SBML converter converts the units in a model to base SI units,
023 * namely metre, kilogram, second, Ampere, Kelvin, mole and candela.
024 * <p>
025 * {@link Unit} conversion will only be performed on models that are fully unit
026 * consistent; that is, all objects have associated units, and there are no
027 * literal numbers with no units specified.  In the case of an SBML
028 * Level&nbsp;3 model involving math expressions, this means that the 
029 * <code>timeUnits</code> attribute on the {@link Model} object must be set, and if there are
030 * any reactions in the model, the <code>extentUnits</code> attribute on the {@link Model}
031 * object must also be set.
032 * <p>
033 * This converter has the additional Boolean property 'removeUnusedUnits'
034 * that can be used to tell the converter whether to remove any
035 * {@link UnitDefinition} objects that are not referred to, after conversion is
036 * complete.  You can set this value by adding the property using
037 * <div class='fragment'><pre>
038prop.addOption('removeUnusedUnits', false);
039</pre></div>
040 * The converter's default behavior is to remove the unused
041 * {@link UnitDefinition} objects in the model.
042 * <p>
043 * @see SBMLFunctionDefinitionConverter
044 * @see SBMLLevelVersionConverter
045 * @see SBMLRuleConverter
046 * @see SBMLStripPackageConverter
047 * @see SBMLUnitsConverter
048 */
049
050public class SBMLUnitsConverter extends SBMLConverter {
051   private long swigCPtr;
052
053   protected SBMLUnitsConverter(long cPtr, boolean cMemoryOwn)
054   {
055     super(libsbmlJNI.SBMLUnitsConverter_SWIGUpcast(cPtr), cMemoryOwn);
056     swigCPtr = cPtr;
057   }
058
059   protected static long getCPtr(SBMLUnitsConverter obj)
060   {
061     return (obj == null) ? 0 : obj.swigCPtr;
062   }
063
064   protected static long getCPtrAndDisown (SBMLUnitsConverter obj)
065   {
066     long ptr = 0;
067
068     if (obj != null)
069     {
070       ptr             = obj.swigCPtr;
071       obj.swigCMemOwn = false;
072     }
073
074     return ptr;
075   }
076
077  protected void finalize() {
078    delete();
079  }
080
081  public synchronized void delete() {
082    if (swigCPtr != 0) {
083      if (swigCMemOwn) {
084        swigCMemOwn = false;
085        libsbmlJNI.delete_SBMLUnitsConverter(swigCPtr);
086      }
087      swigCPtr = 0;
088    }
089    super.delete();
090  }
091
092  public static void init() {
093    libsbmlJNI.SBMLUnitsConverter_init();
094  }
095
096  public SBMLUnitsConverter() {
097    this(libsbmlJNI.new_SBMLUnitsConverter__SWIG_0(), true);
098  }
099
100  public SBMLUnitsConverter(SBMLUnitsConverter obj) {
101    this(libsbmlJNI.new_SBMLUnitsConverter__SWIG_1(SBMLUnitsConverter.getCPtr(obj), obj), true);
102  }
103
104  
105/**
106   * Creates and returns a deep copy of this {@link SBMLConverter} object.
107   * <p>
108   * @return a (deep) copy of this {@link SBMLConverter} object.
109   */ public
110 SBMLConverter cloneObject() {
111    long cPtr = libsbmlJNI.SBMLUnitsConverter_cloneObject(swigCPtr, this);
112    return (cPtr == 0) ? null : new SBMLUnitsConverter(cPtr, true);
113  }
114
115  
116/**
117   * Predicate returning <code>true</code> if this converter's properties matches a
118   * given set of configuration properties.
119   * <p>
120   * @param props the configuration properties to match.
121   * <p>
122   * @return <code>true</code> if this converter's properties match, <code>false</code>
123   * otherwise.
124   */ public
125 boolean matchesProperties(ConversionProperties props) {
126    return libsbmlJNI.SBMLUnitsConverter_matchesProperties(swigCPtr, this, ConversionProperties.getCPtr(props), props);
127  }
128
129  
130/**
131   * Perform the conversion.
132   * <p>
133   * This method causes the converter to do the actual conversion work,
134   * that is, to convert the {@link SBMLDocument} object set by
135   * {@link SBMLConverter#setDocument(SBMLDocument doc)} and
136   * with the configuration options set by
137   * {@link SBMLConverter#setProperties(ConversionProperties props)}.
138   * <p>
139   * @return  integer value indicating the success/failure of the operation.
140   *  The set of possible values that may
141   * be returned depends on the converter subclass; please consult
142   * the documentation for the relevant class to find out what the
143   * possibilities are.
144   */ public
145 int convert() {
146    return libsbmlJNI.SBMLUnitsConverter_convert(swigCPtr, this);
147  }
148
149  
150/**
151   * Returns the default properties of this converter.
152   * <p>
153   * A given converter exposes one or more properties that can be adjusted
154   * in order to influence the behavior of the converter.  This method
155   * returns the <em>default</em> property settings for this converter.  It is
156   * meant to be called in order to discover all the settings for the
157   * converter object.  The run-time properties of the converter object can
158   * be adjusted by using the method
159   * {@link SBMLConverter#setProperties(ConversionProperties props)}.
160   * <p>
161   * @return the default properties for the converter.
162   * <p>
163   * @see #setProperties(ConversionProperties props)
164   * @see #matchesProperties(ConversionProperties props)
165   */ public
166 ConversionProperties getDefaultProperties() {
167    return new ConversionProperties(libsbmlJNI.SBMLUnitsConverter_getDefaultProperties(swigCPtr, this), true);
168  }
169
170}