coll Scope ASTNode.scope() [asScope()] with addElement root Program;
/** a relational nta collection attribute to compute a special scope containing visible fields and subtypes */
coll TypeDeclScope ClassDecl.protectedScope() [asProtectedScope()] with addElement root Program;
coll TypeDeclScope ClassDecl.packageScope() [asPackageScope()] with addElement root Program;
coll TypeDeclScope TypeDecl.protectedScope() [asProtectedScope()] with addElement root Program;
coll TypeDeclScope TypeDecl.packageScope() [asPackageScope()] with addElement root Program;
// collect all scopes
TypeDecl contributes scope() when !isNestedType() && !isClassDecl() to ASTNode.scope() for containingScope();
ClassDecl contributes protectedScope() when isNestedType() to ASTNode.scope() for containingScope();
TypeDecl contributes protectedScope() when isNestedType() to ASTNode.scope() for containingScope();
Block contributes scope() to ASTNode.scope() for containingScope();
ForStmt contributes scope() when !(getStmt() instanceof Block) to ASTNode.scope() for containingScope();
EnhancedForStmt contributes scope() when !(getStmt() instanceof Block) to ASTNode.scope() for containingScope();
// collect all elements
Declarator contributes asDeclaration() when !isField() || isPrivate() to ASTNode.scope() for containingScope();
Declarator contributes asDeclaration() when /* is NOT in interface || */ !isField() || isPrivate() to ASTNode.scope() for containingScope();
// field which is neither private, protected, nor public -> package-private scope
Declarator contributes asDeclaration() when isField() && !isPrivate() && !(isProtected() || isPublic()) to ClassDecl.packageScope() for containingScope();
Declarator contributes asDeclaration() when isField() && !isPrivate() && !(isProtected() || isPublic()) to TypeDecl.packageScope() for containingScope();
// field which is either protected or public -> protected scope
Declarator contributes asDeclaration() when isField() && !isPrivate() && (isProtected() || isPublic()) to ClassDecl.protectedScope() for containingScope();
Declarator contributes asDeclaration() when /* is in interface && */ isField() && !isPrivate() && (isProtected() || isPublic()) to TypeDecl.protectedScope() for containingScope();
ParameterDeclaration contributes asDeclaration() to ASTNode.scope() for containingScope();