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's SimpleSpeciesReference 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 * <p> 046 * <p> 047 */ 048 049public class SimpleSpeciesReference extends SBase { 050 private long swigCPtr; 051 052 protected SimpleSpeciesReference(long cPtr, boolean cMemoryOwn) 053 { 054 super(libsbmlJNI.SimpleSpeciesReference_SWIGUpcast(cPtr), cMemoryOwn); 055 swigCPtr = cPtr; 056 } 057 058 protected static long getCPtr(SimpleSpeciesReference obj) 059 { 060 return (obj == null) ? 0 : obj.swigCPtr; 061 } 062 063 protected static long getCPtrAndDisown (SimpleSpeciesReference obj) 064 { 065 long ptr = 0; 066 067 if (obj != null) 068 { 069 ptr = obj.swigCPtr; 070 obj.swigCMemOwn = false; 071 } 072 073 return ptr; 074 } 075 076 protected void finalize() { 077 delete(); 078 } 079 080 public synchronized void delete() { 081 if (swigCPtr != 0) { 082 if (swigCMemOwn) { 083 swigCMemOwn = false; 084 libsbmlJNI.delete_SimpleSpeciesReference(swigCPtr); 085 } 086 swigCPtr = 0; 087 } 088 super.delete(); 089 } 090 091 092/** 093 * Returns the value of the 'id' attribute of this {@link SimpleSpeciesReference}. 094 * <p> 095 * @return the id of this {@link SimpleSpeciesReference}. 096 */ public 097 String getId() { 098 return libsbmlJNI.SimpleSpeciesReference_getId(swigCPtr, this); 099 } 100 101 102/** 103 * Returns the value of the 'name' attribute of this {@link SimpleSpeciesReference}. 104 * <p> 105 * @return the name of this {@link SimpleSpeciesReference}. 106 */ public 107 String getName() { 108 return libsbmlJNI.SimpleSpeciesReference_getName(swigCPtr, this); 109 } 110 111 112/** 113 * Get the value of the 'species' attribute. 114 * <p> 115 * @return the value of the attribute 'species' for this 116 * {@link SimpleSpeciesReference}. 117 */ public 118 String getSpecies() { 119 return libsbmlJNI.SimpleSpeciesReference_getSpecies(swigCPtr, this); 120 } 121 122 123/** 124 * Predicate returning <code>true</code> if this 125 * {@link SimpleSpeciesReference}'s 'id' attribute is set. 126 * <p> 127 * @return <code>true</code> if the 'id' attribute of this {@link SimpleSpeciesReference} is 128 * set, <code>false</code> otherwise. 129 */ public 130 boolean isSetId() { 131 return libsbmlJNI.SimpleSpeciesReference_isSetId(swigCPtr, this); 132 } 133 134 135/** 136 * Predicate returning <code>true</code> if this 137 * {@link SimpleSpeciesReference}'s 'name' attribute is set. 138 * <p> 139 * @return <code>true</code> if the 'name' attribute of this {@link SimpleSpeciesReference} is 140 * set, <code>false</code> otherwise. 141 */ public 142 boolean isSetName() { 143 return libsbmlJNI.SimpleSpeciesReference_isSetName(swigCPtr, this); 144 } 145 146 147/** 148 * Predicate returning <code>true</code> if this 149 * {@link SimpleSpeciesReference}'s 'species' attribute is set. 150 * <p> 151 * @return <code>true</code> if the 'species' attribute of this 152 * {@link SimpleSpeciesReference} is set, <code>false</code> otherwise. 153 */ public 154 boolean isSetSpecies() { 155 return libsbmlJNI.SimpleSpeciesReference_isSetSpecies(swigCPtr, this); 156 } 157 158 159/** 160 * Sets the 'species' attribute of this {@link SimpleSpeciesReference}. 161 * <p> 162 * The identifier string passed in <code>sid</code> is copied. 163 * <p> 164 * @param sid the identifier of a species defined in the enclosing 165 * {@link Model}'s {@link ListOfSpecies}. 166 * <p> 167 * @return integer value indicating success/failure of the 168 * function. The possible values 169 * returned by this function are: 170 * <ul> 171 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 172 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 173 * </ul> 174 */ public 175 int setSpecies(String sid) { 176 return libsbmlJNI.SimpleSpeciesReference_setSpecies(swigCPtr, this, sid); 177 } 178 179 180/** 181 * Sets the value of the 'id' attribute of this {@link SimpleSpeciesReference}. 182 * <p> 183 * The string <code>sid</code> is copied. Note that SBML has strict requirements 184 * for the syntax of identifiers. The following is a summary of the definition of the SBML identifier type 185<code>SId</code>, which defines the permitted syntax of identifiers. We 186express the syntax using an extended form of BNF notation: 187<pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'> 188letter .= 'a'..'z','A'..'Z' 189digit .= '0'..'9' 190idChar .= letter | digit | '_' 191SId .= ( letter | '_' ) idChar* 192</pre> 193The characters <code>(</code> and <code>)</code> are used for grouping, the 194character <code>*</code> 'zero or more times', and the character 195<code>|</code> indicates logical 'or'. The equality of SBML identifiers is 196determined by an exact character sequence match; i.e., comparisons must be 197performed in a case-sensitive manner. In addition, there are a few 198conditions for the uniqueness of identifiers in an SBML model. Please 199consult the SBML specifications for the exact formulations. 200<p> 201 202 * <p> 203 * @param sid the string to use as the identifier of this {@link SimpleSpeciesReference} 204 * <p> 205 * @return integer value indicating success/failure of the 206 * function. The possible values 207 * returned by this function are: 208 * <ul> 209 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 210 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 211 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 212 * </ul> 213 */ public 214 int setId(String sid) { 215 return libsbmlJNI.SimpleSpeciesReference_setId(swigCPtr, this, sid); 216 } 217 218 219/** 220 * Sets the value of the 'name' attribute of this {@link SimpleSpeciesReference}. 221 * <p> 222 * The string in <code>name</code> is copied. 223 * <p> 224 * @param name the new name for the {@link SimpleSpeciesReference} 225 * <p> 226 * @return integer value indicating success/failure of the 227 * function. The possible values 228 * returned by this function are: 229 * <ul> 230 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 231 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 232 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 233 * </ul> 234 */ public 235 int setName(String name) { 236 return libsbmlJNI.SimpleSpeciesReference_setName(swigCPtr, this, name); 237 } 238 239 240/** 241 * Unsets the value of the 'id' attribute of this {@link SimpleSpeciesReference}. 242 * <p> 243 * @return integer value indicating success/failure of the 244 * function. The possible values 245 * returned by this function are: 246 * <ul> 247 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 248 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 249 * </ul> 250 */ public 251 int unsetId() { 252 return libsbmlJNI.SimpleSpeciesReference_unsetId(swigCPtr, this); 253 } 254 255 256/** 257 * Unsets the value of the 'name' attribute of this {@link SimpleSpeciesReference}. 258 * <p> 259 * @return integer value indicating success/failure of the 260 * function. The possible values 261 * returned by this function are: 262 * <ul> 263 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 264 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 265 * </ul> 266 */ public 267 int unsetName() { 268 return libsbmlJNI.SimpleSpeciesReference_unsetName(swigCPtr, this); 269 } 270 271 272/** 273 * Predicate returning <code>true</code> if this 274 * is a {@link ModifierSpeciesReference}. 275 * <p> 276 * @return <code>true</code> if this {@link SimpleSpeciesReference}'s subclass is 277 * ModiferSpeciesReference, <code>false</code> if it is a plain {@link SpeciesReference}. 278 */ public 279 boolean isModifier() { 280 return libsbmlJNI.SimpleSpeciesReference_isModifier(swigCPtr, this); 281 } 282 283 284/** 285 * Renames all the SIdRef attributes on this element, including any found in MathML 286 */ public 287 void renameSIdRefs(String oldid, String newid) { 288 libsbmlJNI.SimpleSpeciesReference_renameSIdRefs(swigCPtr, this, oldid, newid); 289 } 290 291}