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 * 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 const pointer to the group of the {@link Style}. 078 <p> 079 * @return const 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 const 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 262/** 263 * Sets this SBML object to child SBML objects (if any). 264 * (Creates a child-parent relationship by the parent) 265 <p> 266 * Subclasses must override this function if they define 267 * one ore more child elements. 268 * Basically, this function needs to be called in 269 * constructor, copy constructor, assignment operator. 270 <p> 271 * @see setSBMLDocument 272 * @see enablePackageInternal 273 * @internal 274 */ public 275 void connectToChild() { 276 libsbmlJNI.Style_connectToChild(swigCPtr, this); 277 } 278 279 280/** 281 * Enables/Disables the given package with this element and child 282 * elements (if any). 283 * (This is an internal implementation for enablePakcage function) 284 <p> 285 * @note Subclasses in which one or more child elements are defined 286 * must override this function. 287 * @internal 288 */ public 289 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 290 libsbmlJNI.Style_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 291 } 292 293 294/** 295 * Returns the value of the 'id' attribute of this {@link Style}. 296 <p> 297 * @return the id of the {@link Style} 298 */ public 299 String getId() { 300 return libsbmlJNI.Style_getId(swigCPtr, this); 301 } 302 303 304/** 305 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 306 * {@link Style}'s 'id' attribute has been set. 307 <p> 308 * @return returns true or false depending on whether the id on the 309 * {@link Style} has been set. 310 */ public 311 boolean isSetId() { 312 return libsbmlJNI.Style_isSetId(swigCPtr, this); 313 } 314 315 316/** 317 * Sets the value of the 'id' attribute of this {@link Style}. 318 <p> 319 * @param id the new id for the {@link Style} 320 <p> 321 * @return status if the operation succeeded 322 */ public 323 int setId(String id) { 324 return libsbmlJNI.Style_setId(swigCPtr, this, id); 325 } 326 327 328/** 329 * Unsets the value of the 'id' attribute of this {@link Style}. 330 */ public 331 int unsetId() { 332 return libsbmlJNI.Style_unsetId(swigCPtr, this); 333 } 334 335 336/** 337 * Returns the value of the 'name' attribute of this {@link Style}. 338 <p> 339 * @return the name of the {@link Style} 340 */ public 341 String getName() { 342 return libsbmlJNI.Style_getName(swigCPtr, this); 343 } 344 345 346/** 347 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 348 * {@link Style}'s 'name' attribute has been set. 349 <p> 350 * @return returns true or false depending on whether the name on the 351 * {@link Style} has been set. 352 */ public 353 boolean isSetName() { 354 return libsbmlJNI.Style_isSetName(swigCPtr, this); 355 } 356 357 358/** 359 * Sets the value of the 'name' attribute of this {@link Style}. 360 <p> 361 * @param name the new name for the {@link Style} 362 <p> 363 * @return status if the operation succeeded 364 */ public 365 int setName(String id) { 366 return libsbmlJNI.Style_setName(swigCPtr, this, id); 367 } 368 369 370/** 371 * Unsets the value of the 'name' attribute of this {@link Style}. 372 */ public 373 int unsetName() { 374 return libsbmlJNI.Style_unsetName(swigCPtr, this); 375 } 376 377 378/** * @internal */ public 379 boolean hasRequiredAttributes() { 380 return libsbmlJNI.Style_hasRequiredAttributes(swigCPtr, this); 381 } 382 383 384/** * @internal */ public 385 boolean hasRequiredElements() { 386 return libsbmlJNI.Style_hasRequiredElements(swigCPtr, this); 387 } 388 389}