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