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 * Implementation of SBML's ListOfConstraints construct. 013 <p> 014 * <p> 015 * The various ListOf___ classes in SBML 016 * are merely containers used for organizing the main components of an SBML 017 * model. In libSBML's implementation, ListOf___ 018 * classes are derived from the 019 * intermediate utility class {@link ListOf}, which 020 * is not defined by the SBML specifications but serves as a useful 021 * programmatic construct. {@link ListOf} is itself is in turn derived from {@link SBase}, 022 * which provides all of the various ListOf___ 023 * classes with common features 024 * defined by the SBML specification, such as 'metaid' attributes and 025 * annotations. 026 <p> 027 * The relationship between the lists and the rest of an SBML model is 028 * illustrated by the following (for SBML Level 2 Version 4): 029 <p> 030 * <figure> 031 <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object> 032</figure> 033 034 <p> 035 * Readers may wonder about the motivations for using the ListOf___ 036 * containers in SBML. A simpler approach in XML might be to place the 037 * components all directly at the top level of the model definition. The 038 * choice made in SBML is to group them within XML elements named after 039 * ListOf<em>Classname</em>, in part because it helps organize the 040 * components. More importantly, the fact that the container classes are 041 * derived from {@link SBase} means that software tools can add information <em>about</em> 042 * the lists themselves into each list container's 'annotation'. 043 <p> 044 * @see ListOfFunctionDefinitions 045 * @see ListOfUnitDefinitions 046 * @see ListOfCompartmentTypes 047 * @see ListOfSpeciesTypes 048 * @see ListOfCompartments 049 * @see ListOfSpecies 050 * @see ListOfParameters 051 * @see ListOfInitialAssignments 052 * @see ListOfRules 053 * @see ListOfConstraints 054 * @see ListOfReactions 055 * @see ListOfEvents 056 */ 057 058public class ListOfConstraints extends ListOf { 059 private long swigCPtr; 060 061 protected ListOfConstraints(long cPtr, boolean cMemoryOwn) 062 { 063 super(libsbmlJNI.ListOfConstraints_SWIGUpcast(cPtr), cMemoryOwn); 064 swigCPtr = cPtr; 065 } 066 067 protected static long getCPtr(ListOfConstraints obj) 068 { 069 return (obj == null) ? 0 : obj.swigCPtr; 070 } 071 072 protected static long getCPtrAndDisown (ListOfConstraints obj) 073 { 074 long ptr = 0; 075 076 if (obj != null) 077 { 078 ptr = obj.swigCPtr; 079 obj.swigCMemOwn = false; 080 } 081 082 return ptr; 083 } 084 085 protected void finalize() { 086 delete(); 087 } 088 089 public synchronized void delete() { 090 if (swigCPtr != 0) { 091 if (swigCMemOwn) { 092 swigCMemOwn = false; 093 libsbmlJNI.delete_ListOfConstraints(swigCPtr); 094 } 095 swigCPtr = 0; 096 } 097 super.delete(); 098 } 099 100 101/** 102 * Creates a new {@link ListOfConstraints} object. 103 <p> 104 * The object is constructed such that it is valid for the given SBML 105 * Level and Version combination. 106 <p> 107 * @param level the SBML Level 108 <p> 109 * @param version the Version within the SBML Level 110 */ public 111 ListOfConstraints(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 112 this(libsbmlJNI.new_ListOfConstraints__SWIG_0(level, version), true); 113 } 114 115 116/** 117 * Creates a new {@link ListOfConstraints} object. 118 <p> 119 * The object is constructed such that it is valid for the SBML Level and 120 * Version combination determined by the {@link SBMLNamespaces} object in 121 * <code>sbmlns</code>. 122 <p> 123 * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the 124 * characteristics of the {@link ListOfConstraints} object to be created. 125 */ public 126 ListOfConstraints(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 127 this(libsbmlJNI.new_ListOfConstraints__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 128 } 129 130 131/** 132 * Creates and returns a deep copy of this {@link ListOfConstraints} instance. 133 <p> 134 * @return a (deep) copy of this {@link ListOfConstraints}. 135 */ public 136 ListOfConstraints cloneObject() { 137 long cPtr = libsbmlJNI.ListOfConstraints_cloneObject(swigCPtr, this); 138 return (cPtr == 0) ? null : new ListOfConstraints(cPtr, true); 139 } 140 141 142/** 143 * Returns the libSBML type code for the objects contained in this {@link ListOf} 144 * (i.e., {@link Constraint} objects, if the list is non-empty). 145 <p> 146 * <p> 147 * LibSBML attaches an identifying code to every kind of SBML object. These 148 * are integer constants known as <em>SBML type codes</em>. The names of all 149 * the codes begin with the characters “<code>SBML_</code>”. 150 * In the Java language interface for libSBML, the 151 * type codes are defined as static integer constants in the interface class 152 * {@link libsbmlConstants}. Note that different Level 3 153 * package plug-ins may use overlapping type codes; to identify the package 154 * to which a given object belongs, call the <code>getPackageName()</code> 155 * method on the object. 156 <p> 157 * @return the SBML type code for the objects contained in this {@link ListOf} 158 * instance: {@link libsbmlConstants#SBML_CONSTRAINT SBML_CONSTRAINT} (default). 159 <p> 160 * @see #getElementName() 161 * @see #getPackageName() 162 */ public 163 int getItemTypeCode() { 164 return libsbmlJNI.ListOfConstraints_getItemTypeCode(swigCPtr, this); 165 } 166 167 168/** 169 * Returns the XML element name of this object. 170 <p> 171 * For {@link ListOfConstraints}, the XML element name is <code>'listOfConstraints'.</code> 172 <p> 173 * @return the name of this element, i.e., <code>'listOfConstraints'.</code> 174 */ public 175 String getElementName() { 176 return libsbmlJNI.ListOfConstraints_getElementName(swigCPtr, this); 177 } 178 179 180/** 181 * Get a {@link Constraint} from the {@link ListOfConstraints}. 182 <p> 183 * @param n the index number of the {@link Constraint} to get. 184 <p> 185 * @return the nth {@link Constraint} in this {@link ListOfConstraints}. 186 <p> 187 * @see #size() 188 */ public 189 Constraint get(long n) { 190 long cPtr = libsbmlJNI.ListOfConstraints_get__SWIG_0(swigCPtr, this, n); 191 return (cPtr == 0) ? null : new Constraint(cPtr, false); 192 } 193 194 195/** 196 * Removes the nth item from this {@link ListOfConstraints} items and returns a 197 * pointer to it. 198 <p> 199 * The caller owns the returned item and is responsible for deleting it. 200 <p> 201 * @param n the index of the item to remove 202 <p> 203 * @see #size() 204 */ public 205 Constraint remove(long n) { 206 long cPtr = libsbmlJNI.ListOfConstraints_remove(swigCPtr, this, n); 207 return (cPtr == 0) ? null : new Constraint(cPtr, true); 208 } 209 210}