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 * <span class="pkg-marker pkg-color-comp"><a href="group__comp.html">comp</a></span>
013 Base class for SBML resolvers.
014 <p>
015 * <p style='color: #777; font-style: italic'>
016This class of objects is defined by libSBML only and has no direct
017equivalent in terms of SBML components.  It is a class used in
018the implementation of extra functionality provided by libSBML.
019</p>
020
021 <p>
022 * The {@link SBMLResolver} class is the base class for the various SBML <em></em>
023 * resolvers: facilities that take a unique identifier as input and return
024 * the document associated with that identifier.  In SBML, resolvers come
025 * into play with the SBML Level&nbsp;3 Hierarchical Model Composition
026 * package; this package includes features that allow a model to be composed
027 * from pieces that are external to a given SBML document, which implies the
028 * need to be able to identify and locate those external pieces.  The
029 * {@link SBMLResolver} class and its subclasses provide facilities for software
030 * applications to be able to do these tasks.
031 <p>
032 * LibSBML provides a number of built-in resolvers, and applications can
033 * create their own by subclassing {@link SBMLResolver} and following the examples
034 * of the existing resolvers.  The following are the built-in resolvers
035 * in libSBML 5.13.0
036:
037 * <ul>
038 * <li> {@link SBMLFileResolver}
039 *
040 * </ul> <p>
041 * More resolvers may be provided by libSBML in the future.  Application
042 * authors may also write their own.  
043 <p>
044 * @see SBMLUri 
045 */
046
047public class SBMLResolver {
048   private long swigCPtr;
049   protected boolean swigCMemOwn;
050
051   protected SBMLResolver(long cPtr, boolean cMemoryOwn)
052   {
053     swigCMemOwn = cMemoryOwn;
054     swigCPtr    = cPtr;
055   }
056
057   protected static long getCPtr(SBMLResolver obj)
058   {
059     return (obj == null) ? 0 : obj.swigCPtr;
060   }
061
062   protected static long getCPtrAndDisown (SBMLResolver obj)
063   {
064     long ptr = 0;
065
066     if (obj != null)
067     {
068       ptr             = obj.swigCPtr;
069       obj.swigCMemOwn = false;
070     }
071
072     return ptr;
073   }
074
075  protected void finalize() {
076    delete();
077  }
078
079  public synchronized void delete() {
080    if (swigCPtr != 0) {
081      if (swigCMemOwn) {
082        swigCMemOwn = false;
083        libsbmlJNI.delete_SBMLResolver(swigCPtr);
084      }
085      swigCPtr = 0;
086    }
087  }
088
089  protected void swigDirectorDisconnect() {
090    swigCMemOwn = false;
091    delete();
092  }
093
094  public void swigReleaseOwnership() {
095    swigCMemOwn = false;
096    libsbmlJNI.SBMLResolver_change_ownership(this, swigCPtr, false);
097  }
098
099  public void swigTakeOwnership() {
100    swigCMemOwn = true;
101    libsbmlJNI.SBMLResolver_change_ownership(this, swigCPtr, true);
102  }
103
104  
105/**
106   * Creates a new {@link SBMLResolver} object.
107   */ public
108 SBMLResolver() {
109    this(libsbmlJNI.new_SBMLResolver__SWIG_0(), true);
110    libsbmlJNI.SBMLResolver_director_connect(this, swigCPtr, swigCMemOwn, true);
111  }
112
113  
114/**
115   * Copy constructor.  Creates a copy of an {@link SBMLResolver} object.
116   <p>
117   * @param c the {@link SBMLResolver} object to copy.
118   */ public
119 SBMLResolver(SBMLResolver c) {
120    this(libsbmlJNI.new_SBMLResolver__SWIG_1(SBMLResolver.getCPtr(c), c), true);
121    libsbmlJNI.SBMLResolver_director_connect(this, swigCPtr, swigCMemOwn, true);
122  }
123
124  
125/**
126   * Creates and returns a deep copy of this {@link SBMLResolver} object.
127   <p>
128   * @return a (deep) copy of this {@link SBMLResolver} object.
129   */ public
130 SBMLResolver cloneObject() {
131    long cPtr = (getClass() == SBMLResolver.class) ? libsbmlJNI.SBMLResolver_cloneObject(swigCPtr, this) : libsbmlJNI.SBMLResolver_cloneObjectSwigExplicitSBMLResolver(swigCPtr, this);
132    return (cPtr == 0) ? null : new SBMLResolver(cPtr, true);
133  }
134
135  
136/**
137   * Resolves the document for the given URI.
138   <p>
139   * @param uri the URI to the target document
140   * @param baseUri base URI, in case the URI is a relative one
141   <p>
142   * @return  the document, if this resolver can resolve the document or null.
143   */ public
144 SBMLDocument resolve(String uri, String baseUri) {
145    long cPtr = (getClass() == SBMLResolver.class) ? libsbmlJNI.SBMLResolver_resolve__SWIG_0(swigCPtr, this, uri, baseUri) : libsbmlJNI.SBMLResolver_resolveSwigExplicitSBMLResolver__SWIG_0(swigCPtr, this, uri, baseUri);
146    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
147  }
148
149  
150/**
151   * Resolves the document for the given URI.
152   <p>
153   * @param uri the URI to the target document
154   * @param baseUri base URI, in case the URI is a relative one
155   <p>
156   * @return  the document, if this resolver can resolve the document or null.
157   */ public
158 SBMLDocument resolve(String uri) {
159    long cPtr = (getClass() == SBMLResolver.class) ? libsbmlJNI.SBMLResolver_resolve__SWIG_1(swigCPtr, this, uri) : libsbmlJNI.SBMLResolver_resolveSwigExplicitSBMLResolver__SWIG_1(swigCPtr, this, uri);
160    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
161  }
162
163  
164/**
165   * Resolves the full URI for the given URI without actually reading the
166   * document.
167   <p>
168   * @param uri the URI to the target document
169   * @param baseUri base URI, in case the URI is a relative one
170   <p>
171   * @return  the full URI to the document, if this resolver can resolve the document or null.
172   */ public
173 SBMLUri resolveUri(String uri, String baseUri) {
174    long cPtr = (getClass() == SBMLResolver.class) ? libsbmlJNI.SBMLResolver_resolveUri__SWIG_0(swigCPtr, this, uri, baseUri) : libsbmlJNI.SBMLResolver_resolveUriSwigExplicitSBMLResolver__SWIG_0(swigCPtr, this, uri, baseUri);
175    return (cPtr == 0) ? null : new SBMLUri(cPtr, false);
176  }
177
178  
179/**
180   * Resolves the full URI for the given URI without actually reading the
181   * document.
182   <p>
183   * @param uri the URI to the target document
184   * @param baseUri base URI, in case the URI is a relative one
185   <p>
186   * @return  the full URI to the document, if this resolver can resolve the document or null.
187   */ public
188 SBMLUri resolveUri(String uri) {
189    long cPtr = (getClass() == SBMLResolver.class) ? libsbmlJNI.SBMLResolver_resolveUri__SWIG_1(swigCPtr, this, uri) : libsbmlJNI.SBMLResolver_resolveUriSwigExplicitSBMLResolver__SWIG_1(swigCPtr, this, uri);
190    return (cPtr == 0) ? null : new SBMLUri(cPtr, false);
191  }
192
193}