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 * <span class="pkg-marker pkg-color-comp"><a href="group__comp.html">comp</a></span>
013 Extension of {@link SBMLDocument}.
014 <p>
015 * The {@link CompSBMLDocumentPlugin} class inherits from the {@link SBMLDocumentPlugin}
016 * class, and codifies the extensions to the {@link SBMLDocument} class defined in
017 * the SBML Level&nbsp;3 <a href='../../../extensions-summary.html#comp'>Hierarchical Model Composition</a> (&ldquo;comp&rdquo;) package.  This
018 * extension allows multiple {@link Model} objects to be defined in a single
019 * {@link SBMLDocument}, stored in an optional child {@link ListOfModelDefinitions} object,
020 * as well as define references to {@link Model} objects in other files, stored in
021 * the optional child {@link ListOfExternalModelDefinitions} object.  These model
022 * definitions, if present, allow {@link Submodel} objects to reference other Models
023 * to instantiate.
024 <p>
025 * The presence of any {@link ModelDefinition} or {@link ExternalModelDefinition} in an
026 * {@link SBMLDocument} does not change the default {@link Model} in the file.  If a
027 * {@link SBMLDocument} is submitted somewhere to be simulated, it is still the
028 * <code>&lt;model&gt;</code> child of the <code>&lt;sbml&gt;</code> element
029 * that should be simulated.
030 <p>
031 * In addition, as all packages do, the {@link CompSBMLDocumentPlugin} defines a
032 * required flag named <code>required</code>, which indicates whether 
033 * &ldquo;comp&rdquo; constructs can be used to change the core mathematics of the
034 * <code>&lt;model&gt;</code> child of the <code>&lt;sbml&gt;</code> element.
035 * Because they can, this attribute must be set <code>true.</code>
036 */
037
038public class CompSBMLDocumentPlugin extends SBMLDocumentPlugin {
039   private long swigCPtr;
040
041   protected CompSBMLDocumentPlugin(long cPtr, boolean cMemoryOwn)
042   {
043     super(libsbmlJNI.CompSBMLDocumentPlugin_SWIGUpcast(cPtr), cMemoryOwn);
044     swigCPtr = cPtr;
045   }
046
047   protected static long getCPtr(CompSBMLDocumentPlugin obj)
048   {
049     return (obj == null) ? 0 : obj.swigCPtr;
050   }
051
052   protected static long getCPtrAndDisown (CompSBMLDocumentPlugin obj)
053   {
054     long ptr = 0;
055
056     if (obj != null)
057     {
058       ptr             = obj.swigCPtr;
059       obj.swigCMemOwn = false;
060     }
061
062     return ptr;
063   }
064
065  protected void finalize() {
066    delete();
067  }
068
069  public synchronized void delete() {
070    if (swigCPtr != 0) {
071      if (swigCMemOwn) {
072        swigCMemOwn = false;
073        libsbmlJNI.delete_CompSBMLDocumentPlugin(swigCPtr);
074      }
075      swigCPtr = 0;
076    }
077    super.delete();
078  }
079
080  
081/**
082   * Creates a new {@link CompSBMLDocumentPlugin} object using the given parameters.
083   <p>
084   * <p>
085 * In the XML representation of an SBML document, XML namespaces are used to
086 * identify the origin of each XML construct used.  XML namespaces are
087 * identified by their unique resource identifiers (URIs).  The core SBML
088 * specifications stipulate the namespaces that must be used for core SBML
089 * constructs; for example, all XML elements that belong to SBML Level&nbsp;3
090 * Version&nbsp;1 Core must be placed in the XML namespace identified by the URI
091 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>.  Individual
092 * SBML Level&nbsp;3 packages define their own XML namespaces; for example,
093 * all elements belonging to the SBML Level&nbsp;3 Layout Version&nbsp;1
094 * package must be placed in the XML namespace
095 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>.
096   <p>
097   * <p>
098 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces
099 * information.  It is used to communicate the SBML Level, Version, and (in
100 * Level&nbsp;3) packages used in addition to SBML Level&nbsp;3 Core.  A
101 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
102 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object
103 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments.
104   <p>
105   * @param uri the URI of the SBML Level&nbsp;3 package implemented by
106   * this libSBML package extension.
107   <p>
108   * @param prefix the XML namespace prefix being used for the package.
109   <p>
110   * @param compns the namespaces object for the package.
111   */ public
112 CompSBMLDocumentPlugin(String uri, String prefix, CompPkgNamespaces compns) {
113    this(libsbmlJNI.new_CompSBMLDocumentPlugin__SWIG_0(uri, prefix, CompPkgNamespaces.getCPtr(compns), compns), true);
114  }
115
116  
117/**
118   * Copy constructor. Creates a copy of this {@link CompSBMLDocumentPlugin} object.
119   <p>
120   * @param orig the instance to copy.
121   */ public
122 CompSBMLDocumentPlugin(CompSBMLDocumentPlugin orig) {
123    this(libsbmlJNI.new_CompSBMLDocumentPlugin__SWIG_1(CompSBMLDocumentPlugin.getCPtr(orig), orig), true);
124  }
125
126  
127/**
128   * Creates and returns a deep copy of this {@link CompSBMLDocumentPlugin} object.
129   <p>
130   * @return a (deep) copy of this {@link CompSBMLDocumentPlugin} object.
131   */ public
132 SBasePlugin cloneObject() {
133    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_cloneObject(swigCPtr, this);
134    return (cPtr == 0) ? null : new CompSBMLDocumentPlugin(cPtr, true);
135  }
136
137  
138/**
139   * Returns the first child element found that has the given <code>id</code> in the
140   * model-wide SId namespace, or <code>null</code> if no such object is found.
141   <p>
142   * @param id string representing the identifier of the object to find.
143   <p>
144   * @return a pointer to the {@link SBase} element with the given <code>id</code>.
145   <p>
146   * @note The comp SBML document plugin has multiple model-wide SId
147   * namespaces, so a valid document may well contain multiple elements with
148   * the same SId that reside in separate models.  It is not recommended to
149   * ever call this function&mdash;instead, call the function on the child
150   * {@link ModelDefinition} objects.
151   */ public
152 SBase getElementBySId(String id) {
153  return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_getElementBySId(swigCPtr, this, id), false);
154}
155
156  
157/**
158   * Returns the first child element it can find with the given <code>metaid</code>, or
159   * itself if it has the given <code>metaid</code>, or <code>null</code> if no such object is
160   * found.
161   <p>
162   * @param metaid string representing the meta identifier of the object to find.
163   <p>
164   * @return a pointer to the {@link SBase} element with the given <code>metaid</code>.
165   */ public
166 SBase getElementByMetaId(String metaid) {
167  return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_getElementByMetaId(swigCPtr, this, metaid), false);
168}
169
170  
171/** * @internal */ public
172 SBase createObject(XMLInputStream stream) {
173  return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false);
174}
175
176  
177/** * @internal */ public
178 boolean isCompFlatteningImplemented() {
179    return libsbmlJNI.CompSBMLDocumentPlugin_isCompFlatteningImplemented(swigCPtr, this);
180  }
181
182  
183/** * @internal */ public
184 long checkConsistency() {
185    return libsbmlJNI.CompSBMLDocumentPlugin_checkConsistency(swigCPtr, this);
186  }
187
188  
189/**
190   * Returns the {@link ListOf} object that holds each {@link ModelDefinition}.
191   <p>
192   * @return the {@link ListOf} object that holds each {@link ModelDefinition}.
193   */ public
194 ListOfModelDefinitions getListOfModelDefinitions() {
195    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getListOfModelDefinitions(swigCPtr, this);
196    return (cPtr == 0) ? null : new ListOfModelDefinitions(cPtr, false);
197  }
198
199  
200/**
201   * Returns the {@link ModelDefinition} with the given index.
202   <p>
203   * @param n the index number of the {@link ModelDefinition} to get.
204   <p>
205   * @return the nth {@link ModelDefinition} in the {@link ListOfModelDefinitions}.  If the
206   * index is invalid, <code>null</code> is returned.
207   */ public
208 ModelDefinition getModelDefinition(long n) {
209    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getModelDefinition__SWIG_0(swigCPtr, this, n);
210    return (cPtr == 0) ? null : new ModelDefinition(cPtr, false);
211  }
212
213  
214/**
215   * Returns the model definition object based on its identifier.
216   <p>
217   * @param sid a string representing the identifier 
218   * of the model definition to get.
219   <p>
220   * @return {@link ModelDefinition} in the {@link ListOfModelDefinitions} with the given <code>sid</code>
221   * or <code>null</code> if no such {@link ModelDefinition} exists.
222   <p>
223   * @see #getModelDefinition(long n)
224   * @see #getListOfModelDefinitions()
225   */ public
226 ModelDefinition getModelDefinition(String sid) {
227    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getModelDefinition__SWIG_2(swigCPtr, this, sid);
228    return (cPtr == 0) ? null : new ModelDefinition(cPtr, false);
229  }
230
231  
232/**
233   * Adds a copy of the given {@link ModelDefinition} object to the 
234   * {@link ListOfModelDefinitions}.
235   <p>
236   * @param modelDefinition the {@link ModelDefinition} object to be added to the
237   * {@link ListOfModelDefinitions}.  Fails if the added {@link ModelDefinition} is <code>null</code>,
238   * does not match the level/version/package of the parent object, or cannot
239   * be added to the list of replaced elements.
240   <p>
241   * <p>
242 * @return integer value indicating success/failure of the
243 * function.   The possible values
244 * returned by this function are:
245   * <ul>
246   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
247   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
248   * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH}
249   * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH}
250   * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH}
251   * </ul>
252   */ public
253 int addModelDefinition(ModelDefinition modelDefinition) {
254    return libsbmlJNI.CompSBMLDocumentPlugin_addModelDefinition(swigCPtr, this, ModelDefinition.getCPtr(modelDefinition), modelDefinition);
255  }
256
257  
258/**
259   * Returns the number of {@link ModelDefinition} objects for this {@link SBMLDocumentPlugin}.
260   <p>
261   * @return the number of {@link ModelDefinition} objects.
262   */ public
263 long getNumModelDefinitions() {
264    return libsbmlJNI.CompSBMLDocumentPlugin_getNumModelDefinitions(swigCPtr, this);
265  }
266
267  
268/**
269   * Creates a {@link ModelDefinition} object, adds it to the end of the
270   * {@link ModelDefinition} objects list and returns a pointer to the newly
271   * created object.
272   <p>
273   * @return a newly created {@link ModelDefinition} object.
274   */ public
275 ModelDefinition createModelDefinition() {
276    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_createModelDefinition(swigCPtr, this);
277    return (cPtr == 0) ? null : new ModelDefinition(cPtr, false);
278  }
279
280  
281/**
282   * Removes the {@link ModelDefinition} with the given index from the {@link CompSBMLDocumentPlugin}.
283   <p>
284   * A pointer to the {@link ModelDefinition} that was removed is returned.
285   * If no {@link ModelDefinition} has been removed, <code>null</code> is returned.
286   <p>
287   * @param index the index of the {@link ModelDefinition} object to remove.
288   <p>
289   * @return the {@link ModelDefinition} object removed.  As mentioned above, 
290   * the caller owns the returned object. <code>null</code> is returned if 
291   * the given index is out of range.
292   */ public
293 ModelDefinition removeModelDefinition(long index) {
294    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeModelDefinition__SWIG_0(swigCPtr, this, index);
295    return (cPtr == 0) ? null : new ModelDefinition(cPtr, false);
296  }
297
298  
299/**
300   * Removes the {@link ModelDefinition} with the given <code>id</code> from the {@link CompSBMLDocumentPlugin}.
301   <p>
302   * A pointer to the {@link ModelDefinition} that was removed is returned.
303   * If no {@link ModelDefinition} has been removed, <code>null</code> is returned.
304   <p>
305   * @param id the id of the {@link ModelDefinition} object to remove.
306   <p>
307   * @return the {@link ModelDefinition} object removed.  As mentioned above, 
308   * the caller owns the returned object. <code>null</code> is returned if 
309   * the given index is out of range.
310   */ public
311 ModelDefinition removeModelDefinition(String id) {
312    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeModelDefinition__SWIG_1(swigCPtr, this, id);
313    return (cPtr == 0) ? null : new ModelDefinition(cPtr, false);
314  }
315
316  
317/**
318   * Returns the {@link ListOf} object that holds each {@link ExternalModelDefinition}.
319   <p>
320   * @return the {@link ListOf} object that each all {@link ExternalModelDefinition}.
321   */ public
322 ListOfExternalModelDefinitions getListOfExternalModelDefinitions() {
323    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getListOfExternalModelDefinitions(swigCPtr, this);
324    return (cPtr == 0) ? null : new ListOfExternalModelDefinitions(cPtr, false);
325  }
326
327  
328/**
329   * Returns the {@link ExternalModelDefinition} with the given index.
330   <p>
331   * @param n the index number of the {@link ExternalModelDefinition} to get.
332   <p>
333   * @return the nth {@link ExternalModelDefinition} in the
334   * {@link ListOfExternalModelDefinitions}.  If the index is invalid, <code>null</code> is
335   * returned.
336   */ public
337 ExternalModelDefinition getExternalModelDefinition(long n) {
338    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getExternalModelDefinition__SWIG_0(swigCPtr, this, n);
339    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
340  }
341
342  
343/**
344   * Returns the model definition object based on its identifier.
345   <p>
346   * @param sid a string representing the identifier 
347   * of the model definition to get.
348   <p>
349   * @return {@link ExternalModelDefinition} in the {@link ListOfExternalModelDefinitions} with the given <code>sid</code>
350   * or <code>null</code> if no such {@link ExternalModelDefinition} exists.
351   <p>
352   * @see #getExternalModelDefinition(long n)
353   * @see #getListOfExternalModelDefinitions()
354   */ public
355 ExternalModelDefinition getExternalModelDefinition(String sid) {
356    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getExternalModelDefinition__SWIG_2(swigCPtr, this, sid);
357    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
358  }
359
360  
361/**
362   * Searches the model namespace of the document and returns the {@link Model},
363   * {@link ModelDefinition}, or ExternalModelDefintion object with the given
364   * identifier.
365   <p>
366   * @param sid a string representing the identifier of the model definition to get.
367   <p>
368   * @return The {@link SBase} corresponding to the given <code>sid</code> or <code>null</code> if no such
369   * model exists.  If no such model exists, this will return <code>null.</code>
370   */ public
371 SBase getModel(String sid) {
372  return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_getModel__SWIG_0(swigCPtr, this, sid), false);
373}
374
375  
376/**
377   <p>
378   * Sets the boolean value of 'required' attribute of corresponding package
379   * in {@link SBMLDocument} element.  The only legal value is 'true' for the 
380   * Hierarchical Model Composition package.
381   <p>
382   * @param value the boolean value of 'required' attribute of corresponding 
383   * package in {@link SBMLDocument} element.
384   <p>
385   * <p>
386 * @return integer value indicating success/failure of the
387 * function.   The possible values
388 * returned by this function are:
389   * <ul>
390   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
391   * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE}
392   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
393   * </ul>
394   */ public
395 int setRequired(boolean value) {
396    return libsbmlJNI.CompSBMLDocumentPlugin_setRequired(swigCPtr, this, value);
397  }
398
399  
400/**
401   * Adds a copy of the given {@link ExternalModelDefinition} object to the
402   * {@link ListOfExternalModelDefinitions}.
403   <p>
404   * @param externalModelDefinition the {@link ExternalModelDefinition} object to be
405   * added to the ListOFExternalModelDefinitions.  Fails if the added
406   * {@link ExternalModelDefinition} is <code>null</code>, does not match the
407   * level/version/package of the parent object, or cannot be added to the
408   * list of external model definitions.
409   <p>
410   * <p>
411 * @return integer value indicating success/failure of the
412 * function.   The possible values
413 * returned by this function are:
414   * <ul>
415   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
416   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
417   * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH}
418   * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH}
419   * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH}
420   * </ul>
421   */ public
422 int addExternalModelDefinition(ExternalModelDefinition externalModelDefinition) {
423    return libsbmlJNI.CompSBMLDocumentPlugin_addExternalModelDefinition(swigCPtr, this, ExternalModelDefinition.getCPtr(externalModelDefinition), externalModelDefinition);
424  }
425
426  
427/**
428   * Returns the number of {@link ExternalModelDefinition} objects for this {@link SBMLDocumentPlugin}.
429   <p>
430   * @return the number of {@link ExternalModelDefinition} objects for this {@link SBMLDocumentPlugin}.
431   */ public
432 long getNumExternalModelDefinitions() {
433    return libsbmlJNI.CompSBMLDocumentPlugin_getNumExternalModelDefinitions(swigCPtr, this);
434  }
435
436  
437/**
438   * Creates a {@link ExternalModelDefinition} object, adds it to the end of the
439   * {@link ExternalModelDefinition} objects list and returns a pointer to the newly
440   * created object.
441   <p>
442   * @return a newly created {@link ExternalModelDefinition} object.
443   */ public
444 ExternalModelDefinition createExternalModelDefinition() {
445    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_createExternalModelDefinition(swigCPtr, this);
446    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
447  }
448
449  
450/**
451   * Removes the {@link ExternalModelDefinition} with the given index.
452   <p>
453   * A pointer to the {@link ExternalModelDefinition} that was removed is returned.
454   * If no {@link ExternalModelDefinition} has been removed, <code>null</code> is returned.
455   <p>
456   * @param index the index of the {@link ExternalModelDefinition} object to remove.
457   <p>
458   * @return the {@link ExternalModelDefinition} object removed.  As mentioned above, 
459   * the caller owns the returned object. <code>null</code> is returned if 
460   * the given index is out of range.
461   */ public
462 ExternalModelDefinition removeExternalModelDefinition(long index) {
463    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeExternalModelDefinition__SWIG_0(swigCPtr, this, index);
464    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
465  }
466
467  
468/**
469   * Removes the {@link ExternalModelDefinition} with the given <code>id</code>.
470   <p>
471   * A pointer to the {@link ExternalModelDefinition} that was removed is returned.
472   * If no {@link ExternalModelDefinition} has been removed, <code>null</code> is returned.
473   <p>
474   * @param id the id of the {@link ExternalModelDefinition} object to remove.
475   <p>
476   * @return the {@link ExternalModelDefinition} object removed.  As mentioned above, 
477   * the caller owns the returned object. <code>null</code> is returned if 
478   * the given index is out of range.
479   */ public
480 ExternalModelDefinition removeExternalModelDefinition(String id) {
481    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeExternalModelDefinition__SWIG_1(swigCPtr, this, id);
482    return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false);
483  }
484
485  
486/** * @internal */ public
487 void connectToChild() {
488    libsbmlJNI.CompSBMLDocumentPlugin_connectToChild(swigCPtr, this);
489  }
490
491  
492/** * @internal */ public
493 void connectToParent(SBase parent) {
494    libsbmlJNI.CompSBMLDocumentPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(parent), parent);
495  }
496
497  
498/** * @internal */ public
499 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
500    libsbmlJNI.CompSBMLDocumentPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
501  }
502
503  
504/** * @internal */ public
505 boolean getOverrideCompFlattening() {
506    return libsbmlJNI.CompSBMLDocumentPlugin_getOverrideCompFlattening(swigCPtr, this);
507  }
508
509  
510/** * @internal */ public
511 void setOverrideCompFlattening(boolean overrideCompFlattening) {
512    libsbmlJNI.CompSBMLDocumentPlugin_setOverrideCompFlattening(swigCPtr, this, overrideCompFlattening);
513  }
514
515  
516/** * @internal */ public
517 SBMLDocument getSBMLDocumentFromURI(String uri) {
518    long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getSBMLDocumentFromURI(swigCPtr, this, uri);
519    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
520  }
521
522}