001package de.monochromata.anaphors.ast.relatedexp;
002
003import java.util.List;
004
005import de.monochromata.anaphors.ast.relatedexp.strategy.RelatedExpressionStrategy;
006
007/**
008 * An interface to objects used to traverse the AST to find potential related
009 * expressions.
010 * <p>
011 * Note that the implementations of this interface may choose to support only a
012 * fixed set of {@link RelatedExpressionStrategy} instances.
013 *
014 * @param <N>  The node type in the AST
015 * @param <E>  The expression type
016 * @param <T>  The type type
017 * @param <B>  The binding type
018 * @param <TB> The type binding type
019 * @param <S>  The scope type (optional)
020 * @param <QI> The type used to represent qualified identifiers
021 * @param <R>  The sub-type of related expression to use
022 */
023public interface RelatedExpressionsCollector<N, E, T, B, TB extends B, S, QI, R extends RelatedExpression<N, T, B, TB, S, QI, R>> {
024
025        /**
026         * Traverse the body declaration that contains the given definite expression.
027         * <p>
028         * TODO: Rename the method to make clear that the enclosing body declaration is
029         * to be traversed?
030         * <p>
031         * TODO: There might be related expression that do not traverse the body
032         * enclosing the given definite expression but that check whether that body is
033         * reachable from some place
034         *
035         * @param definiteExpression The definite expression whose enclosing body is to
036         *                           be traversed.
037         * @param scope              The scope containing the definite expression if
038         *                           used by the compiler-specific implementation.
039         *                           Implementations of this method must not access the
040         *                           scope but merely pass it on to SPI's they invoke.
041         * @return collected potential related expressions
042         */
043        public List<R> traverse(E definiteExpression, S scope);
044}