001package de.monochromata.anaphors.ast.transform;
002
003import de.monochromata.anaphors.ast.ASTBasedAnaphora;
004import de.monochromata.anaphors.ast.relatedexp.RelatedExpression;
005
006/**
007 * An AST transformation.
008 *
009 * @param <N>  The node type in the AST
010 * @param <E>  The expression type
011 * @param <T>  The type type
012 * @param <B>  The binding type
013 * @param <TB> The type binding type
014 * @param <S>  The scope type (optional)
015 * @param <I>  The type used to represent identifiers
016 * @param <QI> The type used to represent qualified identifiers
017 * @param <R>  The sub-type of related expression to use
018 * @param <A>  The sub-type of AST-based anaphora to use
019 */
020public interface ASTTransformation<N, E, T, B, TB extends B, S, I, QI, R extends RelatedExpression<N, T, B, TB, S, QI, R>, A extends ASTBasedAnaphora<N, E, T, B, TB, S, I, QI, R, A>> {
021
022        /**
023         * Perform the transformation and convert the given preliminary anaphora (that
024         * is based on the AST before the transformation) into a potential anaphora that
025         * is based on the AST after the transformation (which might contain new nodes).
026         * <p>
027         * The relationship between the transformation and preliminary anaphora depends
028         * on the kind of transformation. I.e. a certain transformation might introduce
029         * a node that exchanges the related expression from the preliminary anaphora by
030         * a new node that is eventually used in the potential anaphora while another
031         * transformation might replace other nodes.
032         * <p>
033         * The potential anaphor uses the same strategies as the preliminary anaphora,
034         * though.
035         * <p>
036         * TODO: error handling: what shall happen if the transformation fails?
037         *
038         * @param preliminaryAnaphora the preliminary anaphora
039         * @return a potential anaphora relation
040         */
041        public A perform(final A preliminaryAnaphora);
042
043}