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 011public class GroupsModelPlugin extends SBasePlugin { 012 private long swigCPtr; 013 014 protected GroupsModelPlugin(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.GroupsModelPlugin_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(GroupsModelPlugin obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (GroupsModelPlugin obj) 026 { 027 long ptr = 0; 028 029 if (obj != null) 030 { 031 ptr = obj.swigCPtr; 032 obj.swigCMemOwn = false; 033 } 034 035 return ptr; 036 } 037 038 protected void finalize() { 039 delete(); 040 } 041 042 public synchronized void delete() { 043 if (swigCPtr != 0) { 044 if (swigCMemOwn) { 045 swigCMemOwn = false; 046 libsbmlJNI.delete_GroupsModelPlugin(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 054/** 055 * Creates a new GroupsModelPlugin 056 */ public 057 GroupsModelPlugin(String uri, String prefix, GroupsPkgNamespaces groupsns) { 058 this(libsbmlJNI.new_GroupsModelPlugin__SWIG_0(uri, prefix, GroupsPkgNamespaces.getCPtr(groupsns), groupsns), true); 059 } 060 061 062/** 063 * Copy constructor for GroupsModelPlugin. 064 <p> 065 * @param orig; the GroupsModelPlugin instance to copy. 066 */ public 067 GroupsModelPlugin(GroupsModelPlugin orig) { 068 this(libsbmlJNI.new_GroupsModelPlugin__SWIG_1(GroupsModelPlugin.getCPtr(orig), orig), true); 069 } 070 071 072/** 073 * Creates and returns a deep copy of this GroupsModelPlugin object. 074 <p> 075 * @return a (deep) copy of this {@link SBase} object 076 */ public 077 SBasePlugin cloneObject() { 078 long cPtr = libsbmlJNI.GroupsModelPlugin_cloneObject(swigCPtr, this); 079 return (cPtr == 0) ? null : new GroupsModelPlugin(cPtr, true); 080 } 081 082 083/** 084 * Subclasses must override this method to create, store, and then 085 * return an SBML object corresponding to the next {@link XMLToken} in the 086 * {@link XMLInputStream} if they have their specific elements. 087 <p> 088 * @return the SBML object corresponding to next {@link XMLToken} in the 089 * {@link XMLInputStream} or null if the token was not recognized. 090 * @internal 091 */ public 092 SBase createObject(XMLInputStream stream) { 093 return libsbml.DowncastSBase(libsbmlJNI.GroupsModelPlugin_createObject(swigCPtr, this, XMLInputStream.getCPtr(stream), stream), false); 094} 095 096 097/** 098 * Checks if this plugin object has all the required elements. 099 <p> 100 * Subclasses should override this function if they have their specific 101 * elements. 102 <p> 103 * @return true if this pugin object has all the required elements, 104 * otherwise false will be returned. 105 * @internal 106 */ public 107 boolean hasRequiredElements() { 108 return libsbmlJNI.GroupsModelPlugin_hasRequiredElements(swigCPtr, this); 109 } 110 111 112/** 113 * Returns the ListOfGroups in this plugin object. 114 <p> 115 * @return ListOfGroups object in this plugin object. 116 * @internal 117 */ public 118 ListOfGroups getListOfGroups() { 119 long cPtr = libsbmlJNI.GroupsModelPlugin_getListOfGroups__SWIG_0(swigCPtr, this); 120 return (cPtr == 0) ? null : new ListOfGroups(cPtr, false); 121 } 122 123 124/** 125 * Returns the Group object that belongs to the given index. If the 126 * index is invalid, null is returned. 127 <p> 128 * @param n the index number of the Group to get. 129 <p> 130 * @return the nth Group in the ListOfGroups. 131 * @internal 132 */ public 133 Group getGroup(long n) { 134 long cPtr = libsbmlJNI.GroupsModelPlugin_getGroup__SWIG_0(swigCPtr, this, n); 135 return (cPtr == 0) ? null : new Group(cPtr, false); 136 } 137 138 139/** 140 * Returns the group object based on its identifier. 141 <p> 142 * @param sid a string representing the identifier 143 * of the Group to get. 144 <p> 145 * @return Group in the ListOfGroups with the given id 146 * or null if no such Group exists. 147 <p> 148 * @see #get(long n) 149 * @see #size() 150 * @internal 151 */ public 152 Group getGroup(String sid) { 153 long cPtr = libsbmlJNI.GroupsModelPlugin_getGroup__SWIG_2(swigCPtr, this, sid); 154 return (cPtr == 0) ? null : new Group(cPtr, false); 155 } 156 157 158/** 159 * Adds a copy of the given Group object to the list of groups. 160 <p> 161 * @param group the Group object to be added to the list of groups. 162 <p> 163 * @return integer value indicating success/failure of the 164 * function. The possible values 165 * returned by this function are: 166 * <ul> 167 * <li> LIBSBML_OPERATION_SUCCESS 168 * @internal 169 * </ul> 170 */ public 171 int addGroup(Group group) { 172 return libsbmlJNI.GroupsModelPlugin_addGroup(swigCPtr, this, Group.getCPtr(group), group); 173 } 174 175 176/** 177 * Creates a new groups object and adds it to the list of groups objects 178 * and returns it. 179 <p> 180 * @return a newly created Group object 181 * @internal 182 */ public 183 Group createGroup() { 184 long cPtr = libsbmlJNI.GroupsModelPlugin_createGroup(swigCPtr, this); 185 return (cPtr == 0) ? null : new Group(cPtr, false); 186 } 187 188 189/** 190 * Removes the nth Group object from this plugin object and 191 * returns a pointer to it. 192 <p> 193 * The caller owns the returned object and is responsible for 194 * deleting it. 195 <p> 196 * @param n the index of the Group object to remove 197 <p> 198 * @return the Group object removed. As mentioned above, the 199 * caller owns the returned object. null is returned if the 200 * given index is out of range. 201 * @internal 202 */ public 203 Group removeGroup(long n) { 204 long cPtr = libsbmlJNI.GroupsModelPlugin_removeGroup__SWIG_0(swigCPtr, this, n); 205 return (cPtr == 0) ? null : new Group(cPtr, true); 206 } 207 208 209/** 210 * Removes the Group object with the given id attribute from 211 * this plugin object and returns a pointer to it. 212 <p> 213 * The caller owns the returned object and is responsible for 214 * deleting it. 215 <p> 216 * @param sid the id attribute of the Group object to remove 217 <p> 218 * @return the Group object removed. As mentioned above, the 219 * caller owns the returned object. null is returned if the 220 * given index is out of range. 221 * @internal 222 */ public 223 Group removeGroup(String sid) { 224 long cPtr = libsbmlJNI.GroupsModelPlugin_removeGroup__SWIG_1(swigCPtr, this, sid); 225 return (cPtr == 0) ? null : new Group(cPtr, true); 226 } 227 228 229/** 230 * Returns the number of Group object in this plugin object. 231 <p> 232 * @return the number of Group object in this plugin object. 233 * @internal 234 */ public 235 long getNumGroups() { 236 return libsbmlJNI.GroupsModelPlugin_getNumGroups(swigCPtr, this); 237 } 238 239 240/** 241 * Sets the parent SBML object of this plugin object to 242 * this object and child elements (if any). 243 * (Creates a child-parent relationship by this plugin object) 244 <p> 245 * This function is called when this object is created by 246 * the parent element. 247 * Subclasses must override this this function if they have one 248 * or more child elements.Also, {@link SBasePlugin#connectToParent()} 249 * must be called in the overridden function. 250 <p> 251 * @param sbase the {@link SBase} object to use 252 <p> 253 * @see setSBMLDocument 254 * @see enablePackageInternal 255 * @internal 256 */ public 257 void connectToParent(SBase sbase) { 258 libsbmlJNI.GroupsModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase); 259 } 260 261 262/** 263 * Enables/Disables the given package with child elements in this plugin 264 * object (if any). 265 * (This is an internal implementation invoked from 266 * {@link SBase#enablePakcageInternal()} function) 267 <p> 268 * @note Subclasses in which one or more {@link SBase} derived elements are 269 * defined must override this function. 270 <p> 271 * @see setSBMLDocument 272 * @see connectToParent 273 * @internal 274 */ public 275 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 276 libsbmlJNI.GroupsModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 277 } 278 279}