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 * Exceptions thrown by some libSBML constructors. 013 <p> 014 * In some situations, constructors for SBML objects may need to indicate to 015 * callers that the creation of the object failed. The failure may be for 016 * different reasons, such as an attempt to use invalid parameters or a 017 * system condition such as a memory error. To communicate this to callers, 018 * those classes will throw an {@link SBMLConstructorException}. 019 <p> 020 * In languages that don't have an exception mechanism (e.g., C), the 021 * constructors generally try to return an error code instead of throwing 022 * an exception. 023 */ 024 025public class SBMLConstructorException extends java.lang.IllegalArgumentException { 026 private long swigCPtr; 027 protected boolean swigCMemOwn; 028 029 protected SBMLConstructorException(long cPtr, boolean cMemoryOwn) 030 { 031 swigCMemOwn = cMemoryOwn; 032 swigCPtr = cPtr; 033 } 034 035 protected static long getCPtr(SBMLConstructorException obj) 036 { 037 return (obj == null) ? 0 : obj.swigCPtr; 038 } 039 040 protected static long getCPtrAndDisown (SBMLConstructorException obj) 041 { 042 long ptr = 0; 043 044 if (obj != null) 045 { 046 ptr = obj.swigCPtr; 047 obj.swigCMemOwn = false; 048 } 049 050 return ptr; 051 } 052 053 protected void finalize() { 054 delete(); 055 } 056 057 public synchronized void delete() { 058 if (swigCPtr != 0) { 059 if (swigCMemOwn) { 060 swigCMemOwn = false; 061 libsbmlJNI.delete_SBMLConstructorException(swigCPtr); 062 } 063 swigCPtr = 0; 064 } 065 } 066 067 protected SBMLConstructorException(long cPtr, boolean cMemoryOwn, String v) 068 { 069 super(v); 070 swigCMemOwn = cMemoryOwn; 071 swigCPtr = cPtr; 072 } 073 074 /** 075 * Exception thrown by libSBML object constructors if something prevents 076 * the object from being properly created. 077 * 078 * An example of what can cause this exception to be thrown is attempting 079 * to create an SBML component with an invalid SBML Level/Version 080 * combination. 081 */ 082 public SBMLConstructorException(String v) 083 { 084 this(libsbmlJNI.new_SBMLConstructorException__SWIG_0(), true, v); 085 } 086 087 088/** * @internal */ public 089 SBMLConstructorException() { 090 this(libsbmlJNI.new_SBMLConstructorException__SWIG_0(), true); 091 } 092 093 094/** * @internal */ public 095 SBMLConstructorException(String errmsg, String sbmlErrMsg) { 096 this(libsbmlJNI.new_SBMLConstructorException__SWIG_1(errmsg, sbmlErrMsg), true); 097 } 098 099 100/** * @internal */ public 101 SBMLConstructorException(String elementName, SBMLNamespaces xmlns) { 102 this(libsbmlJNI.new_SBMLConstructorException__SWIG_2(elementName, SBMLNamespaces.getCPtr(xmlns), xmlns), true); 103 } 104 105 106/** 107 * Returns the message associated with this SBML exception. 108 <p> 109 * @return the message string. 110 */ public 111 String getSBMLErrMsg() { 112 return libsbmlJNI.SBMLConstructorException_getSBMLErrMsg(swigCPtr, this); 113 } 114 115}