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