001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
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 *  A parameter inside an SBML <em>reaction</em> definition.
013 <p>
014 * {@link LocalParameter} has been introduced in SBML Level&nbsp;3 to serve as the
015 * object class for parameter definitions that are intended to be local to
016 * a {@link Reaction}.  Objects of class {@link LocalParameter} never appear at the {@link Model}
017 * level; they are always contained within {@link ListOfLocalParameters} lists
018 * which are in turn contained within {@link KineticLaw} objects.
019 <p>
020 * Like its global {@link Parameter} counterpart, the {@link LocalParameter} object class
021 * is used to define a symbol associated with a value; this symbol can then
022 * be used in a model's mathematical formulas (and specifically, for
023 * {@link LocalParameter}, reaction rate formulas).  Unlike {@link Parameter}, the
024 * {@link LocalParameter} class does not have a 'constant' attribute: local
025 * parameters within reactions are <em>always</em> constant.
026 <p>
027 * {@link LocalParameter} has one required attribute, 'id', to give the
028 * parameter a unique identifier by which other parts of an SBML model
029 * definition can refer to it.  A parameter can also have an optional
030 * 'name' attribute of type <code>string.</code>  Identifiers and names must be used
031 * according to the guidelines described in the SBML specifications.
032 <p>
033 * The optional attribute 'value' determines the value (of type <code>double</code>)
034 * assigned to the parameter.  A missing value for 'value' implies that
035 * the value either is unknown, or to be obtained from an external source,
036 * or determined by an initial assignment.  The unit of measurement
037 * associated with the value of the parameter can be specified using the
038 * optional attribute 'units'.  Here we only mention briefly some notable
039 * points about the possible unit choices, but readers are urged to consult
040 * the SBML specification documents for more information:
041 * <ul>
042 <p>
043 * <li> In SBML Level&nbsp;3, there are no constraints on the units that
044 * can be assigned to parameters in a model; there are also no units to
045 * inherit from the enclosing {@link Model} object.
046 <p>
047 * <li> In SBML Level&nbsp;2, the value assigned to the parameter's 'units'
048 * attribute must be chosen from one of the following possibilities: one of
049 * the base unit identifiers defined in SBML; one of the built-in unit
050 * identifiers <code>'substance'</code>, <code>'time'</code>, <code>'volume'</code>, <code>'area'</code> or 
051 * <code>'length'</code>; or the identifier of a new unit defined in the list of unit
052 * definitions in the enclosing {@link Model} structure.  There are no constraints
053 * on the units that can be chosen from these sets.  There are no default
054 * units for local parameters.
055 * </ul>
056 <p>
057 * As with all other major SBML components, {@link LocalParameter} is derived from
058 * {@link SBase}, and the methods defined on {@link SBase} are available on {@link LocalParameter}.
059 <p>
060 * @warning <span class='warning'>LibSBML derives {@link LocalParameter} from
061 * {@link Parameter}; however, this does not precisely match the object hierarchy
062 * defined by SBML Level&nbsp;3, where {@link LocalParameter} is derived directly
063 * from {@link SBase} and not {@link Parameter}.  We believe this arrangement makes it easier
064 * for libSBML users to program applications that work with both SBML
065 * Level&nbsp;2 and SBML Level&nbsp;3, but programmers should also keep in
066 * mind this difference exists.  A side-effect of libSBML's scheme is that
067 * certain methods on {@link LocalParameter} that are inherited from {@link Parameter} do not
068 * actually have relevance to {@link LocalParameter} objects.  An example of this is
069 * the methods pertaining to {@link Parameter}'s attribute 'constant' (i.e.,
070 * isSetConstant(), setConstant(), and getConstant()).</span>
071 <p>
072 * @see ListOfLocalParameters
073 * @see KineticLaw
074 */
075
076public class LocalParameter extends Parameter {
077   private long swigCPtr;
078
079   protected LocalParameter(long cPtr, boolean cMemoryOwn)
080   {
081     super(libsbmlJNI.LocalParameter_SWIGUpcast(cPtr), cMemoryOwn);
082     swigCPtr = cPtr;
083   }
084
085   protected static long getCPtr(LocalParameter obj)
086   {
087     return (obj == null) ? 0 : obj.swigCPtr;
088   }
089
090   protected static long getCPtrAndDisown (LocalParameter obj)
091   {
092     long ptr = 0;
093
094     if (obj != null)
095     {
096       ptr             = obj.swigCPtr;
097       obj.swigCMemOwn = false;
098     }
099
100     return ptr;
101   }
102
103  protected void finalize() {
104    delete();
105  }
106
107  public synchronized void delete() {
108    if (swigCPtr != 0) {
109      if (swigCMemOwn) {
110        swigCMemOwn = false;
111        libsbmlJNI.delete_LocalParameter(swigCPtr);
112      }
113      swigCPtr = 0;
114    }
115    super.delete();
116  }
117
118  
119/**
120   * Creates a new {@link LocalParameter} object with the given SBML <code>level</code> and
121   * <code>version</code> values.
122   <p>
123   * @param level a long integer, the SBML Level to assign to this
124   * {@link LocalParameter}.
125   <p>
126   * @param version a long integer, the SBML Version to assign to this
127   * {@link LocalParameter}.
128   <p>
129   * <p>
130 * @throws SBMLConstructorException
131 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid
132 * or if this object is incompatible with the given level and version.
133   <p>
134   * <p>
135 * @note Attempting to add an object to an {@link SBMLDocument} having a different
136 * combination of SBML Level, Version and XML namespaces than the object
137 * itself will result in an error at the time a caller attempts to make the
138 * addition.  A parent object must have compatible Level, Version and XML
139 * namespaces.  (Strictly speaking, a parent may also have more XML
140 * namespaces than a child, but the reverse is not permitted.)  The
141 * restriction is necessary to ensure that an SBML model has a consistent
142 * overall structure.  This requires callers to manage their objects
143 * carefully, but the benefit is increased flexibility in how models can be
144 * created by permitting callers to create objects bottom-up if desired.  In
145 * situations where objects are not yet attached to parents (e.g.,
146 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
147 * libSBML determine such things as whether it is valid to assign a
148 * particular value to an attribute.
149   */ public
150 LocalParameter(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
151    this(libsbmlJNI.new_LocalParameter__SWIG_0(level, version), true);
152  }
153
154  
155/**
156   * Creates a new {@link LocalParameter} object with the given {@link SBMLNamespaces}
157   * object <code>sbmlns</code>.
158   <p>
159   * <p>
160 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces
161 * information.  It is used to communicate the SBML Level, Version, and (in
162 * Level&nbsp;3) packages used in addition to SBML Level&nbsp;3 Core.  A
163 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
164 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object
165 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 
166   <p>
167   * It is worth emphasizing that although this constructor does not take
168   * an identifier argument, in SBML Level&nbsp;2 and beyond, the 'id'
169   * (identifier) attribute of a {@link LocalParameter} is required to have a value.
170   * Thus, callers are cautioned to assign a value after calling this
171   * constructor if no identifier is provided as an argument.  Setting the
172   * identifier can be accomplished using the method
173   * setId(String id).
174   <p>
175   * @param sbmlns an {@link SBMLNamespaces} object.
176   <p>
177   * <p>
178 * @throws SBMLConstructorException
179 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible
180 * with this object.
181   <p>
182   * <p>
183 * @note Attempting to add an object to an {@link SBMLDocument} having a different
184 * combination of SBML Level, Version and XML namespaces than the object
185 * itself will result in an error at the time a caller attempts to make the
186 * addition.  A parent object must have compatible Level, Version and XML
187 * namespaces.  (Strictly speaking, a parent may also have more XML
188 * namespaces than a child, but the reverse is not permitted.)  The
189 * restriction is necessary to ensure that an SBML model has a consistent
190 * overall structure.  This requires callers to manage their objects
191 * carefully, but the benefit is increased flexibility in how models can be
192 * created by permitting callers to create objects bottom-up if desired.  In
193 * situations where objects are not yet attached to parents (e.g.,
194 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
195 * libSBML determine such things as whether it is valid to assign a
196 * particular value to an attribute.
197   */ public
198 LocalParameter(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
199    this(libsbmlJNI.new_LocalParameter__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
200  }
201
202  
203/**
204   * Copy constructor; creates a copy of a given {@link LocalParameter} object.
205   <p>
206   * @param orig the {@link LocalParameter} instance to copy.
207   */ public
208 LocalParameter(LocalParameter orig) throws org.sbml.libsbml.SBMLConstructorException {
209    this(libsbmlJNI.new_LocalParameter__SWIG_2(LocalParameter.getCPtr(orig), orig), true);
210  }
211
212  
213/**
214   * Copy constructor; creates a {@link LocalParameter} object by copying
215   * the attributes of a given {@link Parameter} object.
216   <p>
217   * @param orig the {@link Parameter} instance to copy.
218   */ public
219 LocalParameter(Parameter orig) throws org.sbml.libsbml.SBMLConstructorException {
220    this(libsbmlJNI.new_LocalParameter__SWIG_3(Parameter.getCPtr(orig), orig), true);
221  }
222
223  
224/**
225   * Creates and returns a deep copy of this {@link LocalParameter} object.
226   <p>
227   * @return the (deep) copy of this {@link LocalParameter} object.
228   */ public
229 LocalParameter cloneObject() {
230    long cPtr = libsbmlJNI.LocalParameter_cloneObject(swigCPtr, this);
231    return (cPtr == 0) ? null : new LocalParameter(cPtr, true);
232  }
233
234  
235/**
236   * Constructs and returns a {@link UnitDefinition} that corresponds to the units
237   * of this {@link LocalParameter}'s value.
238   <p>
239   * <p>
240 * LocalParameters in SBML have an attribute ('units') for declaring the
241 * units of measurement intended for the parameter's value.  <b>No
242 * defaults are defined</b> by SBML in the absence of a definition for
243 * 'units'.  This method returns a {@link UnitDefinition} object based on the
244 * units declared for this {@link LocalParameter} using its 'units' attribute, or
245 * it returns <code>null</code> if no units have been declared.
246 <p>
247 * Note that unit declarations for {@link LocalParameter} objects are specified
248 * in terms of the <em>identifier</em> of a unit (e.g., using setUnits()), but
249 * <em>this</em> method returns a {@link UnitDefinition} object, not a unit
250 * identifier.  It does this by constructing an appropriate
251 * {@link UnitDefinition}.  For SBML Level&nbsp;2 models, it will do this even
252 * when the value of the 'units' attribute is one of the predefined SBML
253 * units <code>'substance'</code>, <code>'volume'</code>, <code>'area'</code>, <code>'length'</code> or 
254 * <code>'time'.</code>  Callers may find this useful in conjunction with the helper
255 * methods provided by the {@link UnitDefinition} class for comparing different
256 * {@link UnitDefinition} objects.
257   <p>
258   * @return a {@link UnitDefinition} that expresses the units of this 
259   * {@link LocalParameter}, or <code>null</code> if one cannot be constructed.
260   <p>
261   * @note The libSBML system for unit analysis depends on the model as a
262   * whole.  In cases where the {@link LocalParameter} object has not yet been
263   * added to a model, or the model itself is incomplete, unit analysis is
264   * not possible, and consequently this method will return <code>null.</code>
265   <p>
266   * @see #isSetUnits()
267   */ public
268 UnitDefinition getDerivedUnitDefinition() {
269    long cPtr = libsbmlJNI.LocalParameter_getDerivedUnitDefinition__SWIG_0(swigCPtr, this);
270    return (cPtr == 0) ? null : new UnitDefinition(cPtr, false);
271  }
272
273  
274/**
275   * Returns the libSBML type code for this SBML object.
276   <p>
277   * <p>
278 * LibSBML attaches an identifying code to every kind of SBML object.  These
279 * are integer constants known as <em>SBML type codes</em>.  The names of all
280 * the codes begin with the characters <code>SBML_</code>.
281 * In the Java language interface for libSBML, the
282 * type codes are defined as static integer constants in the interface class
283 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
284 * package plug-ins may use overlapping type codes; to identify the package
285 * to which a given object belongs, call the <code>getPackageName()</code>
286 * method on the object.
287   <p>
288   * @return the SBML type code for this object:
289   * {@link libsbmlConstants#SBML_LOCAL_PARAMETER SBML_LOCAL_PARAMETER} (default).
290   <p>
291   * <p>
292 * @warning <span class='warning'>The specific integer values of the possible
293 * type codes may be reused by different Level&nbsp;3 package plug-ins.
294 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
295 * both getTypeCode() and getPackageName()</strong>.</span>
296   <p>
297   * @see #getElementName()
298   * @see #getPackageName()
299   */ public
300 int getTypeCode() {
301    return libsbmlJNI.LocalParameter_getTypeCode(swigCPtr, this);
302  }
303
304  
305/**
306   * Returns the XML element name of this object, which for {@link LocalParameter},
307   * is always <code>'localParameter'.</code>
308   <p>
309   * @return the name of this element, i.e., <code>'localParameter'.</code>
310   */ public
311 String getElementName() {
312    return libsbmlJNI.LocalParameter_getElementName(swigCPtr, this);
313  }
314
315  
316/**
317   * Predicate returning <code>true</code> if all the required attributes for this
318   * {@link LocalParameter} object have been set.
319   <p>
320   * The required attributes for a {@link LocalParameter} object are:
321   * <ul>
322   * <li> 'id'
323   * <li> 'value'
324   *
325   * </ul> <p>
326   * @return <code>true</code> if the required attributes have been set, <code>false</code>
327   * otherwise.
328   */ public
329 boolean hasRequiredAttributes() {
330    return libsbmlJNI.LocalParameter_hasRequiredAttributes(swigCPtr, this);
331  }
332
333  
334/** * @internal */ public
335 boolean getConstant() {
336    return libsbmlJNI.LocalParameter_getConstant(swigCPtr, this);
337  }
338
339  
340/** * @internal */ public
341 boolean isSetConstant() {
342    return libsbmlJNI.LocalParameter_isSetConstant(swigCPtr, this);
343  }
344
345  
346/** * @internal */ public
347 int setConstant(boolean flag) {
348    return libsbmlJNI.LocalParameter_setConstant(swigCPtr, this, flag);
349  }
350
351  
352/** * @internal */ public
353 int unsetConstant() {
354    return libsbmlJNI.LocalParameter_unsetConstant(swigCPtr, this);
355  }
356
357}