001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 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 011public class SBaseRef extends CompBase { 012 private long swigCPtr; 013 014 protected SBaseRef(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.SBaseRef_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(SBaseRef obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (SBaseRef obj) 026 { 027 long ptr = 0; 028 029 if (obj != null) 030 { 031 ptr = obj.swigCPtr; 032 obj.swigCMemOwn = false; 033 } 034 035 return ptr; 036 } 037 038 protected void finalize() { 039 delete(); 040 } 041 042 public synchronized void delete() { 043 if (swigCPtr != 0) { 044 if (swigCMemOwn) { 045 swigCMemOwn = false; 046 libsbmlJNI.delete_SBaseRef(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 public SBaseRef(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 054 this(libsbmlJNI.new_SBaseRef__SWIG_0(level, version, pkgVersion), true); 055 } 056 057 public SBaseRef(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 058 this(libsbmlJNI.new_SBaseRef__SWIG_1(level, version), true); 059 } 060 061 public SBaseRef(long level) throws org.sbml.libsbml.SBMLConstructorException { 062 this(libsbmlJNI.new_SBaseRef__SWIG_2(level), true); 063 } 064 065 public SBaseRef() throws org.sbml.libsbml.SBMLConstructorException { 066 this(libsbmlJNI.new_SBaseRef__SWIG_3(), true); 067 } 068 069 public SBaseRef(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 070 this(libsbmlJNI.new_SBaseRef__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 071 } 072 073 public SBaseRef(SBaseRef source) throws org.sbml.libsbml.SBMLConstructorException { 074 this(libsbmlJNI.new_SBaseRef__SWIG_5(SBaseRef.getCPtr(source), source), true); 075 } 076 077 078/** 079 * Creates and returns a deep copy of this {@link SBase} object. 080 * <p> 081 * @return a (deep) copy of this {@link SBase} object. 082 */ public 083 SBase cloneObject() { 084 long cPtr = libsbmlJNI.SBaseRef_cloneObject(swigCPtr, this); 085 return (cPtr == 0) ? null : new SBaseRef(cPtr, true); 086 } 087 088 089/** 090 * Returns the first child element found that has the given <code>id</code> in the 091 * model-wide <code>SId</code> namespace, or <code>null</code> if no such object is found. 092 * <p> 093 * @param id string representing the 'id' attribute value of the object 094 * to find. 095 * <p> 096 * @return pointer to the first element found with the given identifier. 097 */ public 098 SBase getElementBySId(String id) { 099 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getElementBySId(swigCPtr, this, id), false); 100} 101 102 103/** 104 * Returns the first child element it can find with a specific 'metaid' 105 * attribute value, or <code>null</code> if no such object is found. 106 * <p> 107 * @param metaid string representing the 'metaid' attribute value of the 108 * object to find. 109 * <p> 110 * @return pointer to the first element found with the given meta-identifier. 111 */ public 112 SBase getElementByMetaId(String metaid) { 113 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getElementByMetaId(swigCPtr, this, metaid), false); 114} 115 116 public String getMetaIdRef() { 117 return libsbmlJNI.SBaseRef_getMetaIdRef(swigCPtr, this); 118 } 119 120 public boolean isSetMetaIdRef() { 121 return libsbmlJNI.SBaseRef_isSetMetaIdRef(swigCPtr, this); 122 } 123 124 public int setMetaIdRef(String id) { 125 return libsbmlJNI.SBaseRef_setMetaIdRef(swigCPtr, this, id); 126 } 127 128 public int unsetMetaIdRef() { 129 return libsbmlJNI.SBaseRef_unsetMetaIdRef(swigCPtr, this); 130 } 131 132 public String getPortRef() { 133 return libsbmlJNI.SBaseRef_getPortRef(swigCPtr, this); 134 } 135 136 public boolean isSetPortRef() { 137 return libsbmlJNI.SBaseRef_isSetPortRef(swigCPtr, this); 138 } 139 140 public int setPortRef(String id) { 141 return libsbmlJNI.SBaseRef_setPortRef(swigCPtr, this, id); 142 } 143 144 public int unsetPortRef() { 145 return libsbmlJNI.SBaseRef_unsetPortRef(swigCPtr, this); 146 } 147 148 public String getIdRef() { 149 return libsbmlJNI.SBaseRef_getIdRef(swigCPtr, this); 150 } 151 152 public boolean isSetIdRef() { 153 return libsbmlJNI.SBaseRef_isSetIdRef(swigCPtr, this); 154 } 155 156 public int setIdRef(String id) { 157 return libsbmlJNI.SBaseRef_setIdRef(swigCPtr, this, id); 158 } 159 160 public int unsetIdRef() { 161 return libsbmlJNI.SBaseRef_unsetIdRef(swigCPtr, this); 162 } 163 164 public String getUnitRef() { 165 return libsbmlJNI.SBaseRef_getUnitRef(swigCPtr, this); 166 } 167 168 public boolean isSetUnitRef() { 169 return libsbmlJNI.SBaseRef_isSetUnitRef(swigCPtr, this); 170 } 171 172 public int setUnitRef(String id) { 173 return libsbmlJNI.SBaseRef_setUnitRef(swigCPtr, this, id); 174 } 175 176 public int unsetUnitRef() { 177 return libsbmlJNI.SBaseRef_unsetUnitRef(swigCPtr, this); 178 } 179 180 public SBaseRef getSBaseRef() { 181 long cPtr = libsbmlJNI.SBaseRef_getSBaseRef__SWIG_0(swigCPtr, this); 182 return (cPtr == 0) ? null : new SBaseRef(cPtr, false); 183 } 184 185 public boolean isSetSBaseRef() { 186 return libsbmlJNI.SBaseRef_isSetSBaseRef(swigCPtr, this); 187 } 188 189 public int setSBaseRef(SBaseRef sBaseRef) { 190 return libsbmlJNI.SBaseRef_setSBaseRef(swigCPtr, this, SBaseRef.getCPtr(sBaseRef), sBaseRef); 191 } 192 193 public SBaseRef createSBaseRef() { 194 long cPtr = libsbmlJNI.SBaseRef_createSBaseRef(swigCPtr, this); 195 return (cPtr == 0) ? null : new SBaseRef(cPtr, false); 196 } 197 198 public int unsetSBaseRef() { 199 return libsbmlJNI.SBaseRef_unsetSBaseRef(swigCPtr, this); 200 } 201 202 public int getNumReferents() { 203 return libsbmlJNI.SBaseRef_getNumReferents(swigCPtr, this); 204 } 205 206 207/** 208 * Subclasses should override this method to write out their contained 209 * SBML objects as XML elements. Be sure to call your parents 210 * implementation of this method as well. For example: 211 * @internal 212 */ public 213 boolean hasRequiredAttributes() { 214 return libsbmlJNI.SBaseRef_hasRequiredAttributes(swigCPtr, this); 215 } 216 217 218/** 219 * Renames all the <code>SIdRef</code> attributes on this element, including any 220 * found in MathML content (if such exists). 221 * <p> 222 * This method works by looking at all attributes and (if appropriate) 223 * mathematical formulas, comparing the identifiers to the value of 224 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 225 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 226 * <p> 227 * @param oldid the old identifier 228 * @param newid the new identifier 229 */ public 230 void renameSIdRefs(String oldid, String newid) { 231 libsbmlJNI.SBaseRef_renameSIdRefs(swigCPtr, this, oldid, newid); 232 } 233 234 235/** 236 * Returns the XML element name of this object. 237 * <p> 238 * This is overridden by subclasses to return a string appropriate to the 239 * SBML component. For example, {@link Model} defines it as returning 240 * <code>'model'</code>, {@link CompartmentType} defines it as returning <code>'compartmentType'</code>, 241 * and so on. 242 */ public 243 String getElementName() { 244 return libsbmlJNI.SBaseRef_getElementName(swigCPtr, this); 245 } 246 247 248/** 249 * Returns the libSBML type code for this object. 250 * <p> 251 * This method may return the type code of this SBML object, or it may 252 * return {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN}. This 253 * is because subclasses of {@link SBase} are not required to implement this 254 * method to return a type code. This method is meant primarily for the 255 * LibSBML C interface, in which class and subclass information is not 256 * readily available. 257 * <p> 258 * @return the SBML object type code 259 * of this SBML object or 260 * {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (the default). 261 * <p> 262 * @see #getElementName() 263 * @see #getPackageName() 264 */ public 265 int getTypeCode() { 266 return libsbmlJNI.SBaseRef_getTypeCode(swigCPtr, this); 267 } 268 269 270/** 271 * Sets this SBML object to child SBML objects (if any). 272 * (Creates a child-parent relationship by the parent) 273 * <p> 274 * Subclasses must override this function if they define 275 * one ore more child elements. 276 * Basically, this function needs to be called in 277 * constructor, copy constructor, assignment operator. 278 * <p> 279 * <p> 280 * @internal 281 */ public 282 void connectToChild() { 283 libsbmlJNI.SBaseRef_connectToChild(swigCPtr, this); 284 } 285 286 public SBase getReferencedElementFrom(Model model) { 287 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getReferencedElementFrom(swigCPtr, this, Model.getCPtr(model), model), false); 288} 289 290 public int saveReferencedElement() { 291 return libsbmlJNI.SBaseRef_saveReferencedElement(swigCPtr, this); 292 } 293 294 public SBase getReferencedElement() { 295 return libsbml.DowncastSBase(libsbmlJNI.SBaseRef_getReferencedElement(swigCPtr, this), false); 296} 297 298 public void clearReferencedElement() { 299 libsbmlJNI.SBaseRef_clearReferencedElement(swigCPtr, this); 300 } 301 302 public int performDeletion() { 303 return libsbmlJNI.SBaseRef_performDeletion(swigCPtr, this); 304 } 305 306 307/** 308 * Removes itself from its parent. If the parent was storing it as a 309 * pointer, it is deleted. If not, it is simply cleared (as in {@link ListOf} 310 * objects). Pure virutal, as every {@link SBase} element has different parents, 311 * and therefore different methods of removing itself. Will fail (and 312 * not delete itself) if it has no parent object. This function is 313 * designed to be overridden, but for all objects whose parent is of the 314 * class {@link ListOf}, the default implementation will work. 315 * <p> 316 * @return integer value indicating success/failure of the 317 * function. The possible values 318 * returned by this function are: 319 * <ul> 320 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 321 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 322 * </ul> 323 */ public 324 int removeFromParentAndDelete() { 325 return libsbmlJNI.SBaseRef_removeFromParentAndDelete(swigCPtr, this); 326 } 327 328}