001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.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 Base extension class for the package. 014 <p> 015 * <p style='color: #777; font-style: italic'> 016This class of objects is defined by libSBML only and has no direct 017equivalent in terms of SBML components. This class is not prescribed by 018the SBML specifications, although it is used to implement features 019defined in SBML. 020</p> 021 022 */ 023 024public class CompExtension extends SBMLExtension { 025 private long swigCPtr; 026 027 protected CompExtension(long cPtr, boolean cMemoryOwn) 028 { 029 super(libsbmlJNI.CompExtension_SWIGUpcast(cPtr), cMemoryOwn); 030 swigCPtr = cPtr; 031 } 032 033 protected static long getCPtr(CompExtension obj) 034 { 035 return (obj == null) ? 0 : obj.swigCPtr; 036 } 037 038 protected static long getCPtrAndDisown (CompExtension obj) 039 { 040 long ptr = 0; 041 042 if (obj != null) 043 { 044 ptr = obj.swigCPtr; 045 obj.swigCMemOwn = false; 046 } 047 048 return ptr; 049 } 050 051 protected void finalize() { 052 delete(); 053 } 054 055 public synchronized void delete() { 056 if (swigCPtr != 0) { 057 if (swigCMemOwn) { 058 swigCMemOwn = false; 059 libsbmlJNI.delete_CompExtension(swigCPtr); 060 } 061 swigCPtr = 0; 062 } 063 super.delete(); 064 } 065 066 /** 067 * @internal 068 */ 069 public SBasePlugin DowncastSBasePlugin(long cPtr, boolean owner) 070 { 071 if (cPtr == 0) return null; 072 073 SBasePlugin sbp = new SBasePlugin(cPtr, false); 074 SBase sb = sbp.getParentSBMLObject(); 075 076 if (sb == null) 077 { 078 return new SBasePlugin(cPtr,owner); 079 } 080 081 switch( sb.getTypeCode() ) 082 { 083 case (int) libsbml.SBML_DOCUMENT: 084 return new CompSBMLDocumentPlugin(cPtr,owner); 085 086 case (int) libsbml.SBML_MODEL: 087 case (int) libsbml.SBML_COMP_MODELDEFINITION: 088 return new CompModelPlugin(cPtr, owner); 089 case (int) libsbml.SBML_COMPARTMENT: 090 case (int) libsbml.SBML_COMPARTMENT_TYPE: 091 case (int) libsbml.SBML_CONSTRAINT: 092 case (int) libsbml.SBML_EVENT: 093 case (int) libsbml.SBML_EVENT_ASSIGNMENT: 094 case (int) libsbml.SBML_FUNCTION_DEFINITION: 095 case (int) libsbml.SBML_INITIAL_ASSIGNMENT: 096 case (int) libsbml.SBML_KINETIC_LAW: 097 case (int) libsbml.SBML_LIST_OF: 098 case (int) libsbml.SBML_PARAMETER: 099 case (int) libsbml.SBML_REACTION: 100 case (int) libsbml.SBML_RULE: 101 case (int) libsbml.SBML_SPECIES: 102 case (int) libsbml.SBML_SPECIES_REFERENCE: 103 case (int) libsbml.SBML_SPECIES_TYPE: 104 case (int) libsbml.SBML_MODIFIER_SPECIES_REFERENCE: 105 case (int) libsbml.SBML_UNIT_DEFINITION: 106 case (int) libsbml.SBML_UNIT: 107 case (int) libsbml.SBML_ALGEBRAIC_RULE: 108 case (int) libsbml.SBML_ASSIGNMENT_RULE: 109 case (int) libsbml.SBML_RATE_RULE: 110 case (int) libsbml.SBML_SPECIES_CONCENTRATION_RULE: 111 case (int) libsbml.SBML_COMPARTMENT_VOLUME_RULE: 112 case (int) libsbml.SBML_PARAMETER_RULE: 113 case (int) libsbml.SBML_TRIGGER: 114 case (int) libsbml.SBML_DELAY: 115 case (int) libsbml.SBML_STOICHIOMETRY_MATH: 116 case (int) libsbml.SBML_LOCAL_PARAMETER: 117 case (int) libsbml.SBML_COMP_SUBMODEL: 118 case (int) libsbml.SBML_COMP_SBASEREF: 119 case (int) libsbml.SBML_COMP_REPLACEDELEMENT: 120 case (int) libsbml.SBML_COMP_REPLACEDBY: 121 case (int) libsbml.SBML_COMP_PORT: 122 case (int) libsbml.SBML_COMP_EXTERNALMODELDEFINITION: 123 case (int) libsbml.SBML_COMP_DELETION: 124 return new CompSBasePlugin(cPtr,owner); 125 default: 126 return new SBasePlugin(cPtr,owner); 127 } 128 } 129 130 /** 131 * @internal 132 */ 133 public SBase DowncastSBase(long cPtr, boolean owner) 134 { 135 if (cPtr == 0) return null; 136 137 SBase sb = new SBase(cPtr, false); 138 switch( sb.getTypeCode() ) 139 { 140 case (int) libsbml.SBML_LIST_OF: 141 String name = sb.getElementName(); 142 if(name =="listOfDeletions") 143 { 144 return new ListOfDeletions(cPtr, owner); 145 } 146 else if(name =="listOfExternalModelDefinitions") 147 { 148 return new ListOfExternalModelDefinitions(cPtr, owner); 149 } 150 else if(name =="listOfModelDefinitions") 151 { 152 return new ListOfModelDefinitions(cPtr, owner); 153 } 154 else if(name =="listOfPorts") 155 { 156 return new ListOfPorts(cPtr, owner); 157 } 158 else if(name =="listOfReplacedElements") 159 { 160 return new ListOfReplacedElements(cPtr, owner); 161 } 162 else if(name =="listOfSubmodels") 163 { 164 return new ListOfSubmodels(cPtr, owner); 165 } 166 return new ListOf(cPtr, owner); 167 168 case (int) libsbml.SBML_COMP_DELETION: 169 return new Deletion(cPtr, owner); 170 171 case (int) libsbml.SBML_COMP_MODELDEFINITION: 172 return new ModelDefinition(cPtr, owner); 173 174 case (int) libsbml.SBML_COMP_EXTERNALMODELDEFINITION: 175 return new ExternalModelDefinition(cPtr, owner); 176 177 case (int) libsbml.SBML_COMP_PORT: 178 return new Port(cPtr, owner); 179 180 case (int) libsbml.SBML_COMP_REPLACEDELEMENT: 181 return new ReplacedElement(cPtr, owner); 182 183 case (int) libsbml.SBML_COMP_REPLACEDBY: 184 return new ReplacedBy(cPtr, owner); 185 186 case (int) libsbml.SBML_COMP_SBASEREF: 187 return new SBaseRef(cPtr, owner); 188 189 case (int) libsbml.SBML_COMP_SUBMODEL: 190 return new Submodel(cPtr, owner); 191 192 default: 193 return new SBase(cPtr, owner); 194 } 195 } 196 197 198 199/** 200 * Returns the nickname of the SBML Level 3 package implemented by 201 * this libSBML extension. 202 <p> 203 * @return the package nickname, as a string. 204 <p> 205 * 206 */ public 207 static String getPackageName() { 208 return libsbmlJNI.CompExtension_getPackageName(); 209 } 210 211 212/** 213 * Returns the default SBML Level used by this libSBML package extension. 214 <p> 215 * @return the SBML Level. 216 <p> 217 * 218 */ public 219 static long getDefaultLevel() { 220 return libsbmlJNI.CompExtension_getDefaultLevel(); 221 } 222 223 224/** 225 * Returns the default SBML Version used by this libSBML package extension. 226 <p> 227 * @return the Version within the default SBML Level. 228 <p> 229 * 230 */ public 231 static long getDefaultVersion() { 232 return libsbmlJNI.CompExtension_getDefaultVersion(); 233 } 234 235 236/** 237 * Returns the default version of the SBML Level 3 package implemented 238 * by this libSBML extension. 239 <p> 240 * @return the default version number of the SBML Level 3 package 241 * definition. 242 <p> 243 * 244 */ public 245 static long getDefaultPackageVersion() { 246 return libsbmlJNI.CompExtension_getDefaultPackageVersion(); 247 } 248 249 250/** 251 * Returns the XML namespace URI of the SBML Level 3 package 252 * implemented by this libSBML extension. 253 <p> 254 * @return the XML namespace as a string. 255 <p> 256 * 257 */ public 258 static String getXmlnsL3V1V1() { 259 return libsbmlJNI.CompExtension_getXmlnsL3V1V1(); 260 } 261 262 263/** 264 * Creates a new {@link CompExtension} instance. 265 */ public 266 CompExtension() { 267 this(libsbmlJNI.new_CompExtension__SWIG_0(), true); 268 } 269 270 271/** 272 * Copy constructor. 273 <p> 274 * @param source the instance to copy. 275 */ public 276 CompExtension(CompExtension source) { 277 this(libsbmlJNI.new_CompExtension__SWIG_1(CompExtension.getCPtr(source), source), true); 278 } 279 280 281/** 282 * Creates and returns a deep copy of this {@link CompExtension} object. 283 <p> 284 * @return a (deep) copy of this {@link CompExtension} object. 285 */ public 286 SBMLExtension cloneObject() { 287 long cPtr = libsbmlJNI.CompExtension_cloneObject(swigCPtr, this); 288 return (cPtr == 0) ? null : new CompExtension(cPtr, true); 289 } 290 291 292/** 293 * Returns the name of this package as a short-form label 294 * ("<code>comp</code>"). 295 <p> 296 * @return the name of this package. 297 */ public 298 String getName() { 299 return libsbmlJNI.CompExtension_getName(swigCPtr, this); 300 } 301 302 303/** 304 * Returns a string representing the SBML XML namespace of this SBML 305 * Level 3 package. 306 <p> 307 * The namespace URI constructed by this method corresponds to the 308 * combination of the Level and Version of SBML, and the Version of the SBML 309 * Level 3 package. (At the time of this writing, the only SBML Level 310 * that supports packages is Level 3, so the value of <code>sbmlLevel</code> must 311 * necessarily always be <code>3</code>.) 312 <p> 313 * @param sbmlLevel the level of SBML. 314 * @param sbmlVersion the version of SBML. 315 * @param pkgVersion the version of the package. 316 <p> 317 * @return a string of the package URI, or an empty string if no 318 * corresponding URI exists. 319 */ public 320 String getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) { 321 return libsbmlJNI.CompExtension_getURI(swigCPtr, this, sbmlLevel, sbmlVersion, pkgVersion); 322 } 323 324 325/** 326 * Returns the SBML Level for the given URI of this package. 327 <p> 328 * @param uri a URI that represents a version of this package. 329 <p> 330 * @return the SBML Level for the given URI of this package, or <code>0</code> if the 331 * given URI is invalid, or for a different package. 332 */ public 333 long getLevel(String uri) { 334 return libsbmlJNI.CompExtension_getLevel(swigCPtr, this, uri); 335 } 336 337 338/** 339 * Returns the Version within the SBML Level for the given URI of this 340 * package. 341 <p> 342 * @param uri a URI that represents a version of this package. 343 <p> 344 * @return the SBML Version within the SBML Level for the given URI of this 345 * package, or <code>0</code> if the given URI is invalid, or for a different package. 346 */ public 347 long getVersion(String uri) { 348 return libsbmlJNI.CompExtension_getVersion(swigCPtr, this, uri); 349 } 350 351 352/** 353 * Returns the SBML Level 3 package version for the given URI of this 354 * package. 355 <p> 356 * @param uri a URI that represents one of the valid versions of this 357 * package. 358 <p> 359 * @return the version of the SBML Level 3 package with the given URI, 360 * or <code>0</code> if the given URI is invalid, or for a different package. 361 */ public 362 long getPackageVersion(String uri) { 363 return libsbmlJNI.CompExtension_getPackageVersion(swigCPtr, this, uri); 364 } 365 366 367/** 368 * Returns an {@link CompPkgNamespaces} object. 369 <p> 370 * @param uri a URI that represents one of the valid versions of the 371 * “comp” package. 372 <p> 373 * @return an CompPkgNamespace object corresponding to the given <code>uri</code>, or 374 * <code>null</code> if the URI is not defined in the Hierarchical Model Composition 375 * package. 376 */ public 377 SBMLNamespaces getSBMLExtensionNamespaces(String uri) { 378 return libsbml.DowncastSBMLNamespaces(libsbmlJNI.CompExtension_getSBMLExtensionNamespaces(swigCPtr, this, uri), false); 379} 380 381 382/** 383 * Takes a type code of the “comp” package and returns a string 384 * describing the code. 385 <p> 386 * @param typeCode a libSBML type code defined by the libSBML extension 387 * implementing support for the SBML Level 3 “comp” package. 388 <p> 389 * @return a text string representing the type code given by <code>typeCode</code>. 390 * If the type code is unrecognized for this implementation of the libSBML 391 * “comp” package, the string returned will be 392 * <code>'(Unknown SBML Comp Type)'</code>. 393 */ public 394 String getStringFromTypeCode(int typeCode) { 395 return libsbmlJNI.CompExtension_getStringFromTypeCode(swigCPtr, this, typeCode); 396 } 397 398 399/** * @internal */ public 400 static void init() { 401 libsbmlJNI.CompExtension_init(); 402 } 403 404 405/** * @internal */ public 406 SWIGTYPE_p_packageErrorTableEntry getErrorTable(long index) { 407 return new SWIGTYPE_p_packageErrorTableEntry(libsbmlJNI.CompExtension_getErrorTable(swigCPtr, this, index), true); 408 } 409 410 411/** * @internal */ public 412 long getErrorTableIndex(long errorId) { 413 return libsbmlJNI.CompExtension_getErrorTableIndex(swigCPtr, this, errorId); 414 } 415 416 417/** * @internal */ public 418 long getErrorIdOffset() { 419 return libsbmlJNI.CompExtension_getErrorIdOffset(swigCPtr, this); 420 } 421 422}