NamedTypeTest-class: Class "NamedTypeTest" and sub-classes for tests on class of...

Description Objects from the NamedTypeTest class Slots Extends Methods Author(s) See Also Examples

Description

These classes are for specifying a test on the type of an object using the class of that object and comparing it to target class names. The tests can be either for x inherits from class name (or is(x, "className")) or x is an instance of class name (i.e. class(x) == "className"). The first of these is represented by InheritsTypeTest and the second by StrictTypeTest.

Objects from the NamedTypeTest class

Objects can be created for the non-virtual classes using new("InheritsTypeTest",...) and new("StrictIsTypeTest",...) or the convenience functions InheritsTypeTest(...), StrictIsTypeTest(...) Additionally, where appropriate, a character vector is coerced to InheritsTypeTest.

Slots

.Data:

Object of class "character". This is an internal data type to represent the class names. It is not to be used directly. It is inherited from the “character” class.

Extends

Class "character", from data part. Class "ClassNameOrExpression", directly. Class "vector", by class "character".

Methods

coerce

signature(from = "character", to = "NamedTypeTest"): converts a character vector into a InheritsTypeTest.

Author(s)

Duncan Temple Lang <duncan@wald.ucdavis.edu>

See Also

TypedSignature TypeSpecification-class DynamicTypeTest-class

Examples

1
2
3
4
5
6
7
8
  new("InheritsTypeTest",  c("A", "B"))

  m = array(1:60, c(3, 4, 5))
  tt = new("StrictIsTypeTest",  c("matrix"))
  TypeInfo:::checkType(m, tt)

  tt = new("StrictIsTypeTest",  c("array"))
  TypeInfo:::checkType(m, tt)

TypeInfo documentation built on Nov. 8, 2020, 5:40 p.m.