package de.dhbwstuttgart.syntaxtree;

import org.antlr.v4.runtime.Token;

import java.util.Iterator;
import java.util.List;

public class ParameterList extends SyntaxTreeNode implements Iterable<Pattern> {
    private List<Pattern> formalparameter;

    public ParameterList(List<Pattern> params, Token offset) {
        super(offset);
        this.formalparameter = params;
    }

    public Pattern getParameterAt(int i) {
        if (i >= formalparameter.size())
            return null;

        return formalparameter.get(i);
    }

    public List<Pattern> getFormalparalist() {
        return formalparameter;
    }

    @Override
    public Iterator<Pattern> iterator() {
        return formalparameter.iterator();
    }

    @Override
    public void accept(ASTVisitor visitor) {
        visitor.visit(this);
    }
}
