001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.10 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 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span> 013 014 Extension of {@link Model}. 015 */ 016 017public class LayoutModelPlugin extends SBasePlugin { 018 private long swigCPtr; 019 020 protected LayoutModelPlugin(long cPtr, boolean cMemoryOwn) 021 { 022 super(libsbmlJNI.LayoutModelPlugin_SWIGUpcast(cPtr), cMemoryOwn); 023 swigCPtr = cPtr; 024 } 025 026 protected static long getCPtr(LayoutModelPlugin obj) 027 { 028 return (obj == null) ? 0 : obj.swigCPtr; 029 } 030 031 protected static long getCPtrAndDisown (LayoutModelPlugin obj) 032 { 033 long ptr = 0; 034 035 if (obj != null) 036 { 037 ptr = obj.swigCPtr; 038 obj.swigCMemOwn = false; 039 } 040 041 return ptr; 042 } 043 044 protected void finalize() { 045 delete(); 046 } 047 048 public synchronized void delete() { 049 if (swigCPtr != 0) { 050 if (swigCMemOwn) { 051 swigCMemOwn = false; 052 libsbmlJNI.delete_LayoutModelPlugin(swigCPtr); 053 } 054 swigCPtr = 0; 055 } 056 super.delete(); 057 } 058 059 060/** 061 * Creates a new {@link LayoutModelPlugin} object using the given parameters. 062 <p> 063 * <p> 064 * In the XML representation of an SBML document, XML namespaces are used to 065 * identify the origin of each XML construct used. XML namespaces are 066 * identified by their unique resource identifiers (URIs). The core SBML 067 * specifications stipulate the namespaces that must be used for core SBML 068 * constructs; for example, all XML elements that belong to SBML Level 3 069 * Version 1 Core must be placed in the XML namespace identified by the URI 070 * <code>'http://www.sbml.org/sbml/level3/version1/core'</code>. Individual 071 * SBML Level 3 packages define their own XML namespaces; for example, 072 * all elements belonging to the SBML Level 3 Layout Version 1 073 * package must be placed in the XML namespace 074 * <code>'http://www.sbml.org/sbml/level3/version1/layout/version1/'</code>. 075 <p> 076 * <p> 077 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 078 * information. It is used to communicate the SBML Level, Version, and (in 079 * Level 3) packages used in addition to SBML Level 3 Core. A 080 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 081 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 082 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 083 <p> 084 * @param uri the URI of the SBML Level 3 package implemented by 085 * this libSBML package extension. 086 <p> 087 * @param prefix the XML namespace prefix being used for the package. 088 <p> 089 * @param layoutns the namespaces object for the package. 090 */ public 091 LayoutModelPlugin(String uri, String prefix, LayoutPkgNamespaces layoutns) { 092 this(libsbmlJNI.new_LayoutModelPlugin__SWIG_0(uri, prefix, LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 093 } 094 095 096/** 097 * Copy constructor. Creates a copy of this {@link SBase} object. 098 <p> 099 * @param orig the instance to copy. 100 */ public 101 LayoutModelPlugin(LayoutModelPlugin orig) { 102 this(libsbmlJNI.new_LayoutModelPlugin__SWIG_1(LayoutModelPlugin.getCPtr(orig), orig), true); 103 } 104 105 106/** 107 * Creates and returns a deep copy of this {@link LayoutModelPlugin} object. 108 <p> 109 * @return a (deep) copy of this {@link LayoutModelPlugin} object. 110 */ public 111 SBasePlugin cloneObject() { 112 long cPtr = libsbmlJNI.LayoutModelPlugin_cloneObject(swigCPtr, this); 113 return (cPtr == 0) ? null : new LayoutModelPlugin(cPtr, true); 114 } 115 116 117/** 118 * Returns the {@link ListOfLayouts} object for this {@link Model}. 119 <p> 120 * @return the {@link ListOfLayouts} object for this {@link Model}. 121 */ public 122 ListOfLayouts getListOfLayouts() { 123 long cPtr = libsbmlJNI.LayoutModelPlugin_getListOfLayouts__SWIG_0(swigCPtr, this); 124 return (cPtr == 0) ? null : new ListOfLayouts(cPtr, false); 125 } 126 127 128/** 129 * Returns the layout object that belongs to the given index. If the 130 * index is invalid, <code>null</code> is returned. 131 <p> 132 * @param index the index of list of layout objects. 133 <p> 134 * @return the {@link Layout} object that belongs to the given index. null 135 * is returned if the index is invalid. 136 */ public 137 Layout getLayout(long index) { 138 long cPtr = libsbmlJNI.LayoutModelPlugin_getLayout__SWIG_0(swigCPtr, this, index); 139 return (cPtr == 0) ? null : new Layout(cPtr, false); 140 } 141 142 143/** 144 * Returns the layout object with the given <code>sid</code> attribute. If the 145 * id is invalid, <code>null</code> is returned. 146 <p> 147 * @param sid the id attribute of the layout object. 148 <p> 149 * @return the {@link Layout} object with the given <code>sid</code> attribute. null 150 * is returned if the given <code>sid</code> is invalid. 151 */ public 152 Layout getLayout(String sid) { 153 long cPtr = libsbmlJNI.LayoutModelPlugin_getLayout__SWIG_2(swigCPtr, this, sid); 154 return (cPtr == 0) ? null : new Layout(cPtr, false); 155 } 156 157 158/** 159 * Adds a copy of the layout object to the list of layouts. 160 <p> 161 * @param layout the layout object to be added. 162 <p> 163 * <p> 164 * @return integer value indicating success/failure of the 165 * function. The possible values 166 * returned by this function are: 167 * <ul> 168 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 169 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 170 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 171 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 172 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 173 * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH} 174 * <li> {@link libsbmlConstants#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID} 175 * </ul> 176 */ public 177 int addLayout(Layout layout) { 178 return libsbmlJNI.LayoutModelPlugin_addLayout(swigCPtr, this, Layout.getCPtr(layout), layout); 179 } 180 181 182/** 183 * Creates a new layout object and adds it to the list of layout objects 184 * and returns it. 185 <p> 186 * @return a new layout object. 187 */ public 188 Layout createLayout() { 189 long cPtr = libsbmlJNI.LayoutModelPlugin_createLayout(swigCPtr, this); 190 return (cPtr == 0) ? null : new Layout(cPtr, false); 191 } 192 193 194/** 195 * Removes the nth {@link Layout} object from this {@link Model} object and 196 * returns a pointer to it. 197 <p> 198 * The caller owns the returned object and is responsible for deleting it. 199 <p> 200 * @param n the index of the {@link Layout} object to remove. 201 <p> 202 * @return the {@link Layout} object removed. As mentioned above, the caller owns the 203 * returned object. <code>null</code> is returned if the given index is out of range. 204 */ public 205 Layout removeLayout(long n) { 206 long cPtr = libsbmlJNI.LayoutModelPlugin_removeLayout(swigCPtr, this, n); 207 return (cPtr == 0) ? null : new Layout(cPtr, false); 208 } 209 210 211/** 212 * Returns the number of layout objects. 213 <p> 214 * @return the number of layout objects. 215 */ public 216 int getNumLayouts() { 217 return libsbmlJNI.LayoutModelPlugin_getNumLayouts(swigCPtr, this); 218 } 219 220 221/** * @internal */ public 222 int appendFrom(Model model) { 223 return libsbmlJNI.LayoutModelPlugin_appendFrom(swigCPtr, this, Model.getCPtr(model), model); 224 } 225 226 227/** * @internal */ public 228 void connectToParent(SBase sbase) { 229 libsbmlJNI.LayoutModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase); 230 } 231 232 233/** * @internal */ public 234 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 235 libsbmlJNI.LayoutModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 236 } 237 238}