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