/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.reflection.impl;

import java.lang.reflect.Parameter;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import net.ranides.assira.collection.query.CQuery;
import net.ranides.assira.reflection.*;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public class AArguments extends AElements<IArgument> implements IArguments {

    private final int count;

    AArguments(IHints hints, int count, CQuery<IArgument> stream) {
        super(hints, stream);
        this.count = count;
    }
    
    @Override
    public List<String> names() {
        return list(IArgument::name);
    }

    @Override
    public IClasses types() {
        return FElements.newClasses(AHints.EMPTY, stream(IArgument::type));
    }
    
    @Override
    public IMethods parent() {
        return FElements.newMethods(AHints.EMPTY, stream(IArgument::parent));
    }

    @Override
    public Map<String, IArgument> map() {
        return stream().collect(Collectors.toMap(IArgument::name, a -> a));
    }

    @Override
    public CQuery<Parameter> reflective() {
        return stream().map(IArgument::reflective);
    }

    @Override
    public int count() {
        return count;
    }
    
}
