001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.10
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 *  Base class for extending SBML objects in packages.
013 <p>
014 * <p style='color: #777; font-style: italic'>
015This class of objects is defined by libSBML only and has no direct
016equivalent in terms of SBML components.  This class is not prescribed by
017the SBML specifications, although it is used to implement features
018defined in SBML.
019</p>
020
021 <p>
022 * The {@link SBasePlugin} class is libSBML's base class for extensions of core SBML
023 * component objects.  {@link SBasePlugin} defines basic virtual methods for
024 * reading/writing/checking additional attributes and/or subobjects; these
025 * methods should be overridden by subclasses to implement the necessary
026 * features of an extended SBML object.
027 <p>
028 * <p>
029 * <h2>Basic principles of SBML package extensions in libSBML</h2>
030 <p>
031 * SBML Level&nbsp;3's package structure permits modular extensions to the
032 * core SBML format.  In libSBML, support for SBML Level&nbsp;3 packages is
033 * provided through optional <em>package extensions</em> that can be plugged
034 * into libSBML at the time it is built/compiled.  Users of libSBML can thus
035 * choose which extensions are enabled in their software applications.
036 <p>
037 * LibSBML defines a number of classes that developers of package extensions
038 * can use to implement support for an SBML Level&nbsp;3 package.  These
039 * classes make it easier to extend libSBML objects with new attributes
040 * and/or subobjects as needed by a particular Level&nbsp;3 package.
041 * Three overall categories of classes make up libSBML's facilities for
042 * implementing package extensions.  There are (1) classes that serve as base
043 * classes meant to be subclassed, (2) template classes meant to be
044 * instantiated rather than subclassed, and (3) support classes that provide
045 * utility features. A given package implementation for libSBML will take
046 * the form of code using these and other libSBML classes, placed in a
047 * subdirectory of <code>src/sbml/packages/</code>.
048 <p>
049 * The basic libSBML distribution includes a number of package extensions
050 * implementing support for officially-endorsed SBML Level&nbsp;3 packages;
051 * among these are <em>Flux Balance Constraints</em> ('fbc'),
052 * <em>Hierarchical Model Composition</em> ('comp'), <em>Layout</em>
053 * ('layout'), and <em>Qualitative Models</em> ('qual').  They can serve as
054 * working examples for developers working to implement other packages.
055 <p>
056 * Extensions in libSBML can currently only be implemented in C++ or C;
057 * there is no mechanism to implement them first in languages such as
058 * Java or Python.  However, once implemented in C++ or C, language
059 * interfaces can be generated semi-automatically using the framework in
060 * place in libSBML.  (The approach is based on using <a target='_blank'
061 * href='http://www.swig.org'>SWIG</a> and facilities in libSBML's build
062 * system.)
063 */
064
065public class SBasePlugin {
066   private long swigCPtr;
067   protected boolean swigCMemOwn;
068
069   protected SBasePlugin(long cPtr, boolean cMemoryOwn)
070   {
071     swigCMemOwn = cMemoryOwn;
072     swigCPtr    = cPtr;
073   }
074
075   protected static long getCPtr(SBasePlugin obj)
076   {
077     return (obj == null) ? 0 : obj.swigCPtr;
078   }
079
080   protected static long getCPtrAndDisown (SBasePlugin obj)
081   {
082     long ptr = 0;
083
084     if (obj != null)
085     {
086       ptr             = obj.swigCPtr;
087       obj.swigCMemOwn = false;
088     }
089
090     return ptr;
091   }
092
093  protected void finalize() {
094    delete();
095  }
096
097  public synchronized void delete() {
098    if (swigCPtr != 0) {
099      if (swigCMemOwn) {
100        swigCMemOwn = false;
101        libsbmlJNI.delete_SBasePlugin(swigCPtr);
102      }
103      swigCPtr = 0;
104    }
105  }
106
107  
108/**
109   * Returns the namespace URI of the package to which this plugin object
110   * belongs.
111   <p>
112   * @return the XML namespace URI of the SBML Level&nbsp;3 package
113   * implemented by this libSBML package extension.
114   */ public
115 String getElementNamespace() {
116    return libsbmlJNI.SBasePlugin_getElementNamespace(swigCPtr, this);
117  }
118
119  
120/**
121   * Returns the XML namespace prefix of the package to which this plugin
122   * object belongs.
123   <p>
124   * @return the XML namespace prefix of the SBML Level&nbsp;3 package
125   * implemented by this libSBML package extension.
126   */ public
127 String getPrefix() {
128    return libsbmlJNI.SBasePlugin_getPrefix(swigCPtr, this);
129  }
130
131  
132/**
133   * Returns the short-form name of the package to which this plugin
134   * object belongs.
135   <p>
136   * @return the short-form package name (or nickname) of the SBML package
137   * implemented by this package extension.
138   */ public
139 String getPackageName() {
140    return libsbmlJNI.SBasePlugin_getPackageName(swigCPtr, this);
141  }
142
143  
144/**
145   * Creates and returns a deep copy of this {@link SBasePlugin} object.
146   <p>
147   * @return the (deep) copy of this {@link SBasePlugin} object.
148   */ public
149 SBasePlugin cloneObject() {
150    return libsbml.DowncastSBasePlugin(libsbmlJNI.SBasePlugin_cloneObject(swigCPtr, this), true);
151}
152
153  
154/**
155   * Return the first child object found with a given identifier.
156   <p>
157   * This method searches all the subobjects under this one, compares their
158   * identifiers to <code>id</code>, and returns the first one that machines.
159   <p>
160   * Normally, <code>SId</code> type identifier values are unique across
161   * a model in SBML.  However, in some circumstances they may not be, such
162   * as if a model is invalid because of multiple objects having the same
163   * identifier.
164   <p>
165   * @param id string representing the identifier of the object to find
166   <p>
167   * @return pointer to the first object with the given <code>id</code>.
168   */ public
169 SBase getElementBySId(String id) {
170  return libsbml.DowncastSBase(libsbmlJNI.SBasePlugin_getElementBySId(swigCPtr, this, id), false);
171}
172
173  
174/**
175   * Return the first child object found with a given meta identifier.
176   <p>
177   * This method searches all the subobjects under this one, compares their
178   * meta identifiers to <code>metaid</code>, and returns the first one that machines.
179   <p>
180   * @param metaid string, the metaid of the object to find.
181   <p>
182   * @return pointer to the first object found with the given <code>metaid</code>.
183   */ public
184 SBase getElementByMetaId(String metaid) {
185  return libsbml.DowncastSBase(libsbmlJNI.SBasePlugin_getElementByMetaId(swigCPtr, this, metaid), false);
186}
187
188  
189/** * @internal */ public
190 void connectToParent(SBase sbase) {
191    libsbmlJNI.SBasePlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase);
192  }
193
194  
195/** * @internal */ public
196 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
197    libsbmlJNI.SBasePlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
198  }
199
200  
201/** * @internal */ public
202 boolean stripPackage(String pkgPrefix, boolean flag) {
203    return libsbmlJNI.SBasePlugin_stripPackage(swigCPtr, this, pkgPrefix, flag);
204  }
205
206  
207/**
208   * Returns the {@link SBMLDocument} object containing this object instance.
209   <p>
210   * <p>
211 * LibSBML uses the class {@link SBMLDocument} as a top-level container for
212 * storing SBML content and data associated with it (such as warnings and
213 * error messages).  An SBML model in libSBML is contained inside an
214 * {@link SBMLDocument} object.  {@link SBMLDocument} corresponds roughly to the class
215 * <i>SBML</i> defined in the SBML Level&nbsp;3 and Level&nbsp;2
216 * specifications, but it does not have a direct correspondence in SBML
217 * Level&nbsp;1.  (But, it is created by libSBML no matter whether the
218 * model is Level&nbsp;1, Level&nbsp;2 or Level&nbsp;3.)
219   <p>
220   * This method allows the caller to obtain the {@link SBMLDocument} for the
221   * current object.
222   <p>
223   * @return the parent {@link SBMLDocument} object of this plugin object.
224   <p>
225   * @see #getParentSBMLObject()
226   */ public
227 SBMLDocument getSBMLDocument() {
228    long cPtr = libsbmlJNI.SBasePlugin_getSBMLDocument__SWIG_0(swigCPtr, this);
229    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
230  }
231
232  
233/**
234   * Returns the XML namespace URI for the package to which this object belongs.
235   <p>
236   * <p>
237 * In the XML representation of an SBML document, XML namespaces are used to
238 * identify the origin of each XML construct used.  XML namespaces are
239 * identified by their unique resource identifiers (URIs).  The core SBML
240 * specifications stipulate the namespaces that must be used for core SBML
241 * constructs; for example, all XML elements that belong to SBML Level&nbsp;3
242 * Version&nbsp;1 Core must be placed in the XML namespace identified by the URI
243 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>.  Individual
244 * SBML Level&nbsp;3 packages define their own XML namespaces; for example,
245 * all elements belonging to the SBML Level&nbsp;3 Layout Version&nbsp;1
246 * package must be placed in the XML namespace
247 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>.
248   <p>
249   * This method first looks into the {@link SBMLNamespaces} object possessed by the
250   * parent {@link SBMLDocument} object of the current object.  If this cannot be
251   * found, this method returns the result of getElementNamespace().
252   <p>
253   * @return a string, the URI of the XML namespace to which this object belongs.
254   <p>
255   * @see #getPackageName()
256   * @see #getElementNamespace()
257   * @see #getSBMLDocument()
258   */ public
259 String getURI() {
260    return libsbmlJNI.SBasePlugin_getURI(swigCPtr, this);
261  }
262
263  
264/**
265   * Returns the parent object to which this plugin object is connected.
266   <p>
267   * @return the parent object of this object.
268   */ public
269 SBase getParentSBMLObject() {
270  return libsbml.DowncastSBase(libsbmlJNI.SBasePlugin_getParentSBMLObject__SWIG_0(swigCPtr, this), false);
271}
272
273  
274/**
275   * Sets the XML namespace to which this object belongs.
276   <p>
277   * <p>
278 * In the XML representation of an SBML document, XML namespaces are used to
279 * identify the origin of each XML construct used.  XML namespaces are
280 * identified by their unique resource identifiers (URIs).  The core SBML
281 * specifications stipulate the namespaces that must be used for core SBML
282 * constructs; for example, all XML elements that belong to SBML Level&nbsp;3
283 * Version&nbsp;1 Core must be placed in the XML namespace identified by the URI
284 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>.  Individual
285 * SBML Level&nbsp;3 packages define their own XML namespaces; for example,
286 * all elements belonging to the SBML Level&nbsp;3 Layout Version&nbsp;1
287 * package must be placed in the XML namespace
288 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>.
289   <p>
290   * @param uri the URI to assign to this object.
291   <p>
292   * <p>
293 * @return integer value indicating success/failure of the
294 * function.   The possible values
295 * returned by this function are:
296   * <ul>
297   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
298   *
299   * </ul> <p>
300   * @see #getElementNamespace()
301   */ public
302 int setElementNamespace(String uri) {
303    return libsbmlJNI.SBasePlugin_setElementNamespace(swigCPtr, this, uri);
304  }
305
306  
307/**
308   * Returns the SBML Level of the package extension of this plugin object.
309   <p>
310   * @return the SBML Level.
311   <p>
312   * @see #getVersion()
313   */ public
314 long getLevel() {
315    return libsbmlJNI.SBasePlugin_getLevel(swigCPtr, this);
316  }
317
318  
319/**
320   * Returns the Version within the SBML Level of the package extension of
321   * this plugin object.
322   <p>
323   * @return the SBML Version.
324   <p>
325   * @see #getLevel()
326   */ public
327 long getVersion() {
328    return libsbmlJNI.SBasePlugin_getVersion(swigCPtr, this);
329  }
330
331  
332/**
333   * Returns the package version of the package extension of this plugin
334   * object.
335   <p>
336   * @return the package version of the package extension of this plugin
337   * object.
338   <p>
339   * @see #getLevel()
340   * @see #getVersion()
341   */ public
342 long getPackageVersion() {
343    return libsbmlJNI.SBasePlugin_getPackageVersion(swigCPtr, this);
344  }
345
346  
347/** * @internal */ public
348 void replaceSIDWithFunction(String id, ASTNode function) {
349    libsbmlJNI.SBasePlugin_replaceSIDWithFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function);
350  }
351
352  
353/** * @internal */ public
354 void divideAssignmentsToSIdByFunction(String id, ASTNode function) {
355    libsbmlJNI.SBasePlugin_divideAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function);
356  }
357
358  
359/** * @internal */ public
360 void multiplyAssignmentsToSIdByFunction(String id, ASTNode function) {
361    libsbmlJNI.SBasePlugin_multiplyAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function);
362  }
363
364  
365/** * @internal */ public
366 boolean hasIdentifierBeginningWith(String prefix) {
367    return libsbmlJNI.SBasePlugin_hasIdentifierBeginningWith(swigCPtr, this, prefix);
368  }
369
370  
371/** * @internal */ public
372 int prependStringToAllIdentifiers(String prefix) {
373    return libsbmlJNI.SBasePlugin_prependStringToAllIdentifiers(swigCPtr, this, prefix);
374  }
375
376  
377/**
378   * <p>
379 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
380 * value.
381 <p>
382 * <p>
383 * In SBML, object identifiers are of a data type called <code>SId</code>.
384 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
385 * introduced for attribute values that refer to <code>SId</code> values; in
386 * previous Levels of SBML, this data type did not exist and attributes were
387 * simply described to as 'referring to an identifier', but the effective
388 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
389 * other methods of libSBML refer to the type <code>SIdRef</code> for all
390 * Levels of SBML, even if the corresponding SBML specification did not
391 * explicitly name the data type.
392 <p>
393 * This method works by looking at all attributes and (if appropriate)
394 * mathematical formulas in MathML content, comparing the referenced
395 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
396 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
397 * descend into child elements.
398 <p>
399 * @param oldid the old identifier
400 * @param newid the new identifier
401   */ public
402 void renameSIdRefs(String oldid, String newid) {
403    libsbmlJNI.SBasePlugin_renameSIdRefs(swigCPtr, this, oldid, newid);
404  }
405
406  
407/**
408   * <p>
409 * Replaces all uses of a given meta identifier attribute value with
410 * another value.
411 <p>
412 * <p>
413 * In SBML, object 'meta' identifiers are of the XML data type <code>ID</code>;
414 * the SBML object attribute itself is typically named <code>metaid</code>.  All
415 * attributes that hold values <em>referring</em> to values of type
416 * <code>ID</code> are of the XML data type <code>IDREF</code>.  They are also
417 * sometimes informally referred to as 'metaid refs', in analogy to the
418 * SBML-defined type <code>SIdRef</code>.
419 <p>
420 * This method works by looking at all meta-identifier attribute values,
421 * comparing the identifiers to the value of <code>oldid</code>.  If any matches are
422 * found, the matching identifiers are replaced with <code>newid</code>.  The method
423 * does <em>not</em> descend into child elements.
424 <p>
425 * @param oldid the old identifier
426 * @param newid the new identifier
427   */ public
428 void renameMetaIdRefs(String oldid, String newid) {
429    libsbmlJNI.SBasePlugin_renameMetaIdRefs(swigCPtr, this, oldid, newid);
430  }
431
432  
433/**
434   * <p>
435 * Replaces all uses of a given <code>UnitSIdRef</code> type attribute value with
436 * another value.
437 <p>
438 * <p>
439 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>.  In
440 * SBML Level&nbsp;3, an explicit data type called <code>UnitSIdRef</code> was
441 * introduced for attribute values that refer to <code>UnitSId</code> values; in
442 * previous Levels of SBML, this data type did not exist and attributes were
443 * simply described to as 'referring to a unit identifier', but the effective
444 * data type was the same as <code>UnitSIdRef</code> in Level&nbsp;3.  These and
445 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all
446 * Levels of SBML, even if the corresponding SBML specification did not
447 * explicitly name the data type.
448 <p>
449 * This method works by looking at all unit identifier attribute values
450 * (including, if appropriate, inside mathematical formulas), comparing the
451 * referenced unit identifiers to the value of <code>oldid</code>.  If any matches
452 * are found, the matching values are replaced with <code>newid</code>.  The method
453 * does <em>not</em> descend into child elements.
454 <p>
455 * @param oldid the old identifier
456 * @param newid the new identifier
457   */ public
458 void renameUnitSIdRefs(String oldid, String newid) {
459    libsbmlJNI.SBasePlugin_renameUnitSIdRefs(swigCPtr, this, oldid, newid);
460  }
461
462  
463/** * @internal */ public
464 int transformIdentifiers(IdentifierTransformer sidTransformer) {
465    return libsbmlJNI.SBasePlugin_transformIdentifiers(swigCPtr, this, IdentifierTransformer.getCPtr(sidTransformer), sidTransformer);
466  }
467
468  
469/** * @internal */ public
470 long getLine() {
471    return libsbmlJNI.SBasePlugin_getLine(swigCPtr, this);
472  }
473
474  
475/** * @internal */ public
476 long getColumn() {
477    return libsbmlJNI.SBasePlugin_getColumn(swigCPtr, this);
478  }
479
480  
481/** * @internal */ public
482 SBMLNamespaces getSBMLNamespaces() {
483  return libsbml.DowncastSBMLNamespaces(libsbmlJNI.SBasePlugin_getSBMLNamespaces(swigCPtr, this), false);
484}
485
486  
487/** * @internal */ public
488 void logUnknownElement(String element, long sbmlLevel, long sbmlVersion, long pkgVersion) {
489    libsbmlJNI.SBasePlugin_logUnknownElement(swigCPtr, this, element, sbmlLevel, sbmlVersion, pkgVersion);
490  }
491
492  
493/** */ public
494 boolean isValidTypeForList(SBase item) {
495    return libsbmlJNI.SBasePlugin_isValidTypeForList(swigCPtr, this, SBase.getCPtrAndDisown(item), item);
496  }
497
498  
499/** * @internal */ public
500 SBMLExtension getSBMLExtension() {
501    return libsbml.DowncastExtension(libsbmlJNI.SBasePlugin_getSBMLExtension(swigCPtr, this), false);
502}
503
504  public SBaseList getListOfAllElements(ElementFilter filter) {
505    long cPtr = libsbmlJNI.SBasePlugin_getListOfAllElements__SWIG_0(swigCPtr, this, ElementFilter.getCPtr(filter), filter);
506    return (cPtr == 0) ? null : new SBaseList(cPtr, false);
507  }
508
509  public SBaseList getListOfAllElements() {
510    long cPtr = libsbmlJNI.SBasePlugin_getListOfAllElements__SWIG_1(swigCPtr, this);
511    return (cPtr == 0) ? null : new SBaseList(cPtr, false);
512  }
513
514}