Exemplo n.º 1
0
 L3ParserSettings(L3ParserSettings source) : this(libsbmlPINVOKE.new_L3ParserSettings__SWIG_4(L3ParserSettings.getCPtr(source)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 2
0
        internal static HandleRef getCPtrAndDisown(L3ParserSettings obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
                ptr             = obj.swigCPtr;
                obj.swigCMemOwn = false;
            }

            return(ptr);
        }
Exemplo n.º 3
0
 internal static HandleRef getCPtr(L3ParserSettings obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 4
0
 /**
  * Parses a text string as a mathematical formula using specific parser
  * settings and returns an AST representation of the result.
  *
  * This is identical to @sbmlfunction{parseL3Formula, String}, except
  * that this function uses the parser settings given in the argument @p
  * settings.  The settings override the default parsing behavior.  The
  * following parsing behaviors can be configured:
  *
  * *
  * @li A Model object may optionally be provided to use identifiers (values
  * of type @c SId) from the model in preference to pre-defined MathML symbols
  * More precisely, the Model entities whose identifiers will shadow identical
  * symbols in the mathematical formula are: Species, Compartment, Parameter,
  * Reaction, and SpeciesReference.  For instance, if the parser is given a
  * Model containing a Species with the identifier
  * &quot;<code>pi</code>&quot;, and the formula to be parsed is
  * &quot;<code>3*pi</code>&quot;, the MathML produced by the parser will
  * contain the construct <code>&lt;ci&gt; pi &lt;/ci&gt;</code> instead of
  * the construct <code>&lt;pi/&gt;</code>.  Another example, if the passed-in
  * Model contains a FunctionDefinition with the identifier
  * &quot;<code>sin</code>&quot;, that function will be used instead of the
  * predefined MathML function <code>&lt;sin/&gt;</code>.
  * @li The function @c log with a single argument
  * (&quot;<code>log(x)</code>&quot;) can be parsed as <code>log10(x)</code>,
  * <code>ln(x)</code>, or treated as an error, as desired.
  * @li Unary minus signs can be either collapsed or preserved; that is, the
  * parser can either (1) remove sequential pairs of unary minuses (e.g.,
  * &quot;<code>- -3</code>&quot;) from the input and incorporate single unary
  * minuses into the number node, or (2) preserve all minuses in the AST node
  * structure, turning them into ASTNode objects of type
  * @link libsbmlcs#AST_MINUS AST_MINUS@endlink.
  * @li The character sequence &quot;<code>number id</code>&quot; can be
  * interpreted as a numerical value @c number followed by units of measurement
  * indicated by @c id, or it can be treated as a syntax error.  (In
  * Level&nbsp;3, MathML <code>&lt;cn&gt;</code> elements can have an
  * attribute named @c units placed in the SBML namespace, which can be used
  * to indicate the units to be associated with the number.  The text-string
  * infix formula parser allows units to be placed after raw numbers; they are
  * interpreted as unit identifiers for units defined by the SBML
  * specification or in the containing Model object.)
  * @li The symbol @c avogadro can be parsed either as a MathML @em csymbol or
  * as a identifier.  More specifically, &quot;<code>avogadro</code>&quot; can
  * be treated as an ASTNode of type
  * @link libsbmlcs#AST_NAME_AVOGADRO AST_NAME_AVOGADRO@endlink or of type
  * @link libsbmlcs#AST_NAME AST_NAME@endlink.
  * @li Strings that match built-in functions and constants can either be parsed
  * as a match regardless of capitalization, or may be required to be
  * all-lower-case to be considered a match.
  * @li LibSBML plug-ins implementing support for SBML Level&nbsp;3 packages
  * may introduce extensions to the syntax understood by the parser.  The
  * precise nature of the extensions will be documented by the individual
  * package plug-ins.  An example of a possible extension is a notation for
  * vectors and arrays, introduced by the SBML Level&nbsp;3 @em Arrays
  * package.
  *
  *
  *
  * For more details about the parser, please see the definition of
  * L3ParserSettings and @sbmlfunction{parseL3FormulaWithSettings, String\,
  * L3ParserSettings}.
  *
  * @param formula the mathematical formula expression to be parsed
  *
  * @param settings the settings to be used for this parser invocation
  *
  * @return the root node of an AST representing the mathematical formula,
  * or @c null if an error occurred while parsing the formula.  When @c null
  * is returned, an error is recorded internally; information about the
  * error can be retrieved using @sbmlfunction{getLastParseL3Error,}.
  *
  * @see @sbmlfunction{parseL3Formula, String}
  * @see @sbmlfunction{parseL3FormulaWithSettings, String\, L3ParserSettings}
  * @see @sbmlfunction{parseL3FormulaWithModel, String\, Model}
  * @see @sbmlfunction{parseFormula, String}
  * @see @sbmlfunction{getLastParseL3Error,}
  * @see L3ParserSettings
  *
  * @if conly
  * @memberof ASTNode_t
  * @endif
  */
 public static ASTNode parseL3FormulaWithSettings(string formula, L3ParserSettings settings)
 {
     IntPtr cPtr = libsbmlPINVOKE.parseL3FormulaWithSettings(formula, L3ParserSettings.getCPtr(settings));
     ASTNode ret = (cPtr == IntPtr.Zero) ? null : new ASTNode(cPtr, true);
     return ret;
 }
Exemplo n.º 5
0
        /**
         * Converts an AST to a text string representation of a formula, using
         * specific formatter settings.
         *
         * This function behaves identically to @sbmlfunction{formulaToL3String,
         * ASTNode} but its behavior is controlled by two fields in the @p
         * settings object, namely:
         *
         * @li <em>parseunits</em> ('parse units'): If this field in the @p settings
         *     object is set to <code>true</code> (the default), the function will
         *     write out the units of any numerical ASTNodes that have them,
         *     producing (for example) &quot;<code>3 mL</code>&quot;,
         *     &quot;<code>(3/4) m</code>&quot;, or &quot;<code>5.5e-10
         *     M</code>&quot;.  If this is set to <code>false</code>, this function
         *     will only write out the number itself (&quot;<code>3</code>&quot;,
         *     &quot;<code>(3/4)</code>&quot;, and &quot;<code>5.5e-10</code>&quot;,
         *     in the previous examples).
         * @li <em>collapseminus</em> ('collapse minus'): If this field in the @p
         *     settings object is set to <code>false</code> (the default), the
         *     function will write out explicitly any doubly-nested unary minus
         *     ASTNodes, producing (for example) &quot;<code>- -x</code>&quot; or
         *     even &quot;<code>- - - - -3.1</code>&quot;.  If this is set to
         *     <code>true</code>, the function will collapse the nodes before
         *     producing the infix form, producing &quot;<code>x</code>&quot; and
         *     &quot;<code>-3.1</code>&quot; in the previous examples.
         *
         * All the other settings of the L3ParserSettings object passed in as @p
         * settings will be ignored for the purposes of this function: the
         * <em>parselog</em> ('parse log') setting is ignored so that
         * &quot;<code>log10(x)</code>&quot;, &quot;<code>ln(x)</code>&quot;, and
         * &quot;<code>log(x, y)</code>&quot; are always produced; the
         * <em>avocsymbol</em> ('Avogadro csymbol') is irrelevant to the behavior
         * of this function; and nothing in the Model object set via the
         * <em>model</em> setting is used.
         *
         * @param tree the AST to be converted.

         * @param settings the L3ParserSettings object used to modify the behavior of
         * this function.
         *
         * @return the formula from the given AST as text string, with a syntax
         * oriented towards the capabilities defined in SBML Level&nbsp;3.  The
         * caller owns the returned string and is responsible for freeing it when it
         * is no longer needed.  If @p tree is a null pointer, then a null pointer is
         * returned.
         *
         * @see @sbmlfunction{formulaToL3String, ASTNode}
         * @see @sbmlfunction{formulaToString, ASTNode}
         * @see @sbmlfunction{parseL3FormulaWithSettings, String\, L3ParserSettings}
         * @see @sbmlfunction{parseL3FormulaWithModel, String\, Model}
         * @see @sbmlfunction{parseFormula, String}
         * @see L3ParserSettings
         * @see @sbmlfunction{getDefaultL3ParserSettings,}
         * @see @sbmlfunction{getLastParseL3Error,}
         *
         * @if conly
         * @memberof ASTNode_t
         * @endif
         */
        public static string formulaToL3StringWithSettings(ASTNode tree, L3ParserSettings settings)
        {
            string ret = libsbmlPINVOKE.formulaToL3StringWithSettings(ASTNode.getCPtr(tree), L3ParserSettings.getCPtr(settings));
            return ret;
        }
Exemplo n.º 6
0
        internal static HandleRef getCPtrAndDisown(L3ParserSettings obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
Exemplo n.º 7
0
 internal static HandleRef getCPtr(L3ParserSettings obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Exemplo n.º 8
0
 /**
    * Copy constructor.
    */
 public L3ParserSettings(L3ParserSettings source)
     : this(libsbmlPINVOKE.new_L3ParserSettings__SWIG_4(L3ParserSettings.getCPtr(source)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }