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 3 <a href='../../../extensions-summary.html#comp'>Hierarchical Model Composition</a> 016 * (“comp”) 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 <p> 078 * <p> 079 * @note Attempting to add an object to an {@link SBMLDocument} having a different 080 * combination of SBML Level, Version and XML namespaces than the object 081 * itself will result in an error at the time a caller attempts to make the 082 * addition. A parent object must have compatible Level, Version and XML 083 * namespaces. (Strictly speaking, a parent may also have more XML 084 * namespaces than a child, but the reverse is not permitted.) The 085 * restriction is necessary to ensure that an SBML model has a consistent 086 * overall structure. This requires callers to manage their objects 087 * carefully, but the benefit is increased flexibility in how models can be 088 * created by permitting callers to create objects bottom-up if desired. In 089 * situations where objects are not yet attached to parents (e.g., 090 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 091 * libSBML determine such things as whether it is valid to assign a 092 * particular value to an attribute. For packages, this means that the 093 * parent object to which this package element is being added must have 094 * been created with the package namespace, or that the package namespace 095 * was added to it, even if that parent is not a package object itself. 096 */ public 097 ReplacedBy(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 098 this(libsbmlJNI.new_ReplacedBy__SWIG_0(level, version, pkgVersion), true); 099 } 100 101 102/** 103 * Creates a new {@link ReplacedBy} with the given level, version, and package 104 * version. 105 <p> 106 * @param level the SBML Level. 107 * @param version the Version within the SBML Level. 108 * @param pkgVersion the version of the package. 109 <p> 110 * <p> 111 * @note Attempting to add an object to an {@link SBMLDocument} having a different 112 * combination of SBML Level, Version and XML namespaces than the object 113 * itself will result in an error at the time a caller attempts to make the 114 * addition. A parent object must have compatible Level, Version and XML 115 * namespaces. (Strictly speaking, a parent may also have more XML 116 * namespaces than a child, but the reverse is not permitted.) The 117 * restriction is necessary to ensure that an SBML model has a consistent 118 * overall structure. This requires callers to manage their objects 119 * carefully, but the benefit is increased flexibility in how models can be 120 * created by permitting callers to create objects bottom-up if desired. In 121 * situations where objects are not yet attached to parents (e.g., 122 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 123 * libSBML determine such things as whether it is valid to assign a 124 * particular value to an attribute. For packages, this means that the 125 * parent object to which this package element is being added must have 126 * been created with the package namespace, or that the package namespace 127 * was added to it, even if that parent is not a package object itself. 128 */ public 129 ReplacedBy(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 130 this(libsbmlJNI.new_ReplacedBy__SWIG_1(level, version), true); 131 } 132 133 134/** 135 * Creates a new {@link ReplacedBy} with the given level, version, and package 136 * version. 137 <p> 138 * @param level the SBML Level. 139 * @param version the Version within the SBML Level. 140 * @param pkgVersion the version of the package. 141 <p> 142 * <p> 143 * @note Attempting to add an object to an {@link SBMLDocument} having a different 144 * combination of SBML Level, Version and XML namespaces than the object 145 * itself will result in an error at the time a caller attempts to make the 146 * addition. A parent object must have compatible Level, Version and XML 147 * namespaces. (Strictly speaking, a parent may also have more XML 148 * namespaces than a child, but the reverse is not permitted.) The 149 * restriction is necessary to ensure that an SBML model has a consistent 150 * overall structure. This requires callers to manage their objects 151 * carefully, but the benefit is increased flexibility in how models can be 152 * created by permitting callers to create objects bottom-up if desired. In 153 * situations where objects are not yet attached to parents (e.g., 154 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 155 * libSBML determine such things as whether it is valid to assign a 156 * particular value to an attribute. For packages, this means that the 157 * parent object to which this package element is being added must have 158 * been created with the package namespace, or that the package namespace 159 * was added to it, even if that parent is not a package object itself. 160 */ public 161 ReplacedBy(long level) throws org.sbml.libsbml.SBMLConstructorException { 162 this(libsbmlJNI.new_ReplacedBy__SWIG_2(level), true); 163 } 164 165 166/** 167 * Creates a new {@link ReplacedBy} with the given level, version, and package 168 * version. 169 <p> 170 * @param level the SBML Level. 171 * @param version the Version within the SBML Level. 172 * @param pkgVersion the version of the package. 173 <p> 174 * <p> 175 * @note Attempting to add an object to an {@link SBMLDocument} having a different 176 * combination of SBML Level, Version and XML namespaces than the object 177 * itself will result in an error at the time a caller attempts to make the 178 * addition. A parent object must have compatible Level, Version and XML 179 * namespaces. (Strictly speaking, a parent may also have more XML 180 * namespaces than a child, but the reverse is not permitted.) The 181 * restriction is necessary to ensure that an SBML model has a consistent 182 * overall structure. This requires callers to manage their objects 183 * carefully, but the benefit is increased flexibility in how models can be 184 * created by permitting callers to create objects bottom-up if desired. In 185 * situations where objects are not yet attached to parents (e.g., 186 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 187 * libSBML determine such things as whether it is valid to assign a 188 * particular value to an attribute. For packages, this means that the 189 * parent object to which this package element is being added must have 190 * been created with the package namespace, or that the package namespace 191 * was added to it, even if that parent is not a package object itself. 192 */ public 193 ReplacedBy() throws org.sbml.libsbml.SBMLConstructorException { 194 this(libsbmlJNI.new_ReplacedBy__SWIG_3(), true); 195 } 196 197 198/** 199 * Creates a new {@link ReplacedBy} with the given {@link CompPkgNamespaces} object. 200 <p> 201 * <p> 202 * The package namespaces object used in this constructor is derived from a 203 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 204 * information. It is used to communicate the SBML Level, Version, and 205 * package version and name information used in addition to SBML Level 3 Core. A 206 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 207 * package namespace object somewhere in a program once, then hand that object 208 * as needed to object constructors of that package that accept it as and 209 * argument, such as this one. 210 <p> 211 * @param compns the {@link CompPkgNamespaces} object. 212 <p> 213 * <p> 214 * @note Attempting to add an object to an {@link SBMLDocument} having a different 215 * combination of SBML Level, Version and XML namespaces than the object 216 * itself will result in an error at the time a caller attempts to make the 217 * addition. A parent object must have compatible Level, Version and XML 218 * namespaces. (Strictly speaking, a parent may also have more XML 219 * namespaces than a child, but the reverse is not permitted.) The 220 * restriction is necessary to ensure that an SBML model has a consistent 221 * overall structure. This requires callers to manage their objects 222 * carefully, but the benefit is increased flexibility in how models can be 223 * created by permitting callers to create objects bottom-up if desired. In 224 * situations where objects are not yet attached to parents (e.g., 225 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 226 * libSBML determine such things as whether it is valid to assign a 227 * particular value to an attribute. For packages, this means that the 228 * parent object to which this package element is being added must have 229 * been created with the package namespace, or that the package namespace 230 * was added to it, even if that parent is not a package object itself. 231 */ public 232 ReplacedBy(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 233 this(libsbmlJNI.new_ReplacedBy__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 234 } 235 236 237/** 238 * Copy constructor. 239 <p> 240 * @param source the instance to copy. 241 */ public 242 ReplacedBy(ReplacedBy source) throws org.sbml.libsbml.SBMLConstructorException { 243 this(libsbmlJNI.new_ReplacedBy__SWIG_5(ReplacedBy.getCPtr(source), source), true); 244 } 245 246 247/** 248 * Creates and returns a deep copy of this {@link ReplacedBy} object. 249 <p> 250 * @return a (deep) copy of this {@link ReplacedBy} object. 251 */ public 252 SBase cloneObject() { 253 long cPtr = libsbmlJNI.ReplacedBy_cloneObject(swigCPtr, this); 254 return (cPtr == 0) ? null : new ReplacedBy(cPtr, true); 255 } 256 257 258/** 259 * Returns the XML element name of 260 * this SBML object. 261 <p> 262 * @return the name of this element, as a text string. 263 */ public 264 String getElementName() { 265 return libsbmlJNI.ReplacedBy_getElementName(swigCPtr, this); 266 } 267 268 269/** 270 * Returns the libSBML type code of this object instance. 271 <p> 272 * <p> 273 * LibSBML attaches an identifying code to every kind of SBML object. These 274 * are integer constants known as <em>SBML type codes</em>. The names of all 275 * the codes begin with the characters <code>SBML_</code>. 276 * In the Java language interface for libSBML, the 277 * type codes are defined as static integer constants in the interface class 278 * {@link libsbmlConstants}. Note that different Level 3 279 * package plug-ins may use overlapping type codes; to identify the package 280 * to which a given object belongs, call the <code>getPackageName()</code> 281 * method on the object. 282 <p> 283 * @return the SBML type code for this object: 284 * {@link libsbmlConstants#SBML_COMP_REPLACEDBY SBML_COMP_REPLACEDBY}. 285 <p> 286 * <p> 287 * @warning <span class='warning'>The specific integer values of the possible 288 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 289 * packages, To fully identify the correct code, <strong>it is necessary to 290 * invoke both getTypeCode() and getPackageName()</strong>.</span> 291 <p> 292 * @see #getElementName() 293 * @see #getPackageName() 294 */ public 295 int getTypeCode() { 296 return libsbmlJNI.ReplacedBy_getTypeCode(swigCPtr, this); 297 } 298 299 300/** 301 * Finds this {@link ReplacedBy}'s {@link SBase} parent, gets the “comp” plugin from it, 302 * and tells that to remove this. 303 <p> 304 * <p> 305 * @return integer value indicating success/failure of the 306 * function. The possible values 307 * returned by this function are: 308 * <ul> 309 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 310 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 311 * </ul> 312 */ public 313 int removeFromParentAndDelete() { 314 return libsbmlJNI.ReplacedBy_removeFromParentAndDelete(swigCPtr, this); 315 } 316 317 318/** * @internal */ public 319 int updateIDs(SBase oldnames, SBase newnames) { 320 return libsbmlJNI.ReplacedBy_updateIDs(swigCPtr, this, SBase.getCPtr(oldnames), oldnames, SBase.getCPtr(newnames), newnames); 321 } 322 323}