File: utility-classes.Rd

package info (click to toggle)
r-cran-memisc 0.99.31.8.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,136 kB
  • sloc: ansic: 5,117; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 1,457 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
\name{Utility classes}
\alias{named.list}
\alias{item.list}
\alias{named.list-class}
\alias{item.list-class}
\alias{initialize,item.list-method}
\alias{initialize,named.list-method}
\alias{coerce,data.set,named.list-method}
\alias{show,named.list-method}
\alias{atomic-class}
\alias{double-class}
\title{Named Lists, Lists of Items, and Atomic Vectors}
\description{
  The classes "named.list" and "item.list" are merely some
  'helper classes' for the construction of the classes "data.set"
  and "importer".

  Class "named.list" extends the basic class "list" by an additional
  slot "names". Its \code{initialize} method assures that the names
  of the list are unique.
  
  Class "item.list" extends the class "named.list", but does not
  add any slots. From "named.list" it differs only by the 
  \code{initialize} method, which calls that for "named.list"
  and makes sure that all elements of the list belong to 
  class "\link{item}".
  
  Classes "atomic" and "double" are merely used for
  method selection.
}
\examples{
new("named.list",a=1,b=2)

# This should generate an error, since the names
# are not unique.
try(new("named.list",a=1,a=2))

# Another error, one name is missing.
try(new("named.list",a=1,2))

# Also an error, the resulting list would be unnamed.
try(new("named.list",1,2))


new("item.list",a=1,b=2)

# Also an error: "item.list"s are "named.lists",
# and here the names would be non-unique.
try(new("item.list",a=1,a=2))
}