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 the {@link LocalStyle} concept of the SBML render extension.
013 <p>
014 * Local styles are the style information objects used in {@link LocalRenderInformation} (@see LocalRenderInformation).
015 * Local styles can be associated with layout objects by role and type as well as by 
016 * id of layout objects from the layout the local style belongs to.
017 @see Style) 
018 */
019
020public class LocalStyle extends Style {
021   private long swigCPtr;
022
023   protected LocalStyle(long cPtr, boolean cMemoryOwn)
024   {
025     super(libsbmlJNI.LocalStyle_SWIGUpcast(cPtr), cMemoryOwn);
026     swigCPtr = cPtr;
027   }
028
029   protected static long getCPtr(LocalStyle obj)
030   {
031     return (obj == null) ? 0 : obj.swigCPtr;
032   }
033
034   protected static long getCPtrAndDisown (LocalStyle obj)
035   {
036     long ptr = 0;
037
038     if (obj != null)
039     {
040       ptr             = obj.swigCPtr;
041       obj.swigCMemOwn = false;
042     }
043
044     return ptr;
045   }
046
047  protected void finalize() {
048    delete();
049  }
050
051  public synchronized void delete() {
052    if (swigCPtr != 0) {
053      if (swigCMemOwn) {
054        swigCMemOwn = false;
055        libsbmlJNI.delete_LocalStyle(swigCPtr);
056      }
057      swigCPtr = 0;
058    }
059    super.delete();
060  }
061
062  
063/**
064   * Creates a new {@link LocalStyle} object with the given SBML level
065   * and SBML version.
066   <p>
067   * @param level SBML level of the new object
068   * @param level SBML version of the new object
069   */ public
070 LocalStyle(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
071    this(libsbmlJNI.new_LocalStyle__SWIG_0(level, version, pkgVersion), true);
072  }
073
074  
075/**
076   * Creates a new {@link LocalStyle} object with the given SBML level
077   * and SBML version.
078   <p>
079   * @param level SBML level of the new object
080   * @param level SBML version of the new object
081   */ public
082 LocalStyle(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
083    this(libsbmlJNI.new_LocalStyle__SWIG_1(level, version), true);
084  }
085
086  
087/**
088   * Creates a new {@link LocalStyle} object with the given SBML level
089   * and SBML version.
090   <p>
091   * @param level SBML level of the new object
092   * @param level SBML version of the new object
093   */ public
094 LocalStyle(long level) throws org.sbml.libsbml.SBMLConstructorException {
095    this(libsbmlJNI.new_LocalStyle__SWIG_2(level), true);
096  }
097
098  
099/**
100   * Creates a new {@link LocalStyle} object with the given SBML level
101   * and SBML version.
102   <p>
103   * @param level SBML level of the new object
104   * @param level SBML version of the new object
105   */ public
106 LocalStyle() throws org.sbml.libsbml.SBMLConstructorException {
107    this(libsbmlJNI.new_LocalStyle__SWIG_3(), true);
108  }
109
110  
111/**
112   * Creates a new {@link LocalStyle} object with the given {@link SBMLNamespaces}.
113   <p>
114   * @param sbmlns The SBML namespace for the object.
115   */ public
116 LocalStyle(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
117    this(libsbmlJNI.new_LocalStyle__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
118  }
119
120  
121/**
122   * Creates a new {@link LocalStyle} object from the given {@link XMLNode} object.
123   * The {@link XMLNode} object has to contain a valid XML representation of a 
124   * {@link LocalStyle} object as defined in the render extension specification.
125   * This method is normally called when render information is read from a file and 
126   * should normally not have to be called explicitely.
127   <p>
128   * @param node the {@link XMLNode} object reference that describes the {@link LocalStyle}
129   * object to be instantiated.
130   */ public
131 LocalStyle(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
132    this(libsbmlJNI.new_LocalStyle__SWIG_5(XMLNode.getCPtr(node), node, l2version), true);
133  }
134
135  
136/**
137   * Creates a new {@link LocalStyle} object from the given {@link XMLNode} object.
138   * The {@link XMLNode} object has to contain a valid XML representation of a 
139   * {@link LocalStyle} object as defined in the render extension specification.
140   * This method is normally called when render information is read from a file and 
141   * should normally not have to be called explicitely.
142   <p>
143   * @param node the {@link XMLNode} object reference that describes the {@link LocalStyle}
144   * object to be instantiated.
145   */ public
146 LocalStyle(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
147    this(libsbmlJNI.new_LocalStyle__SWIG_6(XMLNode.getCPtr(node), node), true);
148  }
149
150  
151/**
152   * Constructor which creates a {@link LocalStyle} with an empty group
153   * and empty id, role and type list.
154   * The group has to be filled before the
155   * object is valid.
156   <p>
157   * This constructor is deprecated. The new libsbml API only has
158   * constructors which take the SBML level and version or one that takes
159   * an {@link SBMLNamespaces} object.
160   */ public
161 LocalStyle(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException {
162    this(libsbmlJNI.new_LocalStyle__SWIG_7(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true);
163  }
164
165  
166/**
167   * Returns the number of ids in the id set.
168   <p>
169   * @return the number of ids in the id set
170   */ public
171 long getNumIds() {
172    return libsbmlJNI.LocalStyle_getNumIds(swigCPtr, this);
173  }
174
175  
176/**
177   * Returns the id list.
178   <p>
179   * @return the reference to the list of ids for the local style.
180   */ public
181 StringSet getIdList() {
182    return new StringSet(libsbmlJNI.LocalStyle_getIdList__SWIG_0(swigCPtr, this), false);
183  }
184
185  
186/**
187   * Sets the id list.
188   <p>
189   * @param idList The list of ids to be set on the local style.
190   */ public
191 void setIdList(StringSet idList) {
192    libsbmlJNI.LocalStyle_setIdList(swigCPtr, this, StringSet.getCPtr(idList), idList);
193  }
194
195  
196/**
197   * Adds another id to the set.
198   <p>
199   * @param id the id string to be added to the id list.
200   */ public
201 void addId(String id) {
202    libsbmlJNI.LocalStyle_addId(swigCPtr, this, id);
203  }
204
205  
206/** 
207   * @return the string of all roles
208   */ public
209 String createIdString() {
210    return libsbmlJNI.LocalStyle_createIdString(swigCPtr, this);
211  }
212
213  
214/**
215   * Checks whether a given <code>id</code> is in the id list.
216   <p>
217   * @param id the id to be searched for
218   <p>
219   * @return true or false depending on whether the given <code>id</code> is in the id list or not.
220   */ public
221 boolean isInIdList(String id) {
222    return libsbmlJNI.LocalStyle_isInIdList(swigCPtr, this, id);
223  }
224
225  
226/**
227   * Removes an id from the set.
228   <p>
229   * @param the id to be removed from the id list.
230   */ public
231 void removeId(String id) {
232    libsbmlJNI.LocalStyle_removeId(swigCPtr, this, id);
233  }
234
235  
236/**
237   * Returns the libSBML type code for this SBML object.
238   <p>
239   * LibSBML attaches an
240   * identifying code to every kind of SBML object.  These are known as
241   * <em>SBML type codes</em>.  In other languages, the set of type codes
242   * is stored in an enumeration; in the Java language interface for
243   * libSBML, the type codes are defined as static integer constants in
244   * interface class {@link libsbmlConstants}.  The names of the type codes
245   * all begin with the characters <code>SBML_.</code> 
246   <p>
247   * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
248   <p>
249   * @see #getElementName()
250   */ public
251 int getTypeCode() {
252    return libsbmlJNI.LocalStyle_getTypeCode(swigCPtr, this);
253  }
254
255  
256/**
257   * Creates and returns a deep copy of this {@link LocalStyle} object.
258   <p>
259   * @return a (deep) copy of this {@link LocalStyle} object
260   */ public
261 LocalStyle cloneObject() {
262    long cPtr = libsbmlJNI.LocalStyle_cloneObject(swigCPtr, this);
263    return (cPtr == 0) ? null : new LocalStyle(cPtr, true);
264  }
265
266  
267/**
268   * Returns the XML element name of this object.
269   <p>
270   * This is overridden by subclasses to return a string appropriate to the
271   * SBML component.  For example, {@link Model} defines it as returning 'model',
272   * {@link CompartmentType} defines it as returning 'compartmentType', etc.
273   */ public
274 String getElementName() {
275    return libsbmlJNI.LocalStyle_getElementName(swigCPtr, this);
276  }
277
278  
279/**
280   * Creates an {@link XMLNode} object from this {@link LocalStyle} object.
281   <p>
282   * @return the {@link XMLNode} with the XML representation for the 
283   * {@link LocalStyle} object.
284   */ public
285 XMLNode toXML() {
286    return new XMLNode(libsbmlJNI.LocalStyle_toXML(swigCPtr, this), true);
287  }
288
289}