001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.10
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 * <span class="pkg-marker pkg-color-comp"><a href="group__comp.html">comp</a></span>
013 A model used in model composition.
014 <p>
015 * The <a href='../../../extensions-summary.html#comp'>Hierarchical Model Composition</a> (&ldquo;comp&rdquo;) package allows multiple {@link Model} objects
016 * to be defined in a single {@link SBMLDocument}.  While these new {@link Model} objects are
017 * not new SBML classes, they are given a new name,
018 * <code>&lt;modelDefinition&gt;</code>, and reside in ListOfModelDefinition
019 * objects.  In libSBML, this class inherits from the {@link Model} class, changing
020 * only the expected parent of the object, and the XML name.
021 <p>
022 * An additional restriction is placed on the 'id' attribute of {@link ModelDefinition}
023 * objects:  not only must it be unique across all such attributes of type SId 
024 * within the ModelDefintion, it must also be unique across all {@link Model}, 
025 * {@link ModelDefinition}, and {@link ExternalModelDefinition} objects in the same {@link SBMLDocument}.
026 */
027
028public class ModelDefinition extends Model {
029   private long swigCPtr;
030
031   protected ModelDefinition(long cPtr, boolean cMemoryOwn)
032   {
033     super(libsbmlJNI.ModelDefinition_SWIGUpcast(cPtr), cMemoryOwn);
034     swigCPtr = cPtr;
035   }
036
037   protected static long getCPtr(ModelDefinition obj)
038   {
039     return (obj == null) ? 0 : obj.swigCPtr;
040   }
041
042   protected static long getCPtrAndDisown (ModelDefinition obj)
043   {
044     long ptr = 0;
045
046     if (obj != null)
047     {
048       ptr             = obj.swigCPtr;
049       obj.swigCMemOwn = false;
050     }
051
052     return ptr;
053   }
054
055  protected void finalize() {
056    delete();
057  }
058
059  public synchronized void delete() {
060    if (swigCPtr != 0) {
061      if (swigCMemOwn) {
062        swigCMemOwn = false;
063        libsbmlJNI.delete_ModelDefinition(swigCPtr);
064      }
065      swigCPtr = 0;
066    }
067    super.delete();
068  }
069
070  
071/**
072   * Creates a new {@link ModelDefinition} with the given level, version, and package
073   * version.
074   <p>
075   * @param level the SBML Level
076   * @param version the Version within the SBML Level
077   * @param pkgVersion the version of the package
078   */ public
079 ModelDefinition(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
080    this(libsbmlJNI.new_ModelDefinition__SWIG_0(level, version, pkgVersion), true);
081  }
082
083  
084/**
085   * Creates a new {@link ModelDefinition} with the given level, version, and package
086   * version.
087   <p>
088   * @param level the SBML Level
089   * @param version the Version within the SBML Level
090   * @param pkgVersion the version of the package
091   */ public
092 ModelDefinition(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
093    this(libsbmlJNI.new_ModelDefinition__SWIG_1(level, version), true);
094  }
095
096  
097/**
098   * Creates a new {@link ModelDefinition} with the given level, version, and package
099   * version.
100   <p>
101   * @param level the SBML Level
102   * @param version the Version within the SBML Level
103   * @param pkgVersion the version of the package
104   */ public
105 ModelDefinition(long level) throws org.sbml.libsbml.SBMLConstructorException {
106    this(libsbmlJNI.new_ModelDefinition__SWIG_2(level), true);
107  }
108
109  
110/**
111   * Creates a new {@link ModelDefinition} with the given level, version, and package
112   * version.
113   <p>
114   * @param level the SBML Level
115   * @param version the Version within the SBML Level
116   * @param pkgVersion the version of the package
117   */ public
118 ModelDefinition() throws org.sbml.libsbml.SBMLConstructorException {
119    this(libsbmlJNI.new_ModelDefinition__SWIG_3(), true);
120  }
121
122  
123/**
124   * Creates a new {@link ModelDefinition} with the given {@link CompPkgNamespaces} object.
125   <p>
126   * @param compns the namespace to use
127   */ public
128 ModelDefinition(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException {
129    this(libsbmlJNI.new_ModelDefinition__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true);
130  }
131
132  
133/**
134   * Copy constructor from base {@link Model} object.
135   */ public
136 ModelDefinition(Model source) throws org.sbml.libsbml.SBMLConstructorException {
137    this(libsbmlJNI.new_ModelDefinition__SWIG_5(Model.getCPtr(source), source), true);
138  }
139
140  
141/**
142   * Creates and returns a deep copy of this {@link ModelDefinition} object.
143   <p>
144   * @return a (deep) copy of this {@link ModelDefinition} object
145   */ public
146 ModelDefinition cloneObject() {
147    long cPtr = libsbmlJNI.ModelDefinition_cloneObject(swigCPtr, this);
148    return (cPtr == 0) ? null : new ModelDefinition(cPtr, true);
149  }
150
151  
152/**
153   * Returns the XML element name of this object.
154   <p>
155   * The only difference between a {@link Model} and a {@link ModelDefinition} is the
156   * element name ('modelDefinition').
157   <p>
158   * @return the name of this element, as a text string.
159   <p>
160   * @see #getTypeCode()
161   */ public
162 String getElementName() {
163    return libsbmlJNI.ModelDefinition_getElementName(swigCPtr, this);
164  }
165
166  
167/**
168   * Returns the libSBML type code of this object instance.
169   <p>
170   * <p>
171 * LibSBML attaches an identifying code to every kind of SBML object.  These
172 * are integer constants known as <em>SBML type codes</em>.  The names of all
173 * the codes begin with the characters <code>SBML_</code>.
174 * In the Java language interface for libSBML, the
175 * type codes are defined as static integer constants in the interface class
176 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
177 * package plug-ins may use overlapping type codes; to identify the package
178 * to which a given object belongs, call the <code>getPackageName()</code>
179 * method on the object.
180   <p>
181   * @return the SBML type code for this object:
182   * {@link libsbmlConstants#SBML_COMP_MODELDEFINITION SBML_COMP_MODELDEFINITION}
183   <p>
184   * <p>
185 * @warning <span class='warning'>The specific integer values of the possible
186 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
187 * packages,  To fully identify the correct code, <strong>it is necessary to
188 * invoke both getTypeCode() and getPackageName()</strong>.</span>
189   <p>
190   * @see #getElementName()
191   * @see #getPackageName()
192   */ public
193 int getTypeCode() {
194    return libsbmlJNI.ModelDefinition_getTypeCode(swigCPtr, this);
195  }
196
197  
198/**
199   * Finds this {@link Model}'s parent {@link ListOfModelDefinitions} and removes itself from
200   * it and deletes itself.
201   <p>
202   * This method actually just calls the {@link SBase} function, since the {@link Model}
203   * class overrides it, but that's actually what we want to happen here.
204   <p>
205   * <p>
206 * @return integer value indicating success/failure of the
207 * function.   The possible values
208 * returned by this function are:
209   * <ul>
210   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
211   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
212   * </ul>
213   */ public
214 int removeFromParentAndDelete() {
215    return libsbmlJNI.ModelDefinition_removeFromParentAndDelete(swigCPtr, this);
216  }
217
218}