001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.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-groups"><a href="group__groups.html">groups</a></span>
013 Base extension class for the package.
014 <p>
015 * <p style='color: #777; font-style: italic'>
016This class of objects is defined by libSBML only and has no direct
017equivalent in terms of SBML components.  This class is not prescribed by
018the SBML specifications, although it is used to implement features
019defined in SBML.
020</p>
021
022 <p>
023 * This is the Groups package extension of the {@link SBMLExtension} class that is used
024 * to facilitate libSBML plug-ins in the implementation of an SBMLLevel&nbsp;3
025 * package.
026 */
027
028public class GroupsExtension extends SBMLExtension {
029   private long swigCPtr;
030
031   protected GroupsExtension(long cPtr, boolean cMemoryOwn)
032   {
033     super(libsbmlJNI.GroupsExtension_SWIGUpcast(cPtr), cMemoryOwn);
034     swigCPtr = cPtr;
035   }
036
037   protected static long getCPtr(GroupsExtension obj)
038   {
039     return (obj == null) ? 0 : obj.swigCPtr;
040   }
041
042   protected static long getCPtrAndDisown (GroupsExtension obj)
043   {
044     long ptr = 0;
045
046     if (obj != null)
047     {
048       ptr             = obj.swigCPtr;
049       obj.swigCMemOwn = false;
050     }
051
052     return ptr;
053   }
054
055  protected void finalize() {
056    delete();
057  }
058
059  public synchronized void delete() {
060    if (swigCPtr != 0) {
061      if (swigCMemOwn) {
062        swigCMemOwn = false;
063        libsbmlJNI.delete_GroupsExtension(swigCPtr);
064      }
065      swigCPtr = 0;
066    }
067    super.delete();
068  }
069
070    public SBasePlugin DowncastSBasePlugin(long cPtr, boolean owner)
071    {
072        if (cPtr == 0) return null;
073        
074        SBasePlugin sbp = new SBasePlugin(cPtr, false);
075        SBase sb = sbp.getParentSBMLObject();
076        
077
078    if (sb instanceof Model)
079    {
080      return new GroupsModelPlugin(cPtr, owner);
081    }
082    
083        switch( sb.getTypeCode() )
084        {
085            case (int) libsbml.SBML_MODEL:
086                return new GroupsModelPlugin(cPtr,owner);
087            default:
088                return new SBasePlugin(cPtr,owner);
089        }
090    }
091    
092  public SBase DowncastSBase(long cPtr, boolean owner)
093  {
094    if (cPtr == 0) return null;
095
096    SBase sb = new SBase(cPtr, false);
097    switch ( sb.getTypeCode() )
098    {
099      case (int) libsbml.SBML_LIST_OF:
100        String name = sb.getElementName();
101        if (name.equals("listOfGroups"))
102        {
103          return new ListOfGroups(cPtr, owner);
104        }
105        else if (name.equals("listOfMembers"))
106        {
107          return new ListOfMembers(cPtr, owner);
108        }
109
110        return new ListOf(cPtr, owner);
111
112      case (int) libsbml.SBML_GROUPS_GROUP:
113        return new Group(cPtr, owner);
114
115      case (int) libsbml.SBML_GROUPS_MEMBER:
116        return new Member(cPtr, owner);
117
118      default:
119        return new SBase(cPtr, owner);
120    }
121  }
122
123    
124  
125/**
126   * Returns the nickname of the SBML Level&nbsp;3 package implemented by this
127   * libSBML extension.
128   <p>
129   * @return the package nickname, as a string.
130   <p>
131   * 
132   */ public
133 static String getPackageName() {
134    return libsbmlJNI.GroupsExtension_getPackageName();
135  }
136
137  
138/**
139   * Returns the default SBML Level implemented by this libSBML extension.
140   <p>
141   * @return the SBML Level, as a long integereger.
142   <p>
143   * 
144   */ public
145 static long getDefaultLevel() {
146    return libsbmlJNI.GroupsExtension_getDefaultLevel();
147  }
148
149  
150/**
151   * Returns the default SBML Version implemented by this libSBML extension.
152   <p>
153   * @return the Version within the default SBML Level, as a long integereger.
154   <p>
155   * 
156   */ public
157 static long getDefaultVersion() {
158    return libsbmlJNI.GroupsExtension_getDefaultVersion();
159  }
160
161  
162/**
163   * Returns the default version of the SBML Level&nbsp;3 package implemented
164   * by this libSBML extension.
165   <p>
166   * @return the default version number of the SBML Level&nbsp;3 package
167   * definition, as a long integereger.
168   <p>
169   * 
170   */ public
171 static long getDefaultPackageVersion() {
172    return libsbmlJNI.GroupsExtension_getDefaultPackageVersion();
173  }
174
175  
176/**
177   * Returns the XML namespace URI of the SBML Level&nbsp;3 package implemented
178   * by this libSBML extension.
179   <p>
180   * @return the XML namespace, as a string.
181   <p>
182   * 
183   */ public
184 static String getXmlnsL3V1V1() {
185    return libsbmlJNI.GroupsExtension_getXmlnsL3V1V1();
186  }
187
188  
189/**
190   * Creates a new {@link GroupsExtension} instance.
191   */ public
192 GroupsExtension() {
193    this(libsbmlJNI.new_GroupsExtension__SWIG_0(), true);
194  }
195
196  
197/**
198   * Copy constructor for {@link GroupsExtension}.
199   <p>
200   * @param orig the {@link GroupsExtension} instance to copy.
201   */ public
202 GroupsExtension(GroupsExtension orig) {
203    this(libsbmlJNI.new_GroupsExtension__SWIG_1(GroupsExtension.getCPtr(orig), orig), true);
204  }
205
206  
207/**
208   * Creates and returns a deep copy of this {@link GroupsExtension} object.
209   <p>
210   * @return a (deep) copy of this {@link GroupsExtension} object.
211   */ public
212 GroupsExtension cloneObject() {
213    long cPtr = libsbmlJNI.GroupsExtension_cloneObject(swigCPtr, this);
214    return (cPtr == 0) ? null : new GroupsExtension(cPtr, true);
215  }
216
217  
218/**
219   * Returns the name of this SBML Level&nbsp;3 package ('groups').
220   <p>
221   * @return a string representing the name of this package ('groups').
222   */ public
223 String getName() {
224    return libsbmlJNI.GroupsExtension_getName(swigCPtr, this);
225  }
226
227  
228/**
229   * Returns a string representing the SBML XML namespace of this SBML
230   * Level&nbsp;3 package.
231   <p>
232   * @param sbmlLevel the level of SBML.
233   <p>
234   * @param sbmlVersion the version of SBML.
235   <p>
236   * @param pkgVersion the version of this package.
237   <p>
238   * @return a string representing the name of this package ('groups').
239   <p>
240   * The namespace URI constructed by this method corresponds to the
241   * combination of the Level and Version of SBML, and the Version of the SBML
242   * Level&nbsp;3 package. (At the time of this writing, the only SBML Level
243   * that supports packages is Level&nbsp;3, so the value of <code>sbmlLevel</code> is
244   * necessarily always <code>3</code>.)
245   */ public
246 String getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) {
247    return libsbmlJNI.GroupsExtension_getURI(swigCPtr, this, sbmlLevel, sbmlVersion, pkgVersion);
248  }
249
250  
251/**
252   * Returns the SBML Level for the given URI of this package.
253   <p>
254   * @param uri the string of the URI that represents one of the versions of
255   * the 'groups' package.
256   <p>
257   * @return the SBML Level for the given URI of this package, or <code>0</code> if the
258   * given URI is invalid, or for a different package.
259   */ public
260 long getLevel(String uri) {
261    return libsbmlJNI.GroupsExtension_getLevel(swigCPtr, this, uri);
262  }
263
264  
265/**
266   * Returns the Version within the SBML Level for the given URI of this
267   * package.
268   <p>
269   * @param uri the string of the URI that represents one of the versions of
270   * the 'groups' package.
271   <p>
272   * @return the SBML Version within the SBML Level for the given URI of this
273   * package, or <code>0</code> if the given URI is invalid, or for a different package.
274   */ public
275 long getVersion(String uri) {
276    return libsbmlJNI.GroupsExtension_getVersion(swigCPtr, this, uri);
277  }
278
279  
280/**
281   * Returns the SBML Level&nbsp;3 package version for the given URI of this
282   * package.
283   <p>
284   * @param uri the string of the URI that represents one of the versions of
285   * the 'groups' package.
286   <p>
287   * @return the version of the SBML Level&nbsp;3 package for the given URI of
288   * this package, or <code>0</code> if the given URI is invalid, or for a different
289   * package.
290   */ public
291 long getPackageVersion(String uri) {
292    return libsbmlJNI.GroupsExtension_getPackageVersion(swigCPtr, this, uri);
293  }
294
295  
296/**
297   * Returns a {@link GroupsPkgNamespaces} object.
298   <p>
299   * @param uri the string of the URI that represents one of the versions of
300   * the 'groups' package.
301   <p>
302   * @return {@link GroupsPkgNamespaces} object corresponding to the given URI of this
303   * package, or <code>null</code> if the given URI is not defined in the 'groups'
304   * package.
305   */ public
306 SBMLNamespaces getSBMLExtensionNamespaces(String uri) {
307  return libsbml.DowncastSBMLNamespaces(libsbmlJNI.GroupsExtension_getSBMLExtensionNamespaces(swigCPtr, this, uri), false);
308}
309
310  
311/**
312   * Takes a type code of the &ldquo;groups&rdquo; package and returns a string
313   * describing the code.
314   <p>
315   * @param typeCode a libSBML type code defined by the libSBML extension
316   * implementing support for the SBML Level&nbsp;3 &ldquo;groups&rdquo;
317   * package.
318   <p>
319   * @return a text string representing the type code given by <code>typeCode</code>. If
320   * the type code is unrecognized for this implementation of the libSBML
321   * &ldquo;groups&rdquo; package, the string returned will be <code>'(Unknown
322   * SBML Groups Type)'</code>.
323   */ public
324 String getStringFromTypeCode(int typeCode) {
325    return libsbmlJNI.GroupsExtension_getStringFromTypeCode(swigCPtr, this, typeCode);
326  }
327
328  
329/** * @internal */ public
330 SWIGTYPE_p_packageErrorTableEntry getErrorTable(long index) {
331    return new SWIGTYPE_p_packageErrorTableEntry(libsbmlJNI.GroupsExtension_getErrorTable(swigCPtr, this, index), true);
332  }
333
334  
335/** * @internal */ public
336 long getErrorTableIndex(long errorId) {
337    return libsbmlJNI.GroupsExtension_getErrorTableIndex(swigCPtr, this, errorId);
338  }
339
340  
341/** * @internal */ public
342 long getErrorIdOffset() {
343    return libsbmlJNI.GroupsExtension_getErrorIdOffset(swigCPtr, this);
344  }
345
346  
347/** * @internal */ public
348 static void init() {
349    libsbmlJNI.GroupsExtension_init();
350  }
351
352}