001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.7 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 Extension of {@link SBMLDocument}. 014 <p> 015 * The {@link CompSBMLDocumentPlugin} class inherits from the {@link SBMLDocumentPlugin} 016 * class, and codifies the extentions to the {@link SBMLDocument} class defined in 017 * the SBML Level 3 018 * 'Hierarchical Model Composition' 019 * package (“comp”). This extention allows multiple {@link Model} 020 * objects to be defined in a single {@link SBMLDocument}, stored in an optional 021 * child {@link ListOfModelDefinitions} object, as well as define references to {@link Model} 022 * objects in other files, stored in the optional child 023 * {@link ListOfExternalModelDefinitions} object. These model definitions, if 024 * present, allow {@link Submodel} objects to reference other Models to instantiate. 025 <p> 026 * The presence of ModelDefinitions and ExternalModelDefinitions in an 027 * {@link SBMLDocument} does not change the default {@link Model} in the file. If a 028 * {@link SBMLDocument} is submitted somewhere to be simulated, it is still the 029 * <code><model></code> child of the <code><sbml></code> element 030 * that should be simulated. 031 <p> 032 * In addition, as all packages do, the {@link CompSBMLDocumentPlugin} defines a 033 * required flag named <code>required</code>, which indicates whether 034 * “comp” constructs can be used to change the core mathematics of the 035 * <code><model></code> child of the <code><sbml></code> element. 036 * Because they can, this attribute must be set <code>true.</code> 037 */ 038 039public class CompSBMLDocumentPlugin extends SBMLDocumentPlugin { 040 private long swigCPtr; 041 042 protected CompSBMLDocumentPlugin(long cPtr, boolean cMemoryOwn) 043 { 044 super(libsbmlJNI.CompSBMLDocumentPlugin_SWIGUpcast(cPtr), cMemoryOwn); 045 swigCPtr = cPtr; 046 } 047 048 protected static long getCPtr(CompSBMLDocumentPlugin obj) 049 { 050 return (obj == null) ? 0 : obj.swigCPtr; 051 } 052 053 protected static long getCPtrAndDisown (CompSBMLDocumentPlugin obj) 054 { 055 long ptr = 0; 056 057 if (obj != null) 058 { 059 ptr = obj.swigCPtr; 060 obj.swigCMemOwn = false; 061 } 062 063 return ptr; 064 } 065 066 protected void finalize() { 067 delete(); 068 } 069 070 public synchronized void delete() { 071 if (swigCPtr != 0) { 072 if (swigCMemOwn) { 073 swigCMemOwn = false; 074 libsbmlJNI.delete_CompSBMLDocumentPlugin(swigCPtr); 075 } 076 swigCPtr = 0; 077 } 078 super.delete(); 079 } 080 081 082/** 083 * Constructor. 084 */ public 085 CompSBMLDocumentPlugin(String uri, String prefix, CompPkgNamespaces compns) { 086 this(libsbmlJNI.new_CompSBMLDocumentPlugin__SWIG_0(uri, prefix, CompPkgNamespaces.getCPtr(compns), compns), true); 087 } 088 089 090/** 091 * Copy constructor. Creates a copy of this {@link CompSBMLDocumentPlugin} object. 092 */ public 093 CompSBMLDocumentPlugin(CompSBMLDocumentPlugin orig) { 094 this(libsbmlJNI.new_CompSBMLDocumentPlugin__SWIG_1(CompSBMLDocumentPlugin.getCPtr(orig), orig), true); 095 } 096 097 098/** 099 * Creates and returns a deep copy of this {@link CompSBMLDocumentPlugin} object. 100 <p> 101 * @return a (deep) copy of this {@link CompSBMLDocumentPlugin} object 102 */ public 103 SBasePlugin cloneObject() { 104 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_cloneObject(swigCPtr, this); 105 return (cPtr == 0) ? null : new CompSBMLDocumentPlugin(cPtr, true); 106 } 107 108 109/** 110 * Returns the first child element found that has the given <code>id</code> in the 111 * model-wide SId namespace, or <code>null</code> if no such object is found. 112 <p> 113 * @param id string representing the identifier of objects to find 114 <p> 115 * @return a pointer to the {@link SBase} element with the given <code>id</code>. 116 <p> 117 * @note The comp SBML document plugin has multiple model-wide SId 118 * namespaces, so a valid document may well contain multiple elements with 119 * the same SId that reside in separate models. It is not recommended to 120 * ever call this function—instead, call the function on the child 121 * {@link ModelDefinition} objects. 122 */ public 123 SBase getElementBySId(String id) { 124 return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_getElementBySId(swigCPtr, this, id), false); 125} 126 127 128/** 129 * Returns the first child element it can find with the given <code>metaid</code>, or 130 * itself if it has the given <code>metaid</code>, or <code>null</code> if no such object is 131 * found. 132 <p> 133 * @param metaid string representing the meta identifier of objects to find 134 <p> 135 * @return a pointer to the {@link SBase} element with the given <code>metaid</code>. 136 */ public 137 SBase getElementByMetaId(String metaid) { 138 return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_getElementByMetaId(swigCPtr, this, metaid), false); 139} 140 141 142/** * @internal */ public 143 SBase createObject(XMLInputStream stream) { 144 return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false); 145} 146 147 148/** * @internal */ public 149 boolean isCompFlatteningImplemented() { 150 return libsbmlJNI.CompSBMLDocumentPlugin_isCompFlatteningImplemented(swigCPtr, this); 151 } 152 153 154/** * @internal */ public 155 long checkConsistency() { 156 return libsbmlJNI.CompSBMLDocumentPlugin_checkConsistency(swigCPtr, this); 157 } 158 159 160/** 161 * Returns the {@link ListOf} object that holds all ModelDefinitions. 162 <p> 163 * @return the {@link ListOf} object that holds all ModelDefinitions. 164 */ public 165 ListOfModelDefinitions getListOfModelDefinitions() { 166 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getListOfModelDefinitions(swigCPtr, this); 167 return (cPtr == 0) ? null : new ListOfModelDefinitions(cPtr, false); 168 } 169 170 171/** 172 * Returns the {@link ModelDefinition} with the given index. 173 <p> 174 * @param n the index number of the {@link ModelDefinition} to get. 175 <p> 176 * @return the nth {@link ModelDefinition} in the {@link ListOfModelDefinitions}. If the 177 * index is invalid, <code>null</code> is returned. 178 */ public 179 ModelDefinition getModelDefinition(long n) { 180 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getModelDefinition__SWIG_0(swigCPtr, this, n); 181 return (cPtr == 0) ? null : new ModelDefinition(cPtr, false); 182 } 183 184 185/** 186 * Returns the model definition object based on its identifier. 187 <p> 188 * @param sid a string representing the identifier 189 * of the model definition to get. 190 <p> 191 * @return {@link ModelDefinition} in the {@link ListOfModelDefinitions} with the given <code>sid</code> 192 * or <code>null</code> if no such {@link ModelDefinition} exists. 193 <p> 194 * @see #getModelDefinition(long n) 195 * @see #getListOfModelDefinitions() 196 */ public 197 ModelDefinition getModelDefinition(String sid) { 198 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getModelDefinition__SWIG_2(swigCPtr, this, sid); 199 return (cPtr == 0) ? null : new ModelDefinition(cPtr, false); 200 } 201 202 203/** 204 * Adds a copy of the given {@link ModelDefinition} object to the list of 205 * ModelDefinitions. 206 <p> 207 * @param modelDefinition the {@link ModelDefinition} object to be added to the 208 * list of ModelDefinitions. Fails if the added {@link ModelDefinition} is <code>null</code>, 209 * does not match the level/version/package of the parent object, or cannot 210 * be added to the list of replaced elements. 211 <p> 212 * <p> 213 * @return integer value indicating success/failure of the 214 * function. The possible values 215 * returned by this function are: 216 * <ul> 217 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 218 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 219 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 220 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 221 * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH} 222 * </ul> 223 */ public 224 int addModelDefinition(ModelDefinition modelDefinition) { 225 return libsbmlJNI.CompSBMLDocumentPlugin_addModelDefinition(swigCPtr, this, ModelDefinition.getCPtr(modelDefinition), modelDefinition); 226 } 227 228 229/** 230 * Returns the number of ModelDefinitions for this {@link SBMLDocumentPlugin}. 231 <p> 232 * @return the number of ModelDefinitions. 233 */ public 234 long getNumModelDefinitions() { 235 return libsbmlJNI.CompSBMLDocumentPlugin_getNumModelDefinitions(swigCPtr, this); 236 } 237 238 239/** 240 * Creates a {@link ModelDefinition} object, adds it to the end of the 241 * {@link ModelDefinition} objects list and returns a pointer to the newly 242 * created object. 243 <p> 244 * @return a newly created {@link ModelDefinition} object 245 */ public 246 ModelDefinition createModelDefinition() { 247 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_createModelDefinition(swigCPtr, this); 248 return (cPtr == 0) ? null : new ModelDefinition(cPtr, false); 249 } 250 251 252/** 253 * Removes the {@link ModelDefinition} with the given index from the {@link CompSBMLDocumentPlugin}. 254 <p> 255 * A pointer to the {@link ModelDefinition} that was removed is returned. 256 * If no {@link ModelDefinition} has been removed, <code>null</code> is returned. 257 <p> 258 * @param index the index of the {@link ModelDefinition} object to remove 259 <p> 260 * @return the {@link ModelDefinition} object removed. As mentioned above, 261 * the caller owns the returned object. <code>null</code> is returned if 262 * the given index is out of range. 263 */ public 264 ModelDefinition removeModelDefinition(long index) { 265 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeModelDefinition__SWIG_0(swigCPtr, this, index); 266 return (cPtr == 0) ? null : new ModelDefinition(cPtr, false); 267 } 268 269 270/** 271 * Removes the {@link ModelDefinition} with the given <code>id</code> from the {@link CompSBMLDocumentPlugin}. 272 <p> 273 * A pointer to the {@link ModelDefinition} that was removed is returned. 274 * If no {@link ModelDefinition} has been removed, <code>null</code> is returned. 275 <p> 276 * @param id the id of the {@link ModelDefinition} object to remove 277 <p> 278 * @return the {@link ModelDefinition} object removed. As mentioned above, 279 * the caller owns the returned object. <code>null</code> is returned if 280 * the given index is out of range. 281 */ public 282 ModelDefinition removeModelDefinition(String id) { 283 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeModelDefinition__SWIG_1(swigCPtr, this, id); 284 return (cPtr == 0) ? null : new ModelDefinition(cPtr, false); 285 } 286 287 288/** 289 * Returns the {@link ListOf} object that holds all ExternalModelDefinitions. 290 <p> 291 * @return the {@link ListOf} object that holds all ExternalModelDefinitions. 292 */ public 293 ListOfExternalModelDefinitions getListOfExternalModelDefinitions() { 294 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getListOfExternalModelDefinitions(swigCPtr, this); 295 return (cPtr == 0) ? null : new ListOfExternalModelDefinitions(cPtr, false); 296 } 297 298 299/** 300 * Returns the {@link ExternalModelDefinition} with the given index. 301 <p> 302 * @param n the index number of the {@link ExternalModelDefinition} to get. 303 <p> 304 * @return the nth {@link ExternalModelDefinition} in the 305 * {@link ListOfExternalModelDefinitions}. If the index is invalid, <code>null</code> is 306 * returned. 307 */ public 308 ExternalModelDefinition getExternalModelDefinition(long n) { 309 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getExternalModelDefinition__SWIG_0(swigCPtr, this, n); 310 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false); 311 } 312 313 314/** 315 * Returns the model definition object based on its identifier. 316 <p> 317 * @param sid a string representing the identifier 318 * of the model definition to get. 319 <p> 320 * @return {@link ExternalModelDefinition} in the {@link ListOfExternalModelDefinitions} with the given <code>sid</code> 321 * or <code>null</code> if no such {@link ExternalModelDefinition} exists. 322 <p> 323 * @see #getExternalModelDefinition(long n) 324 * @see #getListOfExternalModelDefinitions() 325 */ public 326 ExternalModelDefinition getExternalModelDefinition(String sid) { 327 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_getExternalModelDefinition__SWIG_2(swigCPtr, this, sid); 328 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false); 329 } 330 331 332/** 333 * Searches the model namespace of the document and returns the {@link Model}, 334 * {@link ModelDefinition}, or ExternalModelDefintion object with the given 335 * identifier. 336 <p> 337 * @param sid a string representing the identifier of the model definition to get. 338 <p> 339 * @return The {@link SBase} corresponding to the given <code>sid</code> or <code>null</code> if no such 340 * model exists. If no such model exists, this will return <code>null.</code> 341 */ public 342 SBase getModel(String sid) { 343 return libsbml.DowncastSBase(libsbmlJNI.CompSBMLDocumentPlugin_getModel__SWIG_0(swigCPtr, this, sid), false); 344} 345 346 347/** 348 <p> 349 * Sets the boolean value of 'required' attribute of corresponding package 350 * in {@link SBMLDocument} element. The only legal value is 'true' for the 351 * Hierarchical Model Composition package. 352 <p> 353 * @param value the boolean value of 'required' attribute of corresponding 354 * package in {@link SBMLDocument} element. 355 <p> 356 * <p> 357 * @return integer value indicating success/failure of the 358 * function. The possible values 359 * returned by this function are: 360 * <ul> 361 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 362 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 363 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 364 * </ul> 365 */ public 366 int setRequired(boolean value) { 367 return libsbmlJNI.CompSBMLDocumentPlugin_setRequired(swigCPtr, this, value); 368 } 369 370 371/** 372 * Adds a copy of the given {@link ExternalModelDefinition} object to the list of 373 * ExternalModelDefinitions. 374 <p> 375 * @param externalModelDefinition the {@link ExternalModelDefinition} object to be 376 * added to the list of ExternalModelDefinitions. Fails if the added 377 * {@link ExternalModelDefinition} is <code>null</code>, does not match the 378 * level/version/package of the parent object, or cannot be added to the 379 * list of external model definitions. 380 <p> 381 * <p> 382 * @return integer value indicating success/failure of the 383 * function. The possible values 384 * returned by this function are: 385 * <ul> 386 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 387 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 388 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 389 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 390 * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH} 391 * </ul> 392 */ public 393 int addExternalModelDefinition(ExternalModelDefinition externalModelDefinition) { 394 return libsbmlJNI.CompSBMLDocumentPlugin_addExternalModelDefinition(swigCPtr, this, ExternalModelDefinition.getCPtr(externalModelDefinition), externalModelDefinition); 395 } 396 397 398/** 399 * Returns the number of ExternalModelDefinitions for this {@link SBMLDocumentPlugin}. 400 <p> 401 * @return the number of ExternalModelDefinitions for this {@link SBMLDocumentPlugin}. 402 */ public 403 long getNumExternalModelDefinitions() { 404 return libsbmlJNI.CompSBMLDocumentPlugin_getNumExternalModelDefinitions(swigCPtr, this); 405 } 406 407 408/** 409 * Creates a {@link ExternalModelDefinition} object, adds it to the end of the 410 * {@link ExternalModelDefinition} objects list and returns a pointer to the newly 411 * created object. 412 <p> 413 * @return a newly created {@link ExternalModelDefinition} object 414 */ public 415 ExternalModelDefinition createExternalModelDefinition() { 416 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_createExternalModelDefinition(swigCPtr, this); 417 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false); 418 } 419 420 421/** 422 * Removes the {@link ExternalModelDefinition} with the given index. 423 <p> 424 * A pointer to the {@link ExternalModelDefinition} that was removed is returned. 425 * If no {@link ExternalModelDefinition} has been removed, <code>null</code> is returned. 426 <p> 427 * @param index the index of the {@link ExternalModelDefinition} object to remove 428 <p> 429 * @return the {@link ExternalModelDefinition} object removed. As mentioned above, 430 * the caller owns the returned object. <code>null</code> is returned if 431 * the given index is out of range. 432 */ public 433 ExternalModelDefinition removeExternalModelDefinition(long index) { 434 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeExternalModelDefinition__SWIG_0(swigCPtr, this, index); 435 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false); 436 } 437 438 439/** 440 * Removes the {@link ExternalModelDefinition} with the given <code>id</code>. 441 <p> 442 * A pointer to the {@link ExternalModelDefinition} that was removed is returned. 443 * If no {@link ExternalModelDefinition} has been removed, <code>null</code> is returned. 444 <p> 445 * @param id the id of the {@link ExternalModelDefinition} object to remove 446 <p> 447 * @return the {@link ExternalModelDefinition} object removed. As mentioned above, 448 * the caller owns the returned object. <code>null</code> is returned if 449 * the given index is out of range. 450 */ public 451 ExternalModelDefinition removeExternalModelDefinition(String id) { 452 long cPtr = libsbmlJNI.CompSBMLDocumentPlugin_removeExternalModelDefinition__SWIG_1(swigCPtr, this, id); 453 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false); 454 } 455 456 457/** * @internal */ public 458 void connectToChild() { 459 libsbmlJNI.CompSBMLDocumentPlugin_connectToChild(swigCPtr, this); 460 } 461 462 463/** * @internal */ public 464 void connectToParent(SBase parent) { 465 libsbmlJNI.CompSBMLDocumentPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(parent), parent); 466 } 467 468 469/** * @internal */ public 470 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 471 libsbmlJNI.CompSBMLDocumentPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 472 } 473 474 475/** * @internal */ public 476 boolean getOverrideCompFlattening() { 477 return libsbmlJNI.CompSBMLDocumentPlugin_getOverrideCompFlattening(swigCPtr, this); 478 } 479 480 481/** * @internal */ public 482 void setOverrideCompFlattening(boolean overrideCompFlattening) { 483 libsbmlJNI.CompSBMLDocumentPlugin_setOverrideCompFlattening(swigCPtr, this, overrideCompFlattening); 484 } 485 486}