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-layout"><a href="group__layout.html">layout</a></span>
013
014 The core module of the 'layout' package extension.
015 */
016
017public class LayoutExtension extends SBMLExtension {
018   private long swigCPtr;
019
020   protected LayoutExtension(long cPtr, boolean cMemoryOwn)
021   {
022     super(libsbmlJNI.LayoutExtension_SWIGUpcast(cPtr), cMemoryOwn);
023     swigCPtr = cPtr;
024   }
025
026   protected static long getCPtr(LayoutExtension obj)
027   {
028     return (obj == null) ? 0 : obj.swigCPtr;
029   }
030
031   protected static long getCPtrAndDisown (LayoutExtension 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_LayoutExtension(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 libsbmlConstants.SBML_MODEL:
074                return new LayoutModelPlugin(cPtr,owner);
075            case libsbmlConstants.SBML_SPECIES_REFERENCE:
076            case libsbmlConstants.SBML_MODIFIER_SPECIES_REFERENCE:
077                return new LayoutSpeciesReferencePlugin(cPtr,owner);
078            default: 
079                return new SBasePlugin(cPtr,owner);
080        }
081    }
082    
083    /**
084     * SBMLExtension derived classes must override this method
085     *
086     * @return the most specific Java object possible for the given SBase
087     */
088    public SBase DowncastSBase(long cPtr, boolean owner)
089    {
090        if (cPtr == 0) return null;
091        
092        SBase sb = new SBase(cPtr,false);
093        
094        switch( sb.getTypeCode() )
095        {
096            case libsbmlConstants.SBML_LIST_OF:
097                String name = sb.getElementName();
098                if(name.equals("listOfCompartmentGlyphs")){
099                    return new ListOfCompartmentGlyphs(cPtr, owner);
100                }
101                else if(name.equals("listOfAdditionalGraphicalObjects")){
102                    return new ListOfGraphicalObjects(cPtr, owner);
103                }
104                else if(name.equals("listOfLayouts")){
105                    return new ListOfLayouts(cPtr, owner);
106                }
107                else if(name.equals("listOfCurveSegments")){
108                    return new ListOfLineSegments(cPtr, owner);
109                }
110                else if(name.equals("listOfSpeciesGlyphs")){
111                    return new ListOfSpeciesGlyphs(cPtr, owner);
112                }
113                else if(name.equals("listOfSpeciesReferenceGlyphs")){
114                    return new ListOfSpeciesReferenceGlyphs(cPtr, owner);
115                }
116                else if(name.equals("listOfReactionGlyphs")){
117                    return new ListOfReactionGlyphs(cPtr, owner);
118                }
119                else if(name.equals("listOfTextGlyphs")){
120                    return new ListOfTextGlyphs(cPtr, owner);
121                }
122                else if(name.equals("listOfReferenceGlyphs")){
123                    return new ListOfReferenceGlyphs(cPtr, owner);
124                }
125                return new ListOf(cPtr, owner);
126                
127            case libsbmlConstants.SBML_LAYOUT_BOUNDINGBOX:
128                return new BoundingBox(cPtr, owner);
129                
130            case libsbmlConstants.SBML_LAYOUT_COMPARTMENTGLYPH:
131                return new CompartmentGlyph(cPtr, owner);
132                
133            case libsbmlConstants.SBML_LAYOUT_CUBICBEZIER:
134                return new CubicBezier(cPtr, owner);
135                
136            case libsbmlConstants.SBML_LAYOUT_CURVE:
137                return new Curve(cPtr, owner);
138                
139            case libsbmlConstants.SBML_LAYOUT_DIMENSIONS:
140                return new Dimensions(cPtr, owner);
141                
142            case libsbmlConstants.SBML_LAYOUT_GRAPHICALOBJECT:
143                return new GraphicalObject(cPtr, owner);
144                
145            case libsbmlConstants.SBML_LAYOUT_LAYOUT:
146                return new Layout(cPtr, owner);
147                
148            case libsbmlConstants.SBML_LAYOUT_LINESEGMENT:
149                return new LineSegment(cPtr, owner);
150                
151            case libsbmlConstants.SBML_LAYOUT_POINT:
152                return new Point(cPtr, owner);
153                
154            case libsbmlConstants.SBML_LAYOUT_REACTIONGLYPH:
155                return new ReactionGlyph(cPtr, owner);
156                
157            case libsbmlConstants.SBML_LAYOUT_SPECIESGLYPH:
158                return new SpeciesGlyph(cPtr, owner);
159                
160            case libsbmlConstants.SBML_LAYOUT_SPECIESREFERENCEGLYPH:
161                return new SpeciesReferenceGlyph(cPtr, owner);
162                
163            case libsbmlConstants.SBML_LAYOUT_TEXTGLYPH:
164                return new TextGlyph(cPtr, owner);
165            
166            case (int) libsbml.SBML_LAYOUT_REFERENCEGLYPH:
167                return new ReferenceGlyph(cPtr, owner);
168            
169            case (int) libsbml.SBML_LAYOUT_GENERALGLYPH:
170                return new GeneralGlyph(cPtr, owner);
171                
172            default:
173                return new SBase(cPtr, owner);
174        }
175    }
176    
177  
178/**
179   * Returns the package name of this extension.
180   */ public
181 static String getPackageName() {
182    return libsbmlJNI.LayoutExtension_getPackageName();
183  }
184
185  
186/**
187   * Returns the default SBML Level this extension.
188   */ public
189 static long getDefaultLevel() {
190    return libsbmlJNI.LayoutExtension_getDefaultLevel();
191  }
192
193  
194/**
195   * Returns the default SBML Version this extension.
196   */ public
197 static long getDefaultVersion() {
198    return libsbmlJNI.LayoutExtension_getDefaultVersion();
199  }
200
201  
202/**
203   * Returns the default SBML version this extension.
204   */ public
205 static long getDefaultPackageVersion() {
206    return libsbmlJNI.LayoutExtension_getDefaultPackageVersion();
207  }
208
209  
210/**
211   * Returns URI of supported versions of this package.
212   */ public
213 static String getXmlnsL3V1V1() {
214    return libsbmlJNI.LayoutExtension_getXmlnsL3V1V1();
215  }
216
217  
218/** */ public
219 static String getXmlnsL2() {
220    return libsbmlJNI.LayoutExtension_getXmlnsL2();
221  }
222
223  
224/** */ public
225 static String getXmlnsXSI() {
226    return libsbmlJNI.LayoutExtension_getXmlnsXSI();
227  }
228
229  
230/**
231   * Constructor
232   */ public
233 LayoutExtension() {
234    this(libsbmlJNI.new_LayoutExtension__SWIG_0(), true);
235  }
236
237  
238/**
239   * Copy constructor.
240   */ public
241 LayoutExtension(LayoutExtension arg0) {
242    this(libsbmlJNI.new_LayoutExtension__SWIG_1(LayoutExtension.getCPtr(arg0), arg0), true);
243  }
244
245  
246/**
247   * Creates and returns a deep copy of this {@link LayoutExtension} object.
248   <p>
249   * @return a (deep) copy of this {@link LayoutExtension} object
250   */ public
251 LayoutExtension cloneObject() {
252    long cPtr = libsbmlJNI.LayoutExtension_cloneObject(swigCPtr, this);
253    return (cPtr == 0) ? null : new LayoutExtension(cPtr, true);
254  }
255
256  
257/**
258   * Returns the name of this package ('layout')
259   <p>
260   * @return the name of this package ('layout')
261   */ public
262 String getName() {
263    return libsbmlJNI.LayoutExtension_getName(swigCPtr, this);
264  }
265
266  
267/**
268   * Returns the namespace URI corresponding to the combination of the given
269   * SBML Level, Version, and package version.
270   <p>
271   * @param sbmlLevel the level of SBML
272   * @param sbmlVersion the version of SBML
273   * @param pkgVersion the version of package
274   <p>
275   * @return a string of the package URI, or an empty string if no
276   * corresponding URI exists.
277   */ public
278 String getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) {
279    return libsbmlJNI.LayoutExtension_getURI(swigCPtr, this, sbmlLevel, sbmlVersion, pkgVersion);
280  }
281
282  
283/**
284   * Returns the SBML Level for the given URI of this package.
285   <p>
286   * @param uri the string of URI that represents one of versions of the
287   * &ldquo;layout&rdquo; package
288   <p>
289   * @return the SBML Level with the given URI of this package, or <code>0</code> if
290   * the given URI is invalid.
291   */ public
292 long getLevel(String uri) {
293    return libsbmlJNI.LayoutExtension_getLevel(swigCPtr, this, uri);
294  }
295
296  
297/**
298   * Returns the SBML Version for the given URI of this package.
299   <p>
300   * @param uri the string of URI that represents one of versions of the
301   * &ldquo;layout&rdquo; package
302   <p>
303   * @return the SBML version with the given URI of this package, or <code>0</code> if
304   * the given URI is invalid.
305   */ public
306 long getVersion(String uri) {
307    return libsbmlJNI.LayoutExtension_getVersion(swigCPtr, this, uri);
308  }
309
310  
311/**
312   * Returns the package version for the given URI of this package.
313   <p>
314   * @param uri the string of URI that represents one of versions of the
315   * &ldquo;layout&rdquo; package
316   <p>
317   * @return the package version with the given URI of this package, or <code>0</code>
318   * if the given URI is invalid.
319   */ public
320 long getPackageVersion(String uri) {
321    return libsbmlJNI.LayoutExtension_getPackageVersion(swigCPtr, this, uri);
322  }
323
324  
325/**
326   * Takes a type code of the &ldquo;layout&rdquo; package and returns a string
327   * describing the code.
328   */ public
329 String getStringFromTypeCode(int typeCode) {
330    return libsbmlJNI.LayoutExtension_getStringFromTypeCode(swigCPtr, this, typeCode);
331  }
332
333  
334/**
335   * Returns an {@link LayoutPkgNamespaces} object.
336   <p>
337   * @param uri the string of URI that represents one of versions of the
338   * &ldquo;layout&rdquo; package
339   <p>
340   * @return an LayoutPkgNamespace object corresponding to the given <code>uri</code>,
341   * or <code>null</code> if the URI is not defined in the {@link Layout} package.
342   */ public
343 SBMLNamespaces getSBMLExtensionNamespaces(String uri) {
344  return libsbml.DowncastSBMLNamespaces(libsbmlJNI.LayoutExtension_getSBMLExtensionNamespaces(swigCPtr, this, uri), false);
345}
346
347  
348/**
349   * Initializes layout extension by creating an object of this class with 
350   * required {@link SBasePlugin} derived objects and registering the object 
351   * to the {@link SBMLExtensionRegistry} class.
352   <p>
353   * (NOTE) This function is automatically invoked when creating the following
354   *        global object in {@link LayoutExtension}.cpp
355   <p>
356   *        static SBMLExtensionRegister<{@link LayoutExtension}> layoutExtensionRegistry;
357   <p>
358   * @internal
359   */ public
360 static void init() {
361    libsbmlJNI.LayoutExtension_init();
362  }
363
364  
365/**
366   * Removes the L2 Namespace from a document. 
367   <p>
368   * This method should be overridden by all extensions that want to serialize
369   * to an L2 annotation.
370   */ public
371 void removeL2Namespaces(XMLNamespaces xmlns) {
372    libsbmlJNI.LayoutExtension_removeL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns);
373  }
374
375  
376/**
377   * adds all L2 Extension namespaces to the namespace list. 
378   <p>
379   * This method should be overridden by all extensions that want to serialize
380   * to an L2 annotation.
381   */ public
382 void addL2Namespaces(XMLNamespaces xmlns) {
383    libsbmlJNI.LayoutExtension_addL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns);
384  }
385
386  
387/**
388   * Adds the L2 Namespace to the document and enables the extension.
389   <p>
390   * If the extension supports serialization to SBML L2 Annotations, this 
391   * method should be overrridden, so it will be activated.
392   */ public
393 void enableL2NamespaceForDocument(SBMLDocument doc) {
394    libsbmlJNI.LayoutExtension_enableL2NamespaceForDocument(swigCPtr, this, SBMLDocument.getCPtr(doc), doc);
395  }
396
397  
398/** 
399   * Determines whether this extension is being used by the given {@link SBMLDocument}
400   <p>
401   * The implementation returns true if the model object contains one 
402   * or more layouts.
403   <p>
404   * @param doc the sbml document to test. 
405   <p>
406   * @return a boolean indicating whether the extension is actually being used
407   *         byy the document. 
408   */ public
409 boolean isInUse(SBMLDocument doc) {
410    return libsbmlJNI.LayoutExtension_isInUse(swigCPtr, this, SBMLDocument.getCPtr(doc), doc);
411  }
412
413  
414/**
415     * Return the entry in the error table at this index. 
416     <p>
417     * @param index a long integergere representing the index of the error in the LayoutSBMLErrorTable
418     <p>
419     * @return packageErrorTableEntry object in the LayoutSBMLErrorTable corresponding to the index given.
420     * @internal
421     */ public
422 SWIGTYPE_p_packageErrorTableEntry getErrorTable(long index) {
423    return new SWIGTYPE_p_packageErrorTableEntry(libsbmlJNI.LayoutExtension_getErrorTable(swigCPtr, this, index), true);
424  }
425
426  
427/**
428     * Return the index in the error table with the given errorId. 
429     <p>
430     * @param errorId a long integergere representing the errorId of the error in the LayoutSBMLErrorTable
431     <p>
432     * @return longeger representing the index in the LayoutSBMLErrorTable corresponding to the errorId given.
433     * @internal
434     */ public
435 long getErrorTableIndex(long errorId) {
436    return libsbmlJNI.LayoutExtension_getErrorTableIndex(swigCPtr, this, errorId);
437  }
438
439  
440/**
441     * Return the offset for the errorId range for the layout L3 package. 
442     <p>
443     * @return longege representing the  offset for errors LayoutSBMLErrorTable.
444     * @internal
445     */ public
446 long getErrorIdOffset() {
447    return libsbmlJNI.LayoutExtension_getErrorIdOffset(swigCPtr, this);
448  }
449
450}