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