001package de.monochromata.anaphors.ast;
002
003import de.monochromata.anaphors.ast.relatedexp.RelatedExpression;
004
005/**
006 * A default implementation of a direct anaphora relation.
007 *
008 * @param <N>  The node type in the AST
009 * @param <E>  The expression type
010 * @param <T>  The type type
011 * @param <B>  The binding type
012 * @param <TB> The type binding type
013 * @param <S>  The scope type (optional)
014 * @param <I>  The type used to represent identifiers
015 * @param <QI> The type used to represent qualified identifiers
016 * @param <R>  The sub-type of related expression to use
017 * @param <A>  The sub-type of AST-based anaphora to use
018 */
019public class DefaultDirectAnaphora<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>>
020        extends AbstractASTBasedAnaphora<N, E, T, B, TB, S, I, QI, R, A>
021        implements DirectAnaphora<N, E, T, B, TB, S, I, QI, R, A> {
022
023    /**
024     * Used in contract testing.
025     */
026    @SuppressWarnings("unused")
027    protected DefaultDirectAnaphora() {
028    }
029
030    public DefaultDirectAnaphora(final RelatedExpressionPart<N, E, T, B, TB, S, I, QI, R> relatedExpressionPart,
031            final AnaphorPart<N, E, T, B, TB, S, I, QI, R, A> anaphorPart, final boolean isUnderspecified) {
032        super(relatedExpressionPart, anaphorPart, isUnderspecified);
033    }
034
035    @Override
036    public String getReferenceDescription() {
037        return getRelatedExpression().getDescription() + " at " + getRelatedExpression().getLine() + ":"
038                + getRelatedExpression().getColumn() + " (" + getKind() + ")";
039    }
040
041    @Override
042    public String toString() {
043        return getKind() + " [getRelatedExpression()=" + getRelatedExpression() + ", getAnaphor()=" + getAnaphor()
044                + ", getAnaphorExpression()=" + getAnaphorExpression() + ", getReferent()=" + getReferent()
045                + ", getRelatedExpressionStrategy()=" + getRelatedExpressionStrategy()
046                + ", getAnaphorResolutionStrategy()=" + getAnaphorResolutionStrategy()
047                + ", getReferentializationStrategy()=" + getReferentializationStrategy() + ", getBinding()="
048                + getBinding() + ", isUnderspecified()=" + isUnderspecified() + ", isExplicated()=" + isExplicated()
049                + "]";
050    }
051
052}