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