001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.8 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 * A qualified XML name. 013 <p> 014 * <p style='color: #777; font-style: italic'> 015This class of objects is defined by libSBML only and has no direct 016equivalent in terms of SBML components. This class is not prescribed by 017the SBML specifications, although it is used to implement features 018defined in SBML. 019</p> 020 021 <p> 022 * A 'triple' in the libSBML XML layer encapsulates the notion of qualified 023 * name, meaning an element name or an attribute name with an optional 024 * namespace qualifier. Triples by themselves are not entities in an XML 025 * stream—they are not, for example, elements or attributes; rather, 026 * {@link XMLTriple} is used in libSBML to construct these other kinds of objects. 027 <p> 028 * An {@link XMLTriple} instance carries up to three data items: 029 * <ol> 030 * <li> The name of the attribute or element; that is, the attribute name 031 * as it appears in an XML document or data stream; 032 * <li> The XML namespace prefix (if any) of the attribute. For example, 033 * in the following fragment of XML, the namespace prefix is the string 034 * <code>mysim</code> and it appears on both the element 035 * <code>someelement</code> and the attribute <code>attribA</code>. When 036 * both the element and the attribute are stored as {@link XMLTriple} objects, 037 * their <i>prefix</i> is <code>mysim</code>. 038 * <pre class='fragment'> 039<mysim:someelement mysim:attribA='value' /> 040</pre> 041 * <li> The XML namespace URI with which the prefix is associated. In 042 * XML, every namespace used must be declared and mapped to a URI. 043 * </ol> 044 <p> 045 * {@link XMLTriple} objects are the lowest-level data item in the XML layer 046 * of libSBML. Other objects such as {@link XMLToken} make use of {@link XMLTriple} 047 * objects. 048 <p> 049 * @see XMLToken 050 * @see XMLNode 051 * @see XMLAttributes 052 * @see XMLNamespaces 053 */ 054 055public class XMLTriple { 056 private long swigCPtr; 057 protected boolean swigCMemOwn; 058 059 protected XMLTriple(long cPtr, boolean cMemoryOwn) 060 { 061 swigCMemOwn = cMemoryOwn; 062 swigCPtr = cPtr; 063 } 064 065 protected static long getCPtr(XMLTriple obj) 066 { 067 return (obj == null) ? 0 : obj.swigCPtr; 068 } 069 070 protected static long getCPtrAndDisown (XMLTriple obj) 071 { 072 long ptr = 0; 073 074 if (obj != null) 075 { 076 ptr = obj.swigCPtr; 077 obj.swigCMemOwn = false; 078 } 079 080 return ptr; 081 } 082 083 protected void finalize() { 084 delete(); 085 } 086 087 public synchronized void delete() { 088 if (swigCPtr != 0) { 089 if (swigCMemOwn) { 090 swigCMemOwn = false; 091 libsbmlJNI.delete_XMLTriple(swigCPtr); 092 } 093 swigCPtr = 0; 094 } 095 } 096 097 /** 098 * Equality comparison method for XMLTriple. 099 * <p> 100 * Because the Java methods for libSBML are actually wrappers around code 101 * implemented in C++ and C, certain operations will not behave as 102 * expected. Equality comparison is one such case. An instance of a 103 * libSBML object class is actually a <em>proxy object</em> 104 * wrapping the real underlying C/C++ object. The normal <code>==</code> 105 * equality operator in Java will <em>only compare the Java proxy objects</em>, 106 * not the underlying native object. The result is almost never what you 107 * want in practical situations. Unfortunately, Java does not provide a 108 * way to override <code>==</code>. 109 * <p> 110 * The alternative that must be followed is to use the 111 * <code>equals()</code> method. The <code>equals</code> method on this 112 * class overrides the default java.lang.Object one, and performs an 113 * intelligent comparison of instances of objects of this class. The 114 * result is an assessment of whether two libSBML Java objects are truly 115 * the same underlying native-code objects. 116 * <p> 117 * The use of this method in practice is the same as the use of any other 118 * Java <code>equals</code> method. For example, 119 * <em>a</em><code>.equals(</code><em>b</em><code>)</code> returns 120 * <code>true</code> if <em>a</em> and <em>b</em> are references to the 121 * same underlying object. 122 * 123 * @param sb a reference to an object to which the current object 124 * instance will be compared 125 * 126 * @return <code>true</code> if <code>sb</code> refers to the same underlying 127 * native object as this one, <code>false</code> otherwise 128 */ 129 public boolean equals(Object sb) 130 { 131 if ( this == sb ) 132 { 133 return true; 134 } 135 return swigCPtr == getCPtr((XMLTriple)(sb)); 136 } 137 138 /** 139 * Returns a hashcode for this XMLTriple object. 140 * 141 * @return a hash code usable by Java methods that need them. 142 */ 143 public int hashCode() 144 { 145 return (int)(swigCPtr^(swigCPtr>>>32)); 146 } 147 148 149/** 150 * Creates a new, empty {@link XMLTriple} object. 151 */ public 152 XMLTriple() { 153 this(libsbmlJNI.new_XMLTriple__SWIG_0(), true); 154 } 155 156 157/** 158 * Creates a new {@link XMLTriple} object with a given <code>name</code>, <code>uri</code> and and 159 * <code>prefix</code>. 160 <p> 161 * @param name a string, the name for the entity represented by this object. 162 * @param uri a string, the XML namespace URI associated with the prefix. 163 * @param prefix a string, the XML namespace prefix for this triple. 164 */ public 165 XMLTriple(String name, String uri, String prefix) { 166 this(libsbmlJNI.new_XMLTriple__SWIG_1(name, uri, prefix), true); 167 } 168 169 170/** 171 * Creates an {@link XMLTriple} object by splitting a given string at a given 172 * separator character. 173 <p> 174 * The 'triplet' in this case is a string that may be in one of the 175 * following three possible formats: 176 * <ol> 177 * <li> <span style='background-color: lightblue; padding-left: 2px; padding-right: 2px'>name</span> </li> 178 * <li> <span style='background-color: #ccc; padding-left: 2px; padding-right: 2px'>URI</span><span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span><span style='background-color: lightblue; padding-left: 2px; padding-right: 2px'>name</span></li> 179 * <li> <span style='background-color: #ccc; padding-left: 2px; padding-right: 2px'>URI</span><span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span><span style='background-color: lightblue; padding-left: 2px; padding-right: 2px'>name</span><span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span><span style='background-color: #d0d0fd; padding-left: 2px; padding-right: 2px'>prefix</span></li> 180 * </ol> 181 <p> 182 * where <span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span> 183 * represents the separator character, <code>sepchar</code>. 184 <p> 185 * @param triplet a string representing the triplet as shown above 186 * @param sepchar a character, the sepchar used in the triplet 187 <p> 188 * 189</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 190The native C++ implementation of this method defines a default argument 191value. In the documentation generated for different libSBML language 192bindings, you may or may not see corresponding arguments in the method 193declarations. For example, in Java and C#, a default argument is handled by 194declaring two separate methods, with one of them having the argument and 195the other one lacking the argument. However, the libSBML documentation will 196be <em>identical</em> for both methods. Consequently, if you are reading 197this and do not see an argument even though one is described, please look 198for descriptions of other variants of this method near where this one 199appears in the documentation. 200</dd></dl> 201 202 */ public 203 XMLTriple(String triplet, char sepchar) { 204 this(libsbmlJNI.new_XMLTriple__SWIG_2(triplet, sepchar), true); 205 } 206 207 208/** 209 * Creates an {@link XMLTriple} object by splitting a given string at a given 210 * separator character. 211 <p> 212 * The 'triplet' in this case is a string that may be in one of the 213 * following three possible formats: 214 * <ol> 215 * <li> <span style='background-color: lightblue; padding-left: 2px; padding-right: 2px'>name</span> </li> 216 * <li> <span style='background-color: #ccc; padding-left: 2px; padding-right: 2px'>URI</span><span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span><span style='background-color: lightblue; padding-left: 2px; padding-right: 2px'>name</span></li> 217 * <li> <span style='background-color: #ccc; padding-left: 2px; padding-right: 2px'>URI</span><span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span><span style='background-color: lightblue; padding-left: 2px; padding-right: 2px'>name</span><span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span><span style='background-color: #d0d0fd; padding-left: 2px; padding-right: 2px'>prefix</span></li> 218 * </ol> 219 <p> 220 * where <span style='background-color: purple; color: white; padding-left: 2px; padding-right: 2px'>x</span> 221 * represents the separator character, <code>sepchar</code>. 222 <p> 223 * @param triplet a string representing the triplet as shown above 224 * @param sepchar a character, the sepchar used in the triplet 225 <p> 226 * 227</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 228The native C++ implementation of this method defines a default argument 229value. In the documentation generated for different libSBML language 230bindings, you may or may not see corresponding arguments in the method 231declarations. For example, in Java and C#, a default argument is handled by 232declaring two separate methods, with one of them having the argument and 233the other one lacking the argument. However, the libSBML documentation will 234be <em>identical</em> for both methods. Consequently, if you are reading 235this and do not see an argument even though one is described, please look 236for descriptions of other variants of this method near where this one 237appears in the documentation. 238</dd></dl> 239 240 */ public 241 XMLTriple(String triplet) { 242 this(libsbmlJNI.new_XMLTriple__SWIG_3(triplet), true); 243 } 244 245 246/** 247 * Copy constructor; creates a copy of this {@link XMLTriple} object. 248 <p> 249 * @param orig the {@link XMLTriple} object to copy. 250 */ public 251 XMLTriple(XMLTriple orig) { 252 this(libsbmlJNI.new_XMLTriple__SWIG_4(XMLTriple.getCPtr(orig), orig), true); 253 } 254 255 256/** 257 * Creates and returns a deep copy of this {@link XMLTriple} object. 258 <p> 259 * @return the (deep) copy of this {@link XMLTriple} object. 260 */ public 261 XMLTriple cloneObject() { 262 long cPtr = libsbmlJNI.XMLTriple_cloneObject(swigCPtr, this); 263 return (cPtr == 0) ? null : new XMLTriple(cPtr, true); 264 } 265 266 267/** 268 * Returns the <em>name</em> portion of this {@link XMLTriple} object. 269 <p> 270 * @return a string, the name portion of this {@link XMLTriple} object. 271 */ public 272 String getName() { 273 return libsbmlJNI.XMLTriple_getName(swigCPtr, this); 274 } 275 276 277/** 278 * Returns the <em>prefix</em> portion of this {@link XMLTriple} object. 279 <p> 280 * @return a string, the prefix portion of this {@link XMLTriple} object. 281 */ public 282 String getPrefix() { 283 return libsbmlJNI.XMLTriple_getPrefix(swigCPtr, this); 284 } 285 286 287/** 288 * Returns the <em>URI</em> portion of this {@link XMLTriple} object. 289 <p> 290 * @return URI a string, the URI portion of this {@link XMLTriple} object. 291 */ public 292 String getURI() { 293 return libsbmlJNI.XMLTriple_getURI(swigCPtr, this); 294 } 295 296 297/** 298 * Returns the prefixed name from this {@link XMLTriple}. 299 <p> 300 * @return a string, the prefixed name from this {@link XMLTriple}. This is 301 * constructed by concatenating the <em>prefix</em> stored in this {@link XMLTriple} 302 * object, followed by a colon character <code>':'</code>, followed by the 303 * <em>name</em> stored in this {@link XMLTriple} object. 304 */ public 305 String getPrefixedName() { 306 return libsbmlJNI.XMLTriple_getPrefixedName(swigCPtr, this); 307 } 308 309 310/** 311 * Returns <code>true</code> if this {@link XMLTriple} object is empty. 312 <p> 313 * @return <code>true</code> if this {@link XMLTriple} is empty, <code>false</code> otherwise. 314 */ public 315 boolean isEmpty() { 316 return libsbmlJNI.XMLTriple_isEmpty(swigCPtr, this); 317 } 318 319}