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 *  Implementation of SBML Level 2's SpeciesType
013 * 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&nbsp;2 Versions&nbsp;2&ndash;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&nbsp;2 Version&nbsp;4 specification).
041 <p>
042 * {@link SpeciesType} was introduced in SBML Level 2 Version 2.  It is not
043 * available in SBML Level&nbsp;1 nor in Level&nbsp;3.
044 <p>
045 * @see Species
046 * @see ListOfSpeciesTypes
047 * @see CompartmentType
048 * @see ListOfCompartmentTypes
049 */
050
051public class SpeciesType extends SBase {
052   private long swigCPtr;
053
054   protected SpeciesType(long cPtr, boolean cMemoryOwn)
055   {
056     super(libsbmlJNI.SpeciesType_SWIGUpcast(cPtr), cMemoryOwn);
057     swigCPtr = cPtr;
058   }
059
060   protected static long getCPtr(SpeciesType obj)
061   {
062     return (obj == null) ? 0 : obj.swigCPtr;
063   }
064
065   protected static long getCPtrAndDisown (SpeciesType obj)
066   {
067     long ptr = 0;
068
069     if (obj != null)
070     {
071       ptr             = obj.swigCPtr;
072       obj.swigCMemOwn = false;
073     }
074
075     return ptr;
076   }
077
078  protected void finalize() {
079    delete();
080  }
081
082  public synchronized void delete() {
083    if (swigCPtr != 0) {
084      if (swigCMemOwn) {
085        swigCMemOwn = false;
086        libsbmlJNI.delete_SpeciesType(swigCPtr);
087      }
088      swigCPtr = 0;
089    }
090    super.delete();
091  }
092
093  
094/**
095   * Creates a new {@link SpeciesType} using the given SBML <code>level</code> and <code>version</code>
096   * values.
097   <p>
098   * @param level a long integer, the SBML Level to assign to this {@link SpeciesType}
099   <p>
100   * @param version a long integer, the SBML Version to assign to this
101   * {@link SpeciesType}
102   <p>
103   * @throws SBMLConstructorException 
104   * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind
105   * of SBML object, are either invalid or mismatched with respect to the
106   * parent {@link SBMLDocument} object.
107   <p>
108   * <p>
109 * @note Upon the addition of a {@link SpeciesType} object to an {@link SBMLDocument}
110 * (e.g., using {@link Model#addSpeciesType(SpeciesType st)}),
111 * the SBML Level, SBML Version and XML namespace of the document 
112 * <em>override</em> the values used when creating the {@link SpeciesType} object via this
113 * constructor.  This is necessary to ensure that an SBML document is a
114 * consistent structure.  Nevertheless, the ability to supply the values
115 * at the time of creation of a {@link SpeciesType} is an important aid to
116 * producing valid SBML.  Knowledge of the intented SBML Level and
117 * Version determine whether it is valid to assign a particular value to
118 * an attribute, or whether it is valid to add an object to an existing
119 * {@link SBMLDocument}.
120   */ public
121 SpeciesType(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
122    this(libsbmlJNI.new_SpeciesType__SWIG_0(level, version), true);
123  }
124
125  
126/**
127   * Creates a new {@link SpeciesType} using the given {@link SBMLNamespaces} object
128   * <code>sbmlns</code>.
129   <p>
130   * <p>
131 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces
132 * information.  It is used to communicate the SBML Level, Version, and (in
133 * Level&nbsp;3) packages used in addition to SBML Level&nbsp;3 Core.  A
134 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
135 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object
136 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 
137   <p>
138   * It is worth emphasizing that although this constructor does not take
139   * an identifier argument, in SBML Level&nbsp;2 and beyond, the 'id'
140   * (identifier) attribute of a {@link SpeciesType} object is required to have a value.
141   * Thus, callers are cautioned to assign a value after calling this
142   * constructor.  Setting the identifier can be accomplished using the
143   * method {@link SBase#setId(String id)}.
144   <p>
145   * @param sbmlns an {@link SBMLNamespaces} object.
146   <p>
147   * @throws SBMLConstructorException 
148   * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind
149   * of SBML object, are either invalid or mismatched with respect to the
150   * parent {@link SBMLDocument} object.
151   <p>
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 Level, SBML Version and XML namespace of the document 
156 * <em>override</em> the values used when creating the {@link SpeciesType} object via this
157 * constructor.  This is necessary to ensure that an SBML document is a
158 * consistent structure.  Nevertheless, the ability to supply the values
159 * at the time of creation of a {@link SpeciesType} is an important aid to
160 * producing valid SBML.  Knowledge of the intented SBML Level and
161 * Version determine whether it is valid to assign a particular value to
162 * an attribute, or whether it is valid to add an object to an existing
163 * {@link SBMLDocument}.
164   */ public
165 SpeciesType(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
166    this(libsbmlJNI.new_SpeciesType__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
167  }
168
169  
170/**
171   * Copy constructor; creates a copy of this {@link SpeciesType}.
172   <p>
173   * @param orig the object to copy.
174   <p>
175   * @throws SBMLConstructorException 
176   * Thrown if the argument <code>orig</code> is <code>null.</code>
177   */ public
178 SpeciesType(SpeciesType orig) throws org.sbml.libsbml.SBMLConstructorException {
179    this(libsbmlJNI.new_SpeciesType__SWIG_2(SpeciesType.getCPtr(orig), orig), true);
180  }
181
182  
183/**
184   * Creates and returns a deep copy of this {@link SpeciesType}.
185   <p>
186   * @return a (deep) copy of this {@link SpeciesType}.
187   */ public
188 SpeciesType cloneObject() {
189    long cPtr = libsbmlJNI.SpeciesType_cloneObject(swigCPtr, this);
190    return (cPtr == 0) ? null : new SpeciesType(cPtr, true);
191  }
192
193  
194/**
195   * Returns the value of the 'id' attribute of this {@link SpeciesType}.
196   <p>
197   * @return the id of this {@link SpeciesType}.
198   */ public
199 String getId() {
200    return libsbmlJNI.SpeciesType_getId(swigCPtr, this);
201  }
202
203  
204/**
205   * Returns the value of the 'name' attribute of this {@link SpeciesType}.
206   <p>
207   * @return the name of this {@link SpeciesType}.
208   */ public
209 String getName() {
210    return libsbmlJNI.SpeciesType_getName(swigCPtr, this);
211  }
212
213  
214/**
215   * Predicate returning <code>true</code> if this
216   * {@link SpeciesType}'s 'id' attribute is set.
217   <p>
218   * @return <code>true</code> if the 'id' attribute of this {@link SpeciesType} is
219   * set, <code>false</code> otherwise.
220   */ public
221 boolean isSetId() {
222    return libsbmlJNI.SpeciesType_isSetId(swigCPtr, this);
223  }
224
225  
226/**
227   * Predicate returning <code>true</code> if this
228   * {@link SpeciesType}'s 'name' attribute is set.
229   <p>
230   * @return <code>true</code> if the 'name' attribute of this {@link SpeciesType} is
231   * set, <code>false</code> otherwise.
232   */ public
233 boolean isSetName() {
234    return libsbmlJNI.SpeciesType_isSetName(swigCPtr, this);
235  }
236
237  
238/**
239   * Sets the value of the 'id' attribute of this {@link SpeciesType}.
240   <p>
241   * The string <code>sid</code> is copied.
242   <p>
243   * <p>
244 * SBML has strict requirements for the syntax of identifiers, that is, the
245 * values of the 'id' attribute present on most types of SBML objects.
246 * The following is a summary of the definition of the SBML identifier type 
247 * <code>SId</code>, which defines the permitted syntax of identifiers.  We
248 * express the syntax using an extended form of BNF notation: 
249 * <pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'>
250 * letter .= 'a'..'z','A'..'Z'
251 * digit  .= '0'..'9'
252 * idChar .= letter | digit | '_'
253 * SId    .= ( letter | '_' ) idChar*
254 * </pre>
255 * The characters <code>(</code> and <code>)</code> are used for grouping, the
256 * character <code>*</code> 'zero or more times', and the character
257 * <code>|</code> indicates logical 'or'.  The equality of SBML identifiers is
258 * determined by an exact character sequence match; i.e., comparisons must be
259 * performed in a case-sensitive manner.  In addition, there are a few
260 * conditions for the uniqueness of identifiers in an SBML model.  Please
261 * consult the SBML specifications for the exact details of the uniqueness
262 * requirements.
263   <p>
264   * @param sid the string to use as the identifier of this {@link SpeciesType}
265   <p>
266   * @return integer value indicating success/failure of the
267   * function.   The possible values
268   * returned by this function are:
269   * <ul>
270   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
271   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
272   * </ul>
273   */ public
274 int setId(String sid) {
275    return libsbmlJNI.SpeciesType_setId(swigCPtr, this, sid);
276  }
277
278  
279/**
280   * Sets the value of the 'name' attribute of this {@link SpeciesType}.
281   <p>
282   * The string in <code>name</code> is copied.
283   <p>
284   * @param name the new name for the {@link SpeciesType}
285   <p>
286   * @return integer value indicating success/failure of the
287   * function.   The possible values
288   * returned by this function are:
289   * <ul>
290   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
291   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
292   * </ul>
293   */ public
294 int setName(String name) {
295    return libsbmlJNI.SpeciesType_setName(swigCPtr, this, name);
296  }
297
298  
299/**
300   * Unsets the value of the 'name' attribute of this {@link SpeciesType}.
301   <p>
302   * @return integer value indicating success/failure of the
303   * function.   The possible values
304   * returned by this function are:
305   * <ul>
306   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
307   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED }
308   * </ul>
309   */ public
310 int unsetName() {
311    return libsbmlJNI.SpeciesType_unsetName(swigCPtr, this);
312  }
313
314  
315/**
316   * Returns the libSBML type code for this SBML object.
317   <p>
318   * <p>
319 * LibSBML attaches an identifying code to every kind of SBML object.  These
320 * are integer constants known as <em>SBML type codes</em>.  The names of all
321 * the codes begin with the characters &ldquo;<code>SBML_</code>&rdquo;. 
322 * In the Java language interface for libSBML, the
323 * type codes are defined as static integer constants in the interface class
324 * {@link libsbmlConstants}.    Note that different Level&nbsp;3 
325 * package plug-ins may use overlapping type codes; to identify the package
326 * to which a given object belongs, call the <code>getPackageName()</code>
327 * method on the object.
328   <p>
329   * @return the SBML type code for this object:
330   * {@link  libsbmlConstants#SBML_SPECIES_TYPE SBML_SPECIES_TYPE} (default).
331   <p>
332   * <p>
333 * @warning <span class='warning'>The specific integer values of the possible
334 * type codes may be reused by different Level&nbsp;3 package plug-ins.
335 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
336 * both getTypeCode() and getPackageName()</strong>.</span>
337   <p>
338   * @see #getElementName()
339   * @see #getPackageName()
340   */ public
341 int getTypeCode() {
342    return libsbmlJNI.SpeciesType_getTypeCode(swigCPtr, this);
343  }
344
345  
346/**
347   * Returns the XML element name of this object, which for
348   * {@link SpeciesType}, is always <code>'compartmentType'.</code>
349   <p>
350   * @return the name of this element, i.e., <code>'compartmentType'.</code>
351   */ public
352 String getElementName() {
353    return libsbmlJNI.SpeciesType_getElementName(swigCPtr, this);
354  }
355
356  
357/**
358   * Predicate returning <code>true</code> if
359   * all the required attributes for this {@link SpeciesType} object
360   * have been set.
361   <p>
362   * @note The required attributes for a {@link SpeciesType} object are:
363   * <ul>
364   * <li> 'id'
365   *
366   * </ul> <p>
367   * @return a boolean value indicating whether all the required
368   * attributes for this object have been defined.
369   */ public
370 boolean hasRequiredAttributes() {
371    return libsbmlJNI.SpeciesType_hasRequiredAttributes(swigCPtr, this);
372  }
373
374}