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