001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 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 * 013 * Implementation of SBML's ListOfSpeciesReferences construct. 014 * <p> 015 * The {@link ListOfSpeciesReferences} class is used to store lists of reactants 016 * and products in a {@link Reaction} object. 017 * <p> 018 * As with the various other ListOf___ classes in SBML, the 019 * {@link ListOfSpeciesReferences} is merely a container used for organizing 020 * instances of other objects, in this case {@link SpeciesReference} objects. 021 * {@link ListOfSpeciesReferences} is derived from the abstract class {@link SBase}, and 022 * inherit the various attributes and subelements of {@link SBase}, such as 023 * 'metaid' as and 'annotation'. The ListOf___ classes do not add any 024 * attributes of their own. 025 */ 026 027public class ListOfSpeciesReferences extends ListOf { 028 private long swigCPtr; 029 030 protected ListOfSpeciesReferences(long cPtr, boolean cMemoryOwn) 031 { 032 super(libsbmlJNI.ListOfSpeciesReferences_SWIGUpcast(cPtr), cMemoryOwn); 033 swigCPtr = cPtr; 034 } 035 036 protected static long getCPtr(ListOfSpeciesReferences obj) 037 { 038 return (obj == null) ? 0 : obj.swigCPtr; 039 } 040 041 protected static long getCPtrAndDisown (ListOfSpeciesReferences obj) 042 { 043 long ptr = 0; 044 045 if (obj != null) 046 { 047 ptr = obj.swigCPtr; 048 obj.swigCMemOwn = false; 049 } 050 051 return ptr; 052 } 053 054 protected void finalize() { 055 delete(); 056 } 057 058 public synchronized void delete() { 059 if (swigCPtr != 0) { 060 if (swigCMemOwn) { 061 swigCMemOwn = false; 062 libsbmlJNI.delete_ListOfSpeciesReferences(swigCPtr); 063 } 064 swigCPtr = 0; 065 } 066 super.delete(); 067 } 068 069 070/** 071 * Creates a new, empty {@link ListOfSpeciesReferences} object. 072 * <p> 073 * The object is constructed such that it is valid for the given SBML 074 * Level and Version combination. 075 * <p> 076 * @param level the SBML Level 077 * <p> 078 * @param version the Version within the SBML Level 079 */ public 080 ListOfSpeciesReferences(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 081 this(libsbmlJNI.new_ListOfSpeciesReferences__SWIG_0(level, version), true); 082 } 083 084 085/** 086 * Creates a new {@link ListOfSpeciesReferences} object. 087 * <p> 088 * The object is constructed such that it is valid for the SBML Level and 089 * Version combination determined by the {@link SBMLNamespaces} object in 090 * <code>sbmlns</code>. 091 * <p> 092 * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the 093 * characteristics of the {@link ListOfSpeciesReferences} object to be created. 094 */ public 095 ListOfSpeciesReferences(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 096 this(libsbmlJNI.new_ListOfSpeciesReferences__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 097 } 098 099 100/** 101 * Creates and returns a deep copy of this {@link ListOfSpeciesReferences} 102 * instance. 103 * <p> 104 * @return a (deep) copy of this {@link ListOfSpeciesReferences}. 105 */ public 106 ListOfSpeciesReferences cloneObject() { 107 long cPtr = libsbmlJNI.ListOfSpeciesReferences_cloneObject(swigCPtr, this); 108 return (cPtr == 0) ? null : new ListOfSpeciesReferences(cPtr, true); 109 } 110 111 112/** 113 * Returns the libSBML type code for this SBML object. 114 * <p> 115 * LibSBML attaches an identifying code to every 116 * kind of SBML object. These are known as <em>SBML type codes</em>. In 117 * other languages, the set of type codes is stored in an enumeration; in 118 * the Java language interface for libSBML, the type codes are defined as 119 * static integer constants in the interface class {@link 120 * libsbmlConstants}. The names of the type codes all begin with the 121 * characters <code>SBML_.</code> 122 * <p> 123 * @return the SBML type code for this object, or {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default). 124 * <p> 125 * @see #getElementName() 126 */ public 127 int getTypeCode() { 128 return libsbmlJNI.ListOfSpeciesReferences_getTypeCode(swigCPtr, this); 129 } 130 131 132/** 133 * Returns the libSBML type code for the objects contained in this {@link ListOf} 134 * (i.e., {@link SpeciesReference} objects, if the list is non-empty). 135 * <p> 136 * LibSBML attaches an identifying code to every 137 * kind of SBML object. These are known as <em>SBML type codes</em>. In 138 * other languages, the set of type codes is stored in an enumeration; in 139 * the Java language interface for libSBML, the type codes are defined as 140 * static integer constants in the interface class {@link 141 * libsbmlConstants}. The names of the type codes all begin with the 142 * characters <code>SBML_.</code> 143 * <p> 144 * @return the SBML type code for the objects contained in this {@link ListOf} 145 * instance, or {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default). 146 * <p> 147 * @see #getElementName() 148 */ public 149 int getItemTypeCode() { 150 return libsbmlJNI.ListOfSpeciesReferences_getItemTypeCode(swigCPtr, this); 151 } 152 153 154/** 155 * Returns the XML element name of this object. 156 * <p> 157 * For {@link ListOfSpeciesReferences}, the XML element name is 158 * <code>'listOfSpeciesReferences'.</code> 159 * <p> 160 * @return the name of this element, i.e., <code>'listOfSpeciesReferences'.</code> 161 */ public 162 String getElementName() { 163 return libsbmlJNI.ListOfSpeciesReferences_getElementName(swigCPtr, this); 164 } 165 166 167/** 168 * Get a {@link SpeciesReference} from the {@link ListOfSpeciesReferences}. 169 * <p> 170 * @param n the index number of the {@link SpeciesReference} to get. 171 * <p> 172 * @return the nth {@link SpeciesReference} in this {@link ListOfSpeciesReferences}. 173 * <p> 174 * @see #size() 175 */ public 176 SimpleSpeciesReference get(long n) { 177 return (SimpleSpeciesReference) libsbml.DowncastSBase(libsbmlJNI.ListOfSpeciesReferences_get__SWIG_0(swigCPtr, this, n), false); 178} 179 180 181/** 182 * Get a {@link SpeciesReference} from the {@link ListOfSpeciesReferences} 183 * based on its identifier. 184 * <p> 185 * @param sid a string representing the identifier 186 * of the {@link SpeciesReference} to get. 187 * <p> 188 * @return {@link SpeciesReference} in this {@link ListOfSpeciesReferences} 189 * with the given <code>sid</code> or <code>null</code> if no such 190 * {@link SpeciesReference} exists. 191 * <p> 192 * @see #get(long n) 193 * @see #size() 194 */ public 195 SimpleSpeciesReference get(String sid) { 196 return (SimpleSpeciesReference) libsbml.DowncastSBase(libsbmlJNI.ListOfSpeciesReferences_get__SWIG_2(swigCPtr, this, sid), false); 197} 198 199 200/** 201 * Removes the nth item from this {@link ListOfSpeciesReferences} items and returns a pointer to 202 * it. 203 * <p> 204 * The caller owns the returned item and is responsible for deleting it. 205 * <p> 206 * @param n the index of the item to remove 207 * <p> 208 * @see #size() 209 */ public 210 SimpleSpeciesReference remove(long n) { 211 return (SimpleSpeciesReference) libsbml.DowncastSBase(libsbmlJNI.ListOfSpeciesReferences_remove__SWIG_0(swigCPtr, this, n), true); 212} 213 214 215/** 216 * Removes item in this {@link ListOfSpeciesReferences} items with the given identifier. 217 * <p> 218 * The caller owns the returned item and is responsible for deleting it. 219 * If none of the items in this list have the identifier <code>sid</code>, then 220 * <code>null</code> is returned. 221 * <p> 222 * @param sid the identifier of the item to remove 223 * <p> 224 * @return the item removed. As mentioned above, the caller owns the 225 * returned item. 226 */ public 227 SimpleSpeciesReference remove(String sid) { 228 return (SimpleSpeciesReference) libsbml.DowncastSBase(libsbmlJNI.ListOfSpeciesReferences_remove__SWIG_1(swigCPtr, this, sid), true); 229} 230 231}