001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.7
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 SBMLDocument#getSBMLNamespaces()
258   * @see #getSBMLDocument()
259   */ public
260 String getURI() {
261    return libsbmlJNI.SBasePlugin_getURI(swigCPtr, this);
262  }
263
264  
265/**
266   * Returns the parent object to which this plugin object is connected.
267   <p>
268   * @return the parent object of this object.
269   */ public
270 SBase getParentSBMLObject() {
271  return libsbml.DowncastSBase(libsbmlJNI.SBasePlugin_getParentSBMLObject__SWIG_0(swigCPtr, this), false);
272}
273
274  
275/**
276   * Sets the XML namespace to which this object belongs.
277   <p>
278   * <p>
279 * In the XML representation of an SBML document, XML namespaces are used to
280 * identify the origin of each XML construct used.  XML namespaces are
281 * identified by their unique resource identifiers (URIs).  The core SBML
282 * specifications stipulate the namespaces that must be used for core SBML
283 * constructs; for example, all XML elements that belong to SBML Level&nbsp;3
284 * Version&nbsp;1 Core must be placed in the XML namespace identified by the URI
285 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>.  Individual
286 * SBML Level&nbsp;3 packages define their own XML namespaces; for example,
287 * all elements belonging to the SBML Level&nbsp;3 Layout Version&nbsp;1
288 * package must be placed in the XML namespace
289 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>.
290   <p>
291   * @param uri the URI to assign to this object.
292   <p>
293   * <p>
294 * @return integer value indicating success/failure of the
295 * function.   The possible values
296 * returned by this function are:
297   * <ul>
298   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
299   *
300   * </ul> <p>
301   * @see #getElementNamespace()
302   */ public
303 int setElementNamespace(String uri) {
304    return libsbmlJNI.SBasePlugin_setElementNamespace(swigCPtr, this, uri);
305  }
306
307  
308/**
309   * Returns the SBML Level of the package extension of this plugin object.
310   <p>
311   * @return the SBML Level.
312   <p>
313   * @see #getVersion()
314   */ public
315 long getLevel() {
316    return libsbmlJNI.SBasePlugin_getLevel(swigCPtr, this);
317  }
318
319  
320/**
321   * Returns the Version within the SBML Level of the package extension of
322   * this plugin object.
323   <p>
324   * @return the SBML Version.
325   <p>
326   * @see #getLevel()
327   */ public
328 long getVersion() {
329    return libsbmlJNI.SBasePlugin_getVersion(swigCPtr, this);
330  }
331
332  
333/**
334   * Returns the package version of the package extension of this plugin
335   * object.
336   <p>
337   * @return the package version of the package extension of this plugin
338   * object.
339   <p>
340   * @see #getLevel()
341   * @see #getVersion()
342   */ public
343 long getPackageVersion() {
344    return libsbmlJNI.SBasePlugin_getPackageVersion(swigCPtr, this);
345  }
346
347  
348/** * @internal */ public
349 void replaceSIDWithFunction(String id, ASTNode function) {
350    libsbmlJNI.SBasePlugin_replaceSIDWithFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function);
351  }
352
353  
354/** * @internal */ public
355 void divideAssignmentsToSIdByFunction(String id, ASTNode function) {
356    libsbmlJNI.SBasePlugin_divideAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function);
357  }
358
359  
360/** * @internal */ public
361 void multiplyAssignmentsToSIdByFunction(String id, ASTNode function) {
362    libsbmlJNI.SBasePlugin_multiplyAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function);
363  }
364
365  
366/** * @internal */ public
367 boolean hasIdentifierBeginningWith(String prefix) {
368    return libsbmlJNI.SBasePlugin_hasIdentifierBeginningWith(swigCPtr, this, prefix);
369  }
370
371  
372/** * @internal */ public
373 int prependStringToAllIdentifiers(String prefix) {
374    return libsbmlJNI.SBasePlugin_prependStringToAllIdentifiers(swigCPtr, this, prefix);
375  }
376
377  
378/**
379   * <p>
380 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
381 * value.
382 <p>
383 * <p>
384 * In SBML, object identifiers are of a data type called <code>SId</code>.
385 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
386 * introduced for attribute values that refer to <code>SId</code> values; in
387 * previous Levels of SBML, this data type did not exist and attributes were
388 * simply described to as 'referring to an identifier', but the effective
389 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
390 * other methods of libSBML refer to the type <code>SIdRef</code> for all
391 * Levels of SBML, even if the corresponding SBML specification did not
392 * explicitly name the data type.
393 <p>
394 * This method works by looking at all attributes and (if appropriate)
395 * mathematical formulas in MathML content, comparing the referenced
396 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
397 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
398 * descend into child elements.
399 <p>
400 * @param oldid the old identifier
401 * @param newid the new identifier
402   */ public
403 void renameSIdRefs(String oldid, String newid) {
404    libsbmlJNI.SBasePlugin_renameSIdRefs(swigCPtr, this, oldid, newid);
405  }
406
407  
408/**
409   * <p>
410 * Replaces all uses of a given meta identifier attribute value with
411 * another value.
412 <p>
413 * <p>
414 * In SBML, object 'meta' identifiers are of the XML data type <code>ID</code>;
415 * the SBML object attribute itself is typically named <code>metaid</code>.  All
416 * attributes that hold values <em>referring</em> to values of type
417 * <code>ID</code> are of the XML data type <code>IDREF</code>.  They are also
418 * sometimes informally referred to as 'metaid refs', in analogy to the
419 * SBML-defined type <code>SIdRef</code>.
420 <p>
421 * This method works by looking at all meta-identifier attribute values,
422 * comparing the identifiers to the value of <code>oldid</code>.  If any matches are
423 * found, the matching identifiers are replaced with <code>newid</code>.  The method
424 * does <em>not</em> descend into child elements.
425 <p>
426 * @param oldid the old identifier
427 * @param newid the new identifier
428   */ public
429 void renameMetaIdRefs(String oldid, String newid) {
430    libsbmlJNI.SBasePlugin_renameMetaIdRefs(swigCPtr, this, oldid, newid);
431  }
432
433  
434/**
435   * <p>
436 * Replaces all uses of a given <code>UnitSIdRef</code> type attribute value with
437 * another value.
438 <p>
439 * <p>
440 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>.  In
441 * SBML Level&nbsp;3, an explicit data type called <code>UnitSIdRef</code> was
442 * introduced for attribute values that refer to <code>UnitSId</code> values; in
443 * previous Levels of SBML, this data type did not exist and attributes were
444 * simply described to as 'referring to a unit identifier', but the effective
445 * data type was the same as <code>UnitSIdRef</code> in Level&nbsp;3.  These and
446 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all
447 * Levels of SBML, even if the corresponding SBML specification did not
448 * explicitly name the data type.
449 <p>
450 * This method works by looking at all unit identifier attribute values
451 * (including, if appropriate, inside mathematical formulas), comparing the
452 * referenced unit identifiers to the value of <code>oldid</code>.  If any matches
453 * are found, the matching values are replaced with <code>newid</code>.  The method
454 * does <em>not</em> descend into child elements.
455 <p>
456 * @param oldid the old identifier
457 * @param newid the new identifier
458   */ public
459 void renameUnitSIdRefs(String oldid, String newid) {
460    libsbmlJNI.SBasePlugin_renameUnitSIdRefs(swigCPtr, this, oldid, newid);
461  }
462
463  
464/** * @internal */ public
465 int transformIdentifiers(IdentifierTransformer sidTransformer) {
466    return libsbmlJNI.SBasePlugin_transformIdentifiers(swigCPtr, this, IdentifierTransformer.getCPtr(sidTransformer), sidTransformer);
467  }
468
469  
470/** * @internal */ public
471 long getLine() {
472    return libsbmlJNI.SBasePlugin_getLine(swigCPtr, this);
473  }
474
475  
476/** * @internal */ public
477 long getColumn() {
478    return libsbmlJNI.SBasePlugin_getColumn(swigCPtr, this);
479  }
480
481  
482/** * @internal */ public
483 SBMLNamespaces getSBMLNamespaces() {
484  return libsbml.DowncastSBMLNamespaces(libsbmlJNI.SBasePlugin_getSBMLNamespaces(swigCPtr, this), false);
485}
486
487  
488/** * @internal */ public
489 void logUnknownElement(String element, long sbmlLevel, long sbmlVersion, long pkgVersion) {
490    libsbmlJNI.SBasePlugin_logUnknownElement(swigCPtr, this, element, sbmlLevel, sbmlVersion, pkgVersion);
491  }
492
493  
494/** */ public
495 boolean isValidTypeForList(SBase item) {
496    return libsbmlJNI.SBasePlugin_isValidTypeForList(swigCPtr, this, SBase.getCPtrAndDisown(item), item);
497  }
498
499  
500/** * @internal */ public
501 SBMLExtension getSBMLExtension() {
502    return libsbml.DowncastExtension(libsbmlJNI.SBasePlugin_getSBMLExtension(swigCPtr, this), false);
503}
504
505  public SBaseList getListOfAllElements(ElementFilter filter) {
506    long cPtr = libsbmlJNI.SBasePlugin_getListOfAllElements__SWIG_0(swigCPtr, this, ElementFilter.getCPtr(filter), filter);
507    return (cPtr == 0) ? null : new SBaseList(cPtr, false);
508  }
509
510  public SBaseList getListOfAllElements() {
511    long cPtr = libsbmlJNI.SBasePlugin_getListOfAllElements__SWIG_1(swigCPtr, this);
512    return (cPtr == 0) ? null : new SBaseList(cPtr, false);
513  }
514
515}