001package de.monochromata.anaphors.ast;
002
003import de.monochromata.anaphors.ast.reference.Referent;
004import de.monochromata.anaphors.ast.reference.strategy.ReferentializationStrategy;
005import de.monochromata.anaphors.ast.relatedexp.RelatedExpression;
006import de.monochromata.anaphors.ast.strategy.AnaphorResolutionStrategy;
007
008/**
009 * Represents an anaphor at the AST level. Because instances of this type
010 * contain AST nodes, they should be short-lived and must not be persisted.
011 *
012 * @param <N>  The node type in the AST
013 * @param <E>  The expression type
014 * @param <T>  The type type
015 * @param <B>  The binding type
016 * @param <TB> The type binding type
017 * @param <S>  The scope type (optional)
018 * @param <I>  The type used to represent identifiers
019 * @param <QI> The type used to represent qualified identifiers
020 * @param <R>  The sub-type of related expression to use
021 * @param <A>  The sub-type of AST-based anaphora to use
022 */
023public interface AnaphorPart<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>> {
024
025        /**
026         * @return A {@link String} representation of the anaphor initially entered by
027         *         the user or chosen algorithmically. This will be identical to the
028         *         {@link String} representation of the anaphor expression returned for
029         *         underspecified anaphora relations but will differ to explicated
030         *         anaphora relations.
031         * @see #getAnaphorExpression()
032         */
033        public String getAnaphor();
034
035        /**
036         * Get the expression that acts as anaphor.
037         *
038         * TODO: Replace by getTargetExpression()? But should the Anaphora interface be
039         * renamed, too, in this case?
040         *
041         * @return The expression that acts as anaphor.
042         */
043        public E getAnaphorExpression();
044
045        /**
046         * Get the referent of the anaphor.
047         *
048         * TODO: Should this method be in an Anaphor or TargetExpression interface?
049         * TODO: Should other referents (e.g. the one of the related expression) be
050         * available, too?
051         *
052         * @return The referent of the anaphor.
053         */
054        public Referent<TB, S, I, QI> getReferent();
055
056        /**
057         * Get the anaphor resolution strategy that was used to find the referent of the
058         * anaphor involved in this anaphora relation.
059         *
060         * @return The anaphor resolution strategy.
061         */
062        public AnaphorResolutionStrategy<N, E, T, B, TB, S, I, QI, R, A> getAnaphorResolutionStrategy();
063
064        public ReferentializationStrategy<E, TB, S, I, QI> getReferentializationStrategy();
065
066        public B getBinding();
067
068        public TB resolveType(S scope);
069
070}