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