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