001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 2.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 *  Interface to an XML output stream.
013 */
014
015public class XMLOutputStream {
016   private long swigCPtr;
017   protected boolean swigCMemOwn;
018
019   protected XMLOutputStream(long cPtr, boolean cMemoryOwn)
020   {
021     swigCMemOwn = cMemoryOwn;
022     swigCPtr    = cPtr;
023   }
024
025   protected static long getCPtr(XMLOutputStream obj)
026   {
027     return (obj == null) ? 0 : obj.swigCPtr;
028   }
029
030   protected static long getCPtrAndDisown (XMLOutputStream obj)
031   {
032     long ptr = 0;
033
034     if (obj != null)
035     {
036       ptr             = obj.swigCPtr;
037       obj.swigCMemOwn = false;
038     }
039
040     return ptr;
041   }
042
043  protected void finalize() {
044    delete();
045  }
046
047  public synchronized void delete() {
048    if (swigCPtr != 0) {
049      if (swigCMemOwn) {
050        swigCMemOwn = false;
051        libsbmlJNI.delete_XMLOutputStream(swigCPtr);
052      }
053      swigCPtr = 0;
054    }
055  }
056
057  /**
058   * Equality comparison method for XMLOutputStream.
059   * <p>
060   * Because the Java methods for libSBML are actually wrappers around code
061   * implemented in C++ and C, certain operations will not behave as
062   * expected.  Equality comparison is one such case.  An instance of a
063   * libSBML object class is actually a <em>proxy object</em>
064   * wrapping the real underlying C/C++ object.  The normal <code>==</code>
065   * equality operator in Java will <em>only compare the Java proxy objects</em>,
066   * not the underlying native object.  The result is almost never what you
067   * want in practical situations.  Unfortunately, Java does not provide a
068   * way to override <code>==</code>.
069   *  <p>
070   * The alternative that must be followed is to use the
071   * <code>equals()</code> method.  The <code>equals</code> method on this
072   * class overrides the default java.lang.Object one, and performs an
073   * intelligent comparison of instances of objects of this class.  The
074   * result is an assessment of whether two libSBML Java objects are truly 
075   * the same underlying native-code objects.
076   *  <p>
077   * The use of this method in practice is the same as the use of any other
078   * Java <code>equals</code> method.  For example,
079   * <em>a</em><code>.equals(</code><em>b</em><code>)</code> returns
080   * <code>true</code> if <em>a</em> and <em>b</em> are references to the
081   * same underlying object.
082   *
083   * @param sb a reference to an object to which the current object
084   * instance will be compared
085   *
086   * @return <code>true</code> if <code>sb</code> refers to the same underlying 
087   * native object as this one, <code>false</code> otherwise
088   */
089  public boolean equals(Object sb)
090  {
091    if ( this == sb ) 
092    {
093      return true;
094    }
095    return swigCPtr == getCPtr((XMLOutputStream)(sb));
096  }
097
098  /**
099   * Returns a hashcode for this XMLOutputStream object.
100   *
101   * @return a hash code usable by Java methods that need them.
102   */
103  public int hashCode()
104  {
105    return (int)(swigCPtr^(swigCPtr>>>32));
106  }
107
108  
109/**
110   * Creates a new {@link XMLOutputStream} that wraps stream.
111   <p>
112   * 
113</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd>
114The native C++ implementation of this method defines a default argument
115value. In the documentation generated for different libSBML language
116bindings, you may or may not see corresponding arguments in the method
117declarations. For example, in Java and C#, a default argument is handled by
118declaring two separate methods, with one of them having the argument and
119the other one lacking the argument. However, the libSBML documentation will
120be <em>identical</em> for both methods. Consequently, if you are reading
121this and do not see an argument even though one is described, please look
122for descriptions of other variants of this method near where this one
123appears in the documentation.
124</dd></dl>
125 
126   */ public
127 XMLOutputStream(OStream stream, String encoding, boolean writeXMLDecl, String programName, String programVersion) throws org.sbml.libsbml.XMLConstructorException {
128    this(libsbmlJNI.new_XMLOutputStream__SWIG_0(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding, writeXMLDecl, programName, programVersion), true);
129  }
130
131  
132/**
133   * Creates a new {@link XMLOutputStream} that wraps stream.
134   <p>
135   * 
136</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd>
137The native C++ implementation of this method defines a default argument
138value. In the documentation generated for different libSBML language
139bindings, you may or may not see corresponding arguments in the method
140declarations. For example, in Java and C#, a default argument is handled by
141declaring two separate methods, with one of them having the argument and
142the other one lacking the argument. However, the libSBML documentation will
143be <em>identical</em> for both methods. Consequently, if you are reading
144this and do not see an argument even though one is described, please look
145for descriptions of other variants of this method near where this one
146appears in the documentation.
147</dd></dl>
148 
149   */ public
150 XMLOutputStream(OStream stream, String encoding, boolean writeXMLDecl, String programName) throws org.sbml.libsbml.XMLConstructorException {
151    this(libsbmlJNI.new_XMLOutputStream__SWIG_1(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding, writeXMLDecl, programName), true);
152  }
153
154  
155/**
156   * Creates a new {@link XMLOutputStream} that wraps stream.
157   <p>
158   * 
159</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd>
160The native C++ implementation of this method defines a default argument
161value. In the documentation generated for different libSBML language
162bindings, you may or may not see corresponding arguments in the method
163declarations. For example, in Java and C#, a default argument is handled by
164declaring two separate methods, with one of them having the argument and
165the other one lacking the argument. However, the libSBML documentation will
166be <em>identical</em> for both methods. Consequently, if you are reading
167this and do not see an argument even though one is described, please look
168for descriptions of other variants of this method near where this one
169appears in the documentation.
170</dd></dl>
171 
172   */ public
173 XMLOutputStream(OStream stream, String encoding, boolean writeXMLDecl) throws org.sbml.libsbml.XMLConstructorException {
174    this(libsbmlJNI.new_XMLOutputStream__SWIG_2(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding, writeXMLDecl), true);
175  }
176
177  
178/**
179   * Creates a new {@link XMLOutputStream} that wraps stream.
180   <p>
181   * 
182</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd>
183The native C++ implementation of this method defines a default argument
184value. In the documentation generated for different libSBML language
185bindings, you may or may not see corresponding arguments in the method
186declarations. For example, in Java and C#, a default argument is handled by
187declaring two separate methods, with one of them having the argument and
188the other one lacking the argument. However, the libSBML documentation will
189be <em>identical</em> for both methods. Consequently, if you are reading
190this and do not see an argument even though one is described, please look
191for descriptions of other variants of this method near where this one
192appears in the documentation.
193</dd></dl>
194 
195   */ public
196 XMLOutputStream(OStream stream, String encoding) throws org.sbml.libsbml.XMLConstructorException {
197    this(libsbmlJNI.new_XMLOutputStream__SWIG_3(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding), true);
198  }
199
200  
201/**
202   * Creates a new {@link XMLOutputStream} that wraps stream.
203   <p>
204   * 
205</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd>
206The native C++ implementation of this method defines a default argument
207value. In the documentation generated for different libSBML language
208bindings, you may or may not see corresponding arguments in the method
209declarations. For example, in Java and C#, a default argument is handled by
210declaring two separate methods, with one of them having the argument and
211the other one lacking the argument. However, the libSBML documentation will
212be <em>identical</em> for both methods. Consequently, if you are reading
213this and do not see an argument even though one is described, please look
214for descriptions of other variants of this method near where this one
215appears in the documentation.
216</dd></dl>
217 
218   */ public
219 XMLOutputStream(OStream stream) throws org.sbml.libsbml.XMLConstructorException {
220    this(libsbmlJNI.new_XMLOutputStream__SWIG_4(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream), true);
221  }
222
223  
224/**
225   * Writes the given XML end element name to this {@link XMLOutputStream}.
226   */ public
227 void endElement(String name, String prefix) {
228    libsbmlJNI.XMLOutputStream_endElement__SWIG_0(swigCPtr, this, name, prefix);
229  }
230
231  
232/**
233   * Writes the given XML end element name to this {@link XMLOutputStream}.
234   */ public
235 void endElement(String name) {
236    libsbmlJNI.XMLOutputStream_endElement__SWIG_1(swigCPtr, this, name);
237  }
238
239  
240/**
241   * Writes the given XML end element 'prefix:name' to this
242   * {@link XMLOutputStream}.
243   */ public
244 void endElement(XMLTriple triple) {
245    libsbmlJNI.XMLOutputStream_endElement__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple);
246  }
247
248  
249/**
250   * Turns automatic indentation on or off for this {@link XMLOutputStream}.
251   */ public
252 void setAutoIndent(boolean indent) {
253    libsbmlJNI.XMLOutputStream_setAutoIndent(swigCPtr, this, indent);
254  }
255
256  
257/**
258   * Writes the given XML start element name to this {@link XMLOutputStream}.
259   */ public
260 void startElement(String name, String prefix) {
261    libsbmlJNI.XMLOutputStream_startElement__SWIG_0(swigCPtr, this, name, prefix);
262  }
263
264  
265/**
266   * Writes the given XML start element name to this {@link XMLOutputStream}.
267   */ public
268 void startElement(String name) {
269    libsbmlJNI.XMLOutputStream_startElement__SWIG_1(swigCPtr, this, name);
270  }
271
272  
273/**
274   * Writes the given XML start element 'prefix:name' to this
275   * {@link XMLOutputStream}.
276   */ public
277 void startElement(XMLTriple triple) {
278    libsbmlJNI.XMLOutputStream_startElement__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple);
279  }
280
281  
282/**
283   * Writes the given XML start and end element name to this {@link XMLOutputStream}.
284   */ public
285 void startEndElement(String name, String prefix) {
286    libsbmlJNI.XMLOutputStream_startEndElement__SWIG_0(swigCPtr, this, name, prefix);
287  }
288
289  
290/**
291   * Writes the given XML start and end element name to this {@link XMLOutputStream}.
292   */ public
293 void startEndElement(String name) {
294    libsbmlJNI.XMLOutputStream_startEndElement__SWIG_1(swigCPtr, this, name);
295  }
296
297  
298/**
299   * Writes the given XML start and end element 'prefix:name' to this
300   * {@link XMLOutputStream}.
301   */ public
302 void startEndElement(XMLTriple triple) {
303    libsbmlJNI.XMLOutputStream_startEndElement__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple);
304  }
305
306  
307/**
308   * Writes the given attribute, name='value' to this {@link XMLOutputStream}.
309   */ public
310 void writeAttribute(String name, String value) {
311    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_0(swigCPtr, this, name, value);
312  }
313
314  
315/**
316   * Writes the given attribute, prefix:name='value' to this {@link XMLOutputStream}.
317   */ public
318 void writeAttribute(String name, String prefix, String value) {
319    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_1(swigCPtr, this, name, prefix, value);
320  }
321
322  
323/**
324   * Writes the given attribute, prefix:name='value' to this
325   * {@link XMLOutputStream}.
326   */ public
327 void writeAttribute(XMLTriple triple, String value) {
328    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value);
329  }
330
331  
332/**
333   * Writes the given attribute, name='true' or name='false' to this
334   * {@link XMLOutputStream}.
335   */ public
336 void writeAttribute(String name, boolean value) {
337    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_6(swigCPtr, this, name, value);
338  }
339
340  
341/**
342   * Writes the given attribute, prefix:name='true' or prefix:name='false' to this
343   * {@link XMLOutputStream}.
344   */ public
345 void writeAttribute(String name, String prefix, boolean value) {
346    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_7(swigCPtr, this, name, prefix, value);
347  }
348
349  
350/**
351   * Writes the given attribute, prefix:name='true' or prefix:name='false'
352   * to this {@link XMLOutputStream}.
353   */ public
354 void writeAttribute(XMLTriple triple, boolean value) {
355    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_8(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value);
356  }
357
358  
359/**
360   * Writes the given attribute, name='value' to this {@link XMLOutputStream}.
361   */ public
362 void writeAttribute(String name, double value) {
363    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_9(swigCPtr, this, name, value);
364  }
365
366  
367/**
368   * Writes the given attribute, prefix:name='value' to this {@link XMLOutputStream}.
369   */ public
370 void writeAttribute(String name, String prefix, double value) {
371    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_10(swigCPtr, this, name, prefix, value);
372  }
373
374  
375/**
376   * Writes the given attribute, prefix:name='value' to this
377   * {@link XMLOutputStream}.
378   */ public
379 void writeAttribute(XMLTriple triple, double value) {
380    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_11(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value);
381  }
382
383  
384/**
385   * Writes the given attribute, name='value' to this {@link XMLOutputStream}.
386   */ public
387 void writeAttribute(String name, int value) {
388    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_12(swigCPtr, this, name, value);
389  }
390
391  
392/**
393   * Writes the given attribute, prefix:name='value' to this {@link XMLOutputStream}.
394   */ public
395 void writeAttribute(String name, String prefix, int value) {
396    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_13(swigCPtr, this, name, prefix, value);
397  }
398
399  
400/**
401   * Writes the given attribute, prefix:name='value' to this
402   * {@link XMLOutputStream}.
403   */ public
404 void writeAttribute(XMLTriple triple, int value) {
405    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_14(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value);
406  }
407
408  
409/**
410   * Writes the given attribute, prefix:name='value' to this {@link XMLOutputStream}.
411   */ public
412 void writeAttribute(String name, String prefix, long value) {
413    libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_18(swigCPtr, this, name, prefix, value);
414  }
415
416  
417/**
418   * Writes the XML declaration:
419   * <?xml version='1.0' encoding='...'?>
420   */ public
421 void writeXMLDecl() {
422    libsbmlJNI.XMLOutputStream_writeXMLDecl(swigCPtr, this);
423  }
424
425  
426/**
427   * Writes an XML comment:
428   * <?xml version='1.0' encoding='...'?>
429   */ public
430 void writeComment(String programName, String programVersion) {
431    libsbmlJNI.XMLOutputStream_writeComment(swigCPtr, this, programName, programVersion);
432  }
433
434  
435/**
436   * Decreases the indentation level for this {@link XMLOutputStream}.
437   */ public
438 void downIndent() {
439    libsbmlJNI.XMLOutputStream_downIndent(swigCPtr, this);
440  }
441
442  
443/**
444   * Increases the indentation level for this {@link XMLOutputStream}.
445   */ public
446 void upIndent() {
447    libsbmlJNI.XMLOutputStream_upIndent(swigCPtr, this);
448  }
449
450  
451/**
452   * Returns the {@link SBMLNamespaces} object attached to this {@link XMLInputStream}
453   * if it has been set, null otherwise.
454   <p>
455   * @return the {@link SBMLNamespaces} object or null if none has been set.
456   */ public
457 SBMLNamespaces getSBMLNamespaces() {
458  return libsbml.DowncastSBMLNamespaces(libsbmlJNI.XMLOutputStream_getSBMLNamespaces(swigCPtr, this), false);
459}
460
461  
462/**
463   * Sets the {@link SBMLNamespaces} object to allow this stream to reference
464   * the available SBML namespaces being read.
465   */ public
466 void setSBMLNamespaces(SBMLNamespaces sbmlns) {
467    libsbmlJNI.XMLOutputStream_setSBMLNamespaces(swigCPtr, this, SBMLNamespaces.getCPtr(sbmlns), sbmlns);
468  }
469
470}