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 * <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 {@link 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.10.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   <p>
103   * @throws SBMLConstructorException 
104   * Thrown if the argument <code>orig</code> is <code>null.</code>
105   */ public
106 SBMLResolver(SBMLResolver c) {
107    this(libsbmlJNI.new_SBMLResolver__SWIG_1(SBMLResolver.getCPtr(c), c), true);
108  }
109
110  
111/**
112   * Creates and returns a deep copy of this {@link SBMLResolver} object.
113   <p>
114   * @return a (deep) copy of this {@link SBMLResolver} object.
115   */ public
116 SBMLResolver cloneObject() {
117    long cPtr = libsbmlJNI.SBMLResolver_cloneObject(swigCPtr, this);
118    return (cPtr == 0) ? null : new SBMLResolver(cPtr, true);
119  }
120
121  
122/**
123   * Resolves the document for the given URI.
124   <p>
125   * @param uri the URI to the target document
126   * @param baseUri base URI, in case the URI is a relative one
127   <p>
128   * @return  the document, if this resolver can resolve the document or null.
129   */ public
130 SBMLDocument resolve(String uri, String baseUri) {
131    long cPtr = libsbmlJNI.SBMLResolver_resolve__SWIG_0(swigCPtr, this, uri, baseUri);
132    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
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) {
145    long cPtr = libsbmlJNI.SBMLResolver_resolve__SWIG_1(swigCPtr, this, uri);
146    return (cPtr == 0) ? null : new SBMLDocument(cPtr, false);
147  }
148
149  
150/**
151   * Resolves the full URI for the given URI without actually reading the
152   * document.
153   <p>
154   * @param uri the URI to the target document
155   * @param baseUri base URI, in case the URI is a relative one
156   <p>
157   * @return  the full URI to the document, if this resolver can resolve the document or null.
158   */ public
159 SBMLUri resolveUri(String uri, String baseUri) {
160    long cPtr = libsbmlJNI.SBMLResolver_resolveUri__SWIG_0(swigCPtr, this, uri, baseUri);
161    return (cPtr == 0) ? null : new SBMLUri(cPtr, false);
162  }
163
164  
165/**
166   * Resolves the full URI for the given URI without actually reading the
167   * document.
168   <p>
169   * @param uri the URI to the target document
170   * @param baseUri base URI, in case the URI is a relative one
171   <p>
172   * @return  the full URI to the document, if this resolver can resolve the document or null.
173   */ public
174 SBMLUri resolveUri(String uri) {
175    long cPtr = libsbmlJNI.SBMLResolver_resolveUri__SWIG_1(swigCPtr, this, uri);
176    return (cPtr == 0) ? null : new SBMLUri(cPtr, false);
177  }
178
179}