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