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