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 Port extends SBaseRef { 012 private long swigCPtr; 013 014 protected Port(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.Port_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(Port obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (Port 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_Port(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 public Port(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 054 this(libsbmlJNI.new_Port__SWIG_0(level, version, pkgVersion), true); 055 } 056 057 public Port(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 058 this(libsbmlJNI.new_Port__SWIG_1(level, version), true); 059 } 060 061 public Port(long level) throws org.sbml.libsbml.SBMLConstructorException { 062 this(libsbmlJNI.new_Port__SWIG_2(level), true); 063 } 064 065 public Port() throws org.sbml.libsbml.SBMLConstructorException { 066 this(libsbmlJNI.new_Port__SWIG_3(), true); 067 } 068 069 public Port(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 070 this(libsbmlJNI.new_Port__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 071 } 072 073 public Port(Port source) throws org.sbml.libsbml.SBMLConstructorException { 074 this(libsbmlJNI.new_Port__SWIG_5(Port.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.Port_cloneObject(swigCPtr, this); 085 return (cPtr == 0) ? null : new Port(cPtr, true); 086 } 087 088 089/** 090 * Returns the value of the 'metaid' attribute of this object. 091 * <p> 092 * The optional attribute named 'metaid', present on every major SBML 093 * component type, is for supporting metadata annotations using RDF 094 * (Resource Description Format). The attribute value has the data type 095 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 096 * identifier type, which means each 'metaid' value must be globally 097 * unique within an SBML file. (Importantly, this uniqueness criterion 098 * applies across any attribute with type <a 099 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 100 * 'metaid' attribute used by SBML—something to be aware of if your 101 * application-specific XML content inside the 'annotation' subelement 102 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 103 * The 'metaid' value serves to identify a model 104 * component for purposes such as referencing that component from 105 * metadata placed within 'annotation' subelements. 106 * <p> 107 * @return the meta-identifier of this SBML object, as a string. 108 * <p> 109 * @see #isSetMetaId() 110 * @see #setMetaId(String metaid) 111 * @internal 112 */ public 113 String getId() { 114 return libsbmlJNI.Port_getId(swigCPtr, this); 115 } 116 117 118/** 119 * Predicate returning <code>true</code> if this object's 'metaid' attribute is set. 120 * <p> 121 * The optional attribute named 'metaid', present on every major SBML 122 * component type, is for supporting metadata annotations using RDF 123 * (Resource Description Format). The attribute value has the data type 124 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 125 * identifier type, which means each 'metaid' value must be globally 126 * unique within an SBML file. (Importantly, this uniqueness criterion 127 * applies across any attribute with type <a 128 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 129 * 'metaid' attribute used by SBML—something to be aware of if your 130 * application-specific XML content inside the 'annotation' subelement 131 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 132 * The 'metaid' value serves to identify a model component for purposes 133 * such as referencing that component from metadata placed within 134 * 'annotation' subelements. 135 * <p> 136 * @return <code>true</code> if the 'metaid' attribute of this SBML object is 137 * set, <code>false</code> otherwise. 138 * <p> 139 * @see #getMetaId() 140 * @see #setMetaId(String metaid) 141 * @internal 142 */ public 143 boolean isSetId() { 144 return libsbmlJNI.Port_isSetId(swigCPtr, this); 145 } 146 147 148/** 149 * Predicate returning <code>true</code> if this 150 * object has a {@link ModelHistory} object attached to it. 151 * <p> 152 * @return <code>true</code> if the {@link ModelHistory} of this object is set, 153 * <code>false</code> otherwise. 154 * <p> 155 * @note In SBML Level 2, model history annotations were only 156 * permitted on the {@link Model} element. In SBML Level 3, they are 157 * permitted on all SBML components derived from {@link SBase}. 158 * @internal 159 */ public 160 int setId(String id) { 161 return libsbmlJNI.Port_setId(swigCPtr, this, id); 162 } 163 164 165/** 166 * Unsets the value of the 'id' attribute of this SBML object. 167 * <p> 168 * Most (but not all) objects in SBML include two common attributes: 'id' 169 * and 'name'. The identifier given by an object's 'id' attribute value 170 * is used to identify the object within the SBML model definition. 171 * Other objects can refer to the component using this identifier. The 172 * data type of 'id' is always either <code>Sid</code> or 173 * <code>UnitSId</code>, depending on the object in question. Both 174 * data types are defined as follows: 175 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 176 * letter .= 'a'..'z','A'..'Z' 177 * digit .= '0'..'9' 178 * idChar .= letter | digit | '_' 179 * SId .= ( letter | '_' ) idChar* 180 * </pre> 181 * <p> 182 * The equality of <code>SId</code> and <code>UnitSId</code> type values 183 * in SBML is determined by an exact character sequence match; i.e., 184 * comparisons of these identifiers must be performed in a case-sensitive 185 * manner. This applies to all uses of <code>SId</code> and 186 * <code>UnitSId</code>. 187 * <p> 188 * @return integer value indicating success/failure of the 189 * function. The possible values returned by this function are: 190 * <ul> 191 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 192 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 193 * </ul> 194 */ public 195 int unsetId() { 196 return libsbmlJNI.Port_unsetId(swigCPtr, this); 197 } 198 199 200/** 201 * Returns the value of the 'metaid' attribute of this object. 202 * <p> 203 * The optional attribute named 'metaid', present on every major SBML 204 * component type, is for supporting metadata annotations using RDF 205 * (Resource Description Format). The attribute value has the data type 206 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 207 * identifier type, which means each 'metaid' value must be globally 208 * unique within an SBML file. (Importantly, this uniqueness criterion 209 * applies across any attribute with type <a 210 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 211 * 'metaid' attribute used by SBML—something to be aware of if your 212 * application-specific XML content inside the 'annotation' subelement 213 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 214 * The 'metaid' value serves to identify a model 215 * component for purposes such as referencing that component from 216 * metadata placed within 'annotation' subelements. 217 * <p> 218 * @return the meta-identifier of this SBML object, as a string. 219 * <p> 220 * @see #isSetMetaId() 221 * @see #setMetaId(String metaid) 222 * @internal 223 */ public 224 String getName() { 225 return libsbmlJNI.Port_getName(swigCPtr, this); 226 } 227 228 229/** 230 * Predicate returning <code>true</code> if this object's 'metaid' attribute is set. 231 * <p> 232 * The optional attribute named 'metaid', present on every major SBML 233 * component type, is for supporting metadata annotations using RDF 234 * (Resource Description Format). The attribute value has the data type 235 * <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, the XML 236 * identifier type, which means each 'metaid' value must be globally 237 * unique within an SBML file. (Importantly, this uniqueness criterion 238 * applies across any attribute with type <a 239 * href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>, not just the 240 * 'metaid' attribute used by SBML—something to be aware of if your 241 * application-specific XML content inside the 'annotation' subelement 242 * happens to use <a href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>.) 243 * The 'metaid' value serves to identify a model component for purposes 244 * such as referencing that component from metadata placed within 245 * 'annotation' subelements. 246 * <p> 247 * @return <code>true</code> if the 'metaid' attribute of this SBML object is 248 * set, <code>false</code> otherwise. 249 * <p> 250 * @see #getMetaId() 251 * @see #setMetaId(String metaid) 252 * @internal 253 */ public 254 boolean isSetName() { 255 return libsbmlJNI.Port_isSetName(swigCPtr, this); 256 } 257 258 259/** 260 * Predicate returning <code>true</code> if this 261 * object has a {@link ModelHistory} object attached to it. 262 * <p> 263 * @return <code>true</code> if the {@link ModelHistory} of this object is set, 264 * <code>false</code> otherwise. 265 * <p> 266 * @note In SBML Level 2, model history annotations were only 267 * permitted on the {@link Model} element. In SBML Level 3, they are 268 * permitted on all SBML components derived from {@link SBase}. 269 * @internal 270 */ public 271 int setName(String name) { 272 return libsbmlJNI.Port_setName(swigCPtr, this, name); 273 } 274 275 276/** 277 * Unsets the value of the 'name' attribute of this SBML object. 278 * <p> 279 * Most (but not all) objects in SBML include two common attributes: 'id' 280 * and 'name'. In contrast to the 'id' attribute, the 'name' attribute is 281 * optional and is not intended to be used for cross-referencing purposes 282 * within a model. Its purpose instead is to provide a human-readable 283 * label for the component. The data type of 'name' is the type 284 * <code>string</code> defined in XML Schema. SBML imposes no 285 * restrictions as to the content of 'name' attributes beyond those 286 * restrictions defined by the <code>string</code> type in XML Schema. 287 * <p> 288 * The recommended practice for handling 'name' is as follows. If a 289 * software tool has the capability for displaying the content of 'name' 290 * attributes, it should display this content to the user as a 291 * component's label instead of the component's 'id'. If the user 292 * interface does not have this capability (e.g., because it cannot 293 * display or use special characters in symbol names), or if the 'name' 294 * attribute is missing on a given component, then the user interface 295 * should display the value of the 'id' attribute instead. (Script 296 * language interpreters are especially likely to display 'id' instead of 297 * 'name'.) 298 * <p> 299 * As a consequence of the above, authors of systems that automatically 300 * generate the values of 'id' attributes should be aware some systems 301 * may display the 'id''s to the user. Authors therefore may wish to 302 * take some care to have their software create 'id' values that are: (a) 303 * reasonably easy for humans to type and read; and (b) likely to be 304 * meaningful, for example by making the 'id' attribute be an abbreviated 305 * form of the name attribute value. 306 * <p> 307 * An additional point worth mentioning is although there are 308 * restrictions on the uniqueness of 'id' values, there are no 309 * restrictions on the uniqueness of 'name' values in a model. This 310 * allows software applications leeway in assigning component identifiers. 311 * <p> 312 * @return integer value indicating success/failure of the 313 * function. The possible values returned by this function are: 314 * <ul> 315 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 316 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 317 * </ul> 318 */ public 319 int unsetName() { 320 return libsbmlJNI.Port_unsetName(swigCPtr, this); 321 } 322 323 public int setPortRef(String id) { 324 return libsbmlJNI.Port_setPortRef(swigCPtr, this, id); 325 } 326 327 328/** 329 * Subclasses should override this method to write out their contained 330 * SBML objects as XML elements. Be sure to call your parents 331 * implementation of this method as well. For example: 332 * @internal 333 */ public 334 boolean hasRequiredAttributes() { 335 return libsbmlJNI.Port_hasRequiredAttributes(swigCPtr, this); 336 } 337 338 339/** 340 * Returns the XML element name of this object. 341 * <p> 342 * This is overridden by subclasses to return a string appropriate to the 343 * SBML component. For example, {@link Model} defines it as returning 344 * <code>'model'</code>, {@link CompartmentType} defines it as returning <code>'compartmentType'</code>, 345 * and so on. 346 */ public 347 String getElementName() { 348 return libsbmlJNI.Port_getElementName(swigCPtr, this); 349 } 350 351 352/** 353 * Returns the libSBML type code for this object. 354 * <p> 355 * This method may return the type code of this SBML object, or it may 356 * return {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN}. This 357 * is because subclasses of {@link SBase} are not required to implement this 358 * method to return a type code. This method is meant primarily for the 359 * LibSBML C interface, in which class and subclass information is not 360 * readily available. 361 * <p> 362 * @return the SBML object type code 363 * of this SBML object or 364 * {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (the default). 365 * <p> 366 * @see #getElementName() 367 * @see #getPackageName() 368 */ public 369 int getTypeCode() { 370 return libsbmlJNI.Port_getTypeCode(swigCPtr, this); 371 } 372 373 public int saveReferencedElement() { 374 return libsbmlJNI.Port_saveReferencedElement(swigCPtr, this); 375 } 376 377 378/** 379 * Renames all the <code>SIdRef</code> attributes on this element, including any 380 * found in MathML content (if such exists). 381 * <p> 382 * This method works by looking at all attributes and (if appropriate) 383 * mathematical formulas, comparing the identifiers to the value of 384 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 385 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 386 * <p> 387 * @param oldid the old identifier 388 * @param newid the new identifier 389 */ public 390 void renameSIdRefs(String oldid, String newid) { 391 libsbmlJNI.Port_renameSIdRefs(swigCPtr, this, oldid, newid); 392 } 393 394 395/** 396 * Renames all the <code>UnitSIdRef</code> attributes on this element. 397 * <p> 398 * This method works by looking at all unit identifier attribute values 399 * (including, if appropriate, inside mathematical formulas), comparing the 400 * unit identifiers to the value of <code>oldid</code>. If any matches are found, 401 * the matching identifiers are replaced with <code>newid</code>. The method does 402 * <em>not</em> descend into child elements. 403 * <p> 404 * @param oldid the old identifier 405 * @param newid the new identifier 406 */ public 407 void renameUnitSIdRefs(String oldid, String newid) { 408 libsbmlJNI.Port_renameUnitSIdRefs(swigCPtr, this, oldid, newid); 409 } 410 411 412/** 413 * Renames all the <code>MetaIdRef</code> attributes on this element. 414 * <p> 415 * This method works by looking at all meta-attribute values, comparing 416 * the identifiers to the value of <code>oldid</code>. If any matches are found, 417 * the matching identifiers are replaced with <code>newid</code>. The method does 418 * <em>not</em> descend into child elements. 419 * <p> 420 * @param oldid the old identifier 421 * @param newid the new identifier 422 */ public 423 void renameMetaIdRefs(String oldid, String newid) { 424 libsbmlJNI.Port_renameMetaIdRefs(swigCPtr, this, oldid, newid); 425 } 426 427 public boolean acceptComp(SWIGTYPE_p_CompVisitor v) { 428 return libsbmlJNI.Port_acceptComp(swigCPtr, this, SWIGTYPE_p_CompVisitor.getCPtr(v)); 429 } 430 431 432/** 433 * Sets this SBML object to child SBML objects (if any). 434 * (Creates a child-parent relationship by the parent) 435 * <p> 436 * Subclasses must override this function if they define 437 * one ore more child elements. 438 * Basically, this function needs to be called in 439 * constructor, copy constructor, assignment operator. 440 * <p> 441 * <p> 442 * @internal 443 */ public 444 void connectToChild() { 445 libsbmlJNI.Port_connectToChild(swigCPtr, this); 446 } 447 448 449/** 450 * Enables/Disables the given package with this element and child 451 * elements (if any). 452 * (This is an internal implementation for enablePackage function) 453 * <p> 454 * @note Subclasses in which one or more child elements are defined 455 * must override this function. 456 * <p> 457 * <p> 458 * @see #connectToChild() 459 * @internal 460 */ public 461 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 462 libsbmlJNI.Port_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 463 } 464 465}