001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.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-groups"><a href="group__groups.html">groups</a></span>
013 Extension of {@link Model}.
014 */
015
016public class GroupsModelPlugin extends SBasePlugin {
017   private long swigCPtr;
018
019   protected GroupsModelPlugin(long cPtr, boolean cMemoryOwn)
020   {
021     super(libsbmlJNI.GroupsModelPlugin_SWIGUpcast(cPtr), cMemoryOwn);
022     swigCPtr = cPtr;
023   }
024
025   protected static long getCPtr(GroupsModelPlugin obj)
026   {
027     return (obj == null) ? 0 : obj.swigCPtr;
028   }
029
030   protected static long getCPtrAndDisown (GroupsModelPlugin obj)
031   {
032     long ptr = 0;
033
034     if (obj != null)
035     {
036       ptr             = obj.swigCPtr;
037       obj.swigCMemOwn = false;
038     }
039
040     return ptr;
041   }
042
043  protected void finalize() {
044    delete();
045  }
046
047  public synchronized void delete() {
048    if (swigCPtr != 0) {
049      if (swigCMemOwn) {
050        swigCMemOwn = false;
051        libsbmlJNI.delete_GroupsModelPlugin(swigCPtr);
052      }
053      swigCPtr = 0;
054    }
055    super.delete();
056  }
057
058  
059/**
060   * Creates a new {@link GroupsModelPlugin} using the given URI, prefix and package
061   * namespace.
062   <p>
063   * @param uri a string, representing the URI of the SBML Level&nbsp;3 package
064   * implemented by this libSBML package extension.
065   <p>
066   * @param prefix a string, the XML namespace prefix being used for this
067   * package.
068   <p>
069   * @param groupsns a pointer to the namesspaces object (GroupsPkgNamespaces)
070   * for this package.
071   <p>
072   * <p>
073 * In the XML representation of an SBML document, XML namespaces are used to
074 * identify the origin of each XML construct used.  XML namespaces are
075 * identified by their unique resource identifiers (URIs).  The core SBML
076 * specifications stipulate the namespaces that must be used for core SBML
077 * constructs; for example, all XML elements that belong to SBML Level&nbsp;3
078 * Version&nbsp;1 Core must be placed in the XML namespace identified by the URI
079 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>.  Individual
080 * SBML Level&nbsp;3 packages define their own XML namespaces; for example,
081 * all elements belonging to the SBML Level&nbsp;3 Layout Version&nbsp;1
082 * package must be placed in the XML namespace
083 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>.
084   <p>
085   * <p>
086 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces
087 * information.  It is used to communicate the SBML Level, Version, and (in
088 * Level&nbsp;3) packages used in addition to SBML Level&nbsp;3 Core.  A
089 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
090 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object
091 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments.
092   */ public
093 GroupsModelPlugin(String uri, String prefix, GroupsPkgNamespaces groupsns) {
094    this(libsbmlJNI.new_GroupsModelPlugin__SWIG_0(uri, prefix, GroupsPkgNamespaces.getCPtr(groupsns), groupsns), true);
095  }
096
097  
098/**
099   * Copy constructor for {@link GroupsModelPlugin}.
100   <p>
101   * @param orig the {@link GroupsModelPlugin} instance to copy.
102   */ public
103 GroupsModelPlugin(GroupsModelPlugin orig) {
104    this(libsbmlJNI.new_GroupsModelPlugin__SWIG_1(GroupsModelPlugin.getCPtr(orig), orig), true);
105  }
106
107  
108/**
109   * Creates and returns a deep copy of this {@link GroupsModelPlugin} object.
110   <p>
111   * @return a (deep) copy of this {@link GroupsModelPlugin} object.
112   */ public
113 SBasePlugin cloneObject() {
114    long cPtr = libsbmlJNI.GroupsModelPlugin_cloneObject(swigCPtr, this);
115    return (cPtr == 0) ? null : new GroupsModelPlugin(cPtr, true);
116  }
117
118  
119/**
120   * Returns the {@link ListOfGroups} from this {@link GroupsModelPlugin}.
121   <p>
122   * @return the {@link ListOfGroups} from this {@link GroupsModelPlugin}.
123   <p>
124   * <p>
125 * The pointer that is returned by this function is not owned by the caller,
126 * but may be queried and modified.  Any changes made will be reflected in any
127 * resulting SBML document containing the pointer's parent.
128   <p>
129   * @see #addGroup(Group object)
130   * @see #createGroup()
131   * @see #getGroup(String sid)
132   * @see #getGroup(long n)
133   * @see #getNumGroups()
134   * @see #removeGroup(String sid)
135   * @see #removeGroup(long n)
136   */ public
137 ListOfGroups getListOfGroups() {
138    long cPtr = libsbmlJNI.GroupsModelPlugin_getListOfGroups__SWIG_0(swigCPtr, this);
139    return (cPtr == 0) ? null : new ListOfGroups(cPtr, false);
140  }
141
142  
143/**
144   * Get a {@link Group} from the {@link GroupsModelPlugin}.
145   <p>
146   * @param n a long integer representing the index of the {@link Group} to retrieve.
147   <p>
148   * @return the nth {@link Group} in the {@link ListOfGroups} within this {@link GroupsModelPlugin}.
149   <p>
150   * <p>
151 * The pointer that is returned by this function is not owned by the caller,
152 * but may be queried and modified.  Any changes made will be reflected in any
153 * resulting SBML document containing the pointer's parent.
154   <p>
155   * @see #addGroup(Group object)
156   * @see #createGroup()
157   * @see #getGroup(String sid)
158   * @see #getNumGroups()
159   * @see #removeGroup(String sid)
160   * @see #removeGroup(long n)
161   */ public
162 Group getGroup(long n) {
163    long cPtr = libsbmlJNI.GroupsModelPlugin_getGroup__SWIG_0(swigCPtr, this, n);
164    return (cPtr == 0) ? null : new Group(cPtr, false);
165  }
166
167  
168/**
169   * Get a {@link Group} from the {@link GroupsModelPlugin} based on its identifier.
170   <p>
171   * @param sid a string representing the identifier of the {@link Group} to retrieve.
172   <p>
173   * @return the {@link Group} in the {@link ListOfGroups} within this {@link GroupsModelPlugin} with
174   * the given <code>sid</code> or <code>null</code> if no such {@link Group} exists.
175   <p>
176   * <p>
177 * The pointer that is returned by this function is not owned by the caller,
178 * but may be queried and modified.  Any changes made will be reflected in any
179 * resulting SBML document containing the pointer's parent.
180   <p>
181   * @see #addGroup(Group object)
182   * @see #createGroup()
183   * @see #getGroup(long n)
184   * @see #getNumGroups()
185   * @see #removeGroup(String sid)
186   * @see #removeGroup(long n)
187   */ public
188 Group getGroup(String sid) {
189    long cPtr = libsbmlJNI.GroupsModelPlugin_getGroup__SWIG_2(swigCPtr, this, sid);
190    return (cPtr == 0) ? null : new Group(cPtr, false);
191  }
192
193  
194/**
195   * Adds a copy of the given {@link Group} to this {@link GroupsModelPlugin}.
196   <p>
197   * @param g the {@link Group} object to add.
198   <p>
199   * <p>
200 * @return integer value indicating success/failure of the
201 * function.   The possible values
202 * returned by this function are:
203   * <ul>
204   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
205   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
206   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
207   * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH}
208   * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH}
209   * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH}
210   * <li> {@link libsbmlConstants#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID}
211   *
212   * </ul> <p>
213   * <p>
214 * @note This method should be used with some caution.  The fact that this
215 * method <em>copies</em> the object passed to it means that the caller will be
216 * left holding a physically different object instance than the one contained
217 * inside this object.  Changes made to the original object instance (such as
218 * resetting attribute values) will <em>not affect the instance in this
219 * object</em>.  In addition, the caller should make sure to free the
220 * original object if it is no longer being used, or else a memory leak will
221 * result.  Please see other methods on this class (particularly a
222 * corresponding method whose name begins with the word <code>create</code>)
223 * for alternatives that do not lead to these issues.
224   <p>
225   * @see #createGroup()
226   * @see #getGroup(String sid)
227   * @see #getGroup(long n)
228   * @see #getNumGroups()
229   * @see #removeGroup(String sid)
230   * @see #removeGroup(long n)
231   */ public
232 int addGroup(Group g) {
233    return libsbmlJNI.GroupsModelPlugin_addGroup(swigCPtr, this, Group.getCPtr(g), g);
234  }
235
236  
237/**
238   * Get the number of {@link Group} objects in this {@link GroupsModelPlugin}.
239   <p>
240   * @return the number of {@link Group} objects in this {@link GroupsModelPlugin}.
241   <p>
242   * @see #addGroup(Group object)
243   * @see #createGroup()
244   * @see #getGroup(String sid)
245   * @see #getGroup(long n)
246   * @see #removeGroup(String sid)
247   * @see #removeGroup(long n)
248   */ public
249 long getNumGroups() {
250    return libsbmlJNI.GroupsModelPlugin_getNumGroups(swigCPtr, this);
251  }
252
253  
254/**
255   * Creates a new {@link Group} object, adds it to this {@link GroupsModelPlugin} object and
256   * returns the {@link Group} object created.
257   <p>
258   * @return a new {@link Group} object instance.
259   <p>
260   * <p>
261 * The pointer that is returned by this function is not owned by the caller,
262 * but may be queried and modified.  Any changes made will be reflected in any
263 * resulting SBML document containing the pointer's parent.
264   <p>
265   * @see #addGroup(Group object)
266   * @see #getGroup(String sid)
267   * @see #getGroup(long n)
268   * @see #getNumGroups()
269   * @see #removeGroup(String sid)
270   * @see #removeGroup(long n)
271   */ public
272 Group createGroup() {
273    long cPtr = libsbmlJNI.GroupsModelPlugin_createGroup(swigCPtr, this);
274    return (cPtr == 0) ? null : new Group(cPtr, false);
275  }
276
277  
278/**
279   * Removes the nth {@link Group} from this {@link GroupsModelPlugin} and returns a pointer to
280   * it.
281   <p>
282   * @param n a long integer representing the index of the {@link Group} to remove.
283   <p>
284   * @return a pointer to the nth {@link Group} in this {@link GroupsModelPlugin}.
285   <p>
286   * <p>
287 * The pointer that is returned by this function is owned by the caller,
288 * who is responsible for deleting it.  Any changes made to the element
289 * will not be reflected in any resulting SBML document unless the element
290 * is added to an SBML Document.  Even in this case, the element's deletion is
291 * still the responsibility of the caller with two exceptions: if it is used
292 * as the 'disownedItem' in the * {@link ListOf#appendAndOwn()} or {@link ListOf#insertAndOwn()} 
293 * functions.  All other functions in libsbml add a copy of the element, 
294 * and do not transfer ownership of the pointer.
295   <p>
296   * @see #addGroup(Group object)
297   * @see #createGroup()
298   * @see #getGroup(String sid)
299   * @see #getGroup(long n)
300   * @see #getNumGroups()
301   * @see #removeGroup(String sid)
302   */ public
303 Group removeGroup(long n) {
304    long cPtr = libsbmlJNI.GroupsModelPlugin_removeGroup__SWIG_0(swigCPtr, this, n);
305    return (cPtr == 0) ? null : new Group(cPtr, true);
306  }
307
308  
309/**
310   * Removes the {@link Group} from this {@link GroupsModelPlugin} based on its identifier and
311   * returns a pointer to it.
312   <p>
313   * @param sid a string representing the identifier of the {@link Group} to remove.
314   <p>
315   * @return the {@link Group} in this {@link GroupsModelPlugin} based on the identifier or
316   * null if no such {@link Group} exists.
317   <p>
318   * <p>
319 * The pointer that is returned by this function is owned by the caller,
320 * who is responsible for deleting it.  Any changes made to the element
321 * will not be reflected in any resulting SBML document unless the element
322 * is added to an SBML Document.  Even in this case, the element's deletion is
323 * still the responsibility of the caller with two exceptions: if it is used
324 * as the 'disownedItem' in the * {@link ListOf#appendAndOwn()} or {@link ListOf#insertAndOwn()} 
325 * functions.  All other functions in libsbml add a copy of the element, 
326 * and do not transfer ownership of the pointer.
327   <p>
328   * @see #addGroup(Group object)
329   * @see #createGroup()
330   * @see #getGroup(String sid)
331   * @see #getGroup(long n)
332   * @see #getNumGroups()
333   * @see #removeGroup(long n)
334   */ public
335 Group removeGroup(String sid) {
336    long cPtr = libsbmlJNI.GroupsModelPlugin_removeGroup__SWIG_1(swigCPtr, this, sid);
337    return (cPtr == 0) ? null : new Group(cPtr, true);
338  }
339
340  
341/** * @internal */ public
342 void connectToChild() {
343    libsbmlJNI.GroupsModelPlugin_connectToChild(swigCPtr, this);
344  }
345
346  
347/** * @internal */ public
348 void connectToParent(SBase base) {
349    libsbmlJNI.GroupsModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(base), base);
350  }
351
352  
353/** * @internal */ public
354 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
355    libsbmlJNI.GroupsModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
356  }
357
358  
359/**
360   * Returns the first child element that has the given <code>id</code> in the model-wide
361   * SId namespace, or <code>null</code> if no such object is found.
362   <p>
363   * @param id a string representing the id attribute of the object to
364   * retrieve.
365   <p>
366   * @return a pointer to the {@link SBase} element with the given <code>id</code>. If no such
367   * object is found, this method returns <code>null.</code>
368   */ public
369 SBase getElementBySId(String id) {
370  return libsbml.DowncastSBase(libsbmlJNI.GroupsModelPlugin_getElementBySId(swigCPtr, this, id), false);
371}
372
373  
374/**
375   * Returns the first child element that has the given <code>metaid</code>, or <code>null</code>
376   * if no such object is found.
377   <p>
378   * @param metaid a string representing the metaid attribute of the object to
379   * retrieve.
380   <p>
381   * @return a pointer to the {@link SBase} element with the given <code>metaid</code>. If no
382   * such object is found this method returns <code>null.</code>
383   */ public
384 SBase getElementByMetaId(String metaid) {
385  return libsbml.DowncastSBase(libsbmlJNI.GroupsModelPlugin_getElementByMetaId(swigCPtr, this, metaid), false);
386}
387
388  
389/** * @internal */ public
390 int appendFrom(Model model) {
391    return libsbmlJNI.GroupsModelPlugin_appendFrom(swigCPtr, this, Model.getCPtr(model), model);
392  }
393
394  
395/**
396   * For nested groups (Member objects that reference a {@link ListOfMembers} 
397   * object), {@link SBO} terms, Notes, and Annotation from the
398   * parent {@link ListOfMembers} applies to the child.  This function
399   * copies any information from any of those three things to all 
400   * child {@link ListOfMembers}, and if that information is not already 
401   * set.  After calling
402   * this function, it is sufficient to check any {@link ListOfMembers}
403   * to see if its {@link SBO} term, Notes, or Annotation is set, without
404   * further checking to see if that element was nested in another
405   * {@link Group}.
406   */ public
407 void copyInformationToNestedLists() {
408    libsbmlJNI.GroupsModelPlugin_copyInformationToNestedLists(swigCPtr, this);
409  }
410
411}