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 * A <em>compartment type</em> in SBML Level 2. 013 <p> 014 * SBML Level 2 Versions 2–4 provide the <em>compartment 015 * type</em> as a grouping construct that can be used to establish a 016 * relationship between multiple {@link Compartment} objects. A {@link CompartmentType} 017 * object only has an identity, and this identity can only be used to 018 * indicate that particular {@link Compartment} objects in the model belong to this 019 * type. This may be useful for conveying a modeling intention, such as 020 * when a model contains many similar compartments, either by their 021 * biological function or the reactions they carry. Without a compartment 022 * type construct, it would be impossible within SBML itself to indicate 023 * that all of the compartments share an underlying conceptual relationship 024 * because each SBML compartment must be given a unique and separate 025 * identity. {@link Compartment} types have no mathematical meaning in 026 * SBML—they have no effect on a model's mathematical interpretation. 027 * Simulators and other numerical analysis software may ignore 028 * {@link CompartmentType} definitions and references to them in a model. 029 <p> 030 * There is no mechanism in SBML Level 2 for representing hierarchies of 031 * compartment types. One {@link CompartmentType} instance cannot be the subtype 032 * of another {@link CompartmentType} instance; SBML provides no means of defining 033 * such relationships. 034 <p> 035 * As with other major structures in SBML, {@link CompartmentType} has a mandatory 036 * attribute, 'id', used to give the compartment type an identifier. The 037 * identifier must be a text string conforming to the identifer syntax 038 * permitted in SBML. {@link CompartmentType} also has an optional 'name' 039 * attribute, of type <code>string.</code> The 'id' and 'name' must be used 040 * according to the guidelines described in the SBML specification (e.g., 041 * Section 3.3 in the Level 2 Version 4 specification). 042 <p> 043 * {@link CompartmentType} was introduced in SBML Level 2 Version 2. It is not 044 * available in SBML Level 1 nor in Level 3. 045 <p> 046 * @see Compartment 047 * @see ListOfCompartmentTypes 048 * @see SpeciesType 049 * @see ListOfSpeciesTypes 050 */ 051 052public class CompartmentType extends SBase { 053 private long swigCPtr; 054 055 protected CompartmentType(long cPtr, boolean cMemoryOwn) 056 { 057 super(libsbmlJNI.CompartmentType_SWIGUpcast(cPtr), cMemoryOwn); 058 swigCPtr = cPtr; 059 } 060 061 protected static long getCPtr(CompartmentType obj) 062 { 063 return (obj == null) ? 0 : obj.swigCPtr; 064 } 065 066 protected static long getCPtrAndDisown (CompartmentType obj) 067 { 068 long ptr = 0; 069 070 if (obj != null) 071 { 072 ptr = obj.swigCPtr; 073 obj.swigCMemOwn = false; 074 } 075 076 return ptr; 077 } 078 079 protected void finalize() { 080 delete(); 081 } 082 083 public synchronized void delete() { 084 if (swigCPtr != 0) { 085 if (swigCMemOwn) { 086 swigCMemOwn = false; 087 libsbmlJNI.delete_CompartmentType(swigCPtr); 088 } 089 swigCPtr = 0; 090 } 091 super.delete(); 092 } 093 094 095/** 096 * Creates a new {@link CompartmentType} object using the given SBML <code>level</code> and 097 * <code>version</code> values. 098 <p> 099 * @param level a long integer, the SBML Level to assign to this 100 * {@link CompartmentType} 101 <p> 102 * @param version a long integer, the SBML Version to assign to this 103 * {@link CompartmentType} 104 <p> 105 * <p> 106 * @throws SBMLConstructorException 107 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 108 * or if this object is incompatible with the given level and version. 109 <p> 110 * <p> 111 * @note Attempting to add an object to an {@link SBMLDocument} having a different 112 * combination of SBML Level, Version and XML namespaces than the object 113 * itself will result in an error at the time a caller attempts to make the 114 * addition. A parent object must have compatible Level, Version and XML 115 * namespaces. (Strictly speaking, a parent may also have more XML 116 * namespaces than a child, but the reverse is not permitted.) The 117 * restriction is necessary to ensure that an SBML model has a consistent 118 * overall structure. This requires callers to manage their objects 119 * carefully, but the benefit is increased flexibility in how models can be 120 * created by permitting callers to create objects bottom-up if desired. In 121 * situations where objects are not yet attached to parents (e.g., 122 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 123 * libSBML determine such things as whether it is valid to assign a 124 * particular value to an attribute. 125 */ public 126 CompartmentType(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 127 this(libsbmlJNI.new_CompartmentType__SWIG_0(level, version), true); 128 } 129 130 131/** 132 * Creates a new {@link CompartmentType} object using the given {@link SBMLNamespaces} 133 * object <code>sbmlns</code>. 134 <p> 135 * <p> 136 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 137 * information. It is used to communicate the SBML Level, Version, and (in 138 * Level 3) packages used in addition to SBML Level 3 Core. A 139 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 140 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 141 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 142 <p> 143 * It is worth emphasizing that although this constructor does not take an 144 * identifier argument, in SBML Level 2 and beyond, the 'id' 145 * (identifier) attribute of a {@link CompartmentType} object is required to have a 146 * value. Thus, callers are cautioned to assign a value after calling this 147 * constructor. Setting the identifier can be accomplished using the 148 * method setId(String). 149 <p> 150 * @param sbmlns an {@link SBMLNamespaces} object. 151 <p> 152 * <p> 153 * @throws SBMLConstructorException 154 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible 155 * with this object. 156 <p> 157 * <p> 158 * @note Attempting to add an object to an {@link SBMLDocument} having a different 159 * combination of SBML Level, Version and XML namespaces than the object 160 * itself will result in an error at the time a caller attempts to make the 161 * addition. A parent object must have compatible Level, Version and XML 162 * namespaces. (Strictly speaking, a parent may also have more XML 163 * namespaces than a child, but the reverse is not permitted.) The 164 * restriction is necessary to ensure that an SBML model has a consistent 165 * overall structure. This requires callers to manage their objects 166 * carefully, but the benefit is increased flexibility in how models can be 167 * created by permitting callers to create objects bottom-up if desired. In 168 * situations where objects are not yet attached to parents (e.g., 169 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 170 * libSBML determine such things as whether it is valid to assign a 171 * particular value to an attribute. 172 */ public 173 CompartmentType(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 174 this(libsbmlJNI.new_CompartmentType__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 175 } 176 177 178/** 179 * Copy constructor; creates a copy of this {@link CompartmentType} object. 180 <p> 181 * @param orig the object to copy. 182 */ public 183 CompartmentType(CompartmentType orig) throws org.sbml.libsbml.SBMLConstructorException { 184 this(libsbmlJNI.new_CompartmentType__SWIG_2(CompartmentType.getCPtr(orig), orig), true); 185 } 186 187 188/** 189 * Creates and returns a deep copy of this {@link CompartmentType} object. 190 <p> 191 * @return the (deep) copy of this {@link CompartmentType} object. 192 */ public 193 CompartmentType cloneObject() { 194 long cPtr = libsbmlJNI.CompartmentType_cloneObject(swigCPtr, this); 195 return (cPtr == 0) ? null : new CompartmentType(cPtr, true); 196 } 197 198 199/** 200 * Returns the value of the 'id' attribute of this {@link CompartmentType} object. 201 <p> 202 * @return the identifier of this {@link CompartmentType} object. 203 <p> 204 * @see #getName() 205 * @see #setId(String) 206 * @see #unsetId() 207 * @see #isSetId() 208 */ public 209 String getId() { 210 return libsbmlJNI.CompartmentType_getId(swigCPtr, this); 211 } 212 213 214/** 215 * Returns the value of the 'name' attribute of this {@link CompartmentType} 216 * object. 217 <p> 218 * @return the name of this {@link CompartmentType} object. 219 <p> 220 * @see #getId() 221 * @see #isSetName() 222 * @see #setName(String) 223 * @see #unsetName() 224 */ public 225 String getName() { 226 return libsbmlJNI.CompartmentType_getName(swigCPtr, this); 227 } 228 229 230/** 231 * Predicate returning <code>true</code> if this {@link CompartmentType} object's 'id' 232 * attribute is set. 233 <p> 234 * @return <code>true</code> if the 'id' attribute of this {@link CompartmentType} object is 235 * set, <code>false</code> otherwise. 236 <p> 237 * @see #getId() 238 * @see #unsetId() 239 * @see #setId(String) 240 */ public 241 boolean isSetId() { 242 return libsbmlJNI.CompartmentType_isSetId(swigCPtr, this); 243 } 244 245 246/** 247 * Predicate returning <code>true</code> if this {@link CompartmentType} object's 'name' 248 * attribute is set. 249 <p> 250 * @return <code>true</code> if the 'name' attribute of this {@link CompartmentType} object 251 * is set, <code>false</code> otherwise. 252 <p> 253 * @see #getName() 254 * @see #setName(String) 255 * @see #unsetName() 256 */ public 257 boolean isSetName() { 258 return libsbmlJNI.CompartmentType_isSetName(swigCPtr, this); 259 } 260 261 262/** 263 * Sets the value of the 'id' attribute of this {@link CompartmentType} object. 264 <p> 265 * The string <code>sid</code> is copied. 266 <p> 267 * <p> 268 * SBML has strict requirements for the syntax of identifiers, that is, the 269 * values of the 'id' attribute present on most types of SBML objects. 270 * The following is a summary of the definition of the SBML identifier type 271 * <code>SId</code>, which defines the permitted syntax of identifiers. We 272 * express the syntax using an extended form of BNF notation: 273 * <pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'> 274 * letter .= 'a'..'z','A'..'Z' 275 * digit .= '0'..'9' 276 * idChar .= letter | digit | '_' 277 * SId .= ( letter | '_' ) idChar*</pre> 278 * The characters <code>(</code> and <code>)</code> are used for grouping, the 279 * character <code>*</code> 'zero or more times', and the character 280 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 281 * determined by an exact character sequence match; i.e., comparisons must be 282 * performed in a case-sensitive manner. In addition, there are a few 283 * conditions for the uniqueness of identifiers in an SBML model. Please 284 * consult the SBML specifications for the exact details of the uniqueness 285 * requirements. 286 <p> 287 * @param sid the string to use as the identifier of this {@link CompartmentType} 288 <p> 289 * <p> 290 * @return integer value indicating success/failure of the 291 * function. The possible values 292 * returned by this function are: 293 * <ul> 294 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 295 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 296 * 297 * </ul> <p> 298 * @see #getId() 299 * @see #unsetId() 300 * @see #isSetId() 301 */ public 302 int setId(String sid) { 303 return libsbmlJNI.CompartmentType_setId(swigCPtr, this, sid); 304 } 305 306 307/** 308 * Sets the value of the 'name' attribute of this {@link CompartmentType} object. 309 <p> 310 * The string in <code>name</code> is copied. 311 <p> 312 * @param name the new name for the {@link CompartmentType} 313 <p> 314 * <p> 315 * @return integer value indicating success/failure of the 316 * function. The possible values 317 * returned by this function are: 318 * <ul> 319 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 320 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 321 * 322 * </ul> <p> 323 * @see #getName() 324 * @see #isSetName() 325 * @see #unsetName() 326 */ public 327 int setName(String name) { 328 return libsbmlJNI.CompartmentType_setName(swigCPtr, this, name); 329 } 330 331 332/** 333 * Unsets the value of the 'name' attribute of this {@link CompartmentType} object. 334 <p> 335 * <p> 336 * @return integer value indicating success/failure of the 337 * function. The possible values 338 * returned by this function are: 339 * <ul> 340 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 341 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 342 * 343 * </ul> <p> 344 * @see #getName() 345 * @see #setName(String) 346 * @see #isSetName() 347 */ public 348 int unsetName() { 349 return libsbmlJNI.CompartmentType_unsetName(swigCPtr, this); 350 } 351 352 353/** 354 * Returns the libSBML type code for this SBML object. 355 <p> 356 * <p> 357 * LibSBML attaches an identifying code to every kind of SBML object. These 358 * are integer constants known as <em>SBML type codes</em>. The names of all 359 * the codes begin with the characters <code>SBML_</code>. 360 * In the Java language interface for libSBML, the 361 * type codes are defined as static integer constants in the interface class 362 * {@link libsbmlConstants}. Note that different Level 3 363 * package plug-ins may use overlapping type codes; to identify the package 364 * to which a given object belongs, call the <code>getPackageName()</code> 365 * method on the object. 366 <p> 367 * @return the SBML type code for this object: 368 * {@link libsbmlConstants#SBML_COMPARTMENT_TYPE SBML_COMPARTMENT_TYPE} (default). 369 <p> 370 * <p> 371 * @warning <span class='warning'>The specific integer values of the possible 372 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 373 * packages, To fully identify the correct code, <strong>it is necessary to 374 * invoke both getTypeCode() and getPackageName()</strong>.</span> 375 <p> 376 * @see #getElementName() 377 * @see #getPackageName() 378 */ public 379 int getTypeCode() { 380 return libsbmlJNI.CompartmentType_getTypeCode(swigCPtr, this); 381 } 382 383 384/** 385 * Returns the XML element name of this object 386 <p> 387 * For {@link CompartmentType}, the element name is always <code>'compartmentType'.</code> 388 <p> 389 * @return the name of this element. 390 <p> 391 * @see #getTypeCode() 392 * @see #getPackageName() 393 */ public 394 String getElementName() { 395 return libsbmlJNI.CompartmentType_getElementName(swigCPtr, this); 396 } 397 398 399/** 400 * Predicate returning <code>true</code> if all the required attributes for this 401 * {@link CompartmentType} object have been set. 402 <p> 403 * The required attributes for a {@link CompartmentType} object are: 404 * <ul> 405 * <li> 'id' 406 * 407 * </ul> <p> 408 * @return <code>true</code> if the required attributes have been set, <code>false</code> 409 * otherwise. 410 */ public 411 boolean hasRequiredAttributes() { 412 return libsbmlJNI.CompartmentType_hasRequiredAttributes(swigCPtr, this); 413 } 414 415}