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 * <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.12.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  
090/**
091   * Creates a new {@link SBMLResolver} object.
092   */ public
093 SBMLResolver() {
094    this(libsbmlJNI.new_SBMLResolver__SWIG_0(), true);
095  }
096
097  
098/**
099   * Copy constructor.  Creates a copy of an {@link SBMLResolver} object.
100   <p>
101   * @param c the {@link SBMLResolver} object to copy.
102   */ public
103 SBMLResolver(SBMLResolver c) {
104    this(libsbmlJNI.new_SBMLResolver__SWIG_1(SBMLResolver.getCPtr(c), c), true);
105  }
106
107  
108/**
109   * Creates and returns a deep copy of this {@link SBMLResolver} object.
110   <p>
111   * @return a (deep) copy of this {@link SBMLResolver} object.
112   */ public
113 SBMLResolver cloneObject() {
114    long cPtr = libsbmlJNI.SBMLResolver_cloneObject(swigCPtr, this);
115    return (cPtr == 0) ? null : new SBMLResolver(cPtr, true);
116  }
117
118  
119/**
120   * Resolves the document for the given URI.
121   <p>
122   * @param uri the URI to the target document
123   * @param baseUri base URI, in case the URI is a relative one
124   <p>
125   * @return  the document, if this resolver can resolve the document or null.
126   */ public
127 SBMLDocument resolve(String uri, String baseUri) {
128    long cPtr = libsbmlJNI.SBMLResolver_resolve__SWIG_0(swigCPtr, this, uri, baseUri);
129    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
130  }
131
132  
133/**
134   * Resolves the document for the given URI.
135   <p>
136   * @param uri the URI to the target document
137   * @param baseUri base URI, in case the URI is a relative one
138   <p>
139   * @return  the document, if this resolver can resolve the document or null.
140   */ public
141 SBMLDocument resolve(String uri) {
142    long cPtr = libsbmlJNI.SBMLResolver_resolve__SWIG_1(swigCPtr, this, uri);
143    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
144  }
145
146  
147/**
148   * Resolves the full URI for the given URI without actually reading the
149   * document.
150   <p>
151   * @param uri the URI to the target document
152   * @param baseUri base URI, in case the URI is a relative one
153   <p>
154   * @return  the full URI to the document, if this resolver can resolve the document or null.
155   */ public
156 SBMLUri resolveUri(String uri, String baseUri) {
157    long cPtr = libsbmlJNI.SBMLResolver_resolveUri__SWIG_0(swigCPtr, this, uri, baseUri);
158    return (cPtr == 0) ? null : new SBMLUri(cPtr, false);
159  }
160
161  
162/**
163   * Resolves the full URI for the given URI without actually reading the
164   * document.
165   <p>
166   * @param uri the URI to the target document
167   * @param baseUri base URI, in case the URI is a relative one
168   <p>
169   * @return  the full URI to the document, if this resolver can resolve the document or null.
170   */ public
171 SBMLUri resolveUri(String uri) {
172    long cPtr = libsbmlJNI.SBMLResolver_resolveUri__SWIG_1(swigCPtr, this, uri);
173    return (cPtr == 0) ? null : new SBMLUri(cPtr, false);
174  }
175
176}