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's SimpleSpeciesReference
013 * construct.
014 <p>
015 * As mentioned in the description of {@link Reaction}, every species that enters
016 * into a given reaction must appear in that reaction's lists of reactants,
017 * products and/or modifiers.  In an SBML model, all species that may
018 * participate in any reaction are listed in the 'listOfSpecies' element of
019 * the top-level {@link Model} object.  Lists of products, reactants and modifiers
020 * in {@link Reaction} objects do not introduce new species, but rather, they refer
021 * back to those listed in the model's top-level 'listOfSpecies'.  For
022 * reactants and products, the connection is made using {@link SpeciesReference}
023 * objects; for modifiers, it is made using {@link ModifierSpeciesReference}
024 * objects.  {@link SimpleSpeciesReference} is an abstract type that serves as the
025 * parent class of both {@link SpeciesReference} and {@link ModifierSpeciesReference}.  It
026 * is used simply to hold the attributes and elements that are common to
027 * the latter two structures.
028 <p>
029 * The {@link SimpleSpeciesReference} structure has a mandatory attribute,
030 * 'species', which must be a text string conforming to the identifer
031 * syntax permitted in SBML.  This attribute is inherited by the
032 * {@link SpeciesReference} and {@link ModifierSpeciesReference} subclasses derived from
033 * {@link SimpleSpeciesReference}.  The value of the 'species' attribute must be
034 * the identifier of a species defined in the enclosing {@link Model}.  The species
035 * is thereby declared as participating in the reaction being defined.  The
036 * precise role of that species as a reactant, product, or modifier in the
037 * reaction is determined by the subclass of {@link SimpleSpeciesReference} (i.e.,
038 * either {@link SpeciesReference} or {@link ModifierSpeciesReference}) in which the
039 * identifier appears.
040 <p>
041 * {@link SimpleSpeciesReference} also contains an optional attribute, 'id',
042 * allowing instances to be referenced from other structures.  No SBML
043 * structures currently do this; however, such structures are anticipated
044 * in future SBML Levels.
045 */
046
047public class SimpleSpeciesReference extends SBase {
048   private long swigCPtr;
049
050   protected SimpleSpeciesReference(long cPtr, boolean cMemoryOwn)
051   {
052     super(libsbmlJNI.SimpleSpeciesReference_SWIGUpcast(cPtr), cMemoryOwn);
053     swigCPtr = cPtr;
054   }
055
056   protected static long getCPtr(SimpleSpeciesReference obj)
057   {
058     return (obj == null) ? 0 : obj.swigCPtr;
059   }
060
061   protected static long getCPtrAndDisown (SimpleSpeciesReference obj)
062   {
063     long ptr = 0;
064
065     if (obj != null)
066     {
067       ptr             = obj.swigCPtr;
068       obj.swigCMemOwn = false;
069     }
070
071     return ptr;
072   }
073
074  protected void finalize() {
075    delete();
076  }
077
078  public synchronized void delete() {
079    if (swigCPtr != 0) {
080      if (swigCMemOwn) {
081        swigCMemOwn = false;
082        libsbmlJNI.delete_SimpleSpeciesReference(swigCPtr);
083      }
084      swigCPtr = 0;
085    }
086    super.delete();
087  }
088
089  
090/**
091   * Returns the value of the 'id' attribute of this {@link SimpleSpeciesReference}.
092   <p>
093   * @return the id of this {@link SimpleSpeciesReference}.
094   */ public
095 String getId() {
096    return libsbmlJNI.SimpleSpeciesReference_getId(swigCPtr, this);
097  }
098
099  
100/**
101   * Returns the value of the 'name' attribute of this {@link SimpleSpeciesReference}.
102   <p>
103   * @return the name of this {@link SimpleSpeciesReference}.
104   */ public
105 String getName() {
106    return libsbmlJNI.SimpleSpeciesReference_getName(swigCPtr, this);
107  }
108
109  
110/**
111   * Get the value of the 'species' attribute.
112   <p>
113   * @return the value of the attribute 'species' for this
114   * {@link SimpleSpeciesReference}.
115   */ public
116 String getSpecies() {
117    return libsbmlJNI.SimpleSpeciesReference_getSpecies(swigCPtr, this);
118  }
119
120  
121/**
122   * Predicate returning <code>true</code> if this
123   * {@link SimpleSpeciesReference}'s 'id' attribute is set.
124   <p>
125   * @return <code>true</code> if the 'id' attribute of this {@link SimpleSpeciesReference} is
126   * set, <code>false</code> otherwise.
127   */ public
128 boolean isSetId() {
129    return libsbmlJNI.SimpleSpeciesReference_isSetId(swigCPtr, this);
130  }
131
132  
133/**
134   * Predicate returning <code>true</code> if this
135   * {@link SimpleSpeciesReference}'s 'name' attribute is set.
136   <p>
137   * @return <code>true</code> if the 'name' attribute of this {@link SimpleSpeciesReference} is
138   * set, <code>false</code> otherwise.
139   */ public
140 boolean isSetName() {
141    return libsbmlJNI.SimpleSpeciesReference_isSetName(swigCPtr, this);
142  }
143
144  
145/**
146   * Predicate returning <code>true</code> if this
147   * {@link SimpleSpeciesReference}'s 'species' attribute is set.
148   <p>
149   * @return <code>true</code> if the 'species' attribute of this
150   * {@link SimpleSpeciesReference} is set, <code>false</code> otherwise.
151   */ public
152 boolean isSetSpecies() {
153    return libsbmlJNI.SimpleSpeciesReference_isSetSpecies(swigCPtr, this);
154  }
155
156  
157/**
158   * Sets the 'species' attribute of this {@link SimpleSpeciesReference}.
159   <p>
160   * The identifier string passed in <code>sid</code> is copied.
161   <p>
162   * @param sid the identifier of a species defined in the enclosing
163   * {@link Model}'s {@link ListOfSpecies}.
164   <p>
165   * @return integer value indicating success/failure of the
166   * function.  The possible values
167   * returned by this function are:
168   * <ul>
169   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
170   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
171   * </ul>
172   */ public
173 int setSpecies(String sid) {
174    return libsbmlJNI.SimpleSpeciesReference_setSpecies(swigCPtr, this, sid);
175  }
176
177  
178/**
179   * Sets the value of the 'id' attribute of this {@link SimpleSpeciesReference}.
180   <p>
181   * The string <code>sid</code> is copied.
182   <p>
183   * <p>
184 * SBML has strict requirements for the syntax of identifiers, that is, the
185 * values of the 'id' attribute present on most types of SBML objects.
186 * The following is a summary of the definition of the SBML identifier type 
187 * <code>SId</code>, which defines the permitted syntax of identifiers.  We
188 * express the syntax using an extended form of BNF notation: 
189 * <pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'>
190 * letter .= 'a'..'z','A'..'Z'
191 * digit  .= '0'..'9'
192 * idChar .= letter | digit | '_'
193 * SId    .= ( letter | '_' ) idChar*
194 * </pre>
195 * The characters <code>(</code> and <code>)</code> are used for grouping, the
196 * character <code>*</code> 'zero or more times', and the character
197 * <code>|</code> indicates logical 'or'.  The equality of SBML identifiers is
198 * determined by an exact character sequence match; i.e., comparisons must be
199 * performed in a case-sensitive manner.  In addition, there are a few
200 * conditions for the uniqueness of identifiers in an SBML model.  Please
201 * consult the SBML specifications for the exact details of the uniqueness
202 * requirements.
203   <p>
204   * @param sid the string to use as the identifier of this {@link SimpleSpeciesReference}
205   <p>
206   * @return integer value indicating success/failure of the
207   * function.  The possible values
208   * returned by this function are:
209   * <ul>
210   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
211   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
212   * <li> {@link  libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE }
213   * </ul>
214   */ public
215 int setId(String sid) {
216    return libsbmlJNI.SimpleSpeciesReference_setId(swigCPtr, this, sid);
217  }
218
219  
220/**
221   * Sets the value of the 'name' attribute of this {@link SimpleSpeciesReference}.
222   <p>
223   * The string in <code>name</code> is copied.
224   <p>
225   * @param name the new name for the {@link SimpleSpeciesReference}
226   <p>
227   * @return integer value indicating success/failure of the
228   * function.  The possible values
229   * returned by this function are:
230   * <ul>
231   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
232   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
233   * <li> {@link  libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE }
234   * </ul>
235   */ public
236 int setName(String name) {
237    return libsbmlJNI.SimpleSpeciesReference_setName(swigCPtr, this, name);
238  }
239
240  
241/**
242   * Unsets the value of the 'id' attribute of this {@link SimpleSpeciesReference}.
243   <p>
244   * @return integer value indicating success/failure of the
245   * function.  The possible values
246   * returned by this function are:
247   * <ul>
248   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
249   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED }
250   * </ul>
251   */ public
252 int unsetId() {
253    return libsbmlJNI.SimpleSpeciesReference_unsetId(swigCPtr, this);
254  }
255
256  
257/**
258   * Unsets the value of the 'name' attribute of this {@link SimpleSpeciesReference}.
259   <p>
260   * @return integer value indicating success/failure of the
261   * function.  The possible values
262   * returned by this function are:
263   * <ul>
264   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
265   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED }
266   * </ul>
267   */ public
268 int unsetName() {
269    return libsbmlJNI.SimpleSpeciesReference_unsetName(swigCPtr, this);
270  }
271
272  
273/**
274   * Predicate returning <code>true</code> if this
275   * is a {@link ModifierSpeciesReference}.
276   <p>
277   * @return <code>true</code> if this {@link SimpleSpeciesReference}'s subclass is
278   * ModiferSpeciesReference, <code>false</code> if it is a plain {@link SpeciesReference}.
279   */ public
280 boolean isModifier() {
281    return libsbmlJNI.SimpleSpeciesReference_isModifier(swigCPtr, this);
282  }
283
284  
285/**
286   * Renames all the <code>SIdRef</code> attributes on this element, including any
287   * found in MathML.
288   <p>
289   * <p>
290 * In SBML, object identifiers are of a data type called <code>SId</code>.
291 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
292 * introduced for attribute values that refer to <code>SId</code> values; in
293 * previous Levels of SBML, this data type did not exist and attributes were
294 * simply described to as 'referring to an identifier', but the effective
295 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
296 * other methods of libSBML refer to the type <code>SIdRef</code> for all
297 * Levels of SBML, even if the corresponding SBML specification did not
298 * explicitly name the data type.
299   <p>
300   * This method works by looking at all attributes and (if appropriate)
301   * mathematical formulas, comparing the identifiers to the value of 
302   * <code>oldid</code>.  If any matches are found, the matching identifiers are replaced
303   * with <code>newid</code>.  The method does <em>not</em> descend into child elements.
304   <p>
305   * @param oldid the old identifier
306   * @param newid the new identifier
307   */ public
308 void renameSIdRefs(String oldid, String newid) {
309    libsbmlJNI.SimpleSpeciesReference_renameSIdRefs(swigCPtr, this, oldid, newid);
310  }
311
312}