1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.2
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package org.sbml.libsbml;
10 
11 /**
12  *  Registry of all libSBML SBML DefinitionURLs.
13  <p>
14  * <p style='color: #777; font-style: italic'>
15 This class of objects is defined by libSBML only and has no direct
16 equivalent in terms of SBML components.  It is a class used in
17 the implementation of extra functionality provided by libSBML.
18 </p>
19 
20  <p>
21  * LibSBML provides facilities for transforming and converting SBML
22  * documents in various ways.  These transformations can involve
23  * essentially anything that can be written algorithmically; examples
24  * include converting the units of measurement in a model, or converting
25  * from one Level+Version combination of SBML to another.  DefinitionURLs are
26  * implemented as objects derived from the class DefinitionURL.
27  <p>
28  * The DefinitionURL registry, implemented as a singleton object of class
29  * {@link DefinitionURLRegistry}, maintains a list of known DefinitionURLs and provides
30  * methods for discovering them.  Callers can use the method
31  * {@link DefinitionURLRegistry#getNumDefinitionURLs()} to find out how many
32  * DefinitionURLs are registered, then use
33  * {@link DefinitionURLRegistry#getDefinitionURLByIndex(int)} to
34  * iterate over each one; alternatively, callers can use
35  * {@link DefinitionURLRegistry#getDefinitionURLFor(ConversionProperties)}
36  * to search for a DefinitionURL having specific properties.
37  */
38 
39 public class DefinitionURLRegistry {
40    private long swigCPtr;
41    protected boolean swigCMemOwn;
42 
DefinitionURLRegistry(long cPtr, boolean cMemoryOwn)43    protected DefinitionURLRegistry(long cPtr, boolean cMemoryOwn)
44    {
45      swigCMemOwn = cMemoryOwn;
46      swigCPtr    = cPtr;
47    }
48 
getCPtr(DefinitionURLRegistry obj)49    protected static long getCPtr(DefinitionURLRegistry obj)
50    {
51      return (obj == null) ? 0 : obj.swigCPtr;
52    }
53 
getCPtrAndDisown(DefinitionURLRegistry obj)54    protected static long getCPtrAndDisown (DefinitionURLRegistry obj)
55    {
56      long ptr = 0;
57 
58      if (obj != null)
59      {
60        ptr             = obj.swigCPtr;
61        obj.swigCMemOwn = false;
62      }
63 
64      return ptr;
65    }
66 
67   @SuppressWarnings("deprecation")
finalize()68   protected void finalize() {
69     delete();
70   }
71 
delete()72   public synchronized void delete() {
73     if (swigCPtr != 0) {
74       if (swigCMemOwn) {
75         swigCMemOwn = false;
76         libsbmlJNI.delete_DefinitionURLRegistry(swigCPtr);
77       }
78       swigCPtr = 0;
79     }
80   }
81 
82 
83 /**
84    * Returns the singleton instance for the DefinitionURL registry.
85    <p>
86    * Prior to using the registry, callers have to obtain a copy of the
87    * registry.  This static method provides the means for doing that.
88    <p>
89    * @return the singleton for the DefinitionURL registry.
90    */ public
getInstance()91  static DefinitionURLRegistry getInstance() {
92     return new DefinitionURLRegistry(libsbmlJNI.DefinitionURLRegistry_getInstance(), false);
93   }
94 
95 
96 /**
97    * Adds the given DefinitionURL to the registry of SBML DefinitionURLs.
98    <p>
99    * @param url the DefinitionURL to add to the registry.
100    * @param type the {@link ASTNodeType_t} of the URL to add to the registry.
101    <p>
102    * <p>
103  * @return integer value indicating success/failure of the
104  * function.   The possible values
105  * returned by this function are:
106    * <ul>
107    * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
108    * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
109    * </ul>
110    */ public
addDefinitionURL(String url, int type)111  static int addDefinitionURL(String url, int type) {
112     return libsbmlJNI.DefinitionURLRegistry_addDefinitionURL(url, type);
113   }
114 
115 
116 /**
117    * Returns the number of DefinitionURLs known by the registry.
118    <p>
119    * @return the number of registered DefinitionURLs.
120    <p>
121    * @see #getDefinitionURLByIndex(int)
122    */ public
getNumDefinitionURLs()123  static int getNumDefinitionURLs() {
124     return libsbmlJNI.DefinitionURLRegistry_getNumDefinitionURLs();
125   }
126 
127 
128 /** */ public
addSBMLDefinitions()129  static void addSBMLDefinitions() {
130     libsbmlJNI.DefinitionURLRegistry_addSBMLDefinitions();
131   }
132 
133 
134 /** */ public
getCoreDefinitionsAdded()135  static boolean getCoreDefinitionsAdded() {
136     return libsbmlJNI.DefinitionURLRegistry_getCoreDefinitionsAdded();
137   }
138 
139 
140 /** */ public
getType(String url)141  static int getType(String url) {
142     return libsbmlJNI.DefinitionURLRegistry_getType(url);
143   }
144 
145 
146 /** */ public
getDefinitionUrlByIndex(int index)147  static String getDefinitionUrlByIndex(int index) {
148     return libsbmlJNI.DefinitionURLRegistry_getDefinitionUrlByIndex(index);
149   }
150 
151 
152 /** */ public
clearDefinitions()153  static void clearDefinitions() {
154     libsbmlJNI.DefinitionURLRegistry_clearDefinitions();
155   }
156 
157 }
158