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 *  Log of diagnostics reported during processing.
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 * The error log is a list.  Each {@link SBMLDocument} maintains its own
023 * {@link SBMLErrorLog}.  When a libSBML operation on SBML content results in an
024 * error, or when there is something worth noting about the SBML content,
025 * the issue is reported as an {@link SBMLError} object stored in the {@link SBMLErrorLog}
026 * list.
027 <p>
028 * {@link SBMLErrorLog} is derived from {@link XMLErrorLog}, an object class that serves
029 * exactly the same purpose but for the XML parsing layer.  {@link XMLErrorLog}
030 * provides crucial methods such as
031 * {@link XMLErrorLog#getNumErrors()}
032 * for determining how many {@link SBMLError} or {@link XMLError} objects are in the log.
033 * {@link SBMLErrorLog} inherits these methods.
034 <p>
035 * The general approach to working with {@link SBMLErrorLog} in user programs
036 * involves first obtaining a pointer to a log from a libSBML object such
037 * as {@link SBMLDocument}.  Callers should then use
038 * {@link XMLErrorLog#getNumErrors()} to inquire how
039 * many objects there are in the list.  (The answer may be 0.)  If there is
040 * at least one {@link SBMLError} object in the {@link SBMLErrorLog} instance, callers can
041 * then iterate over the list using
042 * {@link SBMLErrorLog#getError(long n)}@if clike @endif,
043 * using methods provided by the {@link SBMLError} class to find out the error code
044 * and associated information such as the error severity, the message, and
045 * the line number in the input.
046 <p>
047 * If you wish to simply print the error strings for a human to read, an
048 * easier and more direct way might be to use {@link SBMLDocument#printErrors()}.
049 <p>
050 * @see SBMLError
051 * @see XMLErrorLog
052 * @see XMLError
053 */
054
055public class SBMLErrorLog extends XMLErrorLog {
056   private long swigCPtr;
057
058   protected SBMLErrorLog(long cPtr, boolean cMemoryOwn)
059   {
060     super(libsbmlJNI.SBMLErrorLog_SWIGUpcast(cPtr), cMemoryOwn);
061     swigCPtr = cPtr;
062   }
063
064   protected static long getCPtr(SBMLErrorLog obj)
065   {
066     return (obj == null) ? 0 : obj.swigCPtr;
067   }
068
069   protected static long getCPtrAndDisown (SBMLErrorLog obj)
070   {
071     long ptr = 0;
072
073     if (obj != null)
074     {
075       ptr             = obj.swigCPtr;
076       obj.swigCMemOwn = false;
077     }
078
079     return ptr;
080   }
081
082  protected void finalize() {
083    delete();
084  }
085
086  public synchronized void delete() {
087    if (swigCPtr != 0) {
088      if (swigCMemOwn) {
089        swigCMemOwn = false;
090        libsbmlJNI.delete_SBMLErrorLog(swigCPtr);
091      }
092      swigCPtr = 0;
093    }
094    super.delete();
095  }
096
097  
098/**
099   * Returns the <i>n</i>th {@link SBMLError} object in this log.
100   <p>
101   * Index <code>n</code> is counted from 0.  Callers should first inquire about the
102   * number of items in the log by using the
103   * {@link XMLErrorLog#getNumErrors()} method.
104   * Attempts to use an error index number that exceeds the actual number
105   * of errors in the log will result in a <code>null</code> being returned.
106   <p>
107   * @param n the index number of the error to retrieve (with 0 being the
108   * first error).
109   <p>
110   * @return the <i>n</i>th {@link SBMLError} in this log, or <code>null</code> if <code>n</code> is
111   * greater than or equal to
112   * {@link XMLErrorLog#getNumErrors()}.
113   <p>
114   * @see #getNumErrors()
115   */ public
116 SBMLError getError(long n) {
117    long cPtr = libsbmlJNI.SBMLErrorLog_getError(swigCPtr, this, n);
118    return (cPtr == 0) ? null : new SBMLError(cPtr, false);
119  }
120
121  
122/**
123   * Returns the <i>n</i>th {@link SBMLError} object with given severity in this log.
124   <p>
125   * Index <code>n</code> is counted from 0.  Callers should first inquire about the
126   * number of items in the log by using the
127   * {@link SBMLErrorLog#getNumFailsWithSeverity(long severity)} method.
128   * Attempts to use an error index number that exceeds the actual number
129   * of errors in the log will result in a <code>null</code> being returned.
130   <p>
131   * @param n the index number of the error to retrieve (with 0 being the
132   * first error).
133   * @param severity the severity of the error to retrieve 
134   <p>
135   * @return the <i>n</i>th {@link SBMLError} in this log, or <code>null</code> if <code>n</code> is
136   * greater than or equal to
137   * {@link SBMLErrorLog#getNumFailsWithSeverity(long severity)}.
138   <p>
139   * @see #getNumFailsWithSeverity(long severity)
140   */ public
141 SBMLError getErrorWithSeverity(long n, long severity) {
142    long cPtr = libsbmlJNI.SBMLErrorLog_getErrorWithSeverity(swigCPtr, this, n, severity);
143    return (cPtr == 0) ? null : new SBMLError(cPtr, false);
144  }
145
146  
147/**
148   * Returns the number of errors that have been logged with the given
149   * severity code.
150   <p>
151   * <p>
152 * LibSBML associates severity levels with every {@link SBMLError} object to
153 * provide an indication of how serious the problem is.  Severities range
154 * from informational diagnostics to fatal (irrecoverable) errors.  Given
155 * an {@link SBMLError} object instance, a caller can interrogate it for its
156 * severity level using methods such as {@link SBMLError#getSeverity()},
157 * {@link SBMLError#isFatal()}, and so on.  The present method encapsulates
158 * iteration and interrogation of all objects in an {@link SBMLErrorLog}, making
159 * it easy to check for the presence of error objects with specific
160 * severity levels.
161   <p>
162   * @param severity a
163   * value from the set of <code>LIBSBML_SEV_</code> constants defined by
164   * the interface class <code><a
165   * href='libsbmlConstants.html'>libsbmlConstants</a></code> 
166   <p>
167   * @return a count of the number of errors with the given severity code.
168   <p>
169   * @see #getNumErrors()
170   */ public
171 long getNumFailsWithSeverity(long severity) {
172    return libsbmlJNI.SBMLErrorLog_getNumFailsWithSeverity__SWIG_0(swigCPtr, this, severity);
173  }
174
175  
176/** * @internal */ public
177 SBMLErrorLog() {
178    this(libsbmlJNI.new_SBMLErrorLog__SWIG_0(), true);
179  }
180
181  
182/** * @internal */ public
183 SBMLErrorLog(SBMLErrorLog other) {
184    this(libsbmlJNI.new_SBMLErrorLog__SWIG_1(SBMLErrorLog.getCPtr(other), other), true);
185  }
186
187  
188/** * @internal */ public
189 void logError(long errorId, long level, long version, String details, long line, long column, long severity, long category) {
190    libsbmlJNI.SBMLErrorLog_logError__SWIG_0(swigCPtr, this, errorId, level, version, details, line, column, severity, category);
191  }
192
193  
194/** * @internal */ public
195 void logError(long errorId, long level, long version, String details, long line, long column, long severity) {
196    libsbmlJNI.SBMLErrorLog_logError__SWIG_1(swigCPtr, this, errorId, level, version, details, line, column, severity);
197  }
198
199  
200/** * @internal */ public
201 void logError(long errorId, long level, long version, String details, long line, long column) {
202    libsbmlJNI.SBMLErrorLog_logError__SWIG_2(swigCPtr, this, errorId, level, version, details, line, column);
203  }
204
205  
206/** * @internal */ public
207 void logError(long errorId, long level, long version, String details, long line) {
208    libsbmlJNI.SBMLErrorLog_logError__SWIG_3(swigCPtr, this, errorId, level, version, details, line);
209  }
210
211  
212/** * @internal */ public
213 void logError(long errorId, long level, long version, String details) {
214    libsbmlJNI.SBMLErrorLog_logError__SWIG_4(swigCPtr, this, errorId, level, version, details);
215  }
216
217  
218/** * @internal */ public
219 void logError(long errorId, long level, long version) {
220    libsbmlJNI.SBMLErrorLog_logError__SWIG_5(swigCPtr, this, errorId, level, version);
221  }
222
223  
224/** * @internal */ public
225 void logError(long errorId, long level) {
226    libsbmlJNI.SBMLErrorLog_logError__SWIG_6(swigCPtr, this, errorId, level);
227  }
228
229  
230/** * @internal */ public
231 void logError(long errorId) {
232    libsbmlJNI.SBMLErrorLog_logError__SWIG_7(swigCPtr, this, errorId);
233  }
234
235  
236/** * @internal */ public
237 void logError() {
238    libsbmlJNI.SBMLErrorLog_logError__SWIG_8(swigCPtr, this);
239  }
240
241  
242/** * @internal */ public
243 void logPackageError(String arg0, long errorId, long pkgVersion, long level, long version, String details, long line, long column, long severity, long category) {
244    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_0(swigCPtr, this, arg0, errorId, pkgVersion, level, version, details, line, column, severity, category);
245  }
246
247  
248/** * @internal */ public
249 void logPackageError(String arg0, long errorId, long pkgVersion, long level, long version, String details, long line, long column, long severity) {
250    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_1(swigCPtr, this, arg0, errorId, pkgVersion, level, version, details, line, column, severity);
251  }
252
253  
254/** * @internal */ public
255 void logPackageError(String arg0, long errorId, long pkgVersion, long level, long version, String details, long line, long column) {
256    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_2(swigCPtr, this, arg0, errorId, pkgVersion, level, version, details, line, column);
257  }
258
259  
260/** * @internal */ public
261 void logPackageError(String arg0, long errorId, long pkgVersion, long level, long version, String details, long line) {
262    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_3(swigCPtr, this, arg0, errorId, pkgVersion, level, version, details, line);
263  }
264
265  
266/** * @internal */ public
267 void logPackageError(String arg0, long errorId, long pkgVersion, long level, long version, String details) {
268    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_4(swigCPtr, this, arg0, errorId, pkgVersion, level, version, details);
269  }
270
271  
272/** * @internal */ public
273 void logPackageError(String arg0, long errorId, long pkgVersion, long level, long version) {
274    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_5(swigCPtr, this, arg0, errorId, pkgVersion, level, version);
275  }
276
277  
278/** * @internal */ public
279 void logPackageError(String arg0, long errorId, long pkgVersion, long level) {
280    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_6(swigCPtr, this, arg0, errorId, pkgVersion, level);
281  }
282
283  
284/** * @internal */ public
285 void logPackageError(String arg0, long errorId, long pkgVersion) {
286    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_7(swigCPtr, this, arg0, errorId, pkgVersion);
287  }
288
289  
290/** * @internal */ public
291 void logPackageError(String arg0, long errorId) {
292    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_8(swigCPtr, this, arg0, errorId);
293  }
294
295  
296/** * @internal */ public
297 void logPackageError(String arg0) {
298    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_9(swigCPtr, this, arg0);
299  }
300
301  
302/** * @internal */ public
303 void logPackageError() {
304    libsbmlJNI.SBMLErrorLog_logPackageError__SWIG_10(swigCPtr, this);
305  }
306
307  
308/** * @internal */ public
309 void add(SBMLError error) {
310    libsbmlJNI.SBMLErrorLog_add(swigCPtr, this, SBMLError.getCPtr(error), error);
311  }
312
313  
314/**
315   * Removes an error having errorId from the {@link SBMLError} list.
316   <p>
317   * Only the first item will be removed if there are multiple errors
318   * with the given errorId.
319   <p>
320   * @param errorId the error identifier of the error to be removed.
321   */ public
322 void remove(long errorId) {
323    libsbmlJNI.SBMLErrorLog_remove(swigCPtr, this, errorId);
324  }
325
326  
327/**
328   * Removes all errors having errorId from the {@link SBMLError} list.
329   <p>
330   * @param errorId the error identifier of the error to be removed.
331   */ public
332 void removeAll(long errorId) {
333    libsbmlJNI.SBMLErrorLog_removeAll(swigCPtr, this, errorId);
334  }
335
336  
337/**
338   * Returns true if {@link SBMLErrorLog} contains an errorId
339   <p>
340   * @param errorId the error identifier of the error to be found.
341   */ public
342 boolean contains(long errorId) {
343    return libsbmlJNI.SBMLErrorLog_contains(swigCPtr, this, errorId);
344  }
345
346}