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 * abstract base class for local and global styles 013 <p> 014 * Local and global styles in the SBML render extension have many attributes and methods in common. 015 * These have been implemented in the abstract base class {@link Style}. 016 <p> 017 * A style is a graphical representation for certain layout objects. The assignment of styles to 018 * individual layout objects can either be done through layout object ids (local styles only), 019 * layout object types (SPECIES, COMPARTMENT, etc.) or layout object roles. 020 */ 021 022public class Style extends SBase { 023 private long swigCPtr; 024 025 protected Style(long cPtr, boolean cMemoryOwn) 026 { 027 super(libsbmlJNI.Style_SWIGUpcast(cPtr), cMemoryOwn); 028 swigCPtr = cPtr; 029 } 030 031 protected static long getCPtr(Style obj) 032 { 033 return (obj == null) ? 0 : obj.swigCPtr; 034 } 035 036 protected static long getCPtrAndDisown (Style 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_Style(swigCPtr); 058 } 059 swigCPtr = 0; 060 } 061 super.delete(); 062 } 063 064 065/** 066 * Sets the group of the {@link Style}. 067 <p> 068 * @param group New group to be set on the style. 069 * The group is copied. 070 */ public 071 void setGroup(RenderGroup group) { 072 libsbmlJNI.Style_setGroup(swigCPtr, this, RenderGroup.getCPtr(group), group); 073 } 074 075 076/** 077 * Returns a pointer to the group of the {@link Style}. 078 <p> 079 * @return pointer to the group. 080 */ public 081 RenderGroup getGroup() { 082 long cPtr = libsbmlJNI.Style_getGroup__SWIG_0(swigCPtr, this); 083 return (cPtr == 0) ? null : new RenderGroup(cPtr, false); 084 } 085 086 087/** 088 * Returns the number of ids in the role list. 089 <p> 090 * @return the number of roles in the role list. 091 */ public 092 long getNumRoles() { 093 return libsbmlJNI.Style_getNumRoles(swigCPtr, this); 094 } 095 096 097/** 098 * @return the string of all roles 099 */ public 100 String createRoleString() { 101 return libsbmlJNI.Style_createRoleString(swigCPtr, this); 102 } 103 104 105/** 106 * @return the string of all types 107 */ public 108 String createTypeString() { 109 return libsbmlJNI.Style_createTypeString(swigCPtr, this); 110 } 111 112 113/** 114 * Adds an id to the role list. 115 <p> 116 * @param role New role to be added to the role list. 117 */ public 118 void addRole(String role) { 119 libsbmlJNI.Style_addRole(swigCPtr, this, role); 120 } 121 122 123/** 124 * Checks whether a given role is in the role list. 125 <p> 126 * @param role role string to check for in the role list. 127 */ public 128 boolean isInRoleList(String role) { 129 return libsbmlJNI.Style_isInRoleList(swigCPtr, this, role); 130 } 131 132 133/** 134 * Removes the given role from the role list. 135 <p> 136 * @param role role string to be removed from the role list. 137 */ public 138 void removeRole(String role) { 139 libsbmlJNI.Style_removeRole(swigCPtr, this, role); 140 } 141 142 143/** 144 * Sets the complete role list to a copy of the given list. 145 <p> 146 * @param roleList New list of role strings to be set on the style. 147 */ public 148 void setRoleList(StringSet roleList) { 149 libsbmlJNI.Style_setRoleList(swigCPtr, this, StringSet.getCPtr(roleList), roleList); 150 } 151 152 153/** 154 * Returns a reference to the role list. 155 <p> 156 * @return reference to the role list. 157 */ public 158 StringSet getRoleList() { 159 return new StringSet(libsbmlJNI.Style_getRoleList__SWIG_0(swigCPtr, this), false); 160 } 161 162 163/** 164 * Returns the type list. 165 <p> 166 * @return reference to the type list. 167 */ public 168 StringSet getTypeList() { 169 return new StringSet(libsbmlJNI.Style_getTypeList__SWIG_0(swigCPtr, this), false); 170 } 171 172 173/** 174 * Sets the complete type list to a copy of the given list. 175 <p> 176 * @param typeList the list of types to be set for the style. 177 */ public 178 void setTypeList(StringSet typeList) { 179 libsbmlJNI.Style_setTypeList(swigCPtr, this, StringSet.getCPtr(typeList), typeList); 180 } 181 182 183/** 184 * Returns the number of types in the type list. 185 <p> 186 * @return number of types in type list. 187 */ public 188 long getNumTypes() { 189 return libsbmlJNI.Style_getNumTypes(swigCPtr, this); 190 } 191 192 193/** 194 * Adds a type string to the type list. 195 <p> 196 * @param type new type string to be added to the type list 197 */ public 198 void addType(String type) { 199 libsbmlJNI.Style_addType(swigCPtr, this, type); 200 } 201 202 203/** 204 * Checks whether a given type string is in the type list. 205 <p> 206 * @param type string to be searched for in the type list 207 <p> 208 * @return true or false depending on whether the given string was 209 * found in the type list. 210 */ public 211 boolean isInTypeList(String type) { 212 return libsbmlJNI.Style_isInTypeList(swigCPtr, this, type); 213 } 214 215 216/** 217 * Removes a type string from the type list. 218 <p> 219 * @param type type string to be removed from the type list. 220 */ public 221 void removeType(String type) { 222 libsbmlJNI.Style_removeType(swigCPtr, this, type); 223 } 224 225 226/** 227 * Creates and returns a deep copy of this {@link Style} object. 228 * This method is purely abstract and has to be implemented in derived classes. 229 <p> 230 * @return a (deep) copy of this {@link Style} object 231 */ public 232 SBase cloneObject() { 233 return (Style) libsbml.DowncastSBase(libsbmlJNI.Style_cloneObject(swigCPtr, this), true); 234} 235 236 237/** 238 * Returns the XML element name of this object. 239 <p> 240 * This is overridden by subclasses to return a string appropriate to the 241 * SBML component. For example, {@link Model} defines it as returning 'model', 242 * {@link CompartmentType} defines it as returning 'compartmentType', etc. 243 <p> 244 * NOTE: this function is only ever going to be called from the constructor 245 */ public 246 String getElementName() { 247 return libsbmlJNI.Style_getElementName(swigCPtr, this); 248 } 249 250 251/** 252 * Creates an {@link XMLNode} object from this {@link Style} object. 253 <p> 254 * @return the {@link XMLNode} with the XML representation for the 255 * {@link Style} object. 256 */ public 257 XMLNode toXML() { 258 return new XMLNode(libsbmlJNI.Style_toXML(swigCPtr, this), true); 259 } 260 261 public void connectToChild() { 262 libsbmlJNI.Style_connectToChild(swigCPtr, this); 263 } 264 265 266/** * @internal */ public 267 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 268 libsbmlJNI.Style_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 269 } 270 271 272/** 273 * Returns the value of the 'id' attribute of this {@link Style}. 274 <p> 275 * @return the id of the {@link Style} 276 */ public 277 String getId() { 278 return libsbmlJNI.Style_getId(swigCPtr, this); 279 } 280 281 282/** 283 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 284 * {@link Style}'s 'id' attribute has been set. 285 <p> 286 * @return returns true or false depending on whether the id on the 287 * {@link Style} has been set. 288 */ public 289 boolean isSetId() { 290 return libsbmlJNI.Style_isSetId(swigCPtr, this); 291 } 292 293 294/** 295 * Sets the value of the 'id' attribute of this {@link Style}. 296 <p> 297 * @param id the new id for the {@link Style} 298 <p> 299 * @return status if the operation succeeded 300 */ public 301 int setId(String id) { 302 return libsbmlJNI.Style_setId(swigCPtr, this, id); 303 } 304 305 306/** 307 * Unsets the value of the 'id' attribute of this {@link Style}. 308 */ public 309 int unsetId() { 310 return libsbmlJNI.Style_unsetId(swigCPtr, this); 311 } 312 313 314/** 315 * Returns the value of the 'name' attribute of this {@link Style}. 316 <p> 317 * @return the name of the {@link Style} 318 */ public 319 String getName() { 320 return libsbmlJNI.Style_getName(swigCPtr, this); 321 } 322 323 324/** 325 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 326 * {@link Style}'s 'name' attribute has been set. 327 <p> 328 * @return returns true or false depending on whether the name on the 329 * {@link Style} has been set. 330 */ public 331 boolean isSetName() { 332 return libsbmlJNI.Style_isSetName(swigCPtr, this); 333 } 334 335 336/** 337 * Sets the value of the 'name' attribute of this {@link Style}. 338 <p> 339 * @param name the new name for the {@link Style} 340 <p> 341 * @return status if the operation succeeded 342 */ public 343 int setName(String id) { 344 return libsbmlJNI.Style_setName(swigCPtr, this, id); 345 } 346 347 348/** 349 * Unsets the value of the 'name' attribute of this {@link Style}. 350 */ public 351 int unsetName() { 352 return libsbmlJNI.Style_unsetName(swigCPtr, this); 353 } 354 355 356/** * @internal */ public 357 boolean hasRequiredAttributes() { 358 return libsbmlJNI.Style_hasRequiredAttributes(swigCPtr, this); 359 } 360 361 362/** * @internal */ public 363 boolean hasRequiredElements() { 364 return libsbmlJNI.Style_hasRequiredElements(swigCPtr, this); 365 } 366 367}