001package de.monochromata.ast;
002
003import java.util.Set;
004
005/**
006 * The service provider interface used by the
007 * <code>de.monochromata.anaphors</code> package to perform anaphora resolution
008 * on a given AST implementation.
009 *
010 * @param <N>  The node type in the AST
011 * @param <E>  The expression 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 <EV> The type of the event contained in the condition that is
017 *             evaluated to check when the perspectivations shall be applied.
018 * @param <PP> The type used for positions that carry perspectivations
019 */
020public interface AnaphorsApi<N, E, TB, S, I, QI, EV, PP> {
021
022    public boolean isSimpleName(E definiteExpression);
023
024    public I getIdentifierOfSimpleName(E simpleName);
025
026    /*
027     * TODO: Move logic from PublicDom to d.m.a to remove d.m.a types from the API
028     * public boolean nameOfReferentEqualsIdentifier(Referent<TB, S, I, QI>
029     * referent, I id, boolean caseSensitive);
030     */
031
032    /*
033     * TODO: Move logic from PublicDom to d.m.a to remove d.m.a types from the API
034     *
035     * Returns true, if the name of the referent matches a suffix of the identifier.
036     *
037     * @param referent the referent whose name to match
038     *
039     * @param id the id to match
040     *
041     * @param caseSensitive whether case should be considered during matching
042     *
043     * @return {@code true}, if the name of the referent matches a suffix of the
044     * identifier, {@code false} otherwise (including when the referent has no
045     * name).
046     *
047     * @see Referent#hasName() public boolean
048     * nameOfReferentMatchesConceptualTypeOfIdentifier(Referent<TB, S, I, QI>
049     * referent, I id, boolean caseSensitive);
050     *
051     * public Set<QI>
052     * getFeaturesRemainingInIdentifierBesidesConceptualTypeOfReferentName(I id,
053     * Referent<TB, S, I, QI> referent, boolean caseSensitive);
054     */
055
056    /**
057     * Test whether the given identifier matches the simple name of the given type
058     * binding.
059     *
060     * TODO: Add the possibility to match prefix/suffix
061     *
062     * @param id            The identifier to match.
063     * @param type          The typing binding whose simple name is to be matched.
064     * @param caseSensitive True, if case is to be considered, false, if it is to be
065     *                      ignored. TODO: What about the initial character?
066     * @return True, if the identifier matches the simple name of the type binding,
067     *         false otherwise.
068     */
069    public boolean nameOfIdentifierEqualsSimpleNameOfTypeBinding(I id, TB type, boolean caseSensitive);
070
071    public boolean conceptualTypeInIdentifierEqualsSimpleNameOfType(I id, TB type, boolean caseSensitive);
072
073    public Set<QI> getFeaturesRemainingInIdentifierBesidesConceptualTypeOfReferentType(I id, TB referentType,
074            boolean caseSensitive);
075
076    public boolean nameOfIdentifierEqualsFauxHyponymOfSimpleNameOfTypeBinding(I id, TB type, boolean caseSensitive);
077
078    public boolean conceptualTypeInIdentifierEqualsFauxHyponymyOfSimpleNameOfType(I id, TB type, boolean caseSensitive);
079
080    public Set<QI> getFeaturesRemainingInIdentifierBesidesConceptualTypeOfReferentTypeWithFauxHyponymy(I id, TB type,
081            boolean caseSensitive);
082
083    /*
084     * TODO: Move logic from PublicDom to d.m.a to remove d.m.a types from the API
085     * public PP createPositionForExpression(final E expression, final Predicate<EV>
086     * condition, final List<Perspectivation> perspectivations);
087     */
088
089    public int getLength(final QI qualifiedIdentifier);
090}