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 * Registry class in which extension packages are registered. 013 */ 014 015public class SBMLExtensionRegistry { 016 private long swigCPtr; 017 protected boolean swigCMemOwn; 018 019 protected SBMLExtensionRegistry(long cPtr, boolean cMemoryOwn) 020 { 021 swigCMemOwn = cMemoryOwn; 022 swigCPtr = cPtr; 023 } 024 025 protected static long getCPtr(SBMLExtensionRegistry obj) 026 { 027 return (obj == null) ? 0 : obj.swigCPtr; 028 } 029 030 protected static long getCPtrAndDisown (SBMLExtensionRegistry 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 public synchronized void delete() { 044 if (swigCPtr != 0) { 045 if (swigCMemOwn) { 046 swigCMemOwn = false; 047 throw new UnsupportedOperationException("C++ destructor does not have public access"); 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 * overriden 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 * overriden 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 * If the given <code>package</code> is enabled, returns <code>true</code>; otherwise, 143 * returns <code>false.</code> 144 <p> 145 * @return the status (enabled = <b>true</b>, disabled = <b>false</b> of the given package. 146 */ public 147 static boolean isPackageEnabled(String arg0) { 148 return libsbmlJNI.SBMLExtensionRegistry_isPackageEnabled(arg0); 149 } 150 151 152/** 153 * Enables the package with the given URI / name. 154 */ public 155 static void enablePackage(String arg0) { 156 libsbmlJNI.SBMLExtensionRegistry_enablePackage(arg0); 157 } 158 159 160/** 161 * Returns the number of {@link SBMLExtension} with the given extension point. 162 <p> 163 * @param extPoint the {@link SBaseExtensionPoint} 164 <p> 165 * @return the number of {@link SBMLExtension} with the given extension point. 166 */ public 167 long getNumExtension(SBaseExtensionPoint extPoint) { 168 return libsbmlJNI.SBMLExtensionRegistry_getNumExtension(swigCPtr, this, SBaseExtensionPoint.getCPtr(extPoint), extPoint); 169 } 170 171 172/** 173 * Enable/disable the package with the given uri. 174 <p> 175 * @param uri the URI of the target package. 176 * @param isEnabled the boolean value corresponding to enabled (true) or 177 * disabled (false) 178 <p> 179 * @return false will be returned if the given boolean value is false 180 * or the given package is not registered, otherwise true will be 181 * returned. 182 */ public 183 boolean setEnabled(String uri, boolean isEnabled) { 184 return libsbmlJNI.SBMLExtensionRegistry_setEnabled(swigCPtr, this, uri, isEnabled); 185 } 186 187 188/** 189 * Checks if the extension with the given URI is enabled (true) or 190 * disabled (false) 191 <p> 192 * @param uri the URI of the target package. 193 <p> 194 * @return false will be returned if the given package is disabled 195 * or not registered, otherwise true will be returned. 196 */ public 197 boolean isEnabled(String uri) { 198 return libsbmlJNI.SBMLExtensionRegistry_isEnabled(swigCPtr, this, uri); 199 } 200 201 202/** 203 * Checks if the extension with the given URI is registered (true) 204 * or not (false) 205 <p> 206 * @param uri the URI of the target package. 207 <p> 208 * @return true will be returned if the package with the given URI 209 * is registered, otherwise false will be returned. 210 */ public 211 boolean isRegistered(String uri) { 212 return libsbmlJNI.SBMLExtensionRegistry_isRegistered(swigCPtr, this, uri); 213 } 214 215 216/** 217 * Returns the number of registered packages. 218 <p> 219 * @return the number of registered packages. 220 */ public 221 static long getNumRegisteredPackages() { 222 return libsbmlJNI.SBMLExtensionRegistry_getNumRegisteredPackages(); 223 } 224 225 226/** 227 * Returns the registered package name at the given index 228 <p> 229 * @param index zero based index of the package name to return 230 <p> 231 * @return the package name with the given index or null 232 */ public 233 static String getRegisteredPackageName(long index) { 234 return libsbmlJNI.SBMLExtensionRegistry_getRegisteredPackageName(index); 235 } 236 237}