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