001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.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-qual"><a href="group__qual.html">qual</a></span> 013 014 Extension of {@link Model}. 015 <p> 016 * The extension of SBML Level 3 Core's {@link Model} class is relatively 017 * straightforward: the Qualitative Models Package adds two lists, one for 018 * holding qualitativeSpecies (ListOfQualitativeSpecies), and the other for 019 * holding transitions (ListOfTransitions). The {@link Model} element may contain at 020 * most one {@link ListOfQualitativeSpecies}, which must contain at least one 021 * {@link QualitativeSpecies}. It may also contain at most one {@link ListOfTransitions} 022 * which must contain at least one {@link Transition}. 023 */ 024 025public class QualModelPlugin extends SBasePlugin { 026 private long swigCPtr; 027 028 protected QualModelPlugin(long cPtr, boolean cMemoryOwn) 029 { 030 super(libsbmlJNI.QualModelPlugin_SWIGUpcast(cPtr), cMemoryOwn); 031 swigCPtr = cPtr; 032 } 033 034 protected static long getCPtr(QualModelPlugin obj) 035 { 036 return (obj == null) ? 0 : obj.swigCPtr; 037 } 038 039 protected static long getCPtrAndDisown (QualModelPlugin obj) 040 { 041 long ptr = 0; 042 043 if (obj != null) 044 { 045 ptr = obj.swigCPtr; 046 obj.swigCMemOwn = false; 047 } 048 049 return ptr; 050 } 051 052 protected void finalize() { 053 delete(); 054 } 055 056 public synchronized void delete() { 057 if (swigCPtr != 0) { 058 if (swigCMemOwn) { 059 swigCMemOwn = false; 060 libsbmlJNI.delete_QualModelPlugin(swigCPtr); 061 } 062 swigCPtr = 0; 063 } 064 super.delete(); 065 } 066 067 068/** 069 * Creates a new {@link QualModelPlugin} object using the given parameters. 070 <p> 071 * <p> 072 * In the XML representation of an SBML document, XML namespaces are used to 073 * identify the origin of each XML construct used. XML namespaces are 074 * identified by their unique resource identifiers (URIs). The core SBML 075 * specifications stipulate the namespaces that must be used for core SBML 076 * constructs; for example, all XML elements that belong to SBML Level 3 077 * Version 1 Core must be placed in the XML namespace identified by the URI 078 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>. Individual 079 * SBML Level 3 packages define their own XML namespaces; for example, 080 * all elements belonging to the SBML Level 3 Layout Version 1 081 * package must be placed in the XML namespace 082 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>. 083 <p> 084 * <p> 085 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 086 * information. It is used to communicate the SBML Level, Version, and (in 087 * Level 3) packages used in addition to SBML Level 3 Core. A 088 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 089 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 090 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 091 <p> 092 * @param uri the URI of the SBML Level 3 package implemented by 093 * this libSBML package extension. 094 <p> 095 * @param prefix the XML namespace prefix being used for the package. 096 <p> 097 * @param qualns the namespaces object for the package. 098 */ public 099 QualModelPlugin(String uri, String prefix, QualPkgNamespaces qualns) { 100 this(libsbmlJNI.new_QualModelPlugin__SWIG_0(uri, prefix, QualPkgNamespaces.getCPtr(qualns), qualns), true); 101 } 102 103 104/** 105 * Copy constructor. Creates a copy of this object. 106 <p> 107 * @param orig the instance to copy. 108 */ public 109 QualModelPlugin(QualModelPlugin orig) { 110 this(libsbmlJNI.new_QualModelPlugin__SWIG_1(QualModelPlugin.getCPtr(orig), orig), true); 111 } 112 113 114/** 115 * Creates and returns a deep copy of this {@link QualModelPlugin} object. 116 <p> 117 * @return a (deep) copy of this {@link QualModelPlugin} object. 118 */ public 119 SBasePlugin cloneObject() { 120 long cPtr = libsbmlJNI.QualModelPlugin_cloneObject(swigCPtr, this); 121 return (cPtr == 0) ? null : new QualModelPlugin(cPtr, true); 122 } 123 124 125/** * @internal */ public 126 SBase createObject(XMLInputStream stream) { 127 return libsbml.DowncastSBase(libsbmlJNI.QualModelPlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false); 128} 129 130 131/** * @internal */ public 132 int appendFrom(Model model) { 133 return libsbmlJNI.QualModelPlugin_appendFrom(swigCPtr, this, Model.getCPtr(model), model); 134 } 135 136 137/** 138 * Returns the {@link ListOfQualitativeSpecies} in this plugin object. 139 <p> 140 * @return {@link ListOfQualitativeSpecies} object in this plugin object. 141 */ public 142 ListOfQualitativeSpecies getListOfQualitativeSpecies() { 143 long cPtr = libsbmlJNI.QualModelPlugin_getListOfQualitativeSpecies__SWIG_0(swigCPtr, this); 144 return (cPtr == 0) ? null : new ListOfQualitativeSpecies(cPtr, false); 145 } 146 147 148/** 149 * Returns the {@link QualitativeSpecies} object that belongs to the given index. If the 150 * index is invalid, null is returned. 151 <p> 152 * @param n the index number of the {@link QualitativeSpecies} to get. 153 <p> 154 * @return the nth {@link QualitativeSpecies} in the {@link ListOfQualitativeSpecies}. 155 */ public 156 QualitativeSpecies getQualitativeSpecies(long n) { 157 long cPtr = libsbmlJNI.QualModelPlugin_getQualitativeSpecies__SWIG_0(swigCPtr, this, n); 158 return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, false); 159 } 160 161 162/** 163 * Returns the qualitativeSpecies object based on its identifier. 164 <p> 165 * @param sid a string representing the identifier 166 * of the {@link QualitativeSpecies} to get. 167 <p> 168 * @return {@link QualitativeSpecies} in the {@link ListOfQualitativeSpecies} with the given id 169 * or <code>null</code> if no such {@link QualitativeSpecies} exists. 170 <p> 171 * @see #getQualitativeSpecies(long n) 172 * @see #getListOfQualitativeSpecies() 173 */ public 174 QualitativeSpecies getQualitativeSpecies(String sid) { 175 long cPtr = libsbmlJNI.QualModelPlugin_getQualitativeSpecies__SWIG_2(swigCPtr, this, sid); 176 return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, false); 177 } 178 179 180/** 181 * Adds a copy of the given {@link QualitativeSpecies} object to the list of qual. 182 <p> 183 * @param qualitativeSpecies the {@link QualitativeSpecies} object to be added to the list of qual. 184 <p> 185 * <p> 186 * @return integer value indicating success/failure of the 187 * function. The possible values 188 * returned by this function are: 189 * <ul> 190 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 191 * </ul> 192 */ public 193 int addQualitativeSpecies(QualitativeSpecies qualitativeSpecies) { 194 return libsbmlJNI.QualModelPlugin_addQualitativeSpecies(swigCPtr, this, QualitativeSpecies.getCPtr(qualitativeSpecies), qualitativeSpecies); 195 } 196 197 198/** 199 * Creates a new qual object and adds it to the list of qual objects 200 * and returns it. 201 <p> 202 * @return a newly created {@link QualitativeSpecies} object. 203 */ public 204 QualitativeSpecies createQualitativeSpecies() { 205 long cPtr = libsbmlJNI.QualModelPlugin_createQualitativeSpecies(swigCPtr, this); 206 return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, false); 207 } 208 209 210/** 211 * Removes the nth {@link QualitativeSpecies} object from this plugin object and 212 * returns a pointer to it. 213 <p> 214 * The caller owns the returned object and is responsible for 215 * deleting it. 216 <p> 217 * @param n the index of the {@link QualitativeSpecies} object to remove. 218 <p> 219 * @return the {@link QualitativeSpecies} object removed. As mentioned above, the 220 * caller owns the returned object. null is returned if the 221 * given index is out of range. 222 */ public 223 QualitativeSpecies removeQualitativeSpecies(long n) { 224 long cPtr = libsbmlJNI.QualModelPlugin_removeQualitativeSpecies__SWIG_0(swigCPtr, this, n); 225 return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, true); 226 } 227 228 229/** 230 * Removes the {@link QualitativeSpecies} object with the given id attribute from 231 * this plugin object and returns a pointer to it. 232 <p> 233 * The caller owns the returned object and is responsible for 234 * deleting it. 235 <p> 236 * @param sid the id attribute of the {@link QualitativeSpecies} object to remove. 237 <p> 238 * @return the {@link QualitativeSpecies} object removed. As mentioned above, the 239 * caller owns the returned object. null is returned if the 240 * given index is out of range. 241 */ public 242 QualitativeSpecies removeQualitativeSpecies(String sid) { 243 long cPtr = libsbmlJNI.QualModelPlugin_removeQualitativeSpecies__SWIG_1(swigCPtr, this, sid); 244 return (cPtr == 0) ? null : new QualitativeSpecies(cPtr, true); 245 } 246 247 248/** 249 * Returns the number of {@link QualitativeSpecies} object in this plugin object. 250 <p> 251 * @return the number of {@link QualitativeSpecies} object in this plugin object. 252 */ public 253 long getNumQualitativeSpecies() { 254 return libsbmlJNI.QualModelPlugin_getNumQualitativeSpecies(swigCPtr, this); 255 } 256 257 258/** 259 * Returns the {@link ListOfTransitions} in this plugin object. 260 <p> 261 * @return {@link ListOfTransitions} object in this plugin object. 262 */ public 263 ListOfTransitions getListOfTransitions() { 264 long cPtr = libsbmlJNI.QualModelPlugin_getListOfTransitions__SWIG_0(swigCPtr, this); 265 return (cPtr == 0) ? null : new ListOfTransitions(cPtr, false); 266 } 267 268 269/** 270 * Returns the {@link Transition} object that belongs to the given index. If the 271 * index is invalid, null is returned. 272 <p> 273 * @param n the index number of the {@link Transition} to get. 274 <p> 275 * @return the nth {@link Transition} in the {@link ListOfTransitions}. 276 */ public 277 Transition getTransition(long n) { 278 long cPtr = libsbmlJNI.QualModelPlugin_getTransition__SWIG_0(swigCPtr, this, n); 279 return (cPtr == 0) ? null : new Transition(cPtr, false); 280 } 281 282 283/** 284 * Returns the qualitativeSpecies object based on its identifier. 285 <p> 286 * @param sid a string representing the identifier 287 * of the {@link Transition} to get. 288 <p> 289 * @return {@link Transition} in the {@link ListOfTransitions} with the given id 290 * or <code>null</code> if no such {@link Transition} exists. 291 <p> 292 * @see #getTransition(long n) 293 * @see #getListOfTransitions() 294 */ public 295 Transition getTransition(String sid) { 296 long cPtr = libsbmlJNI.QualModelPlugin_getTransition__SWIG_2(swigCPtr, this, sid); 297 return (cPtr == 0) ? null : new Transition(cPtr, false); 298 } 299 300 301/** 302 * Adds a copy of the given {@link Transition} object to the list of qual. 303 <p> 304 * @param transition the {@link Transition} object to be added to the list of qual. 305 <p> 306 * <p> 307 * @return integer value indicating success/failure of the 308 * function. The possible values 309 * returned by this function are: 310 * <ul> 311 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 312 * </ul> 313 */ public 314 int addTransition(Transition transition) { 315 return libsbmlJNI.QualModelPlugin_addTransition(swigCPtr, this, Transition.getCPtr(transition), transition); 316 } 317 318 319/** 320 * Creates a new qual object and adds it to the list of qual objects 321 * and returns it. 322 <p> 323 * @return a newly created {@link Transition} object. 324 */ public 325 Transition createTransition() { 326 long cPtr = libsbmlJNI.QualModelPlugin_createTransition(swigCPtr, this); 327 return (cPtr == 0) ? null : new Transition(cPtr, false); 328 } 329 330 331/** 332 * Removes the nth {@link Transition} object from this plugin object and 333 * returns a pointer to it. 334 <p> 335 * The caller owns the returned object and is responsible for 336 * deleting it. 337 <p> 338 * @param n the index of the {@link Transition} object to remove. 339 <p> 340 * @return the {@link Transition} object removed. As mentioned above, the 341 * caller owns the returned object. null is returned if the 342 * given index is out of range. 343 */ public 344 Transition removeTransition(long n) { 345 long cPtr = libsbmlJNI.QualModelPlugin_removeTransition__SWIG_0(swigCPtr, this, n); 346 return (cPtr == 0) ? null : new Transition(cPtr, true); 347 } 348 349 350/** 351 * Removes the {@link Transition} object with the given id attribute from 352 * this plugin object and returns a pointer to it. 353 <p> 354 * The caller owns the returned object and is responsible for 355 * deleting it. 356 <p> 357 * @param sid the id attribute of the {@link Transition} object to remove. 358 <p> 359 * @return the {@link Transition} object removed. As mentioned above, the 360 * caller owns the returned object. null is returned if the 361 * given index is out of range. 362 */ public 363 Transition removeTransition(String sid) { 364 long cPtr = libsbmlJNI.QualModelPlugin_removeTransition__SWIG_1(swigCPtr, this, sid); 365 return (cPtr == 0) ? null : new Transition(cPtr, true); 366 } 367 368 369/** 370 * Returns the number of {@link Transition} object in this plugin object. 371 <p> 372 * @return the number of {@link Transition} object in this plugin object. 373 */ public 374 long getNumTransitions() { 375 return libsbmlJNI.QualModelPlugin_getNumTransitions(swigCPtr, this); 376 } 377 378 379/** * @internal */ public 380 void connectToChild() { 381 libsbmlJNI.QualModelPlugin_connectToChild(swigCPtr, this); 382 } 383 384 385/** * @internal */ public 386 void connectToParent(SBase sbase) { 387 libsbmlJNI.QualModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase); 388 } 389 390 391/** * @internal */ public 392 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 393 libsbmlJNI.QualModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 394 } 395 396 397/** 398 * Returns the first child element that has the given <code>id</code> in the model-wide 399 * SId namespace, or <code>null</code> if no such object is found. 400 <p> 401 * @param id a string representing the id attribute of the object to 402 * retrieve. 403 <p> 404 * @return a pointer to the {@link SBase} element with the given <code>id</code>. 405 */ public 406 SBase getElementBySId(String id) { 407 return libsbml.DowncastSBase(libsbmlJNI.QualModelPlugin_getElementBySId(swigCPtr, this, id), false); 408} 409 410 411/** 412 * Returns the first child element that has the given <code>metaid</code>, or <code>null</code> 413 * if no such object is found. 414 <p> 415 * @param metaid a string representing the metaid attribute of the object to 416 * retrieve. 417 <p> 418 * @return a pointer to the {@link SBase} element with the given <code>metaid</code>. 419 */ public 420 SBase getElementByMetaId(String metaid) { 421 return libsbml.DowncastSBase(libsbmlJNI.QualModelPlugin_getElementByMetaId(swigCPtr, this, metaid), false); 422} 423 424}