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 SBMLExtensionRegistry {
012   private long swigCPtr;
013   protected boolean swigCMemOwn;
014
015   protected SBMLExtensionRegistry(long cPtr, boolean cMemoryOwn)
016   {
017     swigCMemOwn = cMemoryOwn;
018     swigCPtr    = cPtr;
019   }
020
021   protected static long getCPtr(SBMLExtensionRegistry obj)
022   {
023     return (obj == null) ? 0 : obj.swigCPtr;
024   }
025
026   protected static long getCPtrAndDisown (SBMLExtensionRegistry obj)
027   {
028     long ptr = 0;
029
030     if (obj != null)
031     {
032       ptr             = obj.swigCPtr;
033       obj.swigCMemOwn = false;
034     }
035
036     return ptr;
037   }
038
039  protected void finalize() {
040    delete();
041  }
042
043  public synchronized void delete() {
044    if (swigCPtr != 0) {
045      if (swigCMemOwn) {
046        swigCMemOwn = false;
047        libsbmlJNI.delete_SBMLExtensionRegistry(swigCPtr);
048      }
049      swigCPtr = 0;
050    }
051  }
052
053  
054/**
055   * <p>
056   * Returns an instance (singleton) of the {@link SBMLExtensionRegistry} class.
057   * This function needs to be invoked when manipulating the {@link SBMLExtensionRegistry} class. 
058   * <p>
059   * @return the instance of the {@link SBMLExtensionRegistry} object.
060   */ public
061 static SBMLExtensionRegistry getInstance() {
062    return new SBMLExtensionRegistry(libsbmlJNI.SBMLExtensionRegistry_getInstance(), false);
063  }
064
065  
066/**
067   * Add the given {@link SBMLExtension} to this {@link SBMLExtensionRegistry}.
068   * <p>
069   * @param ext the {@link SBMLExtension} object to be added.
070   * <p>
071   * @return integer value indicating success/failure of the
072   * function.  The possible values returned by this function are:
073   * <ul>
074   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
075   * <li> {@link  libsbmlConstants#LIBSBML_PKG_CONFLICT LIBSBML_PKG_CONFLICT }
076   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
077   * </ul>
078   */ public
079 int addExtension(SBMLExtension ext) {
080    return libsbmlJNI.SBMLExtensionRegistry_addExtension(swigCPtr, this, SBMLExtension.getCPtr(ext), ext);
081  }
082
083  
084/**
085   * Returns an {@link SBMLExtension} object with the given package URI or package name (string).
086   * <p>
087   * @param package the URI or name of the package extension
088   * <p>
089   * @return a clone of the {@link SBMLExtension} object with the given package URI or name. The returned 
090   *         extension is to be freed (i.e.: deleted) by the caller!
091   */ public
092 SBMLExtension getExtension(String arg0) {
093    return libsbml.DowncastExtension(libsbmlJNI.SBMLExtensionRegistry_getExtension(swigCPtr, this, arg0), false);
094}
095
096  
097/**
098   * Remove all L2 Extension namespaces from the namespace list. This will call all 
099   * overridden SBMLExtension.removeL2Namespaces methods.
100   */ public
101 void removeL2Namespaces(XMLNamespaces xmlns) {
102    libsbmlJNI.SBMLExtensionRegistry_removeL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns);
103  }
104
105  
106/**
107   * adds all L2 Extension namespaces to the namespace list. This will call all 
108   * overridden SBMLExtension.addL2Namespaces methods.
109   */ public
110 void addL2Namespaces(XMLNamespaces xmlns) {
111    libsbmlJNI.SBMLExtensionRegistry_addL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns);
112  }
113
114  
115/**
116   * Enables all extensions that support serialization / deserialization with
117   * SBML Annotations.
118   */ public
119 void enableL2NamespaceForDocument(SBMLDocument doc) {
120    libsbmlJNI.SBMLExtensionRegistry_enableL2NamespaceForDocument(swigCPtr, this, SBMLDocument.getCPtr(doc), doc);
121  }
122
123  
124/** 
125   * Goes through all extensions in the list of plugins of the given document
126   * and disables all plugins that are not being used. 
127   */ public
128 void disableUnusedPackages(SBMLDocument doc) {
129    libsbmlJNI.SBMLExtensionRegistry_disableUnusedPackages(swigCPtr, this, SBMLDocument.getCPtr(doc), doc);
130  }
131
132  
133/**
134   * Disables the package with the given URI / name.
135   */ public
136 static void disablePackage(String arg0) {
137    libsbmlJNI.SBMLExtensionRegistry_disablePackage(arg0);
138  }
139
140  
141/**
142   * Disables all packages with the given URI / name.
143   */ public
144 static void disablePackages(SWIGTYPE_p_std__vectorT_std__string_t packages) {
145    libsbmlJNI.SBMLExtensionRegistry_disablePackages(SWIGTYPE_p_std__vectorT_std__string_t.getCPtr(packages));
146  }
147
148  
149/**
150   * @returns the status (enabled = <b>true</b>, disabled = <b>false</b> of the given package.
151   */ public
152 static boolean isPackageEnabled(String arg0) {
153    return libsbmlJNI.SBMLExtensionRegistry_isPackageEnabled(arg0);
154  }
155
156  
157/**
158   * Enables the package with the given URI / name.
159   */ public
160 static void enablePackage(String arg0) {
161    libsbmlJNI.SBMLExtensionRegistry_enablePackage(arg0);
162  }
163
164  
165/**
166   * Enables all packages with the given URI / name.
167   */ public
168 static void enablePackages(SWIGTYPE_p_std__vectorT_std__string_t packages) {
169    libsbmlJNI.SBMLExtensionRegistry_enablePackages(SWIGTYPE_p_std__vectorT_std__string_t.getCPtr(packages));
170  }
171
172  
173/**
174   * Returns the number of {@link SBMLExtension} with the given extension point.
175   * <p>
176   * @param extPoint the {@link SBaseExtensionPoint}
177   * <p>
178   * @return the number of {@link SBMLExtension} with the given extension point.
179   */ public
180 long getNumExtension(SBaseExtensionPoint extPoint) {
181    return libsbmlJNI.SBMLExtensionRegistry_getNumExtension(swigCPtr, this, SBaseExtensionPoint.getCPtr(extPoint), extPoint);
182  }
183
184  
185/**
186   * Enable/disable the package with the given uri.
187   * <p>
188   * @param uri the URI of the target package.
189   * @param isEnabled the bool value corresponding to enabled (true) or 
190   * disabled (false)
191   * <p>
192   * @return false will be returned if the given bool value is false 
193   * or the given package is not registered, otherwise true will be
194   * returned.
195   */ public
196 boolean setEnabled(String uri, boolean isEnabled) {
197    return libsbmlJNI.SBMLExtensionRegistry_setEnabled(swigCPtr, this, uri, isEnabled);
198  }
199
200  
201/**
202   * Checks if the extension with the given URI is enabled (true) or 
203   * disabled (false)
204   * <p>
205   * @param uri the URI of the target package.
206   * <p>
207   * @return false will be returned if the given package is disabled 
208   * or not registered, otherwise true will be returned.
209   */ public
210 boolean isEnabled(String uri) {
211    return libsbmlJNI.SBMLExtensionRegistry_isEnabled(swigCPtr, this, uri);
212  }
213
214  
215/**
216   * Checks if the extension with the given URI is registered (true) 
217   * or not (false)
218   * <p>
219   * @param uri the URI of the target package.
220   * <p>
221   * @return true will be returned if the package with the given URI
222   * is registered, otherwise false will be returned.
223   */ public
224 boolean isRegistered(String uri) {
225    return libsbmlJNI.SBMLExtensionRegistry_isRegistered(swigCPtr, this, uri);
226  }
227
228  
229/** 
230   * Returns the number of registered packages.
231   * <p>
232   * @return the number of registered packages.
233   */ public
234 static long getNumRegisteredPackages() {
235    return libsbmlJNI.SBMLExtensionRegistry_getNumRegisteredPackages();
236  }
237
238  
239/** 
240   * Returns the registered package name at the given index
241   * <p>
242   * @param index zero based index of the package name to return
243   * <p>
244   * @return the package name with the given index or null
245   */ public
246 static String getRegisteredPackageName(long index) {
247    return libsbmlJNI.SBMLExtensionRegistry_getRegisteredPackageName(index);
248  }
249
250}