Search in sources :

Example 1 with NestableDeclarationImpl

use of org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.NestableDeclarationImpl in project ceylon by eclipse.

the class ClassOrInterfaceDeclarationImpl method filteredDeclaredMembers.

@SuppressWarnings({ "rawtypes", "unchecked" })
private <Kind> Sequential<? extends Kind> filteredDeclaredMembers(@Ignore TypeDescriptor $reifiedKind, Predicates.Predicate predicate) {
    if (predicate == Predicates.false_()) {
        return (Sequential<? extends Kind>) empty_.get_();
    }
    checkInit();
    ArrayList<Kind> members = new ArrayList<Kind>(declarations.size());
    for (ceylon.language.meta.declaration.NestableDeclaration decl : declaredDeclarations) {
        Declaration declaration2 = ((NestableDeclarationImpl) decl).declaration;
        if (!declaration2.isNativeHeader() && predicate.accept(declaration2)) {
            members.add((Kind) decl);
        }
    }
    java.lang.Object[] array = members.toArray(new java.lang.Object[0]);
    ObjectArrayIterable<Kind> iterable = new ObjectArrayIterable<Kind>($reifiedKind, (Kind[]) array);
    return (ceylon.language.Sequential) iterable.sequence();
}
Also used : NestableDeclarationImpl(org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.NestableDeclarationImpl) ArrayList(java.util.ArrayList) ObjectArrayIterable(org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable) Sequential(ceylon.language.Sequential) TypeDeclaration(org.eclipse.ceylon.model.typechecker.model.TypeDeclaration) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Example 2 with NestableDeclarationImpl

use of org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.NestableDeclarationImpl in project ceylon by eclipse.

the class ClassOrInterfaceDeclarationImpl method filteredMembers.

@SuppressWarnings({ "rawtypes", "unchecked" })
private <Kind> Sequential<? extends Kind> filteredMembers(@Ignore TypeDescriptor $reifiedKind, Predicates.Predicate predicate) {
    if (predicate == Predicates.false_()) {
        return (Sequential<? extends Kind>) empty_.get_();
    }
    checkInit();
    ArrayList<Kind> members = new ArrayList<Kind>(declarations.size());
    for (ceylon.language.meta.declaration.NestableDeclaration decl : declarations) {
        Declaration declaration2 = ((NestableDeclarationImpl) decl).declaration;
        if (!declaration2.isNativeHeader() && predicate.accept(declaration2)) {
            members.add((Kind) decl);
        }
    }
    java.lang.Object[] array = members.toArray(new java.lang.Object[0]);
    ObjectArrayIterable<Kind> iterable = new ObjectArrayIterable<Kind>($reifiedKind, (Kind[]) array);
    return (ceylon.language.Sequential) iterable.sequence();
}
Also used : NestableDeclarationImpl(org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.NestableDeclarationImpl) ArrayList(java.util.ArrayList) ObjectArrayIterable(org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable) Sequential(ceylon.language.Sequential) TypeDeclaration(org.eclipse.ceylon.model.typechecker.model.TypeDeclaration) Declaration(org.eclipse.ceylon.model.typechecker.model.Declaration)

Aggregations

Sequential (ceylon.language.Sequential)2 ArrayList (java.util.ArrayList)2 ObjectArrayIterable (org.eclipse.ceylon.compiler.java.language.ObjectArrayIterable)2 NestableDeclarationImpl (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.NestableDeclarationImpl)2 Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)2 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)2