001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.7
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   * Constructor
062   */ public
063 LayoutModelPlugin(String uri, String prefix, LayoutPkgNamespaces layoutns) {
064    this(libsbmlJNI.new_LayoutModelPlugin__SWIG_0(uri, prefix, LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
065  }
066
067  
068/**
069   * Copy constructor. Creates a copy of this {@link SBase} object.
070   */ public
071 LayoutModelPlugin(LayoutModelPlugin orig) {
072    this(libsbmlJNI.new_LayoutModelPlugin__SWIG_1(LayoutModelPlugin.getCPtr(orig), orig), true);
073  }
074
075  
076/**
077   * Creates and returns a deep copy of this {@link LayoutModelPlugin} object.
078   <p>
079   * @return a (deep) copy of this {@link LayoutModelPlugin} object
080   */ public
081 SBasePlugin cloneObject() {
082    long cPtr = libsbmlJNI.LayoutModelPlugin_cloneObject(swigCPtr, this);
083    return (cPtr == 0) ? null : new LayoutModelPlugin(cPtr, true);
084  }
085
086  
087/**
088   * Returns the {@link ListOfLayouts} object for this {@link Model}.
089   <p>
090   * @return the {@link ListOfLayouts} object for this {@link Model}.
091   */ public
092 ListOfLayouts getListOfLayouts() {
093    long cPtr = libsbmlJNI.LayoutModelPlugin_getListOfLayouts__SWIG_0(swigCPtr, this);
094    return (cPtr == 0) ? null : new ListOfLayouts(cPtr, false);
095  }
096
097  
098/**
099   * Returns the layout object that belongs to the given index. If the
100   * index is invalid, <code>null</code> is returned.
101   <p>
102   * @param index the index of list of layout objects.
103   <p>
104   * @return the {@link Layout} object that belongs to the given index. null
105   * is returned if the index is invalid. 
106   */ public
107 Layout getLayout(long index) {
108    long cPtr = libsbmlJNI.LayoutModelPlugin_getLayout__SWIG_0(swigCPtr, this, index);
109    return (cPtr == 0) ? null : new Layout(cPtr, false);
110  }
111
112  
113/**
114   * Returns the layout object with the given <code>sid</code> attribute. If the
115   * id is invalid, <code>null</code> is returned.
116   <p>
117   * @param sid the id attribute of the layout object.
118   <p>
119   * @return the {@link Layout} object with the given <code>sid</code> attribute. null
120   * is returned if the given <code>sid</code> is invalid. 
121   */ public
122 Layout getLayout(String sid) {
123    long cPtr = libsbmlJNI.LayoutModelPlugin_getLayout__SWIG_2(swigCPtr, this, sid);
124    return (cPtr == 0) ? null : new Layout(cPtr, false);
125  }
126
127  
128/**
129   * Adds a copy of the layout object to the list of layouts.
130   <p>
131   * @param layout the layout object to be added.
132   <p>
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/** * @internal */ public
192 void connectToParent(SBase sbase) {
193    libsbmlJNI.LayoutModelPlugin_connectToParent(swigCPtr, this, SBase.getCPtr(sbase), sbase);
194  }
195
196  
197/** * @internal */ public
198 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
199    libsbmlJNI.LayoutModelPlugin_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
200  }
201
202}