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