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 CompModelPlugin extends CompSBasePlugin {
012   private long swigCPtr;
013
014   protected CompModelPlugin(long cPtr, boolean cMemoryOwn)
015   {
016     super(libsbmlJNI.CompModelPlugin_SWIGUpcast(cPtr), cMemoryOwn);
017     swigCPtr = cPtr;
018   }
019
020   protected static long getCPtr(CompModelPlugin obj)
021   {
022     return (obj == null) ? 0 : obj.swigCPtr;
023   }
024
025   protected static long getCPtrAndDisown (CompModelPlugin obj)
026   {
027     long ptr = 0;
028
029     if (obj != null)
030     {
031       ptr             = obj.swigCPtr;
032       obj.swigCMemOwn = false;
033     }
034
035     return ptr;
036   }
037
038  protected void finalize() {
039    delete();
040  }
041
042  public synchronized void delete() {
043    if (swigCPtr != 0) {
044      if (swigCMemOwn) {
045        swigCMemOwn = false;
046        libsbmlJNI.delete_CompModelPlugin(swigCPtr);
047      }
048      swigCPtr = 0;
049    }
050    super.delete();
051  }
052
053  public CompModelPlugin(String uri, String prefix, CompPkgNamespaces compns) {
054    this(libsbmlJNI.new_CompModelPlugin__SWIG_0(uri, prefix, CompPkgNamespaces.getCPtr(compns), compns), true);
055  }
056
057  public CompModelPlugin(CompModelPlugin orig) {
058    this(libsbmlJNI.new_CompModelPlugin__SWIG_1(CompModelPlugin.getCPtr(orig), orig), true);
059  }
060
061  
062/**
063   * Creates and returns a deep copy of this {@link SBasePlugin} object.
064   * <p>
065   * @return a (deep) copy of this {@link SBase} object
066   */ public
067 SBasePlugin cloneObject() {
068    long cPtr = libsbmlJNI.CompModelPlugin_cloneObject(swigCPtr, this);
069    return (cPtr == 0) ? null : new CompModelPlugin(cPtr, true);
070  }
071
072  public SBase createObject(XMLInputStream stream) {
073  return libsbml.DowncastSBase(libsbmlJNI.CompModelPlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false);
074}
075
076  
077/**
078   * Returns the first child element found that has the given <code>id</code> in the model-wide SId namespace, or <code>null</code> if no such object is found.
079   * <p>
080   * @param id string representing the id of objects to find
081   * <p>
082   * @return pointer to the first element found with the given <code>id</code>.
083   */ public
084 SBase getElementBySId(String id) {
085  return libsbml.DowncastSBase(libsbmlJNI.CompModelPlugin_getElementBySId(swigCPtr, this, id), false);
086}
087
088  
089/**
090   * Returns the first child element it can find with the given <code>metaid</code>, or <code>null</code> if no such object is found.
091   * <p>
092   * @param metaid string representing the metaid of objects to find
093   * <p>
094   * @return pointer to the first element found with the given <code>metaid</code>.
095   */ public
096 SBase getElementByMetaId(String metaid) {
097  return libsbml.DowncastSBase(libsbmlJNI.CompModelPlugin_getElementByMetaId(swigCPtr, this, metaid), false);
098}
099
100  public ListOfSubmodels getListOfSubmodels() {
101    long cPtr = libsbmlJNI.CompModelPlugin_getListOfSubmodels(swigCPtr, this);
102    return (cPtr == 0) ? null : new ListOfSubmodels(cPtr, false);
103  }
104
105  public Submodel getSubmodel(long n) {
106    long cPtr = libsbmlJNI.CompModelPlugin_getSubmodel__SWIG_0(swigCPtr, this, n);
107    return (cPtr == 0) ? null : new Submodel(cPtr, false);
108  }
109
110  public Submodel getSubmodel(String id) {
111    long cPtr = libsbmlJNI.CompModelPlugin_getSubmodel__SWIG_2(swigCPtr, this, id);
112    return (cPtr == 0) ? null : new Submodel(cPtr, false);
113  }
114
115  public int addSubmodel(Submodel submodel) {
116    return libsbmlJNI.CompModelPlugin_addSubmodel(swigCPtr, this, Submodel.getCPtr(submodel), submodel);
117  }
118
119  public long getNumSubmodels() {
120    return libsbmlJNI.CompModelPlugin_getNumSubmodels(swigCPtr, this);
121  }
122
123  public Submodel createSubmodel() {
124    long cPtr = libsbmlJNI.CompModelPlugin_createSubmodel(swigCPtr, this);
125    return (cPtr == 0) ? null : new Submodel(cPtr, false);
126  }
127
128  public Submodel removeSubmodel(long index) {
129    long cPtr = libsbmlJNI.CompModelPlugin_removeSubmodel(swigCPtr, this, index);
130    return (cPtr == 0) ? null : new Submodel(cPtr, false);
131  }
132
133  public ListOfPorts getListOfPorts() {
134    long cPtr = libsbmlJNI.CompModelPlugin_getListOfPorts(swigCPtr, this);
135    return (cPtr == 0) ? null : new ListOfPorts(cPtr, false);
136  }
137
138  public Port getPort(long n) {
139    long cPtr = libsbmlJNI.CompModelPlugin_getPort__SWIG_0(swigCPtr, this, n);
140    return (cPtr == 0) ? null : new Port(cPtr, false);
141  }
142
143  public Port getPort(String id) {
144    long cPtr = libsbmlJNI.CompModelPlugin_getPort__SWIG_2(swigCPtr, this, id);
145    return (cPtr == 0) ? null : new Port(cPtr, false);
146  }
147
148  public int addPort(Port port) {
149    return libsbmlJNI.CompModelPlugin_addPort(swigCPtr, this, Port.getCPtr(port), port);
150  }
151
152  public long getNumPorts() {
153    return libsbmlJNI.CompModelPlugin_getNumPorts(swigCPtr, this);
154  }
155
156  public Port createPort() {
157    long cPtr = libsbmlJNI.CompModelPlugin_createPort(swigCPtr, this);
158    return (cPtr == 0) ? null : new Port(cPtr, false);
159  }
160
161  public Port removePort(long index) {
162    long cPtr = libsbmlJNI.CompModelPlugin_removePort(swigCPtr, this, index);
163    return (cPtr == 0) ? null : new Port(cPtr, false);
164  }
165
166  public int setDivider(String divider) {
167    return libsbmlJNI.CompModelPlugin_setDivider(swigCPtr, this, divider);
168  }
169
170  public String getDivider() {
171    return libsbmlJNI.CompModelPlugin_getDivider(swigCPtr, this);
172  }
173
174  public void connectToChild() {
175    libsbmlJNI.CompModelPlugin_connectToChild(swigCPtr, this);
176  }
177
178  
179/**
180   * Sets the parent SBML object of this plugin object to
181   * this object and child elements (if any).
182   * (Creates a child-parent relationship by this plugin object)
183   * <p>
184   * This function is called when this object is created by
185   * the parent element.
186   * Subclasses must override this this function if they have one
187   * or more child elements. Also, {@link SBasePlugin#connectToParent(SBase sbase)}
188   * must be called in the overridden function.
189   * <p>
190   * @param sbase the {@link SBase} object to use
191   * <p>
192   * @see setSBMLDocument
193   * @see enablePackageInternal
194   * @internal
195   */ public
196 void connectToParent(SBase parent) {
197    libsbmlJNI.CompModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(parent), parent);
198  }
199
200  
201/**
202   * Enables/Disables the given package with child elements in this plugin 
203   * object (if any).
204   * (This is an internal implementation invoked from 
205   *  {@link SBase#enablePackageInternal()} function)
206   * <p>
207   * Subclasses which contain one or more {@link SBase} derived elements should 
208   * override this function if elements defined in them can be extended by
209   * some other package extension.
210   * <p>
211   * @see setSBMLDocument
212   * @see connectToParent
213   * @internal
214   */ public
215 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
216    libsbmlJNI.CompModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
217  }
218
219  public boolean acceptComp(SWIGTYPE_p_CompVisitor v) {
220    return libsbmlJNI.CompModelPlugin_acceptComp(swigCPtr, this, SWIGTYPE_p_CompVisitor.getCPtr(v));
221  }
222
223}