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 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span> 013 014 Implementation of the 'layout' package extention to the 015 * Model construct. 016 */ 017 018public class LayoutModelPlugin extends SBasePlugin { 019 private long swigCPtr; 020 021 protected LayoutModelPlugin(long cPtr, boolean cMemoryOwn) 022 { 023 super(libsbmlJNI.LayoutModelPlugin_SWIGUpcast(cPtr), cMemoryOwn); 024 swigCPtr = cPtr; 025 } 026 027 protected static long getCPtr(LayoutModelPlugin obj) 028 { 029 return (obj == null) ? 0 : obj.swigCPtr; 030 } 031 032 protected static long getCPtrAndDisown (LayoutModelPlugin obj) 033 { 034 long ptr = 0; 035 036 if (obj != null) 037 { 038 ptr = obj.swigCPtr; 039 obj.swigCMemOwn = false; 040 } 041 042 return ptr; 043 } 044 045 protected void finalize() { 046 delete(); 047 } 048 049 public synchronized void delete() { 050 if (swigCPtr != 0) { 051 if (swigCMemOwn) { 052 swigCMemOwn = false; 053 libsbmlJNI.delete_LayoutModelPlugin(swigCPtr); 054 } 055 swigCPtr = 0; 056 } 057 super.delete(); 058 } 059 060 061/** 062 * Constructor 063 */ public 064 LayoutModelPlugin(String uri, String prefix, LayoutPkgNamespaces layoutns) { 065 this(libsbmlJNI.new_LayoutModelPlugin__SWIG_0(uri, prefix, LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 066 } 067 068 069/** 070 * Copy constructor. Creates a copy of this {@link SBase} object. 071 */ public 072 LayoutModelPlugin(LayoutModelPlugin orig) { 073 this(libsbmlJNI.new_LayoutModelPlugin__SWIG_1(LayoutModelPlugin.getCPtr(orig), orig), true); 074 } 075 076 077/** 078 * Creates and returns a deep copy of this {@link LayoutModelPlugin} object. 079 <p> 080 * @return a (deep) copy of this {@link LayoutModelPlugin} object 081 */ public 082 SBasePlugin cloneObject() { 083 long cPtr = libsbmlJNI.LayoutModelPlugin_cloneObject(swigCPtr, this); 084 return (cPtr == 0) ? null : new LayoutModelPlugin(cPtr, true); 085 } 086 087 088/** 089 * Returns the {@link ListOfLayouts} object for this {@link Model}. 090 <p> 091 * @return the {@link ListOfLayouts} object for this {@link Model}. 092 */ public 093 ListOfLayouts getListOfLayouts() { 094 long cPtr = libsbmlJNI.LayoutModelPlugin_getListOfLayouts__SWIG_0(swigCPtr, this); 095 return (cPtr == 0) ? null : new ListOfLayouts(cPtr, false); 096 } 097 098 099/** 100 * Returns the layout object that belongs to the given index. If the 101 * index is invalid, <code>null</code> is returned. 102 <p> 103 * @param index the index of list of layout objects. 104 <p> 105 * @return the {@link Layout} object that belongs to the given index. null 106 * is returned if the index is invalid. 107 */ public 108 Layout getLayout(long index) { 109 long cPtr = libsbmlJNI.LayoutModelPlugin_getLayout__SWIG_0(swigCPtr, this, index); 110 return (cPtr == 0) ? null : new Layout(cPtr, false); 111 } 112 113 114/** 115 * Returns the layout object with the given <code>sid</code> attribute. If the 116 * id is invalid, <code>null</code> is returned. 117 <p> 118 * @param sid the id attribute of the layout object. 119 <p> 120 * @return the {@link Layout} object with the given <code>sid</code> attribute. null 121 * is returned if the given <code>sid</code> is invalid. 122 */ public 123 Layout getLayout(String sid) { 124 long cPtr = libsbmlJNI.LayoutModelPlugin_getLayout__SWIG_2(swigCPtr, this, sid); 125 return (cPtr == 0) ? null : new Layout(cPtr, false); 126 } 127 128 129/** 130 * Adds a copy of the layout object to the list of layouts. 131 <p> 132 * @param layout the layout object to be added. 133 <p> 134 * @return integer value indicating success/failure of the 135 * function. The possible values 136 * returned by this function are: 137 * <ul> 138 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 139 * </ul> 140 */ public 141 int addLayout(Layout layout) { 142 return libsbmlJNI.LayoutModelPlugin_addLayout(swigCPtr, this, Layout.getCPtr(layout), layout); 143 } 144 145 146/** 147 * Creates a new layout object and adds it to the list of layout objects 148 * and returns it. 149 <p> 150 * @return a new layout object. 151 */ public 152 Layout createLayout() { 153 long cPtr = libsbmlJNI.LayoutModelPlugin_createLayout(swigCPtr, this); 154 return (cPtr == 0) ? null : new Layout(cPtr, false); 155 } 156 157 158/** 159 * Removes the nth {@link Layout} object from this {@link Model} object and 160 * returns a pointer to it. 161 <p> 162 * The caller owns the returned object and is responsible for deleting it. 163 <p> 164 * @param n the index of the {@link Layout} object to remove 165 <p> 166 * @return the {@link Layout} object removed. As mentioned above, the caller owns the 167 * returned object. <code>null</code> is returned if the given index is out of range. 168 */ public 169 Layout removeLayout(long n) { 170 long cPtr = libsbmlJNI.LayoutModelPlugin_removeLayout(swigCPtr, this, n); 171 return (cPtr == 0) ? null : new Layout(cPtr, false); 172 } 173 174 175/** 176 * Returns the number of layout objects. 177 <p> 178 * @return the number of layout objects. 179 */ public 180 int getNumLayouts() { 181 return libsbmlJNI.LayoutModelPlugin_getNumLayouts(swigCPtr, this); 182 } 183 184 185/** * @internal */ public 186 int appendFrom(Model model) { 187 return libsbmlJNI.LayoutModelPlugin_appendFrom(swigCPtr, this, Model.getCPtr(model), model); 188 } 189 190 191/** 192 * Sets the parent SBML object of this plugin object to 193 * this object and child elements (if any). 194 * (Creates a child-parent relationship by this plugin object) 195 <p> 196 * This function is called when this object is created by 197 * the parent element. 198 * Subclasses must override this this function if they have one 199 * or more child elements. Also, {@link SBasePlugin#connectToParent()} 200 * must be called in the overridden function. 201 <p> 202 * @param sbase the {@link SBase} object to use 203 <p> 204 <p> 205 * @internal 206 */ public 207 void connectToParent(SBase sbase) { 208 libsbmlJNI.LayoutModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase); 209 } 210 211 212/** 213 * Enables/Disables the given package with child elements in this plugin 214 * object (if any). 215 * (This is an internal implementation invoked from 216 * {@link SBase#enablePakcageInternal()} function) 217 <p> 218 * @note Subclasses in which one or more {@link SBase} derived elements are 219 * defined must override this function. 220 <p> 221 <p> 222 * @internal 223 */ public 224 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 225 libsbmlJNI.LayoutModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 226 } 227 228}