001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.10
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 Indicates an object replaced by another.
014 <p>
015 * The {@link ReplacedBy} class was introduced by the SBML Level&nbsp;3 <a href='../../../extensions-summary.html#comp'>Hierarchical Model Composition</a>
016 * (&ldquo;comp&rdquo;) package to allow submodel elements to be 'canonical'
017 * versions of the element while still allowing the parent model to reference
018 * those elements.  Whereas a {@link ReplacedElement} object indicates that the
019 * containing object replaces another, a {@link ReplacedBy} object indicates the
020 * converse: the parent object is to be replaced by another object.
021<p>
022 * As is the case with {@link ReplacedElement}, the {@link ReplacedBy} class inherits from {@link SBaseRef}.  
023 * It additionally defines one required attribute ('submodelRef'), defined in 
024 * libSBML in the {@link Replacing} class.
025 */
026
027public class ReplacedBy extends Replacing {
028   private long swigCPtr;
029
030   protected ReplacedBy(long cPtr, boolean cMemoryOwn)
031   {
032     super(libsbmlJNI.ReplacedBy_SWIGUpcast(cPtr), cMemoryOwn);
033     swigCPtr = cPtr;
034   }
035
036   protected static long getCPtr(ReplacedBy obj)
037   {
038     return (obj == null) ? 0 : obj.swigCPtr;
039   }
040
041   protected static long getCPtrAndDisown (ReplacedBy obj)
042   {
043     long ptr = 0;
044
045     if (obj != null)
046     {
047       ptr             = obj.swigCPtr;
048       obj.swigCMemOwn = false;
049     }
050
051     return ptr;
052   }
053
054  protected void finalize() {
055    delete();
056  }
057
058  public synchronized void delete() {
059    if (swigCPtr != 0) {
060      if (swigCMemOwn) {
061        swigCMemOwn = false;
062        libsbmlJNI.delete_ReplacedBy(swigCPtr);
063      }
064      swigCPtr = 0;
065    }
066    super.delete();
067  }
068
069  
070/**
071   * Creates a new {@link ReplacedBy} with the given level, version, and package
072   * version.
073   <p>
074   * @param level the SBML Level
075   * @param version the Version within the SBML Level
076   * @param pkgVersion the version of the package
077   */ public
078 ReplacedBy(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
079    this(libsbmlJNI.new_ReplacedBy__SWIG_0(level, version, pkgVersion), true);
080  }
081
082  
083/**
084   * Creates a new {@link ReplacedBy} with the given level, version, and package
085   * version.
086   <p>
087   * @param level the SBML Level
088   * @param version the Version within the SBML Level
089   * @param pkgVersion the version of the package
090   */ public
091 ReplacedBy(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
092    this(libsbmlJNI.new_ReplacedBy__SWIG_1(level, version), true);
093  }
094
095  
096/**
097   * Creates a new {@link ReplacedBy} with the given level, version, and package
098   * version.
099   <p>
100   * @param level the SBML Level
101   * @param version the Version within the SBML Level
102   * @param pkgVersion the version of the package
103   */ public
104 ReplacedBy(long level) throws org.sbml.libsbml.SBMLConstructorException {
105    this(libsbmlJNI.new_ReplacedBy__SWIG_2(level), true);
106  }
107
108  
109/**
110   * Creates a new {@link ReplacedBy} with the given level, version, and package
111   * version.
112   <p>
113   * @param level the SBML Level
114   * @param version the Version within the SBML Level
115   * @param pkgVersion the version of the package
116   */ public
117 ReplacedBy() throws org.sbml.libsbml.SBMLConstructorException {
118    this(libsbmlJNI.new_ReplacedBy__SWIG_3(), true);
119  }
120
121  
122/**
123   * Creates a new {@link ReplacedBy} with the given {@link CompPkgNamespaces} object.
124   <p>
125   * @param compns the namespace to use
126   */ public
127 ReplacedBy(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException {
128    this(libsbmlJNI.new_ReplacedBy__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true);
129  }
130
131  
132/**
133   * Copy constructor.
134   */ public
135 ReplacedBy(ReplacedBy source) throws org.sbml.libsbml.SBMLConstructorException {
136    this(libsbmlJNI.new_ReplacedBy__SWIG_5(ReplacedBy.getCPtr(source), source), true);
137  }
138
139  
140/**
141   * Creates and returns a deep copy of this {@link ReplacedBy} object.
142   <p>
143   * @return a (deep) copy of this {@link ReplacedBy} object
144   */ public
145 SBase cloneObject() {
146    long cPtr = libsbmlJNI.ReplacedBy_cloneObject(swigCPtr, this);
147    return (cPtr == 0) ? null : new ReplacedBy(cPtr, true);
148  }
149
150  
151/**
152   * Returns the XML element name of
153   * this SBML object.
154   <p>
155   * @return the name of this element, as a text string.
156   */ public
157 String getElementName() {
158    return libsbmlJNI.ReplacedBy_getElementName(swigCPtr, this);
159  }
160
161  
162/**
163   * Returns the libSBML type code of this object instance.
164   <p>
165   * <p>
166 * LibSBML attaches an identifying code to every kind of SBML object.  These
167 * are integer constants known as <em>SBML type codes</em>.  The names of all
168 * the codes begin with the characters <code>SBML_</code>.
169 * In the Java language interface for libSBML, the
170 * type codes are defined as static integer constants in the interface class
171 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
172 * package plug-ins may use overlapping type codes; to identify the package
173 * to which a given object belongs, call the <code>getPackageName()</code>
174 * method on the object.
175   <p>
176   * @return the SBML type code for this object:
177   * {@link libsbmlConstants#SBML_COMP_REPLACEDBY SBML_COMP_REPLACEDBY}
178   <p>
179   * <p>
180 * @warning <span class='warning'>The specific integer values of the possible
181 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
182 * packages,  To fully identify the correct code, <strong>it is necessary to
183 * invoke both getTypeCode() and getPackageName()</strong>.</span>
184   <p>
185   * @see #getElementName()
186   * @see #getPackageName()
187   */ public
188 int getTypeCode() {
189    return libsbmlJNI.ReplacedBy_getTypeCode(swigCPtr, this);
190  }
191
192  
193/**
194   * Finds this {@link ReplacedBy}'s {@link SBase} parent, gets the &ldquo;comp&rdquo; plugin from it,
195   * and tells that to remove this.
196   <p>
197   * <p>
198 * @return integer value indicating success/failure of the
199 * function.   The possible values
200 * returned by this function are:
201   * <ul>
202   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
203   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
204   * </ul>
205   */ public
206 int removeFromParentAndDelete() {
207    return libsbmlJNI.ReplacedBy_removeFromParentAndDelete(swigCPtr, this);
208  }
209
210  
211/** * @internal */ public
212 int updateIDs(SBase oldnames, SBase newnames) {
213    return libsbmlJNI.ReplacedBy_updateIDs(swigCPtr, this, SBase.getCPtr(oldnames), oldnames, SBase.getCPtr(newnames), newnames);
214  }
215
216}