001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
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 Deletion of an object from a submodel.
014 <p>
015 * The {@link Deletion} class was introduced by the SBML Level&nbsp;3 
016 * 'Hierarchical Model Composition' package
017 * (&ldquo;comp&rdquo;) to allow elements of submodels to be removed before
018 * instantiation.
019<p>
020 * The {@link Deletion} object class is used to define a deletion operation
021 * to be applied when a submodel instantiates a model definition.
022 * Deletions may be useful in hierarchical model composition scenarios for
023 * various reasons.  For example, some components in a submodel may be
024 * redundant in the composed model, perhaps because the same features are
025 * implemented in a different way in the new model.
026<p>
027 * Deletions function as follows.  When the {@link Model} to which the {@link Submodel}
028 * object refers (via the 'modelRef' attribute) is read and processed for
029 * inclusion into the composed model, each {@link Deletion} object identifies an
030 * object to remove from that {@link Model} instance.  The resulting submodel
031 * instance consists of everything in the {@link Model} object instance minus the
032 * entities referenced by the list of {@link Deletion} objects.
033 <p>
034 * As might be expected, deletions can have wide-ranging implications,
035 * especially when the object deleted has substantial substructure, as in
036 * the case of reactions.  The following are rules regarding deletions and
037 * their effects.
038 <p>
039 * <ul>
040 * <li> An object that has been deleted is considered inaccessible.
041 * Any element that has been deleted (or replaced)
042 * may not be referenced by an {@link SBaseRef} object.
043 * <li> If the deleted object has child objects and other structures, the
044 * child objects and substructure are also considered to be deleted.
045 * <li> It is not an error to delete explicitly an object that is already
046 * deleted by implication (for example as a result of the second point
047 * above).  The resulting model is the same.
048 * <li> If the deleted object is from an SBML namespace that is not
049 * understood by the interpreter, the deletion must be ignored&mdash;the 
050 * object will not need to be deleted, as the interpreter could not
051 * understand the package.  If an interpreter cannot tell whether 
052 * a referenced object does not exist or if exists in an unparsed namespace
053 * it may produce a warning.
054 *
055 * </ul> <p>
056 * The {@link Deletion} object class is subclassed from {@link SBaseRef}, and reuses all the 
057 * machinery provided by {@link SBaseRef}.  In addition, it defines two optional 
058 * attributes, 'id' and 'name'.  The 'id' attribute can be used to give an
059 * identifier to a given deletion operation.  The identifier has no
060 * mathematical meaning, but it may be useful for creating submodels that
061 * can be manipulated more directly by other submodels.  (Indeed, it is
062 * legitimate for an enclosing model definition to delete a deletion!)
063 <p>
064 * The optional 'name' attribute is provided on {@link Deletion} for the
065 * same reason it is provided on other elements that have identifiers;
066 * viz., to provide for the possibility of giving a human-readable name to
067 * the object.  The name may be useful in situations when deletions are
068 * displayed to modelers.
069 */
070
071public class Deletion extends SBaseRef {
072   private long swigCPtr;
073
074   protected Deletion(long cPtr, boolean cMemoryOwn)
075   {
076     super(libsbmlJNI.Deletion_SWIGUpcast(cPtr), cMemoryOwn);
077     swigCPtr = cPtr;
078   }
079
080   protected static long getCPtr(Deletion obj)
081   {
082     return (obj == null) ? 0 : obj.swigCPtr;
083   }
084
085   protected static long getCPtrAndDisown (Deletion obj)
086   {
087     long ptr = 0;
088
089     if (obj != null)
090     {
091       ptr             = obj.swigCPtr;
092       obj.swigCMemOwn = false;
093     }
094
095     return ptr;
096   }
097
098  protected void finalize() {
099    delete();
100  }
101
102  public synchronized void delete() {
103    if (swigCPtr != 0) {
104      if (swigCMemOwn) {
105        swigCMemOwn = false;
106        libsbmlJNI.delete_Deletion(swigCPtr);
107      }
108      swigCPtr = 0;
109    }
110    super.delete();
111  }
112
113  
114/**
115   * Creates a new {@link Deletion} with the given level, version, and package version.
116   <p>
117   * @param level the SBML Level
118   * @param version the Version within the SBML Level
119   * @param pkgVersion the version of the package
120   */ public
121 Deletion(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
122    this(libsbmlJNI.new_Deletion__SWIG_0(level, version, pkgVersion), true);
123  }
124
125  
126/**
127   * Creates a new {@link Deletion} with the given level, version, and package version.
128   <p>
129   * @param level the SBML Level
130   * @param version the Version within the SBML Level
131   * @param pkgVersion the version of the package
132   */ public
133 Deletion(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
134    this(libsbmlJNI.new_Deletion__SWIG_1(level, version), true);
135  }
136
137  
138/**
139   * Creates a new {@link Deletion} with the given level, version, and package version.
140   <p>
141   * @param level the SBML Level
142   * @param version the Version within the SBML Level
143   * @param pkgVersion the version of the package
144   */ public
145 Deletion(long level) throws org.sbml.libsbml.SBMLConstructorException {
146    this(libsbmlJNI.new_Deletion__SWIG_2(level), true);
147  }
148
149  
150/**
151   * Creates a new {@link Deletion} with the given level, version, and package version.
152   <p>
153   * @param level the SBML Level
154   * @param version the Version within the SBML Level
155   * @param pkgVersion the version of the package
156   */ public
157 Deletion() throws org.sbml.libsbml.SBMLConstructorException {
158    this(libsbmlJNI.new_Deletion__SWIG_3(), true);
159  }
160
161  
162/**
163   * Creates a new {@link Deletion} with the given {@link CompPkgNamespaces} object.
164   */ public
165 Deletion(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException {
166    this(libsbmlJNI.new_Deletion__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true);
167  }
168
169  
170/**
171   * Copy constructor.
172   */ public
173 Deletion(Deletion source) throws org.sbml.libsbml.SBMLConstructorException {
174    this(libsbmlJNI.new_Deletion__SWIG_5(Deletion.getCPtr(source), source), true);
175  }
176
177  
178/**
179   * Creates and returns a deep copy of this {@link Deletion} object.
180   <p>
181   * @return a (deep) copy of this {@link Deletion} object
182   */ public
183 SBase cloneObject() {
184    long cPtr = libsbmlJNI.Deletion_cloneObject(swigCPtr, this);
185    return (cPtr == 0) ? null : new Deletion(cPtr, true);
186  }
187
188  
189/**
190   * Sets the value of the 'id' attribute of this {@link Deletion}.
191   <p>
192   * This method fails if the <code>id</code> is not a valid syntax for an SId.
193   <p>
194   * @param id the identifier to use
195   <p>
196   * <p>
197 * @return integer value indicating success/failure of the
198 * function.   The possible values
199 * returned by this function are:
200   * <ul>
201   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
202   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
203   * </ul>
204   */ public
205 int setId(String id) {
206    return libsbmlJNI.Deletion_setId(swigCPtr, this, id);
207  }
208
209  
210/**
211   * Returns the value of the 'id' attribute of this {@link Deletion}.
212   <p>
213   * @return the name of this {@link Deletion}.
214   */ public
215 String getId() {
216    return libsbmlJNI.Deletion_getId(swigCPtr, this);
217  }
218
219  
220/**
221   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
222   * object's 'id' attribute has been set.
223   <p>
224   * <em>Some words of explanation about the</em>
225<code>set</code>/<code>unset</code>/<code>isSet</code> <em>methods</em>:
226The SBML specifications define certain attributes on some classes of
227objects as being optional.  This requires an application to be careful
228about the distinction between two cases when reading a model: (1) a given
229attribute has <em>never</em> been set to a value, and therefore should be
230assumed to have the SBML-defined default value if one exists, and (2) a
231given attribute has been set to a value, but the value happens to be an
232empty string.  The situation can be ambiguous when reading a model from a
233file or data stream and then examining the data objects that libSBML
234constructs as a result.  LibSBML supports these distinctions by providing
235methods to set, unset, and query the status of attributes that are
236optional.  The methods have names of the form <code>set</code><em><span
237class="placeholder">Attribute</span></em><code>(...)</code>,
238<code>unset</code><em><span
239class="placeholder">Attribute</span></em><code>()</code>, and
240<code>isSet</code><em><span
241class="placeholder">Attribute</span></em><code>()</code>, where <em><span
242class="placeholder">Attribute</span></em> is the the name of the optional
243attribute in question.
244
245   <p>
246   * @return <code>true</code> if the 'id' attribute of this object has been
247   * set, <code>false</code> otherwise.
248   */ public
249 boolean isSetId() {
250    return libsbmlJNI.Deletion_isSetId(swigCPtr, this);
251  }
252
253  
254/**
255   * Unsets the value of the 'id' attribute of this {@link Deletion}.
256   <p>
257   * <p>
258 * @return integer value indicating success/failure of the
259 * function.   The possible values
260 * returned by this function are:
261   * <ul>
262   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
263   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
264   * </ul>
265   */ public
266 int unsetId() {
267    return libsbmlJNI.Deletion_unsetId(swigCPtr, this);
268  }
269
270  
271/**
272   * Sets the value of the 'name' attribute of this {@link Deletion}.
273   <p>
274   * The string in <code>name</code> is copied.
275   <p>
276   * @param name the new name for the {@link Deletion}
277   <p>
278   * <p>
279 * @return integer value indicating success/failure of the
280 * function.   The possible values
281 * returned by this function are:
282   * <ul>
283   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
284   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
285   * </ul>
286   */ public
287 int setName(String name) {
288    return libsbmlJNI.Deletion_setName(swigCPtr, this, name);
289  }
290
291  
292/**
293   * Returns the value of the 'name' attribute of this {@link Deletion}.
294   <p>
295   * @return the name of this {@link Deletion}.
296   */ public
297 String getName() {
298    return libsbmlJNI.Deletion_getName(swigCPtr, this);
299  }
300
301  
302/**
303   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
304   * object's 'name' attribute has been set.
305   <p>
306   * <em>Some words of explanation about the</em>
307<code>set</code>/<code>unset</code>/<code>isSet</code> <em>methods</em>:
308The SBML specifications define certain attributes on some classes of
309objects as being optional.  This requires an application to be careful
310about the distinction between two cases when reading a model: (1) a given
311attribute has <em>never</em> been set to a value, and therefore should be
312assumed to have the SBML-defined default value if one exists, and (2) a
313given attribute has been set to a value, but the value happens to be an
314empty string.  The situation can be ambiguous when reading a model from a
315file or data stream and then examining the data objects that libSBML
316constructs as a result.  LibSBML supports these distinctions by providing
317methods to set, unset, and query the status of attributes that are
318optional.  The methods have names of the form <code>set</code><em><span
319class="placeholder">Attribute</span></em><code>(...)</code>,
320<code>unset</code><em><span
321class="placeholder">Attribute</span></em><code>()</code>, and
322<code>isSet</code><em><span
323class="placeholder">Attribute</span></em><code>()</code>, where <em><span
324class="placeholder">Attribute</span></em> is the the name of the optional
325attribute in question.
326
327   <p>
328   * @return <code>true</code> if the 'name' attribute of this object has been set, @c
329   * false otherwise.
330   */ public
331 boolean isSetName() {
332    return libsbmlJNI.Deletion_isSetName(swigCPtr, this);
333  }
334
335  
336/**
337   * Unsets the value of the 'name' attribute of this {@link Deletion}.
338   <p>
339   * <p>
340 * @return integer value indicating success/failure of the
341 * function.   The possible values
342 * returned by this function are:
343   * <ul>
344   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
345   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
346   * </ul>
347   */ public
348 int unsetName() {
349    return libsbmlJNI.Deletion_unsetName(swigCPtr, this);
350  }
351
352  
353/**
354   * Returns the XML element name of this SBML object.
355   <p>
356   * @return the name of this element, as a text string.
357   */ public
358 String getElementName() {
359    return libsbmlJNI.Deletion_getElementName(swigCPtr, this);
360  }
361
362  
363/**
364   * Returns the libSBML type code of this object instance.
365   <p>
366   * <p>
367 * LibSBML attaches an identifying code to every kind of SBML object.  These
368 * are integer constants known as <em>SBML type codes</em>.  The names of all
369 * the codes begin with the characters <code>SBML_</code>.
370 * In the Java language interface for libSBML, the
371 * type codes are defined as static integer constants in the interface class
372 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
373 * package plug-ins may use overlapping type codes; to identify the package
374 * to which a given object belongs, call the <code>getPackageName()</code>
375 * method on the object.
376   <p>
377   * @return the SBML type code for this object:
378   * {@link libsbmlConstants#SBML_COMP_DELETION SBML_COMP_DELETION}
379   <p>
380   * <p>
381 * @warning <span class='warning'>The specific integer values of the possible
382 * type codes may be reused by different Level&nbsp;3 package plug-ins.
383 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
384 * both getTypeCode() and getPackageName()</strong>.</span>
385   <p>
386   * @see #getElementName()
387   * @see #getPackageName()
388   */ public
389 int getTypeCode() {
390    return libsbmlJNI.Deletion_getTypeCode(swigCPtr, this);
391  }
392
393  
394/**
395   * Finds and stores the referenced object.  It finds its {@link Submodel} parent,
396   * gets its instantiated {@link Model} object, calls
397   * 'getReferencedElementFrom' on that model, and stores the result.
398   <p>
399   * <p>
400 * @return integer value indicating success/failure of the
401 * function.   The possible values
402 * returned by this function are:
403   * <ul>
404   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
405   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
406   * </ul>
407   */ public
408 int saveReferencedElement() {
409    return libsbmlJNI.Deletion_saveReferencedElement(swigCPtr, this);
410  }
411
412}