001package de.monochromata.anaphors.ast;
002
003import de.monochromata.anaphors.ast.reference.strategy.ReferentializationStrategy;
004import de.monochromata.anaphors.ast.relatedexp.RelatedExpression;
005import de.monochromata.anaphors.ast.relatedexp.strategy.RelatedExpressionStrategy;
006import de.monochromata.anaphors.ast.strategy.AnaphorResolutionStrategy;
007
008public interface KindComposition {
009
010        /**
011         * Returns a kind composed of the kinds provided by the
012         * {@link RelatedExpressionPart} and the {@link AnaphorPart}.
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 <I>  The type used to represent identifiers
021         * @param <QI> The type used to represent qualified identifiers
022         * @param <R>  The sub-type of related expression to use
023         * @param <A>  The sub-type of AST-based anaphora to use
024         */
025        static <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>> String getKind(
026                        final RelatedExpressionPart<N, E, T, B, TB, S, I, QI, R> relatedExpressionPart,
027                        final AnaphorPart<N, E, T, B, TB, S, I, QI, R, A> anaphorPart) {
028                return getKind(relatedExpressionPart.getRelatedExpression().getStrategy(),
029                                anaphorPart.getAnaphorResolutionStrategy(), anaphorPart.getReferentializationStrategy());
030        }
031
032        /**
033         * Returns a kind composed of the kinds of the provided strategies.
034         *
035         * @param <N>  The node type in the AST
036         * @param <E>  The expression type
037         * @param <T>  The type type
038         * @param <B>  The binding type
039         * @param <TB> The type binding type
040         * @param <S>  The scope type (optional)
041         * @param <I>  The type used to represent identifiers
042         * @param <QI> The type used to represent qualified identifiers
043         * @param <R>  The sub-type of related expression to use
044         * @param <A>  The sub-type of AST-based anaphora to use
045         */
046        static <N, T, B, TB extends B, S, QI, E, I, R extends RelatedExpression<N, T, B, TB, S, QI, R>, A extends ASTBasedAnaphora<N, E, T, B, TB, S, I, QI, R, A>> String getKind(
047                        final RelatedExpressionStrategy<N, T, B, TB, S, QI, R> relatedExpressionStrategy,
048                        final AnaphorResolutionStrategy<N, E, T, B, TB, S, I, QI, R, A> anaphorResolutionStrategy,
049                        final ReferentializationStrategy<E, TB, S, I, QI> referentializationStrategy) {
050                return relatedExpressionStrategy.getKind() + "-" + anaphorResolutionStrategy.getKind() + "-"
051                                + referentializationStrategy.getKind();
052        }
053
054}