| 42333 |
ripley |
1 |
% File src/library/methods/man/MethodsList-class.Rd
|
|
|
2 |
% Part of the R package, http://www.R-project.org
|
|
|
3 |
% Copyright 1995-2007 R Core Development Team
|
|
|
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
| 17376 |
jmc |
6 |
\name{MethodsList-class}
|
|
|
7 |
\alias{MethodsList-class}
|
| 25816 |
jmc |
8 |
\alias{body<-,MethodDefinition-method}
|
| 19123 |
hornik |
9 |
\docType{class}
|
| 19064 |
jmc |
10 |
\title{Class MethodsList, Representation of Methods for a Generic Function }
|
|
|
11 |
\description{ Objects from this class are generated and revised by the
|
|
|
12 |
definition of methods for a generic function.}
|
|
|
13 |
\section{Slots}{\describe{
|
|
|
14 |
|
| 19123 |
hornik |
15 |
\item{\code{argument}:}{Object of class \code{"name"}. The name of the
|
| 19064 |
jmc |
16 |
argument being used for dispatch at this level. }
|
|
|
17 |
\item{\code{methods}:}{A named list of the methods (and method lists)
|
| 39016 |
jmc |
18 |
defined \emph{explicitly} for this argument.
|
|
|
19 |
The names are the names of classes, and the corresponding
|
|
|
20 |
element defines the method or methods to be used if the corresponding
|
|
|
21 |
argument has that class. See the details below.}
|
|
|
22 |
\item{\code{allMethods}:}{A named list, contains
|
| 19064 |
jmc |
23 |
all the directly defined methods from the \code{methods} slot, plus
|
| 39016 |
jmc |
24 |
any inherited methods. Ignored when methods tables are used for dispatch (see \link{Methods} }
|
| 17376 |
jmc |
25 |
}}
|
| 19064 |
jmc |
26 |
|
| 39016 |
jmc |
27 |
\details{
|
|
|
28 |
Suppose a function \code{f} has
|
|
|
29 |
formal arguments \code{x} and \code{y}. The methods list object for
|
|
|
30 |
that function has the object \code{as.name("x")} as its
|
|
|
31 |
\code{argument} slot. An element of the methods named \code{"track"}
|
|
|
32 |
is selected if the actual argument corresponding to \code{x} is an
|
|
|
33 |
object of class \code{"track"}. If there is such an element, it can
|
|
|
34 |
generally be either a function or another methods list object.
|
| 19064 |
jmc |
35 |
|
| 39016 |
jmc |
36 |
In the first case, the function defines the method to use for any call
|
|
|
37 |
in which \code{x} is of class \code{"track"}. In the second case, the
|
|
|
38 |
new methods list object defines the available methods depending on
|
|
|
39 |
the remaining formal arguments, in this example, \code{y}.
|
|
|
40 |
|
|
|
41 |
Each method corresponds conceptually to a \emph{signature};
|
|
|
42 |
that is a named list of classes, with names corresponding to some or
|
|
|
43 |
all of the formal arguments. In the previous example, if selecting
|
|
|
44 |
class \code{"track"} for \code{x}, finding that the selection was
|
|
|
45 |
another methods list and then selecting class \code{"numeric"} for
|
|
|
46 |
\code{y} would produce a method associated with the signature
|
|
|
47 |
\code{x = "track", y = "numeric"}.
|
|
|
48 |
|
|
|
49 |
You can see the methods
|
|
|
50 |
arranged by signature by calling the function
|
|
|
51 |
\code{\link{showMethods}},
|
|
|
52 |
A methods list can be converted into an ordinary list with the methods arranged this
|
|
|
53 |
way (in two different forms) by calling the functions
|
|
|
54 |
\code{\link{listFromMlist}} and \code{\link{linearizeMlist}}.
|
|
|
55 |
|
|
|
56 |
}
|
|
|
57 |
|
| 17376 |
jmc |
58 |
\section{Extends}{
|
| 19064 |
jmc |
59 |
Class \code{"OptionalMethods"}, directly.
|
| 17376 |
jmc |
60 |
}
|
| 19064 |
jmc |
61 |
\keyword{classes}
|
| 19123 |
hornik |
62 |
\keyword{methods}
|