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-fbc"><a href="group__fbc.html">fbc</a></span>
013 The core module of the 'fbc' package extension.
014 */
015
016public class FbcExtension extends SBMLExtension {
017   private long swigCPtr;
018
019   protected FbcExtension(long cPtr, boolean cMemoryOwn)
020   {
021     super(libsbmlJNI.FbcExtension_SWIGUpcast(cPtr), cMemoryOwn);
022     swigCPtr = cPtr;
023   }
024
025   protected static long getCPtr(FbcExtension obj)
026   {
027     return (obj == null) ? 0 : obj.swigCPtr;
028   }
029
030   protected static long getCPtrAndDisown (FbcExtension 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_FbcExtension(swigCPtr);
052      }
053      swigCPtr = 0;
054    }
055    super.delete();
056  }
057
058    public SBasePlugin DowncastSBasePlugin(long cPtr, boolean owner)
059    {
060        if (cPtr == 0) return null;
061        
062        SBasePlugin sbp = new SBasePlugin(cPtr, false);
063        SBase sb = sbp.getParentSBMLObject();
064        
065        switch( sb.getTypeCode() )
066        {
067            case (int) libsbml.SBML_MODEL:
068                return new FbcModelPlugin(cPtr,owner);
069      case (int) libsbml.SBML_SPECIES:
070        return new FbcSpeciesPlugin(cPtr, owner);
071            default:
072                return new SBasePlugin(cPtr,owner);
073        }
074    }
075    
076    public SBase DowncastSBase(long cPtr, boolean owner)
077    {
078        if (cPtr == 0) return null;
079        
080        SBase sb = new SBase(cPtr, false);
081        switch( sb.getTypeCode() )
082        {
083            case (int) libsbml.SBML_LIST_OF:
084                 String name = sb.getElementName();
085                 if(name =="listOfFluxBounds")
086                 {
087                    return new ListOfFluxBounds(cPtr, owner);
088                 }
089                 else if(name =="listOfFluxes")
090                 {
091                    return new ListOfFluxObjectives(cPtr, owner);
092                 }
093                 else if(name =="listOfGeneAssociations")
094                 {
095                    return new ListOfGeneAssociations(cPtr, owner);
096                 }
097                 else if(name =="listOfObjectives")
098                 {
099                    return new ListOfObjectives(cPtr, owner);
100                 }
101                 return new ListOf(cPtr, owner);
102                
103            case (int) libsbml.SBML_FBC_ASSOCIATION:
104                return new Association(cPtr, owner);
105                
106            case (int) libsbml.SBML_FBC_FLUXBOUND:
107                return new FluxBound(cPtr, owner);
108
109            case (int) libsbml.SBML_FBC_FLUXOBJECTIVE:
110                return new FluxObjective(cPtr, owner);
111                
112            case (int) libsbml.SBML_FBC_GENEASSOCIATION:
113                return new GeneAssociation(cPtr, owner);
114                
115            case (int) libsbml.SBML_FBC_OBJECTIVE:
116                return new Objective(cPtr, owner);
117                
118            default:
119                return new SBase(cPtr, owner);
120        }
121    }
122    
123    
124  
125/**
126   * Returns the package name of this extension.
127   */ public
128 static String getPackageName() {
129    return libsbmlJNI.FbcExtension_getPackageName();
130  }
131
132  
133/**
134   * Returns the default SBML Level this extension.
135   */ public
136 static long getDefaultLevel() {
137    return libsbmlJNI.FbcExtension_getDefaultLevel();
138  }
139
140  
141/**
142   * Returns the default SBML Version this extension.
143   */ public
144 static long getDefaultVersion() {
145    return libsbmlJNI.FbcExtension_getDefaultVersion();
146  }
147
148  
149/**
150   * Returns the default SBML version this extension.
151   */ public
152 static long getDefaultPackageVersion() {
153    return libsbmlJNI.FbcExtension_getDefaultPackageVersion();
154  }
155
156  
157/**
158   * Returns URI of supported versions of this package.
159   */ public
160 static String getXmlnsL3V1V1() {
161    return libsbmlJNI.FbcExtension_getXmlnsL3V1V1();
162  }
163
164  
165/**
166   * Constructor
167   */ public
168 FbcExtension() {
169    this(libsbmlJNI.new_FbcExtension__SWIG_0(), true);
170  }
171
172  
173/**
174   * Copy constructor.
175   */ public
176 FbcExtension(FbcExtension arg0) {
177    this(libsbmlJNI.new_FbcExtension__SWIG_1(FbcExtension.getCPtr(arg0), arg0), true);
178  }
179
180  
181/**
182   * Creates and returns a deep copy of this {@link FbcExtension} object.
183   <p>
184   * @return a (deep) copy of this {@link FbcExtension} object
185   */ public
186 FbcExtension cloneObject() {
187    long cPtr = libsbmlJNI.FbcExtension_cloneObject(swigCPtr, this);
188    return (cPtr == 0) ? null : new FbcExtension(cPtr, true);
189  }
190
191  
192/**
193   * Returns the name of this package ('fbc')
194   <p>
195   * @return the name of this package ('fbc')
196   */ public
197 String getName() {
198    return libsbmlJNI.FbcExtension_getName(swigCPtr, this);
199  }
200
201  
202/**
203   * Returns the namespace URI corresponding to the combination of the given
204   * SBML Level, Version, and package version.
205   <p>
206   * @param sbmlLevel the level of SBML
207   * @param sbmlVersion the version of SBML
208   * @param pkgVersion the version of package
209   <p>
210   * @return a string of the package URI, or an empty string if no
211   * corresponding URI exists.
212   */ public
213 String getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) {
214    return libsbmlJNI.FbcExtension_getURI(swigCPtr, this, sbmlLevel, sbmlVersion, pkgVersion);
215  }
216
217  
218/**
219   * Returns the SBML Level for the given URI of this package.
220   <p>
221   * @param uri the string of URI that represents one of versions of the
222   * &ldquo;fbc&rdquo; package
223   <p>
224   * @return the SBML Level with the given URI of this package, or <code>0</code> if
225   * the given URI is invalid.
226   */ public
227 long getLevel(String uri) {
228    return libsbmlJNI.FbcExtension_getLevel(swigCPtr, this, uri);
229  }
230
231  
232/**
233   * Returns the SBML Version for the given URI of this package.
234   <p>
235   * @param uri the string of URI that represents one of versions of the
236   * &ldquo;fbc&rdquo; package
237   <p>
238   * @return the SBML version with the given URI of this package, or <code>0</code> if
239   * the given URI is invalid.
240   */ public
241 long getVersion(String uri) {
242    return libsbmlJNI.FbcExtension_getVersion(swigCPtr, this, uri);
243  }
244
245  
246/**
247   * Returns the package version for the given URI of this package.
248   <p>
249   * @param uri the string of URI that represents one of versions of the
250   * &ldquo;fbc&rdquo; package
251   <p>
252   * @return the package version with the given URI of this package, or <code>0</code>
253   * if the given URI is invalid.
254   */ public
255 long getPackageVersion(String uri) {
256    return libsbmlJNI.FbcExtension_getPackageVersion(swigCPtr, this, uri);
257  }
258
259  
260/**
261   * Returns an {@link FbcPkgNamespaces} object.
262   <p>
263   * @param uri the string of URI that represents one of versions of the
264   * &ldquo;fbc&rdquo; package
265   <p>
266   * @return an FbcPkgNamespace object corresponding to the given <code>uri</code>, or
267   * <code>null</code> if the URI is not defined in the FBC package.
268   */ public
269 SBMLNamespaces getSBMLExtensionNamespaces(String uri) {
270  return libsbml.DowncastSBMLNamespaces(libsbmlJNI.FbcExtension_getSBMLExtensionNamespaces(swigCPtr, this, uri), false);
271}
272
273  
274/**
275   * Takes a type code of the &ldquo;fbc&rdquo; package and returns a string
276   * describing the code.
277   */ public
278 String getStringFromTypeCode(int typeCode) {
279    return libsbmlJNI.FbcExtension_getStringFromTypeCode(swigCPtr, this, typeCode);
280  }
281
282  
283/**
284   * Initializes fbc extension by creating an object of this class with 
285   * required {@link SBasePlugin} derived objects and registering the object 
286   * to the {@link SBMLExtensionRegistry} class.
287   <p>
288   * (NOTE) This function is automatically invoked when creating the following
289   *        global object in {@link FbcExtension}.cpp
290   <p>
291   *        static SBMLExtensionRegister<{@link FbcExtension}> fbcExtensionRegister;
292   <p>
293   * @internal
294   */ public
295 static void init() {
296    libsbmlJNI.FbcExtension_init();
297  }
298
299  
300/** * @internal */ public
301 SWIGTYPE_p_packageErrorTableEntry getErrorTable(long index) {
302    return new SWIGTYPE_p_packageErrorTableEntry(libsbmlJNI.FbcExtension_getErrorTable(swigCPtr, this, index), true);
303  }
304
305  
306/** * @internal */ public
307 long getErrorTableIndex(long errorId) {
308    return libsbmlJNI.FbcExtension_getErrorTableIndex(swigCPtr, this, errorId);
309  }
310
311  
312/** * @internal */ public
313 long getErrorIdOffset() {
314    return libsbmlJNI.FbcExtension_getErrorIdOffset(swigCPtr, this);
315  }
316
317}