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 CompSBasePlugin extends SBasePlugin { 012 private long swigCPtr; 013 014 protected CompSBasePlugin(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.CompSBasePlugin_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(CompSBasePlugin obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (CompSBasePlugin 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_CompSBasePlugin(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 public CompSBasePlugin(String uri, String prefix, CompPkgNamespaces compns) { 054 this(libsbmlJNI.new_CompSBasePlugin__SWIG_0(uri, prefix, CompPkgNamespaces.getCPtr(compns), compns), true); 055 } 056 057 public CompSBasePlugin(CompSBasePlugin orig) { 058 this(libsbmlJNI.new_CompSBasePlugin__SWIG_1(CompSBasePlugin.getCPtr(orig), orig), true); 059 } 060 061 062/** 063 * Creates and returns a deep copy of this {@link SBasePlugin} object. 064 * <p> 065 * @return a (deep) copy of this {@link SBase} object 066 */ public 067 SBasePlugin cloneObject() { 068 long cPtr = libsbmlJNI.CompSBasePlugin_cloneObject(swigCPtr, this); 069 return (cPtr == 0) ? null : new CompSBasePlugin(cPtr, true); 070 } 071 072 public SBase createObject(XMLInputStream stream) { 073 return libsbml.DowncastSBase(libsbmlJNI.CompSBasePlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false); 074} 075 076 077/** 078 * Returns the first child element found that has the given <code>id</code> in the model-wide SId namespace, or <code>null</code> if no such object is found. 079 * <p> 080 * @param id string representing the id of objects to find 081 * <p> 082 * @return pointer to the first element found with the given <code>id</code>. 083 */ public 084 SBase getElementBySId(String id) { 085 return libsbml.DowncastSBase(libsbmlJNI.CompSBasePlugin_getElementBySId(swigCPtr, this, id), false); 086} 087 088 089/** 090 * Returns the first child element it can find with the given <code>metaid</code>, or <code>null</code> if no such object is found. 091 * <p> 092 * @param metaid string representing the metaid of objects to find 093 * <p> 094 * @return pointer to the first element found with the given <code>metaid</code>. 095 */ public 096 SBase getElementByMetaId(String metaid) { 097 return libsbml.DowncastSBase(libsbmlJNI.CompSBasePlugin_getElementByMetaId(swigCPtr, this, metaid), false); 098} 099 100 public ListOfReplacedElements getListOfReplacedElements() { 101 long cPtr = libsbmlJNI.CompSBasePlugin_getListOfReplacedElements(swigCPtr, this); 102 return (cPtr == 0) ? null : new ListOfReplacedElements(cPtr, false); 103 } 104 105 public ReplacedElement getReplacedElement(long n) { 106 long cPtr = libsbmlJNI.CompSBasePlugin_getReplacedElement__SWIG_0(swigCPtr, this, n); 107 return (cPtr == 0) ? null : new ReplacedElement(cPtr, false); 108 } 109 110 public int addReplacedElement(ReplacedElement replacedElement) { 111 return libsbmlJNI.CompSBasePlugin_addReplacedElement(swigCPtr, this, ReplacedElement.getCPtr(replacedElement), replacedElement); 112 } 113 114 public long getNumReplacedElements() { 115 return libsbmlJNI.CompSBasePlugin_getNumReplacedElements(swigCPtr, this); 116 } 117 118 public void clearReplacedElements() { 119 libsbmlJNI.CompSBasePlugin_clearReplacedElements(swigCPtr, this); 120 } 121 122 public ReplacedElement createReplacedElement() { 123 long cPtr = libsbmlJNI.CompSBasePlugin_createReplacedElement(swigCPtr, this); 124 return (cPtr == 0) ? null : new ReplacedElement(cPtr, false); 125 } 126 127 public ReplacedElement removeReplacedElement(long index) { 128 long cPtr = libsbmlJNI.CompSBasePlugin_removeReplacedElement(swigCPtr, this, index); 129 return (cPtr == 0) ? null : new ReplacedElement(cPtr, false); 130 } 131 132 public ReplacedBy getReplacedBy() { 133 long cPtr = libsbmlJNI.CompSBasePlugin_getReplacedBy__SWIG_0(swigCPtr, this); 134 return (cPtr == 0) ? null : new ReplacedBy(cPtr, false); 135 } 136 137 public boolean isSetReplacedBy() { 138 return libsbmlJNI.CompSBasePlugin_isSetReplacedBy(swigCPtr, this); 139 } 140 141 public int setReplacedBy(ReplacedBy replacedBy) { 142 return libsbmlJNI.CompSBasePlugin_setReplacedBy(swigCPtr, this, ReplacedBy.getCPtr(replacedBy), replacedBy); 143 } 144 145 public ReplacedBy createReplacedBy() { 146 long cPtr = libsbmlJNI.CompSBasePlugin_createReplacedBy(swigCPtr, this); 147 return (cPtr == 0) ? null : new ReplacedBy(cPtr, false); 148 } 149 150 public int unsetReplacedBy() { 151 return libsbmlJNI.CompSBasePlugin_unsetReplacedBy(swigCPtr, this); 152 } 153 154 public void logInvalidId(String attribute, String wrongattribute) { 155 libsbmlJNI.CompSBasePlugin_logInvalidId(swigCPtr, this, attribute, wrongattribute); 156 } 157 158 public void connectToChild() { 159 libsbmlJNI.CompSBasePlugin_connectToChild(swigCPtr, this); 160 } 161 162 163/** 164 * Sets the parent SBML object of this plugin object to 165 * this object and child elements (if any). 166 * (Creates a child-parent relationship by this plugin object) 167 * <p> 168 * This function is called when this object is created by 169 * the parent element. 170 * Subclasses must override this this function if they have one 171 * or more child elements. Also, {@link SBasePlugin#connectToParent(SBase sbase)} 172 * must be called in the overridden function. 173 * <p> 174 * @param sbase the {@link SBase} object to use 175 * <p> 176 * @see setSBMLDocument 177 * @see enablePackageInternal 178 * @internal 179 */ public 180 void connectToParent(SBase parent) { 181 libsbmlJNI.CompSBasePlugin_connectToParent(swigCPtr, this, SBase.getCPtr(parent), parent); 182 } 183 184 185/** 186 * Enables/Disables the given package with child elements in this plugin 187 * object (if any). 188 * (This is an internal implementation invoked from 189 * {@link SBase#enablePackageInternal()} function) 190 * <p> 191 * Subclasses which contain one or more {@link SBase} derived elements should 192 * override this function if elements defined in them can be extended by 193 * some other package extension. 194 * <p> 195 * @see setSBMLDocument 196 * @see connectToParent 197 * @internal 198 */ public 199 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 200 libsbmlJNI.CompSBasePlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 201 } 202 203 public boolean acceptComp(SWIGTYPE_p_CompVisitor v) { 204 return libsbmlJNI.CompSBasePlugin_acceptComp(swigCPtr, this, SWIGTYPE_p_CompVisitor.getCPtr(v)); 205 } 206 207}