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 ListOfGroups extends ListOf { 012 private long swigCPtr; 013 014 protected ListOfGroups(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.ListOfGroups_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(ListOfGroups obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (ListOfGroups 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_ListOfGroups(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 054/** 055 * @return a (deep) copy of this ListOfGroups. 056 */ public 057 ListOfGroups cloneObject() { 058 long cPtr = libsbmlJNI.ListOfGroups_cloneObject(swigCPtr, this); 059 return (cPtr == 0) ? null : new ListOfGroups(cPtr, true); 060 } 061 062 063/** 064 * Creates a new ListOfGroups with the given level, version, and package version. 065 */ public 066 ListOfGroups(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 067 this(libsbmlJNI.new_ListOfGroups__SWIG_0(level, version, pkgVersion), true); 068 } 069 070 071/** 072 * Creates a new ListOfGroups with the given level, version, and package version. 073 */ public 074 ListOfGroups(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 075 this(libsbmlJNI.new_ListOfGroups__SWIG_1(level, version), true); 076 } 077 078 079/** 080 * Creates a new ListOfGroups with the given level, version, and package version. 081 */ public 082 ListOfGroups(long level) throws org.sbml.libsbml.SBMLConstructorException { 083 this(libsbmlJNI.new_ListOfGroups__SWIG_2(level), true); 084 } 085 086 087/** 088 * Creates a new ListOfGroups with the given level, version, and package version. 089 */ public 090 ListOfGroups() throws org.sbml.libsbml.SBMLConstructorException { 091 this(libsbmlJNI.new_ListOfGroups__SWIG_3(), true); 092 } 093 094 095/** 096 * Creates a new ListOfGroups with the given GroupsPkgNamespaces object. 097 */ public 098 ListOfGroups(GroupsPkgNamespaces groupsns) throws org.sbml.libsbml.SBMLConstructorException { 099 this(libsbmlJNI.new_ListOfGroups__SWIG_4(GroupsPkgNamespaces.getCPtr(groupsns), groupsns), true); 100 } 101 102 103/** 104 * Get a Group from the ListOfGroups. 105 <p> 106 * @param n the index number of the Group to get. 107 <p> 108 * @return the nth Group in this ListOfGroups. 109 <p> 110 * @see #size() 111 */ public 112 Group get(long n) { 113 long cPtr = libsbmlJNI.ListOfGroups_get__SWIG_0(swigCPtr, this, n); 114 return (cPtr == 0) ? null : new Group(cPtr, false); 115 } 116 117 118/** 119 * Get a Group from the ListOfGroups 120 * based on its identifier. 121 <p> 122 * @param sid a string representing the identifier 123 * of the Group to get. 124 <p> 125 * @return Group in this ListOfGroups 126 * with the given id or null if no such 127 * Group exists. 128 <p> 129 * @see #get(long n) 130 * @see #size() 131 */ public 132 Group get(String sid) { 133 long cPtr = libsbmlJNI.ListOfGroups_get__SWIG_2(swigCPtr, this, sid); 134 return (cPtr == 0) ? null : new Group(cPtr, false); 135 } 136 137 138/** 139 * Removes the nth item from this ListOfGroups items and returns a pointer to 140 * it. 141 <p> 142 * The caller owns the returned item and is responsible for deleting it. 143 <p> 144 * @param n the index of the item to remove 145 <p> 146 * @see #size() 147 */ public 148 Group remove(long n) { 149 long cPtr = libsbmlJNI.ListOfGroups_remove__SWIG_0(swigCPtr, this, n); 150 return (cPtr == 0) ? null : new Group(cPtr, true); 151 } 152 153 154/** 155 * Removes item in this ListOfGroups items with the given identifier. 156 <p> 157 * The caller owns the returned item and is responsible for deleting it. 158 * If none of the items in this list have the identifier <code>sid</code>, then @c 159 * null is returned. 160 <p> 161 * @param sid the identifier of the item to remove 162 <p> 163 * @return the item removed. As mentioned above, the caller owns the 164 * returned item. 165 */ public 166 Group remove(String sid) { 167 long cPtr = libsbmlJNI.ListOfGroups_remove__SWIG_1(swigCPtr, this, sid); 168 return (cPtr == 0) ? null : new Group(cPtr, true); 169 } 170 171 172/** 173 * @return the typecode (int) of SBML objects contained in this {@link ListOf} or 174 * SBML_UNKNOWN (default). 175 */ public 176 int getItemTypeCode() { 177 return libsbmlJNI.ListOfGroups_getItemTypeCode(swigCPtr, this); 178 } 179 180 181/** 182 * Subclasses should override this method to return XML element name of 183 * this SBML object. 184 <p> 185 * @return the string of the name of this element. 186 */ public 187 String getElementName() { 188 return libsbmlJNI.ListOfGroups_getElementName(swigCPtr, this); 189 } 190 191}