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 * <span class="pkg-marker pkg-color-qual"><a href="group__qual.html">qual</a></span>
013
014 Implementation of the 'qual' package extention to the
015 * Model construct.  The extension of SBML Level 3 Core's {@link Model} class is
016 * relatively straightforward: the Qualitative Models Package adds two lists,
017 * one for holding qualitativeSpecies (ListOfQualitativeSpecies), and the
018 * other for holding transitions (ListOfTransitions).  The {@link Model} element may
019 * contain at most one {@link ListOfQualitativeSpecies}, which must contain at least
020 * one {@link QualitativeSpecies}. It may also contain at most one {@link ListOfTransitions}
021 * which must contain at least one {@link Transition}.
022 */
023
024public class QualModelPlugin extends SBasePlugin {
025   private long swigCPtr;
026
027   protected QualModelPlugin(long cPtr, boolean cMemoryOwn)
028   {
029     super(libsbmlJNI.QualModelPlugin_SWIGUpcast(cPtr), cMemoryOwn);
030     swigCPtr = cPtr;
031   }
032
033   protected static long getCPtr(QualModelPlugin obj)
034   {
035     return (obj == null) ? 0 : obj.swigCPtr;
036   }
037
038   protected static long getCPtrAndDisown (QualModelPlugin obj)
039   {
040     long ptr = 0;
041
042     if (obj != null)
043     {
044       ptr             = obj.swigCPtr;
045       obj.swigCMemOwn = false;
046     }
047
048     return ptr;
049   }
050
051  protected void finalize() {
052    delete();
053  }
054
055  public synchronized void delete() {
056    if (swigCPtr != 0) {
057      if (swigCMemOwn) {
058        swigCMemOwn = false;
059        libsbmlJNI.delete_QualModelPlugin(swigCPtr);
060      }
061      swigCPtr = 0;
062    }
063    super.delete();
064  }
065
066  
067/**
068   * Constructor
069   */ public
070 QualModelPlugin(String uri, String prefix, QualPkgNamespaces qualns) {
071    this(libsbmlJNI.new_QualModelPlugin__SWIG_0(uri, prefix, QualPkgNamespaces.getCPtr(qualns), qualns), true);
072  }
073
074  
075/**
076   * Copy constructor. Creates a copy of this {@link SBase} object.
077   */ public
078 QualModelPlugin(QualModelPlugin orig) {
079    this(libsbmlJNI.new_QualModelPlugin__SWIG_1(QualModelPlugin.getCPtr(orig), orig), true);
080  }
081
082  
083/**
084   * Creates and returns a deep copy of this {@link QualModelPlugin} object.
085   <p>
086   * @return a (deep) copy of this {@link SBase} object
087   */ public
088 SBasePlugin cloneObject() {
089    long cPtr = libsbmlJNI.QualModelPlugin_cloneObject(swigCPtr, this);
090    return (cPtr == 0) ? null : new QualModelPlugin(cPtr, true);
091  }
092
093  
094/**
095   * Subclasses must override this method to create, store, and then
096   * return an SBML object corresponding to the next {@link XMLToken} in the
097   * {@link XMLInputStream} if they have their specific elements.
098   <p>
099   * @return the SBML object corresponding to next {@link XMLToken} in the
100   * {@link XMLInputStream} or null if the token was not recognized.
101   * @internal
102   */ public
103 SBase createObject(XMLInputStream stream) {
104  return libsbml.DowncastSBase(libsbmlJNI.QualModelPlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false);
105}
106
107  
108/**
109   * Checks if this plugin object has all the required elements.
110   <p>
111   * Subclasses should override this function if they have their specific
112   * elements.
113   <p>
114   * @return true if this plugin object has all the required elements,
115   * otherwise false will be returned.
116   * @internal
117   */ public
118 boolean hasRequiredElements() {
119    return libsbmlJNI.QualModelPlugin_hasRequiredElements(swigCPtr, this);
120  }
121
122  
123/** * @internal */ public
124 int appendFrom(Model model) {
125    return libsbmlJNI.QualModelPlugin_appendFrom(swigCPtr, this, Model.getCPtr(model), model);
126  }
127
128  
129/**
130   * Returns the {@link ListOfQualitativeSpecies} in this plugin object.
131   <p>
132   * @return {@link ListOfQualitativeSpecies} object in this plugin object.
133   */ public
134 ListOfQualitativeSpecies getListOfQualitativeSpecies() {
135    long cPtr = libsbmlJNI.QualModelPlugin_getListOfQualitativeSpecies__SWIG_0(swigCPtr, this);
136    return (cPtr == 0) ? null : new ListOfQualitativeSpecies(cPtr, false);
137  }
138
139  
140/**
141   * Returns the {@link QualitativeSpecies} object that belongs to the given index. If the
142   * index is invalid, null is returned.
143   <p>
144   * @param n the index number of the {@link QualitativeSpecies} to get.
145   <p>
146   * @return the nth {@link QualitativeSpecies} in the {@link ListOfQualitativeSpecies}.
147   */ public
148 QualitativeSpecies getQualitativeSpecies(long n) {
149    long cPtr = libsbmlJNI.QualModelPlugin_getQualitativeSpecies__SWIG_0(swigCPtr, this, n);
150    return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, false);
151  }
152
153  
154/**
155   * Returns the qualitativeSpecies object based on its identifier.
156   <p>
157   * @param sid a string representing the identifier 
158   * of the {@link QualitativeSpecies} to get.
159   <p>
160   * @return {@link QualitativeSpecies} in the {@link ListOfQualitativeSpecies} with the given id
161   * or null if no such {@link QualitativeSpecies} exists.
162   <p>
163   * @see #getQualitativeSpecies(long n)
164   * @see #getListOfQualitativeSpecies()
165   */ public
166 QualitativeSpecies getQualitativeSpecies(String sid) {
167    long cPtr = libsbmlJNI.QualModelPlugin_getQualitativeSpecies__SWIG_2(swigCPtr, this, sid);
168    return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, false);
169  }
170
171  
172/**
173   * Adds a copy of the given {@link QualitativeSpecies} object to the list of qual.
174   <p>
175   * @param qualitativeSpecies the {@link QualitativeSpecies} object to be added to the list of qual.
176   <p>
177   * @return integer value indicating success/failure of the
178   * operation. The possible return values are:
179   * <ul>
180   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
181   * </ul>
182   */ public
183 int addQualitativeSpecies(QualitativeSpecies qualitativeSpecies) {
184    return libsbmlJNI.QualModelPlugin_addQualitativeSpecies(swigCPtr, this, QualitativeSpecies.getCPtr(qualitativeSpecies), qualitativeSpecies);
185  }
186
187  
188/**
189   * Creates a new qual object and adds it to the list of qual objects
190   * and returns it.
191   <p>
192   * @return a newly created {@link QualitativeSpecies} object
193   */ public
194 QualitativeSpecies createQualitativeSpecies() {
195    long cPtr = libsbmlJNI.QualModelPlugin_createQualitativeSpecies(swigCPtr, this);
196    return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, false);
197  }
198
199  
200/**
201   * Removes the nth {@link QualitativeSpecies} object from this plugin object and
202   * returns a pointer to it.
203   <p>
204   * The caller owns the returned object and is responsible for
205   *  deleting it.
206   <p>
207   * @param n the index of the {@link QualitativeSpecies} object to remove
208   <p>
209   * @return the {@link QualitativeSpecies} object removed.  As mentioned above, the 
210   * caller owns the returned object. null is returned if the 
211   * given index is out of range.
212   */ public
213 QualitativeSpecies removeQualitativeSpecies(long n) {
214    long cPtr = libsbmlJNI.QualModelPlugin_removeQualitativeSpecies__SWIG_0(swigCPtr, this, n);
215    return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, true);
216  }
217
218  
219/**
220   * Removes the {@link QualitativeSpecies} object with the given id attribute from 
221   * this plugin object and returns a pointer to it.
222   <p>
223   * The caller owns the returned object and is responsible for
224   * deleting it.
225   <p>
226   * @param sid the id attribute of the {@link QualitativeSpecies} object to remove
227   <p>
228   * @return the {@link QualitativeSpecies} object removed.  As mentioned above, the 
229   * caller owns the returned object. null is returned if the 
230   * given index is out of range.
231   */ public
232 QualitativeSpecies removeQualitativeSpecies(String sid) {
233    long cPtr = libsbmlJNI.QualModelPlugin_removeQualitativeSpecies__SWIG_1(swigCPtr, this, sid);
234    return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, true);
235  }
236
237  
238/**
239   * Returns the number of {@link QualitativeSpecies} object in this plugin object.
240   <p>
241   * @return the number of {@link QualitativeSpecies} object in this plugin object.
242   */ public
243 long getNumQualitativeSpecies() {
244    return libsbmlJNI.QualModelPlugin_getNumQualitativeSpecies(swigCPtr, this);
245  }
246
247  
248/**
249   * Returns the {@link ListOfTransitions} in this plugin object.
250   <p>
251   * @return {@link ListOfTransitions} object in this plugin object.
252   */ public
253 ListOfTransitions getListOfTransitions() {
254    long cPtr = libsbmlJNI.QualModelPlugin_getListOfTransitions__SWIG_0(swigCPtr, this);
255    return (cPtr == 0) ? null : new ListOfTransitions(cPtr, false);
256  }
257
258  
259/**
260   * Returns the {@link Transition} object that belongs to the given index. If the
261   * index is invalid, null is returned.
262   <p>
263   * @param n the index number of the {@link Transition} to get.
264   <p>
265   * @return the nth {@link Transition} in the {@link ListOfTransitions}.
266   */ public
267 Transition getTransition(long n) {
268    long cPtr = libsbmlJNI.QualModelPlugin_getTransition__SWIG_0(swigCPtr, this, n);
269    return (cPtr == 0) ? null : new Transition(cPtr, false);
270  }
271
272  
273/**
274   * Returns the qualitativeSpecies object based on its identifier.
275   <p>
276   * @param sid a string representing the identifier 
277   * of the {@link Transition} to get.
278   <p>
279   * @return {@link Transition} in the {@link ListOfTransitions} with the given id
280   * or null if no such {@link Transition} exists.
281   <p>
282   * @see #getTransition(long n)
283   * @see #getListOfTransitions()
284   */ public
285 Transition getTransition(String sid) {
286    long cPtr = libsbmlJNI.QualModelPlugin_getTransition__SWIG_2(swigCPtr, this, sid);
287    return (cPtr == 0) ? null : new Transition(cPtr, false);
288  }
289
290  
291/**
292   * Adds a copy of the given {@link Transition} object to the list of qual.
293   <p>
294   * @param transition the {@link Transition} object to be added to the list of qual.
295   <p>
296   * @return integer value indicating success/failure of the
297   * operation. The possible return values are:
298   * <ul>
299   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
300   * </ul>
301   */ public
302 int addTransition(Transition transition) {
303    return libsbmlJNI.QualModelPlugin_addTransition(swigCPtr, this, Transition.getCPtr(transition), transition);
304  }
305
306  
307/**
308   * Creates a new qual object and adds it to the list of qual objects
309   * and returns it.
310   <p>
311   * @return a newly created {@link Transition} object
312   */ public
313 Transition createTransition() {
314    long cPtr = libsbmlJNI.QualModelPlugin_createTransition(swigCPtr, this);
315    return (cPtr == 0) ? null : new Transition(cPtr, false);
316  }
317
318  
319/**
320   * Removes the nth {@link Transition} object from this plugin object and
321   * returns a pointer to it.
322   <p>
323   * The caller owns the returned object and is responsible for
324   *  deleting it.
325   <p>
326   * @param n the index of the {@link Transition} object to remove
327   <p>
328   * @return the {@link Transition} object removed.  As mentioned above, the 
329   * caller owns the returned object. null is returned if the 
330   * given index is out of range.
331   */ public
332 Transition removeTransition(long n) {
333    long cPtr = libsbmlJNI.QualModelPlugin_removeTransition__SWIG_0(swigCPtr, this, n);
334    return (cPtr == 0) ? null : new Transition(cPtr, true);
335  }
336
337  
338/**
339   * Removes the {@link Transition} object with the given id attribute from 
340   * this plugin object and returns a pointer to it.
341   <p>
342   * The caller owns the returned object and is responsible for
343   * deleting it.
344   <p>
345   * @param sid the id attribute of the {@link Transition} object to remove
346   <p>
347   * @return the {@link Transition} object removed.  As mentioned above, the 
348   * caller owns the returned object. null is returned if the 
349   * given index is out of range.
350   */ public
351 Transition removeTransition(String sid) {
352    long cPtr = libsbmlJNI.QualModelPlugin_removeTransition__SWIG_1(swigCPtr, this, sid);
353    return (cPtr == 0) ? null : new Transition(cPtr, true);
354  }
355
356  
357/**
358   * Returns the number of {@link Transition} object in this plugin object.
359   <p>
360   * @return the number of {@link Transition} object in this plugin object.
361   */ public
362 long getNumTransitions() {
363    return libsbmlJNI.QualModelPlugin_getNumTransitions(swigCPtr, this);
364  }
365
366  
367/**
368   * Sets the *parent* of this SBML object to child SBML objects (if any).
369   * (Creates a child-parent relationship by the parent)
370   <p>
371   * @see setSBMLDocument
372   * @see enablePackageInternal
373   * @internal
374   */ public
375 void connectToChild() {
376    libsbmlJNI.QualModelPlugin_connectToChild(swigCPtr, this);
377  }
378
379  
380/**
381   * Sets the parent SBML object of this plugin object to
382   * this object and child elements (if any).
383   * (Creates a child-parent relationship by this plugin object)
384   <p>
385   * This function is called when this object is created by
386   * the parent element.
387   * Subclasses must override this this function if they have one
388   * or more child elements.Also, {@link SBasePlugin#connectToParent()}
389   * must be called in the overridden function.
390   <p>
391   * @param sbase the {@link SBase} object to use
392   <p>
393   * @see setSBMLDocument
394   * @see enablePackageInternal
395   * @internal
396   */ public
397 void connectToParent(SBase sbase) {
398    libsbmlJNI.QualModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase);
399  }
400
401  
402/**
403   * Enables/Disables the given package with child elements in this plugin
404   * object (if any).
405   * (This is an internal implementation invoked from
406   *  {@link SBase#enablePackageInternal()} function)
407   <p>
408   * @note Subclasses in which one or more {@link SBase} derived elements are
409   * defined must override this function.
410   <p>
411   * @see setSBMLDocument
412   * @see connectToParent
413   * @internal
414   */ public
415 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
416    libsbmlJNI.QualModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
417  }
418
419}