/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.6
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace libsbml {

 using System;
 using System.Runtime.InteropServices;

/** 
 * @sbmlpackage{core}
 *
@htmlinclude pkg-marker-core.html The rate expression for an SBML reaction.
 *
 * An object of class KineticLaw is used to describe the rate at which the
 * process defined by a given Reaction takes place.  KineticLaw has
 * subelements called 'math' (for MathML content) and 'listOfParameters'
 * (of class ListOfParameters), in addition to the attributes and
 * subelements it inherits from SBase.
 *
 * KineticLaw's 'math' subelement for holding a MathML formula (required 
 * through SBML Level&nbsp;3 Version&nbsp;1, but optional as of SBML 
 * Level&nbsp;3 Version&nbsp;2) defines the
 * rate of the reaction.  The formula may refer to other entities in a
 * model as well as local parameter definitions within the scope of the
 * Reaction (see below).  It is important to keep in mind, however, that
 * the only Species identifiers that can be used in this formula are those
 * declared in the lists of reactants, products and modifiers in the
 * Reaction structure.  (In other words, before a species can be referenced
 * in the KineticLaw, it must be declared in one of those lists.)
 *
 * KineticLaw provides a way to define @em local parameters whose
 * identifiers can be used in the 'math' formula of that KineticLaw
 * instance.  Prior to SBML Level&nbsp;3, these parameter definitions are
 * stored inside a 'listOfParameters' subelement containing Parameter
 * objects; in SBML Level&nbsp;3, this is achieved using a specialized
 * object class called LocalParameter and the containing subelement is
 * called 'listOfLocalParameters'.  In both cases, the parameters so
 * defined are only visible within the KineticLaw (or, as of SBML
 * Level&nbsp;3 Version&nbsp;2, only visible within the parent Reaction); 
 * they cannot be accessed
 * outside.  A local parameter within one reaction is not visible from
 * within another reaction, nor is it visible to any other construct
 * outside of the KineticLaw in which it is defined.  In addition, another
 * important feature is that if such a Parameter (or in Level&nbsp;3,
 * LocalParameter) object has the same identifier as another object in the
 * scope of the enclosing Model, the definition inside the KineticLaw takes
 * precedence.  In other words, within the KineticLaw's 'math' formula,
 * references to local parameter identifiers <strong>shadow any identical
 * global identifiers</strong>.
 *
 * The values of local parameters defined within KineticLaw objects cannot
 * change.  In SBML Level&nbsp;3, this quality is built into the
 * LocalParameter construct.  In Level&nbsp;2, where the same kind of
 * Parameter object class is used as for global parameters, the Parameter
 * objects' 'constant' attribute must always have a value of @c true
 * (either explicitly or left to its default value).
 *
 * 
 * @section shadowing-warning A warning about identifier shadowing
 *
 * A common misconception is that different classes of objects (e.g.,
 * species, compartments, parameters) in SBML have different identifier
 * scopes.  They do not.  The implication is that if a KineticLaw's local
 * parameter definition uses an identifier identical to @em any other
 * identifier defined in the model outside the KineticLaw, even if the
 * other identifier does @em not belong to a parameter type of object, the
 * local parameter's identifier takes precedence within that KineticLaw's
 * 'math' formula.  It is not an error in SBML for identifiers to shadow
 * each other this way, but can lead to confusing and subtle errors.
 *
 * 
 * @section version-diffs SBML Level/Version differences
 *
 * In SBML Level&nbsp;2 Version&nbsp;1, the SBML specification
 * included two additional attributes on KineticLaw called 'substanceUnits'
 * and 'timeUnits'.  They were removed beginning with SBML Level&nbsp;2
 * Version&nbsp;2 because further research determined they introduced many
 * problems.  The most significant problem was that their use could easily
 * lead to the creation of valid models whose reactions nevertheless could
 * not be integrated into a system of equations without outside knowledge
 * for converting the quantities used.  Examination of real-life models
 * revealed that a common reason for using 'substanceUnits' on KineticLaw
 * was to set the units of all reactions to the same set of substance
 * units, something that is better achieved by using UnitDefinition to
 * redefine @c 'substance' for the whole Model.
 *
 * As mentioned above, in SBML Level&nbsp;2 Versions 2&ndash;4, local
 * parameters are of class Parameter.  In SBML Level&nbsp;3, the class of
 * object is LocalParameter.
 *
 * In SBML Level&nbsp;3 Version&nbsp;2, the scope of the LocalParameter
 * was expanded to the entire Reaction, instead of just the KineticLaw.  
 * This introduced a single new restriction: an L3v2 LocalParameter may 
 * not now shadow the @c id of any Species referenced by a SpeciesReference
 * in the same Reaction.  Other than that, there is no difference in any 
 * core construct.  However, packages may take advantage of this new scope by 
 * adding elements to the Reaction that may now reference a LocalParameter 
 * defined in the same Reaction.
 */

public class KineticLaw : SBase {
	private HandleRef swigCPtr;
	
	internal KineticLaw(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.KineticLaw_SWIGUpcast(cPtr), cMemoryOwn)
	{
		//super(libsbmlPINVOKE.KineticLawUpcast(cPtr), cMemoryOwn);
		swigCPtr = new HandleRef(this, cPtr);
	}
	
	internal static HandleRef getCPtr(KineticLaw obj)
	{
		return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
	}
	
	internal static HandleRef getCPtrAndDisown (KineticLaw obj)
	{
		HandleRef ptr = new HandleRef(null, IntPtr.Zero);
		
		if (obj != null)
		{
			ptr             = obj.swigCPtr;
			obj.swigCMemOwn = false;
		}
		
		return ptr;
	}

  ~KineticLaw() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          libsbmlPINVOKE.delete_KineticLaw(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  
/**
   * Creates a new KineticLaw using the given SBML @p level and @p version
   * values.
   *
   * @param level a long integer, the SBML Level to assign to this KineticLaw.
   *
   * @param version a long integer, the SBML Version to assign to this
   * KineticLaw.
   *
   *
 * @throws SBMLConstructorException
 * Thrown if the given @p level and @p version combination are invalid
 * or if this object is incompatible with the given level and version.
 *
 *
   *
   *
 * @note Attempting to add an object to an SBMLDocument having a different
 * combination of SBML Level, Version and XML namespaces than the object
 * itself will result in an error at the time a caller attempts to make the
 * addition.  A parent object must have compatible Level, Version and XML
 * namespaces.  (Strictly speaking, a parent may also have more XML
 * namespaces than a child, but the reverse is not permitted.)  The
 * restriction is necessary to ensure that an SBML model has a consistent
 * overall structure.  This requires callers to manage their objects
 * carefully, but the benefit is increased flexibility in how models can be
 * created by permitting callers to create objects bottom-up if desired.  In
 * situations where objects are not yet attached to parents (e.g.,
 * SBMLDocument), knowledge of the intented SBML Level and Version help
 * libSBML determine such things as whether it is valid to assign a
 * particular value to an attribute.
 *
 *
   */ public
 KineticLaw(long level, long version) : this(libsbmlPINVOKE.new_KineticLaw__SWIG_0(level, version), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  
/**
   * Creates a new KineticLaw using the given SBMLNamespaces object
   * @p sbmlns.
   *
   *
 * 
 * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces
 * information.  It is used to communicate the SBML Level, Version, and (in
 * Level&nbsp;3) packages used in addition to SBML Level&nbsp;3 Core.  A
 * common approach to using libSBML's SBMLNamespaces facilities is to create an
 * SBMLNamespaces object somewhere in a program once, then hand that object
 * as needed to object constructors that accept SBMLNamespaces as arguments.
 *
 *
   *
   * @param sbmlns an SBMLNamespaces object.
   *
   *
 * @throws SBMLConstructorException
 * Thrown if the given @p sbmlns is inconsistent or incompatible
 * with this object.
 *
 *
   *
   *
 * @note Attempting to add an object to an SBMLDocument having a different
 * combination of SBML Level, Version and XML namespaces than the object
 * itself will result in an error at the time a caller attempts to make the
 * addition.  A parent object must have compatible Level, Version and XML
 * namespaces.  (Strictly speaking, a parent may also have more XML
 * namespaces than a child, but the reverse is not permitted.)  The
 * restriction is necessary to ensure that an SBML model has a consistent
 * overall structure.  This requires callers to manage their objects
 * carefully, but the benefit is increased flexibility in how models can be
 * created by permitting callers to create objects bottom-up if desired.  In
 * situations where objects are not yet attached to parents (e.g.,
 * SBMLDocument), knowledge of the intented SBML Level and Version help
 * libSBML determine such things as whether it is valid to assign a
 * particular value to an attribute.
 *
 *
   */ public
 KineticLaw(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_KineticLaw__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  
/**
   * Copy constructor; creates a copy of this KineticLaw.
   *
   * @param orig the object to copy.
   */ public
 KineticLaw(KineticLaw orig) : this(libsbmlPINVOKE.new_KineticLaw__SWIG_2(KineticLaw.getCPtr(orig)), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  
/**
   * Creates and returns a deep copy of this KineticLaw object.
   *
   * @return the (deep) copy of this KineticLaw object.
   */ public new
 KineticLaw clone() {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_clone(swigCPtr);
    KineticLaw ret = (cPtr == IntPtr.Zero) ? null : new KineticLaw(cPtr, true);
    return ret;
  }

  
/**
   * Returns the first child element found that has the given @p id in the
   * model-wide SId namespace, or @c null if no such object is found.
   *
   * @param id string representing the id of the object to find.
   *
   * @return pointer to the first element found with the given @p id.
   */ public new
 SBase getElementBySId(string id) {
	SBase ret = (SBase) libsbml.DowncastSBase(libsbmlPINVOKE.KineticLaw_getElementBySId(swigCPtr, id), false);
	return ret;
}

  
/**
   * Returns the first child element it can find with the given @p metaid, or
   * @c null if no such object is found.
   *
   * @param metaid string representing the metaid of the object to find.
   *
   * @return pointer to the first element found with the given @p metaid.
   */ public new
 SBase getElementByMetaId(string metaid) {
	SBase ret = (SBase) libsbml.DowncastSBase(libsbmlPINVOKE.KineticLaw_getElementByMetaId(swigCPtr, metaid), false);
	return ret;
}

  
/**
   * Returns the mathematical formula for this KineticLaw object and return
   * it as as a text string.
   *
   * This is fundamentally equivalent to
   * @if java KineticLaw::getMath()@else getMath()@endif.
   * This variant is provided principally for compatibility compatibility
   * with SBML Level&nbsp;1.
   * 
   * @return a string representing the formula of this KineticLaw.
   *
   * @note @htmlinclude level-1-uses-text-string-math.html
   *
   * @see getMath()
   */ public
 string getFormula() {
    string ret = libsbmlPINVOKE.KineticLaw_getFormula(swigCPtr);
    return ret;
  }

  
/**
   * Returns the mathematical formula for this KineticLaw object and return
   * it as as an AST.
   *
   * This is fundamentally equivalent to
   * @if java KineticLaw::getFormula()@else getFormula()@endif.
   * The latter is provided principally for compatibility compatibility
   * with SBML Level&nbsp;1, which represented mathematical formulas in
   * text-string form.
   * 
   * @return the ASTNode representation of the mathematical formula, 
   * or null if the math is not set.
   *
   * @see getFormula()
   */ public new
 ASTNode getMath() {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getMath(swigCPtr);
    ASTNode ret = (cPtr == IntPtr.Zero) ? null : new ASTNode(cPtr, false);
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Returns the value of the
   * 'timeUnits' attribute of this KineticLaw object.
   *
   * @return the 'timeUnits' attribute value.
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 string getTimeUnits() {
    string ret = libsbmlPINVOKE.KineticLaw_getTimeUnits(swigCPtr);
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Returns the value of the
   * 'substanceUnits' attribute of this KineticLaw object.
   *
   * @return the 'substanceUnits' attribute value.
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 string getSubstanceUnits() {
    string ret = libsbmlPINVOKE.KineticLaw_getSubstanceUnits(swigCPtr);
    return ret;
  }

  
/**
   * Predicate returning @c true if this KineticLaw's 'formula' attribute is
   * set.
   *
   * This is functionally identical to the method
   * @if java KineticLaw::isSetMath()@else isSetMath()@endif.  It is
   * provided in order to mirror the parallel between
   * @if java KineticLaw::getFormula()@else getFormula()@endif and
   * @if java KineticLaw::getMath()@else getMath()@endif.
   *
   * @return @c true if the formula (meaning the @c math subelement) of
   * this KineticLaw is set, @c false otherwise.
   *
   * @note @htmlinclude level-1-uses-text-string-math.html
   *
   * @see isSetMath()
   */ public
 bool isSetFormula() {
    bool ret = libsbmlPINVOKE.KineticLaw_isSetFormula(swigCPtr);
    return ret;
  }

  
/**
   * Predicate returning @c true if this Kinetic's 'math' subelement is set.
   *
   * This is identical to the method
   * @if java KineticLaw::isSetFormula()@else isSetFormula()@endif.
   * It is provided in order to mirror the parallel between
   * @if java KineticLaw::getFormula()@else getFormula()@endif and
   * @if java KineticLaw::getMath()@else getMath()@endif.
   * 
   * @return @c true if the formula (meaning the @c math subelement) of
   * this KineticLaw is set, @c false otherwise.
   * 
   * @see isSetFormula()
   */ public
 bool isSetMath() {
    bool ret = libsbmlPINVOKE.KineticLaw_isSetMath(swigCPtr);
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Predicate returning @c true if
   * this SpeciesReference's 'timeUnits' attribute is set.
   *
   * @return @c true if the 'timeUnits' attribute of this KineticLaw object
   * is set, @c false otherwise.
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 bool isSetTimeUnits() {
    bool ret = libsbmlPINVOKE.KineticLaw_isSetTimeUnits(swigCPtr);
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Predicate returning @c true if
   * this SpeciesReference's 'substanceUnits' attribute is set.
   *
   * @return @c true if the 'substanceUnits' attribute of this KineticLaw
   * object is set, @c false otherwise.
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 bool isSetSubstanceUnits() {
    bool ret = libsbmlPINVOKE.KineticLaw_isSetSubstanceUnits(swigCPtr);
    return ret;
  }

  
/**
   * Sets the mathematical expression of this KineticLaw instance to the
   * given @p formula.
   *
   * The given @p formula string is copied.  Internally, libSBML stores the
   * mathematical expression as an ASTNode.
   *
   * @param formula the mathematical expression to use, represented in
   * text-string form.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
   *
   * @note @htmlinclude level-1-uses-text-string-math.html
   *
   * @see setMath(ASTNode math)
   */ public
 int setFormula(string formula) {
    int ret = libsbmlPINVOKE.KineticLaw_setFormula(swigCPtr, formula);
    return ret;
  }

  
/**
   * Sets the mathematical expression of this KineticLaw instance to a copy
   * of the given ASTNode.
   *
   * This is fundamentally identical to
   * @if java KineticLaw::setFormula(String formula)@else getFormula()@endif.
   * The latter is provided principally for compatibility compatibility with
   * SBML Level&nbsp;1, which represented mathematical formulas in text-string
   * form.
   *
   * @param math an ASTNode representing a formula tree.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
   *
   * @see setFormula(string formula)
   */ public new
 int setMath(ASTNode math) {
    int ret = libsbmlPINVOKE.KineticLaw_setMath(swigCPtr, ASTNode.getCPtr(math));
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Sets the 'timeUnits' attribute
   * of this KineticLaw object to a copy of the identifier in @p sid.
   *
   * @param sid the identifier of the units to use.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink
   * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 int setTimeUnits(string sid) {
    int ret = libsbmlPINVOKE.KineticLaw_setTimeUnits(swigCPtr, sid);
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Sets the 'substanceUnits'
   * attribute of this KineticLaw object to a copy of the identifier given
   * in @p sid.
   *
   * @param sid the identifier of the units to use.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink
   * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 int setSubstanceUnits(string sid) {
    int ret = libsbmlPINVOKE.KineticLaw_setSubstanceUnits(swigCPtr, sid);
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Unsets the 'timeUnits'
   * attribugte of this KineticLaw object.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
   * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 int unsetTimeUnits() {
    int ret = libsbmlPINVOKE.KineticLaw_unsetTimeUnits(swigCPtr);
    return ret;
  }

  
/**
   * (SBML Level&nbsp;2 Version&nbsp;1 only) Unsets the 'substanceUnits'
   * attribute of this KineticLaw object.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
   * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink
   *
   *
 * @note The attributes 'timeUnits' and 'substanceUnits' are present only
 * in SBML Level&nbsp;2 Version&nbsp;1.  In SBML Level&nbsp;2
 * Version&nbsp;2, the 'timeUnits' and 'substanceUnits' attributes were
 * removed.  For compatibility with new versions of SBML, users are
 * cautioned to avoid these attributes.
 * 
   */ public
 int unsetSubstanceUnits() {
    int ret = libsbmlPINVOKE.KineticLaw_unsetSubstanceUnits(swigCPtr);
    return ret;
  }

  
/**
   * Adds a copy of the given Parameter object to the list of local
   * parameters in this KineticLaw.
   *
   * @param p the Parameter to add.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink
   * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink
   * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@endlink
   * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
   * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
   *
   *
 * @note This method should be used with some caution.  The fact that this
 * method @em copies the object passed to it means that the caller will be
 * left holding a physically different object instance than the one contained
 * inside this object.  Changes made to the original object instance (such as
 * resetting attribute values) will <em>not affect the instance in this
 * object</em>.  In addition, the caller should make sure to free the
 * original object if it is no longer being used, or else a memory leak will
 * result.  Please see other methods on this class (particularly a
 * corresponding method whose name begins with the word <code>create</code>)
 * for alternatives that do not lead to these issues.
 *
 * 
   *
   * @see createParameter()
   */ public
 int addParameter(Parameter p) {
    int ret = libsbmlPINVOKE.KineticLaw_addParameter(swigCPtr, Parameter.getCPtr(p));
    return ret;
  }

  
/**
   * Adds a copy of the given LocalParameter object to the list of local
   * parameters in this KineticLaw.
   *
   * @param p the LocalParameter to add.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink
   * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink
   * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@endlink
   * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
   * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
   *
   *
 * @note This method should be used with some caution.  The fact that this
 * method @em copies the object passed to it means that the caller will be
 * left holding a physically different object instance than the one contained
 * inside this object.  Changes made to the original object instance (such as
 * resetting attribute values) will <em>not affect the instance in this
 * object</em>.  In addition, the caller should make sure to free the
 * original object if it is no longer being used, or else a memory leak will
 * result.  Please see other methods on this class (particularly a
 * corresponding method whose name begins with the word <code>create</code>)
 * for alternatives that do not lead to these issues.
 *
 * 
   *
   * @see createLocalParameter()
   */ public
 int addLocalParameter(LocalParameter p) {
    int ret = libsbmlPINVOKE.KineticLaw_addLocalParameter(swigCPtr, LocalParameter.getCPtr(p));
    return ret;
  }

  
/**
   * Creates a new Parameter object, adds it to this KineticLaw's list of
   * local parameters, and returns the Parameter object created.
   *
   * @return a new Parameter object instance.
   *
   * @see addParameter(Parameter p)
   */ public
 Parameter createParameter() {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_createParameter(swigCPtr);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, false);
    return ret;
  }

  
/**
   * Creates a new LocalParameter object, adds it to this KineticLaw's list
   * of local parameters, and returns the LocalParameter object created.
   *
   * @return a new LocalParameter object instance.
   *
   * @see addLocalParameter(LocalParameter p)
   */ public
 LocalParameter createLocalParameter() {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_createLocalParameter(swigCPtr);
    LocalParameter ret = (cPtr == IntPtr.Zero) ? null : new LocalParameter(cPtr, false);
    return ret;
  }

  
/**
   * Returns the list of local parameters in this KineticLaw object.
   * 
   * @return the list of Parameters for this KineticLaw.
   */ public
 ListOfParameters getListOfParameters() {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getListOfParameters__SWIG_0(swigCPtr);
    ListOfParameters ret = (cPtr == IntPtr.Zero) ? null : new ListOfParameters(cPtr, false);
    return ret;
  }

  
/**
   * Returns the list of local parameters in this KineticLaw object.
   * 
   * @return the list of LocalParameters for this KineticLaw.
   */ public
 ListOfLocalParameters getListOfLocalParameters() {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getListOfLocalParameters__SWIG_0(swigCPtr);
    ListOfLocalParameters ret = (cPtr == IntPtr.Zero) ? null : new ListOfLocalParameters(cPtr, false);
    return ret;
  }

  
/**
   * Returns the nth Parameter object in the list of local parameters in
   * this KineticLaw instance.
   *
   * @param n the index of the Parameter object sought.
   * 
   * @return the nth Parameter of this KineticLaw.
   */ public
 Parameter getParameter(long n) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getParameter__SWIG_0(swigCPtr, n);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, false);
    return ret;
  }

  
/**
   * Returns the nth LocalParameter object in the list of local parameters in
   * this KineticLaw instance.
   *
   * @param n the index of the LocalParameter object sought.
   * 
   * @return the nth LocalParameter of this KineticLaw.
   */ public
 LocalParameter getLocalParameter(long n) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getLocalParameter__SWIG_0(swigCPtr, n);
    LocalParameter ret = (cPtr == IntPtr.Zero) ? null : new LocalParameter(cPtr, false);
    return ret;
  }

  
/**
   * Returns a local parameter based on its identifier.
   *
   * @param sid the identifier of the Parameter being sought.
   * 
   * @return the Parameter object in this KineticLaw instace having the
   * given 'id', or @c null if no such Parameter exists.
   */ public
 Parameter getParameter(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getParameter__SWIG_2(swigCPtr, sid);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, false);
    return ret;
  }

  
/**
   * Returns a local parameter based on its identifier.
   *
   * @param sid the identifier of the LocalParameter being sought.
   * 
   * @return the LocalParameter object in this KineticLaw instace having the
   * given 'id', or @c null if no such LocalParameter exists.
   */ public
 LocalParameter getLocalParameter(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getLocalParameter__SWIG_2(swigCPtr, sid);
    LocalParameter ret = (cPtr == IntPtr.Zero) ? null : new LocalParameter(cPtr, false);
    return ret;
  }

  
/**
   * Returns the number of local parameters in this KineticLaw instance.
   * 
   * @return the number of Parameters in this KineticLaw.
   */ public
 long getNumParameters() { return (long)libsbmlPINVOKE.KineticLaw_getNumParameters(swigCPtr); }

  
/**
   * Returns the number of local parameters in this KineticLaw instance.
   * 
   * @return the number of LocalParameters in this KineticLaw.
   */ public
 long getNumLocalParameters() { return (long)libsbmlPINVOKE.KineticLaw_getNumLocalParameters(swigCPtr); }

  
/**
   * Calculates and returns a UnitDefinition that expresses the units of
   * measurement assumed for the 'math' expression of this KineticLaw.
   *
   *
 * 
 * The units are calculated based on the mathematical expression in the
 * KineticLaw and the model quantities referenced by <code>&lt;ci&gt;</code>
 * elements used within that expression.  The
 * @if java KineticLaw::getDerivedUnitDefinition()@else getDerivedUnitDefinition()@endif
 * method returns the calculated units.
 *
 * 
   *
   *
 * @note The functionality that facilitates unit analysis depends on the
 * model as a whole.  Thus, in cases where the object has not been added to
 * a model or the model itself is incomplete, unit analysis is not possible
 * and this method will return @c null.
 *
 * 
   *
   *
 * @warning <span class='warning'>Note that it is possible the 'math'
 * expression in the KineticLaw contains pure numbers or parameters with
 * undeclared units.  In those cases, it is not possible to calculate the
 * units of the overall expression without making assumptions.  LibSBML does
 * not make assumptions about the units, and
 * KineticLaw::getDerivedUnitDefinition() returns the units as far as it is
 * able to determine them.  For example, in an expression <em>X + Y</em>, if
 * <em>X</em> has unambiguously-defined units and <em>Y</em> does not, it
 * will return the units of <em>X</em>.  <strong>It is important that callers
 * also invoke the method</strong>
 * KineticLaw::containsUndeclaredUnits()<strong>to determine whether this
 * situation holds</strong>.  Callers may wish to take suitable actions in
 * those scenarios.</span>
 *
 *
   * 
   * @return a UnitDefinition that expresses the units of the math 
   * expression of this KineticLaw, or @c null if one cannot be constructed.
   *
   * @see containsUndeclaredUnits()
   */ public
 UnitDefinition getDerivedUnitDefinition() {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_getDerivedUnitDefinition__SWIG_0(swigCPtr);
    UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, false);
    return ret;
  }

  
/**
   * Predicate returning @c true if the math expression of this KineticLaw
   * contains parameters/numbers with undeclared units.
   * 
   * @return @c true if the math expression of this KineticLaw
   * includes parameters/numbers 
   * with undeclared units, @c false otherwise.
   *
   * @note A return value of @c true indicates that the UnitDefinition
   * returned by
   * @if java KineticLaw::getDerivedUnitDefinition()@else getDerivedUnitDefinition()@endif
   * may not accurately represent the units of the expression.
   *
   * @see getDerivedUnitDefinition()
   */ public
 bool containsUndeclaredUnits() {
    bool ret = libsbmlPINVOKE.KineticLaw_containsUndeclaredUnits__SWIG_0(swigCPtr);
    return ret;
  }

  
/**
   * Removes the nth Parameter object in the list of local parameters 
   * in this KineticLaw instance and returns a pointer to it.
   *
   * The caller owns the returned object and is responsible for deleting it.
   *
   * @param n the index of the Parameter object to remove.
   * 
   * @return the Parameter object removed.  As mentioned above, 
   * the caller owns the returned item. @c null is returned if the given index 
   * is out of range.
   */ public
 Parameter removeParameter(long n) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_removeParameter__SWIG_0(swigCPtr, n);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, true);
    return ret;
  }

  
/**
   * Removes the nth LocalParameter object in the list of local parameters 
   * in this KineticLaw instance and returns a pointer to it.
   *
   * The caller owns the returned object and is responsible for deleting it.
   *
   * @param n the index of the LocalParameter object to remove.
   * 
   * @return the LocalParameter object removed.  As mentioned above, 
   * the caller owns the returned item. @c null is returned if the given index 
   * is out of range.
   */ public
 LocalParameter removeLocalParameter(long n) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_removeLocalParameter__SWIG_0(swigCPtr, n);
    LocalParameter ret = (cPtr == IntPtr.Zero) ? null : new LocalParameter(cPtr, true);
    return ret;
  }

  
/**
   * Removes a Parameter object with the given identifier in the list of
   * local parameters in this KineticLaw instance and returns a pointer to it.
   *
   * The caller owns the returned object and is responsible for deleting it.
   *
   * @param sid the identifier of the Parameter to remove.
   * 
   * @return the Parameter object removed.  As mentioned above, the 
   * caller owns the returned object. @c null is returned if no Parameter
   * object with the identifier exists in this KineticLaw instance.
   */ public
 Parameter removeParameter(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_removeParameter__SWIG_1(swigCPtr, sid);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, true);
    return ret;
  }

  
/**
   * Removes a LocalParameter object with the given identifier in the list of
   * local parameters in this KineticLaw instance and returns a pointer to it.
   *
   * The caller owns the returned object and is responsible for deleting it.
   *
   * @param sid the identifier of the LocalParameter to remove.
   * 
   * @return the LocalParameter object removed.  As mentioned above, the 
   * caller owns the returned object. @c null is returned if no LocalParameter
   * object with the identifier exists in this KineticLaw instance.
   */ public
 LocalParameter removeLocalParameter(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.KineticLaw_removeLocalParameter__SWIG_1(swigCPtr, sid);
    LocalParameter ret = (cPtr == IntPtr.Zero) ? null : new LocalParameter(cPtr, true);
    return ret;
  }

  public override void connectToChild() {
    libsbmlPINVOKE.KineticLaw_connectToChild(swigCPtr);
  }

  
/** */ /* libsbml-internal */ public new
 void enablePackageInternal(string pkgURI, string pkgPrefix, bool flag) {
    libsbmlPINVOKE.KineticLaw_enablePackageInternal(swigCPtr, pkgURI, pkgPrefix, flag);
  }

  
/**
   * Returns the libSBML type code for this %SBML object.
   * 
   *
 * 
 * LibSBML attaches an identifying code to every kind of SBML object.  These
 * are integer constants known as <em>SBML type codes</em>.  The names of all
 * the codes begin with the characters <code>SBML_</code>.
 * @if clike The set of possible type codes for core elements is defined in
 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for
 * SBML Level&nbsp;3 packages define their own extra enumerations of type
 * codes (e.g., #SBMLLayoutTypeCode_t for the Level&nbsp;3 Layout
 * package).@endif@if java In the Java language interface for libSBML, the
 * type codes are defined as static integer constants in the interface class
 * {@link libsbmlConstants}.  @endif@if python In the Python language
 * interface for libSBML, the type codes are defined as static integer
 * constants in the interface class @link libsbml@endlink.@endif@if csharp In
 * the C# language interface for libSBML, the type codes are defined as
 * static integer constants in the interface class
 * @link libsbmlcs.libsbml@endlink.@endif  Note that different Level&nbsp;3
 * package plug-ins may use overlapping type codes; to identify the package
 * to which a given object belongs, call the <code>getPackageName()</code>
 * method on the object.
 *
 *
   *
   * @return the SBML type code for this object:
   * @link libsbml#SBML_KINETIC_LAW SBML_KINETIC_LAW@endlink (default).
   *
   *
 * @warning <span class='warning'>The specific integer values of the possible
 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
 * packages,  To fully identify the correct code, <strong>it is necessary to
 * invoke both getTypeCode() and getPackageName()</strong>.</span>
 *
 *
   *
   * @see getElementName()
   * @see getPackageName()
   */ public new
 int getTypeCode() {
    int ret = libsbmlPINVOKE.KineticLaw_getTypeCode(swigCPtr);
    return ret;
  }

  
/**
   * Returns the XML element name of this object, which for Species, is
   * always @c 'kineticLaw'.
   * 
   * @return the name of this element, i.e., @c 'kineticLaw'.
   */ public new
 string getElementName() {
    string ret = libsbmlPINVOKE.KineticLaw_getElementName(swigCPtr);
    return ret;
  }

  
/**
   * Predicate returning @c true if all the required attributes for this
   * KineticLaw object have been set.
   *
   * The required attributes for a KineticLaw object are:
   * @li 'formula' (SBML Level&nbsp;1 only)
   *
   * @return @c true if the required attributes have been set, @c false
   * otherwise.
   */ public new
 bool hasRequiredAttributes() {
    bool ret = libsbmlPINVOKE.KineticLaw_hasRequiredAttributes(swigCPtr);
    return ret;
  }

  
/**
   * Predicate returning @c true if all the required elements for this
   * KineticLaw object have been set.
   *
   * @note The required elements for a KineticLaw object are:
   * @li 'math' inSBML Level&nbsp;2 and Level&nbsp;3 Version&nbsp;1.  
   *     (In SBML Level&nbsp;3 Version&nbsp;2+, it is no longer required.)
   *
   * @return a boolean value indicating whether all the required
   * elements for this object have been defined.
   */ public new
 bool hasRequiredElements() {
    bool ret = libsbmlPINVOKE.KineticLaw_hasRequiredElements(swigCPtr);
    return ret;
  }

  
/**
   * Finds this KineticLaw's Reaction parent and calls unsetKineticLaw() on
   * it, indirectly deleting itself.
   *
   * Overridden from the SBase function since the parent is not a ListOf.
   *
   *
 * @return integer value indicating success/failure of the
 * function.  @if clike The value is drawn from the
 * enumeration #OperationReturnValues_t. @endif The possible values
 * returned by this function are:
 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
   * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
   */ public new
 int removeFromParentAndDelete() {
    int ret = libsbmlPINVOKE.KineticLaw_removeFromParentAndDelete(swigCPtr);
    return ret;
  }

  
/**
   *
 * Replaces all uses of a given @c SIdRef type attribute value with another
 * value.
 *
 *
 * 

 * In SBML, object identifiers are of a data type called <code>SId</code>.
 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
 * introduced for attribute values that refer to <code>SId</code> values; in
 * previous Levels of SBML, this data type did not exist and attributes were
 * simply described to as 'referring to an identifier', but the effective
 * data type was the same as <code>SIdRef</code> in Level&nbsp;3.  These and
 * other methods of libSBML refer to the type <code>SIdRef</code> for all
 * Levels of SBML, even if the corresponding SBML specification did not
 * explicitly name the data type.
 *
 *
 *
 * This method works by looking at all attributes and (if appropriate)
 * mathematical formulas in MathML content, comparing the referenced
 * identifiers to the value of @p oldid.  If any matches are found, the
 * matching values are replaced with @p newid.  The method does @em not
 * descend into child elements.
 *
 * @param oldid the old identifier.
 * @param newid the new identifier.
 *
 *
   */ public new
 void renameSIdRefs(string oldid, string newid) {
    libsbmlPINVOKE.KineticLaw_renameSIdRefs(swigCPtr, oldid, newid);
  }

  
/**
   *
 * Replaces all uses of a given @c UnitSIdRef type attribute value with
 * another value.
 *
 *
 * 
 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>.  In
 * SBML Level&nbsp;3, an explicit data type called <code>UnitSIdRef</code> was
 * introduced for attribute values that refer to <code>UnitSId</code> values; in
 * previous Levels of SBML, this data type did not exist and attributes were
 * simply described to as 'referring to a unit identifier', but the effective
 * data type was the same as <code>UnitSIdRef</code> in Level&nbsp;3.  These and
 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all
 * Levels of SBML, even if the corresponding SBML specification did not
 * explicitly name the data type.
 *
 *
 *
 * This method works by looking at all unit identifier attribute values
 * (including, if appropriate, inside mathematical formulas), comparing the
 * referenced unit identifiers to the value of @p oldid.  If any matches
 * are found, the matching values are replaced with @p newid.  The method
 * does @em not descend into child elements.
 *
 * @param oldid the old identifier.
 * @param newid the new identifier.
 *
 *
   */ public new
 void renameUnitSIdRefs(string oldid, string newid) {
    libsbmlPINVOKE.KineticLaw_renameUnitSIdRefs(swigCPtr, oldid, newid);
  }

  
/** */ /* libsbml-internal */ public new
 void replaceSIDWithFunction(string id, ASTNode function) {
    libsbmlPINVOKE.KineticLaw_replaceSIDWithFunction(swigCPtr, id, ASTNode.getCPtr(function));
  }

  
/** */ /* libsbml-internal */ public new
 void divideAssignmentsToSIdByFunction(string id, ASTNode function) {
    libsbmlPINVOKE.KineticLaw_divideAssignmentsToSIdByFunction(swigCPtr, id, ASTNode.getCPtr(function));
  }

  
/** */ /* libsbml-internal */ public new
 void multiplyAssignmentsToSIdByFunction(string id, ASTNode function) {
    libsbmlPINVOKE.KineticLaw_multiplyAssignmentsToSIdByFunction(swigCPtr, id, ASTNode.getCPtr(function));
  }

}

}
