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