Lines 965-971
Link Here
|
965 |
possibleExtends <- function(class1, class2, ClassDef1, ClassDef2) |
965 |
possibleExtends <- function(class1, class2, ClassDef1, ClassDef2) |
966 |
.identC(class1, class2) || .identC(class2, "ANY") |
966 |
.identC(class1, class2) || .identC(class2, "ANY") |
967 |
|
967 |
|
968 |
## "Real" definition (assigned in ./zzz.R ) |
|
|
969 |
.possibleExtends <- |
968 |
.possibleExtends <- |
970 |
## Find the information that says whether class1 extends class2, |
969 |
## Find the information that says whether class1 extends class2, |
971 |
## directly or indirectly. This can be either a logical value or |
970 |
## directly or indirectly. This can be either a logical value or |
Lines 979-995
Link Here
|
979 |
## ext <- TRUE # may become a list of extends definitions |
978 |
## ext <- TRUE # may become a list of extends definitions |
980 |
if(is.null(ClassDef1)) # class1 not defined |
979 |
if(is.null(ClassDef1)) # class1 not defined |
981 |
return(FALSE) |
980 |
return(FALSE) |
982 |
## else |
|
|
983 |
ext <- ClassDef1@contains |
981 |
ext <- ClassDef1@contains |
984 |
nm1 <- names(ext) |
982 |
nm1 <- names(ext) |
985 |
i <- match(class2, nm1) |
983 |
i <- which(nm1 == class2) |
986 |
if(is.na(i)) { |
984 |
if ( length(i) ) { |
|
|
985 |
return( ext[[i]] ) |
986 |
} else if (is.null(ClassDef2)) { |
987 |
return(FALSE) |
988 |
} else { |
987 |
## look for class1 in the known subclasses of class2 |
989 |
## look for class1 in the known subclasses of class2 |
988 |
if(!is.null(ClassDef2)) { |
|
|
989 |
ext <- ClassDef2@subclasses |
990 |
ext <- ClassDef2@subclasses |
990 |
## check for a classUnion definition, not a plain "classRepresentation" |
991 |
## check for a classUnion definition, not a plain "classRepresentation" |
991 |
if(!.identC(class(ClassDef2), "classRepresentation") && |
992 |
if(!.identC(class(ClassDef2), "classRepresentation") && isClassUnion(ClassDef2)) |
992 |
isClassUnion(ClassDef2)) |
|
|
993 |
## a simple TRUE iff class1 or one of its superclasses belongs to the union |
993 |
## a simple TRUE iff class1 or one of its superclasses belongs to the union |
994 |
i <- any(c(class1, nm1) %in% names(ext)) |
994 |
i <- any(c(class1, nm1) %in% names(ext)) |
995 |
else { |
995 |
else { |
Lines 1001-1014
Link Here
|
1001 |
} |
1001 |
} |
1002 |
} |
1002 |
} |
1003 |
} |
1003 |
} |
1004 |
if(is.na(i)) |
|
|
1005 |
FALSE |
1006 |
else if(is.logical(i)) |
1007 |
i |
1008 |
else |
1009 |
el(ext, i) |
1010 |
} |
1011 |
|
1004 |
|
|
|
1005 |
|
1012 |
## complete the extends information in the class definition, by following |
1006 |
## complete the extends information in the class definition, by following |
1013 |
## transitive chains. |
1007 |
## transitive chains. |
1014 |
## |
1008 |
## |