attrData-class             package:graph             R Documentation

_C_l_a_s_s "_a_t_t_r_D_a_t_a"

_D_e_s_c_r_i_p_t_i_o_n:

     A container class to manage generic attributes.  Supports named
     attributes with default values with methods for vectorized access.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form 'new("attrData",
     defaults)'. The 'defaults' argument should be a named list
     containing the initial attribute names and default values.

_S_l_o_t_s:

     '_d_a_t_a': Where custom attribute data is stored

     '_d_e_f_a_u_l_t_s': A named list of known attribute names and defualt
          values.

_M_e_t_h_o_d_s:

     _a_t_t_r_D_a_t_a_I_t_e_m<- 'signature(self = "attrData", x = "character", attr
          = "character")': ... 

     _a_t_t_r_D_a_t_a_I_t_e_m 'signature(self = "attrData", x = "character", attr =
          "missing")': ... 

     _a_t_t_r_D_a_t_a_I_t_e_m 'signature(self = "attrData", x = "character", attr =
          "character")': ... 

     _a_t_t_r_D_e_f_a_u_l_t_s<- 'signature(self = "attrData", attr = "character",
          value = "ANY")': ... 

     _a_t_t_r_D_e_f_a_u_l_t_s<- 'signature(self = "attrData", attr = "missing",
          value = "list")': ... 

     _a_t_t_r_D_e_f_a_u_l_t_s 'signature(self = "attrData", attr = "missing")': ... 

     _a_t_t_r_D_e_f_a_u_l_t_s 'signature(self = "attrData", attr = "character")':
          ... 

     _i_n_i_t_i_a_l_i_z_e 'signature(.Object = "attrData")': ... 

     _r_e_m_o_v_e_A_t_t_r_D_a_t_a_I_t_e_m 'signature(self="attrData", x="character",
          value="NULL")': Remove the data associated with the key
          specified by 'x'.

_A_u_t_h_o_r(_s):

     Seth Falcon

_E_x_a_m_p_l_e_s:

     defaultProps <- list(weight=1, color="blue", friends=c("Bob", "Alice"))
     adat <- new("attrData", defaults=defaultProps)

     ## Get all defaults
     attrDefaults(adat)

     ## Or get only a specific attribute
     attrDefaults(adat, attr="color")

     ## Update default weight
     attrDefaults(adat, attr="weight") <- 500

     ## Add new attribute
     attrDefaults(adat, attr="length") <- 0

     ## Asking for the attributes of an element you haven't customized
     ## returns the defaults
     attrDataItem(adat, x=c("n1", "n2"), attr="length")

     ## You can customize values
     attrDataItem(adat, x=c("n1", "n2"), attr="length") <- 5

