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> (“comp”) 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><modelDefinition></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 <p> 079 * <p> 080 * @note Attempting to add an object to an {@link SBMLDocument} having a different 081 * combination of SBML Level, Version and XML namespaces than the object 082 * itself will result in an error at the time a caller attempts to make the 083 * addition. A parent object must have compatible Level, Version and XML 084 * namespaces. (Strictly speaking, a parent may also have more XML 085 * namespaces than a child, but the reverse is not permitted.) The 086 * restriction is necessary to ensure that an SBML model has a consistent 087 * overall structure. This requires callers to manage their objects 088 * carefully, but the benefit is increased flexibility in how models can be 089 * created by permitting callers to create objects bottom-up if desired. In 090 * situations where objects are not yet attached to parents (e.g., 091 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 092 * libSBML determine such things as whether it is valid to assign a 093 * particular value to an attribute. For packages, this means that the 094 * parent object to which this package element is being added must have 095 * been created with the package namespace, or that the package namespace 096 * was added to it, even if that parent is not a package object itself. 097 */ public 098 ModelDefinition(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 099 this(libsbmlJNI.new_ModelDefinition__SWIG_0(level, version, pkgVersion), true); 100 } 101 102 103/** 104 * Creates a new {@link ModelDefinition} with the given level, version, and package 105 * version. 106 <p> 107 * @param level the SBML Level. 108 * @param version the Version within the SBML Level. 109 * @param pkgVersion the version of the package. 110 <p> 111 * <p> 112 * @note Attempting to add an object to an {@link SBMLDocument} having a different 113 * combination of SBML Level, Version and XML namespaces than the object 114 * itself will result in an error at the time a caller attempts to make the 115 * addition. A parent object must have compatible Level, Version and XML 116 * namespaces. (Strictly speaking, a parent may also have more XML 117 * namespaces than a child, but the reverse is not permitted.) The 118 * restriction is necessary to ensure that an SBML model has a consistent 119 * overall structure. This requires callers to manage their objects 120 * carefully, but the benefit is increased flexibility in how models can be 121 * created by permitting callers to create objects bottom-up if desired. In 122 * situations where objects are not yet attached to parents (e.g., 123 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 124 * libSBML determine such things as whether it is valid to assign a 125 * particular value to an attribute. For packages, this means that the 126 * parent object to which this package element is being added must have 127 * been created with the package namespace, or that the package namespace 128 * was added to it, even if that parent is not a package object itself. 129 */ public 130 ModelDefinition(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 131 this(libsbmlJNI.new_ModelDefinition__SWIG_1(level, version), true); 132 } 133 134 135/** 136 * Creates a new {@link ModelDefinition} with the given level, version, and package 137 * version. 138 <p> 139 * @param level the SBML Level. 140 * @param version the Version within the SBML Level. 141 * @param pkgVersion the version of the package. 142 <p> 143 * <p> 144 * @note Attempting to add an object to an {@link SBMLDocument} having a different 145 * combination of SBML Level, Version and XML namespaces than the object 146 * itself will result in an error at the time a caller attempts to make the 147 * addition. A parent object must have compatible Level, Version and XML 148 * namespaces. (Strictly speaking, a parent may also have more XML 149 * namespaces than a child, but the reverse is not permitted.) The 150 * restriction is necessary to ensure that an SBML model has a consistent 151 * overall structure. This requires callers to manage their objects 152 * carefully, but the benefit is increased flexibility in how models can be 153 * created by permitting callers to create objects bottom-up if desired. In 154 * situations where objects are not yet attached to parents (e.g., 155 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 156 * libSBML determine such things as whether it is valid to assign a 157 * particular value to an attribute. For packages, this means that the 158 * parent object to which this package element is being added must have 159 * been created with the package namespace, or that the package namespace 160 * was added to it, even if that parent is not a package object itself. 161 */ public 162 ModelDefinition(long level) throws org.sbml.libsbml.SBMLConstructorException { 163 this(libsbmlJNI.new_ModelDefinition__SWIG_2(level), true); 164 } 165 166 167/** 168 * Creates a new {@link ModelDefinition} with the given level, version, and package 169 * version. 170 <p> 171 * @param level the SBML Level. 172 * @param version the Version within the SBML Level. 173 * @param pkgVersion the version of the package. 174 <p> 175 * <p> 176 * @note Attempting to add an object to an {@link SBMLDocument} having a different 177 * combination of SBML Level, Version and XML namespaces than the object 178 * itself will result in an error at the time a caller attempts to make the 179 * addition. A parent object must have compatible Level, Version and XML 180 * namespaces. (Strictly speaking, a parent may also have more XML 181 * namespaces than a child, but the reverse is not permitted.) The 182 * restriction is necessary to ensure that an SBML model has a consistent 183 * overall structure. This requires callers to manage their objects 184 * carefully, but the benefit is increased flexibility in how models can be 185 * created by permitting callers to create objects bottom-up if desired. In 186 * situations where objects are not yet attached to parents (e.g., 187 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 188 * libSBML determine such things as whether it is valid to assign a 189 * particular value to an attribute. For packages, this means that the 190 * parent object to which this package element is being added must have 191 * been created with the package namespace, or that the package namespace 192 * was added to it, even if that parent is not a package object itself. 193 */ public 194 ModelDefinition() throws org.sbml.libsbml.SBMLConstructorException { 195 this(libsbmlJNI.new_ModelDefinition__SWIG_3(), true); 196 } 197 198 199/** 200 * Creates a new {@link ModelDefinition} with the given {@link CompPkgNamespaces} object. 201 <p> 202 * <p> 203 * The package namespaces object used in this constructor is derived from a 204 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 205 * information. It is used to communicate the SBML Level, Version, and 206 * package version and name information used in addition to SBML Level 3 Core. A 207 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 208 * package namespace object somewhere in a program once, then hand that object 209 * as needed to object constructors of that package that accept it as and 210 * argument, such as this one. 211 <p> 212 * @param compns the {@link CompPkgNamespaces} object. 213 <p> 214 * <p> 215 * @note Attempting to add an object to an {@link SBMLDocument} having a different 216 * combination of SBML Level, Version and XML namespaces than the object 217 * itself will result in an error at the time a caller attempts to make the 218 * addition. A parent object must have compatible Level, Version and XML 219 * namespaces. (Strictly speaking, a parent may also have more XML 220 * namespaces than a child, but the reverse is not permitted.) The 221 * restriction is necessary to ensure that an SBML model has a consistent 222 * overall structure. This requires callers to manage their objects 223 * carefully, but the benefit is increased flexibility in how models can be 224 * created by permitting callers to create objects bottom-up if desired. In 225 * situations where objects are not yet attached to parents (e.g., 226 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 227 * libSBML determine such things as whether it is valid to assign a 228 * particular value to an attribute. For packages, this means that the 229 * parent object to which this package element is being added must have 230 * been created with the package namespace, or that the package namespace 231 * was added to it, even if that parent is not a package object itself. 232 */ public 233 ModelDefinition(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 234 this(libsbmlJNI.new_ModelDefinition__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 235 } 236 237 238/** 239 * Copy constructor from base {@link Model} object. 240 <p> 241 * @param source the instance to copy. 242 */ public 243 ModelDefinition(Model source) throws org.sbml.libsbml.SBMLConstructorException { 244 this(libsbmlJNI.new_ModelDefinition__SWIG_5(Model.getCPtr(source), source), true); 245 } 246 247 248/** 249 * Creates and returns a deep copy of this {@link ModelDefinition} object. 250 <p> 251 * @return a (deep) copy of this {@link ModelDefinition} object. 252 */ public 253 ModelDefinition cloneObject() { 254 long cPtr = libsbmlJNI.ModelDefinition_cloneObject(swigCPtr, this); 255 return (cPtr == 0) ? null : new ModelDefinition(cPtr, true); 256 } 257 258 259/** 260 * Returns the XML element name of this object. 261 <p> 262 * The only difference between a {@link Model} and a {@link ModelDefinition} is the 263 * element name ('modelDefinition'). 264 <p> 265 * @return the name of this element, as a text string. 266 <p> 267 * @see #getTypeCode() 268 */ public 269 String getElementName() { 270 return libsbmlJNI.ModelDefinition_getElementName(swigCPtr, this); 271 } 272 273 274/** 275 * Returns the libSBML type code of this object instance. 276 <p> 277 * <p> 278 * LibSBML attaches an identifying code to every kind of SBML object. These 279 * are integer constants known as <em>SBML type codes</em>. The names of all 280 * the codes begin with the characters <code>SBML_</code>. 281 * In the Java language interface for libSBML, the 282 * type codes are defined as static integer constants in the interface class 283 * {@link libsbmlConstants}. Note that different Level 3 284 * package plug-ins may use overlapping type codes; to identify the package 285 * to which a given object belongs, call the <code>getPackageName()</code> 286 * method on the object. 287 <p> 288 * @return the SBML type code for this object: 289 * {@link libsbmlConstants#SBML_COMP_MODELDEFINITION SBML_COMP_MODELDEFINITION} 290 <p> 291 * <p> 292 * @warning <span class='warning'>The specific integer values of the possible 293 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 294 * packages, To fully identify the correct code, <strong>it is necessary to 295 * invoke both getTypeCode() and getPackageName()</strong>.</span> 296 <p> 297 * @see #getElementName() 298 * @see #getPackageName() 299 */ public 300 int getTypeCode() { 301 return libsbmlJNI.ModelDefinition_getTypeCode(swigCPtr, this); 302 } 303 304 305/** 306 * Finds this {@link Model}'s parent {@link ListOfModelDefinitions} and removes itself from 307 * it and deletes itself. 308 <p> 309 * This method actually just calls the {@link SBase} function, since the {@link Model} 310 * class overrides it, but that's actually what we want to happen here. 311 <p> 312 * <p> 313 * @return integer value indicating success/failure of the 314 * function. The possible values 315 * returned by this function are: 316 * <ul> 317 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 318 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 319 * </ul> 320 */ public 321 int removeFromParentAndDelete() { 322 return libsbmlJNI.ModelDefinition_removeFromParentAndDelete(swigCPtr, this); 323 } 324 325}