/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.0
 *
 * 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;

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

  ~Model() {
    Dispose();
  }

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

  public Model(long level, long version) : this(libsbmlPINVOKE.new_Model__SWIG_0(level, version), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public Model(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_Model__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public Model(Model orig) : this(libsbmlPINVOKE.new_Model__SWIG_2(Model.getCPtr(orig)), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public new Model clone() {
    IntPtr cPtr = libsbmlPINVOKE.Model_clone(swigCPtr);
    Model ret = (cPtr == IntPtr.Zero) ? null : new Model(cPtr, true);
    return ret;
  }

  public new string getId() {
    string ret = libsbmlPINVOKE.Model_getId(swigCPtr);
    return ret;
  }

  public new string getName() {
    string ret = libsbmlPINVOKE.Model_getName(swigCPtr);
    return ret;
  }

  public string getSubstanceUnits() {
    string ret = libsbmlPINVOKE.Model_getSubstanceUnits(swigCPtr);
    return ret;
  }

  public string getTimeUnits() {
    string ret = libsbmlPINVOKE.Model_getTimeUnits(swigCPtr);
    return ret;
  }

  public string getVolumeUnits() {
    string ret = libsbmlPINVOKE.Model_getVolumeUnits(swigCPtr);
    return ret;
  }

  public string getAreaUnits() {
    string ret = libsbmlPINVOKE.Model_getAreaUnits(swigCPtr);
    return ret;
  }

  public string getLengthUnits() {
    string ret = libsbmlPINVOKE.Model_getLengthUnits(swigCPtr);
    return ret;
  }

  public string getExtentUnits() {
    string ret = libsbmlPINVOKE.Model_getExtentUnits(swigCPtr);
    return ret;
  }

  public string getConversionFactor() {
    string ret = libsbmlPINVOKE.Model_getConversionFactor(swigCPtr);
    return ret;
  }

  public new bool isSetId() {
    bool ret = libsbmlPINVOKE.Model_isSetId(swigCPtr);
    return ret;
  }

  public new bool isSetName() {
    bool ret = libsbmlPINVOKE.Model_isSetName(swigCPtr);
    return ret;
  }

  public bool isSetSubstanceUnits() {
    bool ret = libsbmlPINVOKE.Model_isSetSubstanceUnits(swigCPtr);
    return ret;
  }

  public bool isSetTimeUnits() {
    bool ret = libsbmlPINVOKE.Model_isSetTimeUnits(swigCPtr);
    return ret;
  }

  public bool isSetVolumeUnits() {
    bool ret = libsbmlPINVOKE.Model_isSetVolumeUnits(swigCPtr);
    return ret;
  }

  public bool isSetAreaUnits() {
    bool ret = libsbmlPINVOKE.Model_isSetAreaUnits(swigCPtr);
    return ret;
  }

  public bool isSetLengthUnits() {
    bool ret = libsbmlPINVOKE.Model_isSetLengthUnits(swigCPtr);
    return ret;
  }

  public bool isSetExtentUnits() {
    bool ret = libsbmlPINVOKE.Model_isSetExtentUnits(swigCPtr);
    return ret;
  }

  public bool isSetConversionFactor() {
    bool ret = libsbmlPINVOKE.Model_isSetConversionFactor(swigCPtr);
    return ret;
  }

  public new int setId(string sid) {
    int ret = libsbmlPINVOKE.Model_setId(swigCPtr, sid);
    return ret;
  }

  public new int setName(string name) {
    int ret = libsbmlPINVOKE.Model_setName(swigCPtr, name);
    return ret;
  }

  public int setSubstanceUnits(string units) {
    int ret = libsbmlPINVOKE.Model_setSubstanceUnits(swigCPtr, units);
    return ret;
  }

  public int setTimeUnits(string units) {
    int ret = libsbmlPINVOKE.Model_setTimeUnits(swigCPtr, units);
    return ret;
  }

  public int setVolumeUnits(string units) {
    int ret = libsbmlPINVOKE.Model_setVolumeUnits(swigCPtr, units);
    return ret;
  }

  public int setAreaUnits(string units) {
    int ret = libsbmlPINVOKE.Model_setAreaUnits(swigCPtr, units);
    return ret;
  }

  public int setLengthUnits(string units) {
    int ret = libsbmlPINVOKE.Model_setLengthUnits(swigCPtr, units);
    return ret;
  }

  public int setExtentUnits(string units) {
    int ret = libsbmlPINVOKE.Model_setExtentUnits(swigCPtr, units);
    return ret;
  }

  public int setConversionFactor(string units) {
    int ret = libsbmlPINVOKE.Model_setConversionFactor(swigCPtr, units);
    return ret;
  }

  public int unsetId() {
    int ret = libsbmlPINVOKE.Model_unsetId(swigCPtr);
    return ret;
  }

  public int unsetName() {
    int ret = libsbmlPINVOKE.Model_unsetName(swigCPtr);
    return ret;
  }

  public int unsetSubstanceUnits() {
    int ret = libsbmlPINVOKE.Model_unsetSubstanceUnits(swigCPtr);
    return ret;
  }

  public int unsetTimeUnits() {
    int ret = libsbmlPINVOKE.Model_unsetTimeUnits(swigCPtr);
    return ret;
  }

  public int unsetVolumeUnits() {
    int ret = libsbmlPINVOKE.Model_unsetVolumeUnits(swigCPtr);
    return ret;
  }

  public int unsetAreaUnits() {
    int ret = libsbmlPINVOKE.Model_unsetAreaUnits(swigCPtr);
    return ret;
  }

  public int unsetLengthUnits() {
    int ret = libsbmlPINVOKE.Model_unsetLengthUnits(swigCPtr);
    return ret;
  }

  public int unsetExtentUnits() {
    int ret = libsbmlPINVOKE.Model_unsetExtentUnits(swigCPtr);
    return ret;
  }

  public int unsetConversionFactor() {
    int ret = libsbmlPINVOKE.Model_unsetConversionFactor(swigCPtr);
    return ret;
  }

  public int addFunctionDefinition(FunctionDefinition fd) {
    int ret = libsbmlPINVOKE.Model_addFunctionDefinition(swigCPtr, FunctionDefinition.getCPtr(fd));
    return ret;
  }

  public int addUnitDefinition(UnitDefinition ud) {
    int ret = libsbmlPINVOKE.Model_addUnitDefinition(swigCPtr, UnitDefinition.getCPtr(ud));
    return ret;
  }

  public int addCompartmentType(CompartmentType ct) {
    int ret = libsbmlPINVOKE.Model_addCompartmentType(swigCPtr, CompartmentType.getCPtr(ct));
    return ret;
  }

  public int addSpeciesType(SpeciesType st) {
    int ret = libsbmlPINVOKE.Model_addSpeciesType(swigCPtr, SpeciesType.getCPtr(st));
    return ret;
  }

  public int addCompartment(Compartment c) {
    int ret = libsbmlPINVOKE.Model_addCompartment(swigCPtr, Compartment.getCPtr(c));
    return ret;
  }

  public int addSpecies(Species s) {
    int ret = libsbmlPINVOKE.Model_addSpecies(swigCPtr, Species.getCPtr(s));
    return ret;
  }

  public int addParameter(Parameter p) {
    int ret = libsbmlPINVOKE.Model_addParameter(swigCPtr, Parameter.getCPtr(p));
    return ret;
  }

  public int addInitialAssignment(InitialAssignment ia) {
    int ret = libsbmlPINVOKE.Model_addInitialAssignment(swigCPtr, InitialAssignment.getCPtr(ia));
    return ret;
  }

  public int addRule(Rule r) {
    int ret = libsbmlPINVOKE.Model_addRule(swigCPtr, Rule.getCPtr(r));
    return ret;
  }

  public int addConstraint(Constraint c) {
    int ret = libsbmlPINVOKE.Model_addConstraint(swigCPtr, Constraint.getCPtr(c));
    return ret;
  }

  public int addReaction(Reaction r) {
    int ret = libsbmlPINVOKE.Model_addReaction(swigCPtr, Reaction.getCPtr(r));
    return ret;
  }

  public int addEvent(Event e) {
    int ret = libsbmlPINVOKE.Model_addEvent(swigCPtr, Event.getCPtr(e));
    return ret;
  }

  public FunctionDefinition createFunctionDefinition() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createFunctionDefinition(swigCPtr);
    FunctionDefinition ret = (cPtr == IntPtr.Zero) ? null : new FunctionDefinition(cPtr, false);
    return ret;
  }

  public UnitDefinition createUnitDefinition() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createUnitDefinition(swigCPtr);
    UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, false);
    return ret;
  }

  public Unit createUnit() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createUnit(swigCPtr);
    Unit ret = (cPtr == IntPtr.Zero) ? null : new Unit(cPtr, false);
    return ret;
  }

  public CompartmentType createCompartmentType() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createCompartmentType(swigCPtr);
    CompartmentType ret = (cPtr == IntPtr.Zero) ? null : new CompartmentType(cPtr, false);
    return ret;
  }

  public SpeciesType createSpeciesType() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createSpeciesType(swigCPtr);
    SpeciesType ret = (cPtr == IntPtr.Zero) ? null : new SpeciesType(cPtr, false);
    return ret;
  }

  public Compartment createCompartment() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createCompartment(swigCPtr);
    Compartment ret = (cPtr == IntPtr.Zero) ? null : new Compartment(cPtr, false);
    return ret;
  }

  public Species createSpecies() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createSpecies(swigCPtr);
    Species ret = (cPtr == IntPtr.Zero) ? null : new Species(cPtr, false);
    return ret;
  }

  public Parameter createParameter() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createParameter(swigCPtr);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, false);
    return ret;
  }

  public InitialAssignment createInitialAssignment() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createInitialAssignment(swigCPtr);
    InitialAssignment ret = (cPtr == IntPtr.Zero) ? null : new InitialAssignment(cPtr, false);
    return ret;
  }

  public AlgebraicRule createAlgebraicRule() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createAlgebraicRule(swigCPtr);
    AlgebraicRule ret = (cPtr == IntPtr.Zero) ? null : new AlgebraicRule(cPtr, false);
    return ret;
  }

  public AssignmentRule createAssignmentRule() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createAssignmentRule(swigCPtr);
    AssignmentRule ret = (cPtr == IntPtr.Zero) ? null : new AssignmentRule(cPtr, false);
    return ret;
  }

  public RateRule createRateRule() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createRateRule(swigCPtr);
    RateRule ret = (cPtr == IntPtr.Zero) ? null : new RateRule(cPtr, false);
    return ret;
  }

  public Constraint createConstraint() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createConstraint(swigCPtr);
    Constraint ret = (cPtr == IntPtr.Zero) ? null : new Constraint(cPtr, false);
    return ret;
  }

  public Reaction createReaction() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createReaction(swigCPtr);
    Reaction ret = (cPtr == IntPtr.Zero) ? null : new Reaction(cPtr, false);
    return ret;
  }

  public SpeciesReference createReactant() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createReactant(swigCPtr);
    SpeciesReference ret = (cPtr == IntPtr.Zero) ? null : new SpeciesReference(cPtr, false);
    return ret;
  }

  public SpeciesReference createProduct() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createProduct(swigCPtr);
    SpeciesReference ret = (cPtr == IntPtr.Zero) ? null : new SpeciesReference(cPtr, false);
    return ret;
  }

  public ModifierSpeciesReference createModifier() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createModifier(swigCPtr);
    ModifierSpeciesReference ret = (cPtr == IntPtr.Zero) ? null : new ModifierSpeciesReference(cPtr, false);
    return ret;
  }

  public KineticLaw createKineticLaw() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createKineticLaw(swigCPtr);
    KineticLaw ret = (cPtr == IntPtr.Zero) ? null : new KineticLaw(cPtr, false);
    return ret;
  }

  public Parameter createKineticLawParameter() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createKineticLawParameter(swigCPtr);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, false);
    return ret;
  }

  public LocalParameter createKineticLawLocalParameter() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createKineticLawLocalParameter(swigCPtr);
    LocalParameter ret = (cPtr == IntPtr.Zero) ? null : new LocalParameter(cPtr, false);
    return ret;
  }

  public Event createEvent() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createEvent(swigCPtr);
    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, false);
    return ret;
  }

  public EventAssignment createEventAssignment() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createEventAssignment(swigCPtr);
    EventAssignment ret = (cPtr == IntPtr.Zero) ? null : new EventAssignment(cPtr, false);
    return ret;
  }

  public Trigger createTrigger() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createTrigger(swigCPtr);
    Trigger ret = (cPtr == IntPtr.Zero) ? null : new Trigger(cPtr, false);
    return ret;
  }

  public Delay createDelay() {
    IntPtr cPtr = libsbmlPINVOKE.Model_createDelay(swigCPtr);
    Delay ret = (cPtr == IntPtr.Zero) ? null : new Delay(cPtr, false);
    return ret;
  }

  public override int setAnnotation(XMLNode annotation) {
    int ret = libsbmlPINVOKE.Model_setAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
    return ret;
  }

  public override int setAnnotation(string annotation) {
    int ret = libsbmlPINVOKE.Model_setAnnotation__SWIG_1(swigCPtr, annotation);
    return ret;
  }

  public override int appendAnnotation(XMLNode annotation) {
    int ret = libsbmlPINVOKE.Model_appendAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation));
    return ret;
  }

  public override int appendAnnotation(string annotation) {
    int ret = libsbmlPINVOKE.Model_appendAnnotation__SWIG_1(swigCPtr, annotation);
    return ret;
  }

  public ListOfFunctionDefinitions getListOfFunctionDefinitions() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfFunctionDefinitions__SWIG_0(swigCPtr);
    ListOfFunctionDefinitions ret = (cPtr == IntPtr.Zero) ? null : new ListOfFunctionDefinitions(cPtr, false);
    return ret;
  }

  public ListOfUnitDefinitions getListOfUnitDefinitions() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfUnitDefinitions__SWIG_0(swigCPtr);
    ListOfUnitDefinitions ret = (cPtr == IntPtr.Zero) ? null : new ListOfUnitDefinitions(cPtr, false);
    return ret;
  }

  public ListOfCompartmentTypes getListOfCompartmentTypes() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfCompartmentTypes__SWIG_0(swigCPtr);
    ListOfCompartmentTypes ret = (cPtr == IntPtr.Zero) ? null : new ListOfCompartmentTypes(cPtr, false);
    return ret;
  }

  public ListOfSpeciesTypes getListOfSpeciesTypes() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfSpeciesTypes__SWIG_0(swigCPtr);
    ListOfSpeciesTypes ret = (cPtr == IntPtr.Zero) ? null : new ListOfSpeciesTypes(cPtr, false);
    return ret;
  }

  public ListOfCompartments getListOfCompartments() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfCompartments__SWIG_0(swigCPtr);
    ListOfCompartments ret = (cPtr == IntPtr.Zero) ? null : new ListOfCompartments(cPtr, false);
    return ret;
  }

  public ListOfSpecies getListOfSpecies() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfSpecies__SWIG_0(swigCPtr);
    ListOfSpecies ret = (cPtr == IntPtr.Zero) ? null : new ListOfSpecies(cPtr, false);
    return ret;
  }

  public ListOfParameters getListOfParameters() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfParameters__SWIG_0(swigCPtr);
    ListOfParameters ret = (cPtr == IntPtr.Zero) ? null : new ListOfParameters(cPtr, false);
    return ret;
  }

  public ListOfInitialAssignments getListOfInitialAssignments() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfInitialAssignments__SWIG_0(swigCPtr);
    ListOfInitialAssignments ret = (cPtr == IntPtr.Zero) ? null : new ListOfInitialAssignments(cPtr, false);
    return ret;
  }

  public ListOfRules getListOfRules() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfRules__SWIG_0(swigCPtr);
    ListOfRules ret = (cPtr == IntPtr.Zero) ? null : new ListOfRules(cPtr, false);
    return ret;
  }

  public ListOfConstraints getListOfConstraints() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfConstraints__SWIG_0(swigCPtr);
    ListOfConstraints ret = (cPtr == IntPtr.Zero) ? null : new ListOfConstraints(cPtr, false);
    return ret;
  }

  public ListOfReactions getListOfReactions() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfReactions__SWIG_0(swigCPtr);
    ListOfReactions ret = (cPtr == IntPtr.Zero) ? null : new ListOfReactions(cPtr, false);
    return ret;
  }

  public ListOfEvents getListOfEvents() {
    IntPtr cPtr = libsbmlPINVOKE.Model_getListOfEvents__SWIG_0(swigCPtr);
    ListOfEvents ret = (cPtr == IntPtr.Zero) ? null : new ListOfEvents(cPtr, false);
    return ret;
  }

  public FunctionDefinition getFunctionDefinition(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getFunctionDefinition__SWIG_0(swigCPtr, n);
    FunctionDefinition ret = (cPtr == IntPtr.Zero) ? null : new FunctionDefinition(cPtr, false);
    return ret;
  }

  public FunctionDefinition getFunctionDefinition(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getFunctionDefinition__SWIG_2(swigCPtr, sid);
    FunctionDefinition ret = (cPtr == IntPtr.Zero) ? null : new FunctionDefinition(cPtr, false);
    return ret;
  }

  public UnitDefinition getUnitDefinition(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getUnitDefinition__SWIG_0(swigCPtr, n);
    UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, false);
    return ret;
  }

  public UnitDefinition getUnitDefinition(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getUnitDefinition__SWIG_2(swigCPtr, sid);
    UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, false);
    return ret;
  }

  public CompartmentType getCompartmentType(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getCompartmentType__SWIG_0(swigCPtr, n);
    CompartmentType ret = (cPtr == IntPtr.Zero) ? null : new CompartmentType(cPtr, false);
    return ret;
  }

  public CompartmentType getCompartmentType(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getCompartmentType__SWIG_2(swigCPtr, sid);
    CompartmentType ret = (cPtr == IntPtr.Zero) ? null : new CompartmentType(cPtr, false);
    return ret;
  }

  public SpeciesType getSpeciesType(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getSpeciesType__SWIG_0(swigCPtr, n);
    SpeciesType ret = (cPtr == IntPtr.Zero) ? null : new SpeciesType(cPtr, false);
    return ret;
  }

  public SpeciesType getSpeciesType(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getSpeciesType__SWIG_2(swigCPtr, sid);
    SpeciesType ret = (cPtr == IntPtr.Zero) ? null : new SpeciesType(cPtr, false);
    return ret;
  }

  public Compartment getCompartment(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getCompartment__SWIG_0(swigCPtr, n);
    Compartment ret = (cPtr == IntPtr.Zero) ? null : new Compartment(cPtr, false);
    return ret;
  }

  public Compartment getCompartment(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getCompartment__SWIG_2(swigCPtr, sid);
    Compartment ret = (cPtr == IntPtr.Zero) ? null : new Compartment(cPtr, false);
    return ret;
  }

  public Species getSpecies(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getSpecies__SWIG_0(swigCPtr, n);
    Species ret = (cPtr == IntPtr.Zero) ? null : new Species(cPtr, false);
    return ret;
  }

  public Species getSpecies(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getSpecies__SWIG_2(swigCPtr, sid);
    Species ret = (cPtr == IntPtr.Zero) ? null : new Species(cPtr, false);
    return ret;
  }

  public Parameter getParameter(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getParameter__SWIG_0(swigCPtr, n);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, false);
    return ret;
  }

  public Parameter getParameter(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getParameter__SWIG_2(swigCPtr, sid);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, false);
    return ret;
  }

  public InitialAssignment getInitialAssignment(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getInitialAssignment__SWIG_0(swigCPtr, n);
    InitialAssignment ret = (cPtr == IntPtr.Zero) ? null : new InitialAssignment(cPtr, false);
    return ret;
  }

  public InitialAssignment getInitialAssignment(string symbol) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getInitialAssignment__SWIG_2(swigCPtr, symbol);
    InitialAssignment ret = (cPtr == IntPtr.Zero) ? null : new InitialAssignment(cPtr, false);
    return ret;
  }

  public Rule getRule(long n) {
        Rule ret = (Rule) libsbml.DowncastSBase(libsbmlPINVOKE.Model_getRule__SWIG_0(swigCPtr, n), false);
	return ret;
}

  public Rule getRule(string variable) {
        Rule ret = (Rule) libsbml.DowncastSBase(libsbmlPINVOKE.Model_getRule__SWIG_2(swigCPtr, variable), false);
	return ret;
}

  public Constraint getConstraint(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getConstraint__SWIG_0(swigCPtr, n);
    Constraint ret = (cPtr == IntPtr.Zero) ? null : new Constraint(cPtr, false);
    return ret;
  }

  public Reaction getReaction(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getReaction__SWIG_0(swigCPtr, n);
    Reaction ret = (cPtr == IntPtr.Zero) ? null : new Reaction(cPtr, false);
    return ret;
  }

  public Reaction getReaction(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getReaction__SWIG_2(swigCPtr, sid);
    Reaction ret = (cPtr == IntPtr.Zero) ? null : new Reaction(cPtr, false);
    return ret;
  }

  public SpeciesReference getSpeciesReference(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getSpeciesReference__SWIG_0(swigCPtr, sid);
    SpeciesReference ret = (cPtr == IntPtr.Zero) ? null : new SpeciesReference(cPtr, false);
    return ret;
  }

  public Event getEvent(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getEvent__SWIG_0(swigCPtr, n);
    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, false);
    return ret;
  }

  public Event getEvent(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_getEvent__SWIG_2(swigCPtr, sid);
    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, false);
    return ret;
  }

  public long getNumFunctionDefinitions() { return (long)libsbmlPINVOKE.Model_getNumFunctionDefinitions(swigCPtr); }

  public long getNumUnitDefinitions() { return (long)libsbmlPINVOKE.Model_getNumUnitDefinitions(swigCPtr); }

  public long getNumCompartmentTypes() { return (long)libsbmlPINVOKE.Model_getNumCompartmentTypes(swigCPtr); }

  public long getNumSpeciesTypes() { return (long)libsbmlPINVOKE.Model_getNumSpeciesTypes(swigCPtr); }

  public long getNumCompartments() { return (long)libsbmlPINVOKE.Model_getNumCompartments(swigCPtr); }

  public long getNumSpecies() { return (long)libsbmlPINVOKE.Model_getNumSpecies(swigCPtr); }

  public long getNumSpeciesWithBoundaryCondition() { return (long)libsbmlPINVOKE.Model_getNumSpeciesWithBoundaryCondition(swigCPtr); }

  public long getNumParameters() { return (long)libsbmlPINVOKE.Model_getNumParameters(swigCPtr); }

  public long getNumInitialAssignments() { return (long)libsbmlPINVOKE.Model_getNumInitialAssignments(swigCPtr); }

  public long getNumRules() { return (long)libsbmlPINVOKE.Model_getNumRules(swigCPtr); }

  public long getNumConstraints() { return (long)libsbmlPINVOKE.Model_getNumConstraints(swigCPtr); }

  public long getNumReactions() { return (long)libsbmlPINVOKE.Model_getNumReactions(swigCPtr); }

  public long getNumEvents() { return (long)libsbmlPINVOKE.Model_getNumEvents(swigCPtr); }

  public void convertL1ToL2() {
    libsbmlPINVOKE.Model_convertL1ToL2(swigCPtr);
  }

  public void convertL1ToL3() {
    libsbmlPINVOKE.Model_convertL1ToL3(swigCPtr);
  }

  public void convertL2ToL3() {
    libsbmlPINVOKE.Model_convertL2ToL3(swigCPtr);
  }

  public void convertL2ToL1(bool strict) {
    libsbmlPINVOKE.Model_convertL2ToL1__SWIG_0(swigCPtr, strict);
  }

  public void convertL2ToL1() {
    libsbmlPINVOKE.Model_convertL2ToL1__SWIG_1(swigCPtr);
  }

  public void convertL3ToL1() {
    libsbmlPINVOKE.Model_convertL3ToL1(swigCPtr);
  }

  public void convertL3ToL2() {
    libsbmlPINVOKE.Model_convertL3ToL2(swigCPtr);
  }

  public void addModifiers() {
    libsbmlPINVOKE.Model_addModifiers(swigCPtr);
  }

  public void addConstantAttribute() {
    libsbmlPINVOKE.Model_addConstantAttribute(swigCPtr);
  }

  public void setSpatialDimensions(double dims) {
    libsbmlPINVOKE.Model_setSpatialDimensions__SWIG_0(swigCPtr, dims);
  }

  public void setSpatialDimensions() {
    libsbmlPINVOKE.Model_setSpatialDimensions__SWIG_1(swigCPtr);
  }

  public void addDefinitionsForDefaultUnits() {
    libsbmlPINVOKE.Model_addDefinitionsForDefaultUnits(swigCPtr);
  }

  public void convertParametersToLocals(long level, long version) {
    libsbmlPINVOKE.Model_convertParametersToLocals(swigCPtr, level, version);
  }

  public void setSpeciesReferenceConstantValueAndStoichiometry() {
    libsbmlPINVOKE.Model_setSpeciesReferenceConstantValueAndStoichiometry(swigCPtr);
  }

  public void removeParameterRuleUnits() {
    libsbmlPINVOKE.Model_removeParameterRuleUnits(swigCPtr);
  }

  public void convertStoichiometryMath() {
    libsbmlPINVOKE.Model_convertStoichiometryMath(swigCPtr);
  }

  public void assignRequiredValues() {
    libsbmlPINVOKE.Model_assignRequiredValues(swigCPtr);
  }

  public void dealWithModelUnits() {
    libsbmlPINVOKE.Model_dealWithModelUnits(swigCPtr);
  }

  public void dealWithStoichiometry() {
    libsbmlPINVOKE.Model_dealWithStoichiometry(swigCPtr);
  }

  public override int getTypeCode() {
    int ret = libsbmlPINVOKE.Model_getTypeCode(swigCPtr);
    return ret;
  }

  public override string getElementName() {
    string ret = libsbmlPINVOKE.Model_getElementName(swigCPtr);
    return ret;
  }

  public void populateListFormulaUnitsData() {
    libsbmlPINVOKE.Model_populateListFormulaUnitsData(swigCPtr);
  }

  public bool isPopulatedListFormulaUnitsData() {
    bool ret = libsbmlPINVOKE.Model_isPopulatedListFormulaUnitsData(swigCPtr);
    return ret;
  }

  public override bool hasRequiredElements() {
    bool ret = libsbmlPINVOKE.Model_hasRequiredElements(swigCPtr);
    return ret;
  }

  public FunctionDefinition removeFunctionDefinition(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeFunctionDefinition__SWIG_0(swigCPtr, n);
    FunctionDefinition ret = (cPtr == IntPtr.Zero) ? null : new FunctionDefinition(cPtr, true);
    return ret;
  }

  public FunctionDefinition removeFunctionDefinition(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeFunctionDefinition__SWIG_1(swigCPtr, sid);
    FunctionDefinition ret = (cPtr == IntPtr.Zero) ? null : new FunctionDefinition(cPtr, true);
    return ret;
  }

  public UnitDefinition removeUnitDefinition(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeUnitDefinition__SWIG_0(swigCPtr, n);
    UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, true);
    return ret;
  }

  public UnitDefinition removeUnitDefinition(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeUnitDefinition__SWIG_1(swigCPtr, sid);
    UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, true);
    return ret;
  }

  public CompartmentType removeCompartmentType(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeCompartmentType__SWIG_0(swigCPtr, n);
    CompartmentType ret = (cPtr == IntPtr.Zero) ? null : new CompartmentType(cPtr, true);
    return ret;
  }

  public CompartmentType removeCompartmentType(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeCompartmentType__SWIG_1(swigCPtr, sid);
    CompartmentType ret = (cPtr == IntPtr.Zero) ? null : new CompartmentType(cPtr, true);
    return ret;
  }

  public SpeciesType removeSpeciesType(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeSpeciesType__SWIG_0(swigCPtr, n);
    SpeciesType ret = (cPtr == IntPtr.Zero) ? null : new SpeciesType(cPtr, true);
    return ret;
  }

  public SpeciesType removeSpeciesType(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeSpeciesType__SWIG_1(swigCPtr, sid);
    SpeciesType ret = (cPtr == IntPtr.Zero) ? null : new SpeciesType(cPtr, true);
    return ret;
  }

  public Compartment removeCompartment(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeCompartment__SWIG_0(swigCPtr, n);
    Compartment ret = (cPtr == IntPtr.Zero) ? null : new Compartment(cPtr, true);
    return ret;
  }

  public Compartment removeCompartment(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeCompartment__SWIG_1(swigCPtr, sid);
    Compartment ret = (cPtr == IntPtr.Zero) ? null : new Compartment(cPtr, true);
    return ret;
  }

  public Species removeSpecies(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeSpecies__SWIG_0(swigCPtr, n);
    Species ret = (cPtr == IntPtr.Zero) ? null : new Species(cPtr, true);
    return ret;
  }

  public Species removeSpecies(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeSpecies__SWIG_1(swigCPtr, sid);
    Species ret = (cPtr == IntPtr.Zero) ? null : new Species(cPtr, true);
    return ret;
  }

  public Parameter removeParameter(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeParameter__SWIG_0(swigCPtr, n);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, true);
    return ret;
  }

  public Parameter removeParameter(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeParameter__SWIG_1(swigCPtr, sid);
    Parameter ret = (cPtr == IntPtr.Zero) ? null : new Parameter(cPtr, true);
    return ret;
  }

  public InitialAssignment removeInitialAssignment(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeInitialAssignment__SWIG_0(swigCPtr, n);
    InitialAssignment ret = (cPtr == IntPtr.Zero) ? null : new InitialAssignment(cPtr, true);
    return ret;
  }

  public InitialAssignment removeInitialAssignment(string symbol) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeInitialAssignment__SWIG_1(swigCPtr, symbol);
    InitialAssignment ret = (cPtr == IntPtr.Zero) ? null : new InitialAssignment(cPtr, true);
    return ret;
  }

  public Rule removeRule(long n) {
        Rule ret = (Rule) libsbml.DowncastSBase(libsbmlPINVOKE.Model_removeRule__SWIG_0(swigCPtr, n), true);
	return ret;
}

  public Rule removeRule(string variable) {
        Rule ret = (Rule) libsbml.DowncastSBase(libsbmlPINVOKE.Model_removeRule__SWIG_1(swigCPtr, variable), true);
	return ret;
}

  public Constraint removeConstraint(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeConstraint(swigCPtr, n);
    Constraint ret = (cPtr == IntPtr.Zero) ? null : new Constraint(cPtr, true);
    return ret;
  }

  public Reaction removeReaction(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeReaction__SWIG_0(swigCPtr, n);
    Reaction ret = (cPtr == IntPtr.Zero) ? null : new Reaction(cPtr, true);
    return ret;
  }

  public Reaction removeReaction(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeReaction__SWIG_1(swigCPtr, sid);
    Reaction ret = (cPtr == IntPtr.Zero) ? null : new Reaction(cPtr, true);
    return ret;
  }

  public Event removeEvent(long n) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeEvent__SWIG_0(swigCPtr, n);
    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, true);
    return ret;
  }

  public Event removeEvent(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.Model_removeEvent__SWIG_1(swigCPtr, sid);
    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, true);
    return ret;
  }

}

}
