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