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 * <span class="pkg-marker pkg-color-comp"><a href="group__comp.html">comp</a></span>
013 Base class for references to objects.
014 <p>
015 * The {@link SBaseRef} class was introduced by the SBML Level&nbsp;3 
016 * 'Hierarchical Model Composition' package
017 * (&ldquo;comp&rdquo;) as the principle way by which submodel elements may
018 * be referenced.  The {@link SBaseRef} class is usually found as the base class of a
019 * {@link Port}, {@link Deletion}, {@link ReplacedElement}, or {@link ReplacedBy} class, but may appear as an
020 * child of one of the above classes if the parent object references a
021 * {@link Submodel}.
022 <p>
023 * An {@link SBaseRef} object must reference an element using exactly one of the
024 * optional attributes of the class.  Subclasses of {@link SBaseRef} may define
025 * additional optional attributes that are legal ways to reference an element.
026 <p>
027 * {@link SBaseRef} objects may reference elements that do not live in the {@link Model} parent 
028 * of the {@link SBaseRef} object.  However, the {@link SBaseRef} class itself does not 
029 * provide a method of determining which {@link Model} or {@link Submodel} is being referenced.
030 * The subclasses of {@link SBaseRef} provide methods for this instead.
031 <p>
032 * Once the {@link Model} to which the {@link SBaseRef} object is referencing has been established,
033 * there are four optional attributes defined in the {@link SBaseRef} class that
034 * are each methods of referencing an element:
035 <p>
036 * <ul>
037 * <li> 'portRef' (type PortSIdRef):  As its name implies, this attribute is used to
038 * refer to a port identifier, in the case when the reference being
039 * constructed with the {@link SBaseRef} is intended to refer to a port on a
040 * submodel.  The namespace of the PortSIdRef value is the set
041 * of identifiers of type PortSId defined in the submodel, not
042 * the parent model.
043 * <li> 'idRef' (type SIdRef): As its name implies, this attribute is used to
044 * refer to a regular identifier (i.e., the value of an 'id'
045 * attribute on some other object), in the case when the reference being
046 * constructed with the {@link SBaseRef} is intended to refer to an object that
047 * does not have a port identifier.  The namespace of the SIdRef
048 * value is the set of identifiers of type SId defined in the
049 * submodel, not the parent model.
050 * <li> 'unitRef' (type UnitSIdRef): This attribute is used to refer to the identifier
051 * of a {@link UnitDefinition} object.  The namespace of the UnitSIdRef
052 * value is the set of unit identifiers defined in the submodel, not the
053 * parent model. (Note that even though this attribute is of type UnitSIdRef,
054 * the reserved unit identifiers that are defined by SBML Level 3 (see
055 * Section 3.1.10 of the core specification) are
056 * *not* permitted as values of 'unitRef'.  Reserved unit
057 * identifiers may not be replaced or deleted.)
058 * <li> 'metaIdRef' (type IDREF): This attribute is used to refer to a 'metaid'
059 * attribute value on some other object, in the case when the reference
060 * being constructed with the {@link SBaseRef} is intended to refer to an object
061 * that does not have a port identifier.  The namespace of the 'metaIdRef'
062 * value is the entire document in which the referenced model resides, but
063 * must refer to a subelement of the referenced model.  Since meta identifiers are
064 * optional attributes of {@link SBase}, all SBML objects have the potential to
065 * have a meta identifier value.
066 *
067 * </ul> <p>
068 * An {@link SBaseRef} object may have up to one subcomponent named 'sBaseRef', of
069 * type {@link SBaseRef}.  This permits recursive structures to be constructed so
070 * that objects inside submodels can be referenced.
071 <p>
072 * The form of such recursive references must be as follows.  The
073 * highest-level {@link SBaseRef} object of such a chain (which will necessarily
074 * be an object of class {@link Port}, {@link Deletion}, {@link ReplacedElement} or {@link ReplacedBy},
075 * because they are the only classes derived from the class {@link SBaseRef}) must
076 * refer to a {@link Submodel} object in the containing model.  All child
077 * {@link SBaseRef} objects in the chain must refer to components inside the
078 * {@link Model} instance to which the {@link Submodel} refers.
079 */
080
081public class SBaseRef extends CompBase {
082   private long swigCPtr;
083
084   protected SBaseRef(long cPtr, boolean cMemoryOwn)
085   {
086     super(libsbmlJNI.SBaseRef_SWIGUpcast(cPtr), cMemoryOwn);
087     swigCPtr = cPtr;
088   }
089
090   protected static long getCPtr(SBaseRef obj)
091   {
092     return (obj == null) ? 0 : obj.swigCPtr;
093   }
094
095   protected static long getCPtrAndDisown (SBaseRef obj)
096   {
097     long ptr = 0;
098
099     if (obj != null)
100     {
101       ptr             = obj.swigCPtr;
102       obj.swigCMemOwn = false;
103     }
104
105     return ptr;
106   }
107
108  protected void finalize() {
109    delete();
110  }
111
112  public synchronized void delete() {
113    if (swigCPtr != 0) {
114      if (swigCMemOwn) {
115        swigCMemOwn = false;
116        libsbmlJNI.delete_SBaseRef(swigCPtr);
117      }
118      swigCPtr = 0;
119    }
120    super.delete();
121  }
122
123  
124/**
125   * Creates a new {@link SBaseRef} with the given level, version, and package version.
126   <p>
127   * @param level the SBML Level
128   * @param version the Version within the SBML Level
129   * @param pkgVersion the version of the package
130   */ public
131 SBaseRef(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
132    this(libsbmlJNI.new_SBaseRef__SWIG_0(level, version, pkgVersion), true);
133  }
134
135  
136/**
137   * Creates a new {@link SBaseRef} with the given level, version, and package version.
138   <p>
139   * @param level the SBML Level
140   * @param version the Version within the SBML Level
141   * @param pkgVersion the version of the package
142   */ public
143 SBaseRef(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
144    this(libsbmlJNI.new_SBaseRef__SWIG_1(level, version), true);
145  }
146
147  
148/**
149   * Creates a new {@link SBaseRef} with the given level, version, and package version.
150   <p>
151   * @param level the SBML Level
152   * @param version the Version within the SBML Level
153   * @param pkgVersion the version of the package
154   */ public
155 SBaseRef(long level) throws org.sbml.libsbml.SBMLConstructorException {
156    this(libsbmlJNI.new_SBaseRef__SWIG_2(level), true);
157  }
158
159  
160/**
161   * Creates a new {@link SBaseRef} with the given level, version, and package version.
162   <p>
163   * @param level the SBML Level
164   * @param version the Version within the SBML Level
165   * @param pkgVersion the version of the package
166   */ public
167 SBaseRef() throws org.sbml.libsbml.SBMLConstructorException {
168    this(libsbmlJNI.new_SBaseRef__SWIG_3(), true);
169  }
170
171  
172/**
173   * Creates a new {@link SBaseRef} with the given {@link CompPkgNamespaces} object.
174   <p>
175   * @param compns the namespace to use
176   */ public
177 SBaseRef(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException {
178    this(libsbmlJNI.new_SBaseRef__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true);
179  }
180
181  
182/**
183   * Copy constructor.
184   */ public
185 SBaseRef(SBaseRef source) throws org.sbml.libsbml.SBMLConstructorException {
186    this(libsbmlJNI.new_SBaseRef__SWIG_5(SBaseRef.getCPtr(source), source), true);
187  }
188
189  
190/**
191   * Creates and returns a deep copy of this {@link SBaseRef} object.
192   <p>
193   * @return a (deep) copy of this {@link SBaseRef} object
194   */ public
195 SBase cloneObject() {
196    long cPtr = libsbmlJNI.SBaseRef_cloneObject(swigCPtr, this);
197    return (cPtr == 0) ? null : new SBaseRef(cPtr, true);
198  }
199
200  
201/**
202   * Returns the first child element found that has the given <code>id</code> in the
203   * model-wide SId namespace, or <code>null</code> if no such object is found.
204   <p>
205   * @param id string representing the id of objects to find
206   <p>
207   * @return a pointer to the {@link SBase} element with the given <code>id</code>.
208   */ public
209 SBase getElementBySId(String id) {
210  return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getElementBySId(swigCPtr, this, id), false);
211}
212
213  
214/**
215   * Returns the first child element it can find with the given <code>metaid</code>, or
216   * itself if it has the given <code>metaid</code>, or <code>null</code> if no such object is found.
217   <p>
218   * @param metaid string representing the metaid of objects to find
219   <p>
220   * @return a pointer to the {@link SBase} element with the given <code>metaid</code>.
221   */ public
222 SBase getElementByMetaId(String metaid) {
223  return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getElementByMetaId(swigCPtr, this, metaid), false);
224}
225
226  
227/**
228   * Returns the value of the 'metaIdRef' attribute of this {@link SBaseRef}.
229   <p>
230   * @return the value of the 'metaIdRef' attribute of this {@link SBaseRef}.
231   */ public
232 String getMetaIdRef() {
233    return libsbmlJNI.SBaseRef_getMetaIdRef(swigCPtr, this);
234  }
235
236  
237/**
238   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
239   * {@link SBaseRef}'s 'metaIdRef' attribute has been set.
240   <p>
241   * @return <code>true</code> if this {@link SBaseRef}'s 'metaIdRef' attribute has been set, 
242   * otherwise <code>false</code> is returned.
243   */ public
244 boolean isSetMetaIdRef() {
245    return libsbmlJNI.SBaseRef_isSetMetaIdRef(swigCPtr, this);
246  }
247
248  
249/**
250   * Sets the value of the 'metaIdRef' attribute of this {@link SBaseRef}.
251   <p>
252   * This method fails if the id is not a valid syntax for an IDREF ({@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}), or if the {@link SBaseRef} already
253   * points to an element of the submodel using a different interface ({@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}).  An sBaseRef must use exactly one
254   * method to point to a submodel element.
255   <p>
256   * <p>
257 * @return integer value indicating success/failure of the
258 * function.   The possible values
259 * returned by this function are:
260   * <ul>
261   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
262   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
263   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
264   * </ul>
265   */ public
266 int setMetaIdRef(String id) {
267    return libsbmlJNI.SBaseRef_setMetaIdRef(swigCPtr, this, id);
268  }
269
270  
271/**
272   * Unsets the value of the 'metaIdRef' attribute of this {@link SBaseRef}.
273   <p>
274   * <p>
275 * @return integer value indicating success/failure of the
276 * function.   The possible values
277 * returned by this function are:
278   * <ul>
279   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
280   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
281   * </ul>
282   */ public
283 int unsetMetaIdRef() {
284    return libsbmlJNI.SBaseRef_unsetMetaIdRef(swigCPtr, this);
285  }
286
287  
288/**
289   * Returns the value of the 'portRef' attribute of this {@link SBaseRef}.
290   <p>
291   * @return the value of the 'portRef' attribute of this {@link SBaseRef}.
292   */ public
293 String getPortRef() {
294    return libsbmlJNI.SBaseRef_getPortRef(swigCPtr, this);
295  }
296
297  
298/**
299   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
300   * {@link SBaseRef}'s 'portRef' attribute has been set.
301   <p>
302   * @return <code>true</code> if this {@link SBaseRef}'s 'portRef' attribute has been set, 
303   * otherwise <code>false</code> is returned.
304   */ public
305 boolean isSetPortRef() {
306    return libsbmlJNI.SBaseRef_isSetPortRef(swigCPtr, this);
307  }
308
309  
310/**
311   * Sets the value of the 'portRef' attribute of this {@link SBaseRef}.  Fails if
312   * the id is not a valid syntax for a PortSIdRef ({@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}), or if the {@link SBaseRef} already
313   * points to an element of the submodel using a different interface ({@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}).  An {@link SBaseRef} must use exactly one
314   * method to point to a submodel element.
315   <p>
316   * <p>
317 * @return integer value indicating success/failure of the
318 * function.   The possible values
319 * returned by this function are:
320   * <ul>
321   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
322   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
323   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
324   * </ul>
325   */ public
326 int setPortRef(String id) {
327    return libsbmlJNI.SBaseRef_setPortRef(swigCPtr, this, id);
328  }
329
330  
331/**
332   * Unsets the value of the 'portRef' attribute of this {@link SBaseRef}.
333   <p>
334   * <p>
335 * @return integer value indicating success/failure of the
336 * function.   The possible values
337 * returned by this function are:
338   * <ul>
339   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
340   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
341   * </ul>
342   */ public
343 int unsetPortRef() {
344    return libsbmlJNI.SBaseRef_unsetPortRef(swigCPtr, this);
345  }
346
347  
348/**
349   * Returns the value of the 'idRef' attribute of this {@link SBaseRef}.
350   <p>
351   * @return the value of the 'idRef' attribute of this {@link SBaseRef}.
352   */ public
353 String getIdRef() {
354    return libsbmlJNI.SBaseRef_getIdRef(swigCPtr, this);
355  }
356
357  
358/**
359   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
360   * {@link SBaseRef}'s 'idRef' attribute has been set.
361   <p>
362   * @return <code>true</code> if this {@link SBaseRef}'s 'idRef' attribute has been set, 
363   * otherwise <code>false</code> is returned.
364   */ public
365 boolean isSetIdRef() {
366    return libsbmlJNI.SBaseRef_isSetIdRef(swigCPtr, this);
367  }
368
369  
370/**
371   * Sets the value of the 'idRef' attribute of this {@link SBaseRef}.
372   <p>
373   * This method fails if the id is not a valid syntax for an SIdRef ({@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}), or if the {@link SBaseRef} already
374   * points to an element of the submodel using a different interface ({@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}).  A sBaseRef must use exactly one
375   * method to point to a submodel element.
376   <p>
377   * <p>
378 * @return integer value indicating success/failure of the
379 * function.   The possible values
380 * returned by this function are:
381   * <ul>
382   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
383   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
384   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
385   * </ul>
386   */ public
387 int setIdRef(String id) {
388    return libsbmlJNI.SBaseRef_setIdRef(swigCPtr, this, id);
389  }
390
391  
392/**
393   * Unsets the value of the 'idRef' attribute of this {@link SBaseRef}.
394   <p>
395   * <p>
396 * @return integer value indicating success/failure of the
397 * function.   The possible values
398 * returned by this function are:
399   * <ul>
400   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
401   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
402   * </ul>
403   */ public
404 int unsetIdRef() {
405    return libsbmlJNI.SBaseRef_unsetIdRef(swigCPtr, this);
406  }
407
408  
409/**
410   * Returns the value of the 'unitRef' attribute of this {@link SBaseRef}.
411   <p>
412   * @return the value of the 'unitRef' attribute of this {@link SBaseRef}.
413   */ public
414 String getUnitRef() {
415    return libsbmlJNI.SBaseRef_getUnitRef(swigCPtr, this);
416  }
417
418  
419/**
420   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
421   * {@link SBaseRef}'s 'unitRef' attribute has been set.
422   <p>
423   * @return <code>true</code> if this {@link SBaseRef}'s 'unitRef' attribute has been set, 
424   * otherwise <code>false</code> is returned.
425   */ public
426 boolean isSetUnitRef() {
427    return libsbmlJNI.SBaseRef_isSetUnitRef(swigCPtr, this);
428  }
429
430  
431/**
432   * Sets the value of the 'unitRef' attribute of this {@link SBaseRef}.
433   <p>
434   * This method fails if the id is not a valid syntax for a UnitSIdRef ({@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}), or if the {@link SBaseRef} already
435   * points to an element of the submodel using a different interface ({@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}).  A sBaseRef must use exactly one
436   * method to point to a submodel element.
437   <p>
438   * <p>
439 * @return integer value indicating success/failure of the
440 * function.   The possible values
441 * returned by this function are:
442   * <ul>
443   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
444   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
445   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
446   * </ul>
447   */ public
448 int setUnitRef(String id) {
449    return libsbmlJNI.SBaseRef_setUnitRef(swigCPtr, this, id);
450  }
451
452  
453/**
454   * Unsets the value of the 'unitRef' attribute of this {@link SBaseRef}.
455   <p>
456   * <p>
457 * @return integer value indicating success/failure of the
458 * function.   The possible values
459 * returned by this function are:
460   * <ul>
461   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
462   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
463   * </ul>
464   */ public
465 int unsetUnitRef() {
466    return libsbmlJNI.SBaseRef_unsetUnitRef(swigCPtr, this);
467  }
468
469  
470/**
471   * Get the child sBaseRef of this sBaseRef.
472   <p>
473   * @return the  {@link SBaseRef} child of this {@link SBaseRef}, or null if none exists.
474   */ public
475 SBaseRef getSBaseRef() {
476    long cPtr = libsbmlJNI.SBaseRef_getSBaseRef__SWIG_0(swigCPtr, this);
477    return (cPtr == 0) ? null : new SBaseRef(cPtr, false);
478  }
479
480  
481/**
482   * Predicate for testing whether the sBaseRef for this {@link SBaseRef} is set.
483   <p>
484   * @return <code>true</code> if the sBaseRef of this {@link SBaseRef} is set, <code>false</code>
485   * otherwise.
486   */ public
487 boolean isSetSBaseRef() {
488    return libsbmlJNI.SBaseRef_isSetSBaseRef(swigCPtr, this);
489  }
490
491  
492/**
493   * Sets the sBaseRef definition of this {@link SBaseRef} to a copy of the given
494   * {@link SBaseRef} object instance.
495   <p>
496   * This method fails if the added sBaseRef does not match the
497   * level/version/package of the parent object or if the added sBaseRef cannot
498   * be copied.
499   <p>
500   * @param sBaseRef the {@link SBaseRef} object instance to use.
501   <p>
502   * <p>
503 * @return integer value indicating success/failure of the
504 * function.   The possible values
505 * returned by this function are:
506   * <ul>
507   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
508   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
509   * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH}
510   * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH}
511   * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH}
512   * </ul>
513   */ public
514 int setSBaseRef(SBaseRef sBaseRef) {
515    return libsbmlJNI.SBaseRef_setSBaseRef(swigCPtr, this, SBaseRef.getCPtr(sBaseRef), sBaseRef);
516  }
517
518  
519/**
520   * Creates a new, empty {@link SBaseRef}, adds it to this {@link SBaseRef} and 
521   * returns the created {@link SBaseRef}.
522   <p>
523   * @return the newly created {@link SBaseRef} object instance.
524   */ public
525 SBaseRef createSBaseRef() {
526    long cPtr = libsbmlJNI.SBaseRef_createSBaseRef(swigCPtr, this);
527    return (cPtr == 0) ? null : new SBaseRef(cPtr, false);
528  }
529
530  
531/**
532   * Unsets the child {@link SBaseRef} of this {@link SBaseRef}.  Deletes the former {@link SBaseRef} child,
533   * if one existed.
534   <p>
535   * <p>
536 * @return integer value indicating success/failure of the
537 * function.   The possible values
538 * returned by this function are:
539   * <ul>
540   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
541   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
542   * </ul>
543   */ public
544 int unsetSBaseRef() {
545    return libsbmlJNI.SBaseRef_unsetSBaseRef(swigCPtr, this);
546  }
547
548  
549/**
550   * Returns how many elements are being referred to by this {@link SBaseRef}.  A
551   * valid {@link SBaseRef} will have exactly one.  Possible referents are portRef,
552   * idRef, unitRef, and metaIdRef.
553   <p>
554   * @return integer value between 0 and 4: the number of different ways this element points to its referent.
555   */ public
556 int getNumReferents() {
557    return libsbmlJNI.SBaseRef_getNumReferents(swigCPtr, this);
558  }
559
560  
561/**
562   * Returns true if getNumReferents() is exactly 1.
563   <p>
564   * @return boolean: 'true' if the attributes are correctly set; 'false' if not.
565   */ public
566 boolean hasRequiredAttributes() {
567    return libsbmlJNI.SBaseRef_hasRequiredAttributes(swigCPtr, this);
568  }
569
570  
571/**
572   * <p>
573 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
574 * value.
575 <p>
576 * <p>
577 * In SBML, object identifiers are of a data type called <code>SId</code>.
578 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
579 * introduced for attribute values that refer to <code>SId</code> values; in
580 * previous Levels of SBML, this data type did not exist and attributes were
581 * simply described to as 'referring to an identifier', but the effective
582 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
583 * other methods of libSBML refer to the type <code>SIdRef</code> for all
584 * Levels of SBML, even if the corresponding SBML specification did not
585 * explicitly name the data type.
586 <p>
587 * This method works by looking at all attributes and (if appropriate)
588 * mathematical formulas in MathML content, comparing the referenced
589 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
590 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
591 * descend into child elements.
592 <p>
593 * @param oldid the old identifier
594 * @param newid the new identifier
595   */ public
596 void renameSIdRefs(String oldid, String newid) {
597    libsbmlJNI.SBaseRef_renameSIdRefs(swigCPtr, this, oldid, newid);
598  }
599
600  
601/**
602   * Returns the XML element name of
603   * this SBML object.
604   <p>
605   * @return the name of this element, as a text string.
606   */ public
607 String getElementName() {
608    return libsbmlJNI.SBaseRef_getElementName(swigCPtr, this);
609  }
610
611  
612/**
613   * Returns the libSBML type code of this object instance.
614   <p>
615   * <p>
616 * LibSBML attaches an identifying code to every kind of SBML object.  These
617 * are integer constants known as <em>SBML type codes</em>.  The names of all
618 * the codes begin with the characters <code>SBML_</code>.
619 * In the Java language interface for libSBML, the
620 * type codes are defined as static integer constants in the interface class
621 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
622 * package plug-ins may use overlapping type codes; to identify the package
623 * to which a given object belongs, call the <code>getPackageName()</code>
624 * method on the object.
625   <p>
626   * @return the SBML type code for this object:
627   * {@link libsbmlConstants#SBML_COMP_SBASEREF SBML_COMP_SBASEREF}
628   <p>
629   * <p>
630 * @warning <span class='warning'>The specific integer values of the possible
631 * type codes may be reused by different Level&nbsp;3 package plug-ins.
632 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
633 * both getTypeCode() and getPackageName()</strong>.</span>
634   <p>
635   * @see #getElementName()
636   * @see #getPackageName()
637   */ public
638 int getTypeCode() {
639    return libsbmlJNI.SBaseRef_getTypeCode(swigCPtr, this);
640  }
641
642  public void connectToChild() {
643    libsbmlJNI.SBaseRef_connectToChild(swigCPtr, this);
644  }
645
646  
647/**
648   * Examines the referenced {@link Model} for the referenced object, and returns it, if found.
649   <p>
650   * @param model the {@link Model} in which to look for the object referenced by
651   * this {@link SBaseRef}.
652   <p>
653   * @return the element in the referenced {@link Model} to which this {@link SBaseRef}
654   * refers.  If this object references an object in a {@link Submodel}, the returned
655   * object will be in the instantiated {@link Model} in that {@link Submodel}.
656   */ public
657 SBase getReferencedElementFrom(Model model) {
658  return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getReferencedElementFrom(swigCPtr, this, Model.getCPtr(model), model), false);
659}
660
661  
662/**
663   * Finds and stores the referenced object by finding the {@link Model} it needs to
664   * point to, calling 'saveReferencedElement' on its parent (which will also
665   * be a {@link SBaseRef} or one of its subclasses), and the storing the result.
666   <p>
667   * <p>
668 * @return integer value indicating success/failure of the
669 * function.   The possible values
670 * returned by this function are:
671   * <ul>
672   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
673   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
674   * </ul>
675   */ public
676 int saveReferencedElement() {
677    return libsbmlJNI.SBaseRef_saveReferencedElement(swigCPtr, this);
678  }
679
680  
681/**
682   * Returns the object pointed to by this element.  If that element was
683   * previously found and set with 'saveReferencedElement', that element is
684   * returned; otherwise, 'saveReferencedElement' is called first, and the
685   * found element is returned.
686   */ public
687 SBase getReferencedElement() {
688  return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getReferencedElement(swigCPtr, this), false);
689}
690
691  
692/**
693   * Removes the saved referenced element, if it had been saved earlier.
694   */ public
695 void clearReferencedElement() {
696    libsbmlJNI.SBaseRef_clearReferencedElement(swigCPtr, this);
697  }
698
699  
700/**
701   * DEPRECATED FUNCTION:  DO NOT USE
702   <p>
703   * Deletes the referenced object,
704   * plus any other elements that element points to through {@link ReplacedElement}
705   * or {@link ReplacedBy} children.  Instead of calling this function directly, use
706   * 'CompModelPlugin.instantiateSubmodels' instead, which deals with all the
707   * intricacies of replacements and deletions, and gives you access to the
708   * non-flattened hierarchical form of the model.
709   */ public
710 int performDeletion() {
711    return libsbmlJNI.SBaseRef_performDeletion(swigCPtr, this);
712  }
713
714  
715/**
716   * Finds this {@link SBaseRef}'s parent, which can either be a List or can be
717   * another {@link SBaseRef}, and tells it to remove this.
718   <p>
719   * <p>
720 * @return integer value indicating success/failure of the
721 * function.   The possible values
722 * returned by this function are:
723   * <ul>
724   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
725   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
726   * </ul>
727   */ public
728 int removeFromParentAndDelete() {
729    return libsbmlJNI.SBaseRef_removeFromParentAndDelete(swigCPtr, this);
730  }
731
732}