isSealedMethod(methods)
isSealedMethod()所属R语言包:methods
Check for a Sealed Method or Class
检查密封的方法或类
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions check for either a method or a class that has been sealed when it was defined, and which therefore cannot be re-defined.
这些功能的检查方法或已被查封时,它被定义,因此不能被重新定义的类。
用法----------Usage----------
isSealedMethod(f, signature, fdef, where)
isSealedClass(Class, where)
参数----------Arguments----------
参数:f
The quoted name of the generic function.
泛型函数的引用名称。
参数:signature
The class names in the method's signature, as they would be supplied to setMethod.
该方法的签名中的类名,他们将提供setMethod。
参数:fdef
Optional, and usually omitted: the generic function definition for f.
可选的,而且通常省略:f的通用函数的定义。
参数:Class
The quoted name of the class.
引用类的名字。
参数:where
where to search for the method or class definition. By default, searches from the top environment of the call to isSealedMethod or isSealedClass, typically the global environment or the namespace of a package containing a call to one of the functions.
到哪里寻找的方法或类定义。默认情况下,搜索从顶部的呼叫环境isSealedMethod或isSealedClass,通常是全球性的环境或命名空间包含包呼叫的功能之一。
Details
详情----------Details----------
In the R implementation of classes and methods, it is possible to seal the definition of either a class or a method. The basic classes (numeric and other types of vectors, matrix and array data) are sealed. So also are the methods for the primitive functions on those data types. The effect is that programmers cannot re-define the meaning of these basic data types and computations. More precisely, for primitive functions that depend on only one data argument, methods cannot be specified for basic classes. For functions (such as the arithmetic operators) that depend on two arguments, methods can be specified if one of those arguments is a basic class, but not if both are.
ŕ实施中的类和方法,它是密封一个类或方法的定义。密封的基本类(向量,矩阵和数组数据的数字和其他类型)。因此,也为这些数据类型的原始功能的方法。其效果是,程序员不能重新定义这些基本数据类型和计算的意义。更确切地说,取决于原始功能上只有一个数据参数,方法不能被指定为基本类。功能(如算术运算符)取决于两个参数,可以指定方法,如果这些参数之一是一个基本的类,但都没有如果。
Programmers can seal other class and method definitions by using the sealed argument to setClass or setMethod.
程序员可以使用sealed参数setClass或setMethod密封的其他类和方法的定义。
值----------Value----------
The functions return FALSE if the method or class is not sealed (including the case that it is not defined); TRUE if it is.
函数返回FALSE如果方法或类不是密封(包括它是没有定义的情况下);TRUE如果是。
参考文献----------References----------
Software for Data Analysis: Programming with R Springer. (For the R version.)
Programming with Data Springer (For the original S4 version.)
举例----------Examples----------
## these are both TRUE[#这些都是真实的]
isSealedMethod("+", c("numeric", "character"))
isSealedClass("matrix")
setClass("track",
representation(x="numeric", y="numeric"))
## but this is FALSE[#但是这是假的]
isSealedClass("track")
## and so is this[#等是本]
isSealedClass("A Name for an undefined Class")
## and so are these, because only one of the two arguments is basic[#等等这些,因为只有两个参数之一是基本]
isSealedMethod("+", c("track", "numeric"))
isSealedMethod("+", c("numeric", "track"))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|