Class AbstractAnaphorResolutionStrategy<N,E,T,B,VB extends B,FB extends B,MB extends B,TB extends B,S,I,QI,EV,PP,R extends RelatedExpression<N,T,B,TB,S,QI,R>,A extends ASTBasedAnaphora<N,E,T,B,TB,S,I,QI,R,A>>
java.lang.Object
de.monochromata.AbstractStrategy
de.monochromata.anaphors.ast.strategy.AbstractAnaphorResolutionStrategy<N,E,T,B,VB,FB,MB,TB,S,I,QI,EV,PP,R,A>
- Type Parameters:
N- The node type in the ASTE- The expression typeT- The type typeB- The binding typeVB- The variable binding typeFB- The field binding typeMB- The method binding typeTB- The type binding typeS- The scope type (optional)I- The type used to represent identifiersQI- The type used to represent qualified identifiersEV- The type of the event contained in the condition that is evaluated to check when the perspectivations shall be applied.PP- The type used for positions that carry perspectivationsR- The sub-type of related expression to useA- The sub-type of AST-based anaphora to use
- All Implemented Interfaces:
AnaphorResolutionStrategy<N,E,T,B,TB,S,I,QI,R,A>,Strategy
- Direct Known Subclasses:
AbstractAnchoringStrategy,DA1ReStrategy
public abstract class AbstractAnaphorResolutionStrategy<N,E,T,B,VB extends B,FB extends B,MB extends B,TB extends B,S,I,QI,EV,PP,R extends RelatedExpression<N,T,B,TB,S,QI,R>,A extends ASTBasedAnaphora<N,E,T,B,TB,S,I,QI,R,A>> extends AbstractStrategy implements AnaphorResolutionStrategy<N,E,T,B,TB,S,I,QI,R,A>
An abstract base class for strategies used to for resolve or construct the
referents of anaphors.
-
Field Summary
Fields Modifier and Type Field Description protected AnaphoraResolutionSpi<N,E,T,B,VB,FB,MB,TB,S,I,QI,R,A>anaphoraResolutionSpiprotected AnaphorsSpi<N,E,TB,S,I,QI,EV,PP>anaphorsSpiprotected RelatedExpressionsSpi<N,E,T,B,MB,TB,S,I,QI,EV,PP,R>relatedExpressionsSpiprotected List<Class<? extends RelatedExpressionStrategy>>supportedRelatedExpressionStrategies -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAnaphorResolutionStrategy()Used in contract testing.protectedAbstractAnaphorResolutionStrategy(List<Class<? extends RelatedExpressionStrategy>> supportedRelatedExpressionStrategies, AnaphorsSpi<N,E,TB,S,I,QI,EV,PP> anaphorsSpi, RelatedExpressionsSpi<N,E,T,B,MB,TB,S,I,QI,EV,PP,R> relatedExpressionsSpi, AnaphoraResolutionSpi<N,E,T,B,VB,FB,MB,TB,S,I,QI,R,A> anaphoraResolutionSpi) -
Method Summary
Modifier and Type Method Description booleancanRelateTo(RelatedExpressionStrategy<N,T,B,TB,S,QI,R> potentialRelatedExpressionStrategy)Used to decide whether this strategy can create potential anaphora relations for the given potential related expression.protected booleancouldBeAPreviousRealization(E definiteExpression)protected abstract List<Referent<TB,S,I,QI>>createPotentialReferents(S scope, R potentialRelatedExpression)List<A>generatePotentialAnaphora(S scope, String anaphor, E definiteExpression, List<R> potentialRelatedExpressions, List<ReferentializationStrategy<E,TB,S,I,QI>> refStrategies)Generates a list of potentialASTBasedAnaphorarelations.protected List<A>generatePotentialAnaphora(S scope, String anaphor, E definiteExpression, List<R> potentialRelatedExpressions, List<ReferentializationStrategy<E,TB,S,I,QI>> refStrategies, List<A> anaphoras, I idFromDefiniteExpression)protected Optional<I>getIdForDefiniteExpression(E definiteExpression)protected IgetIdForPreviousRealization(E definiteExpression)Should only be invoked ifcouldBeAPreviousRealization(Object)returned true.protected voidrequireThisAnaphorResolutionStrategy(A anaphora)Methods inherited from class de.monochromata.AbstractStrategy
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.monochromata.anaphors.ast.strategy.AnaphorResolutionStrategy
createAnaphora, createReferent, getAnaphorToBeRealized, getKindOfAnaphorResolutionStrategyToBeRealized, getKindOfReferentializationStrategyToBeRealized, getLocalTempVariableContents, realize, underspecifyAnaphor
-
Field Details
-
supportedRelatedExpressionStrategies
protected final List<Class<? extends RelatedExpressionStrategy>> supportedRelatedExpressionStrategies -
anaphorsSpi
-
anaphoraResolutionSpi
-
-
Constructor Details
-
AbstractAnaphorResolutionStrategy
protected AbstractAnaphorResolutionStrategy()Used in contract testing. -
AbstractAnaphorResolutionStrategy
protected AbstractAnaphorResolutionStrategy(List<Class<? extends RelatedExpressionStrategy>> supportedRelatedExpressionStrategies, AnaphorsSpi<N,E,TB,S,I,QI,EV,PP> anaphorsSpi, RelatedExpressionsSpi<N,E,T,B,MB,TB,S,I,QI,EV,PP,R> relatedExpressionsSpi, AnaphoraResolutionSpi<N,E,T,B,VB,FB,MB,TB,S,I,QI,R,A> anaphoraResolutionSpi)
-
-
Method Details
-
generatePotentialAnaphora
public List<A> generatePotentialAnaphora(S scope, String anaphor, E definiteExpression, List<R> potentialRelatedExpressions, List<ReferentializationStrategy<E,TB,S,I,QI>> refStrategies)Description copied from interface:AnaphorResolutionStrategyGenerates a list of potentialASTBasedAnaphorarelations. InvokesAnaphorResolutionStrategy.canRelateTo(RelatedExpressionStrategy)andAnaphorResolutionStrategy.createAnaphora(Object, String, Object, RelatedExpression, Referent, ReferentializationStrategy).- Specified by:
generatePotentialAnaphorain interfaceAnaphorResolutionStrategy<N,E,T,B,VB extends B,FB extends B,MB extends B,TB extends B,S,I>- Parameters:
scope- The scope containing the anaphor if used by the compiler-specific implementation. Implementations of this method must not access the scope but merely pass it on to SPI's they invoke.anaphor- The anaphor that is to be (re-)resolved.definiteExpression- The expression that may function as anaphor in the anaphora relation to be generated by this method. If the anaphora relation is to be re-resolved, this can be a non-trivial expression. If the anaphora relation is to be resolved for the first time, this is typically a simple name and might as well be called a definite expression at this point.potentialRelatedExpressions- Related expressions that could potentially constitute an anaphora relation with the given anaphor.refStrategies- Referentialisation strategies to be used to generate anaphora relations.- Returns:
- A list of potential anaphora relations.
- See Also:
AnaphorResolutionStrategy.canRelateTo(RelatedExpressionStrategy),AnaphorResolutionStrategy.createAnaphora(Object, String, Object, RelatedExpression, Referent, ReferentializationStrategy)
-
generatePotentialAnaphora
-
getIdForDefiniteExpression
-
couldBeAPreviousRealization
- Returns:
- true if the given definite expression has been or could
have been created by this or any other
AnaphorResolutionStrategy. - See Also:
getIdForPreviousRealization(Object)
-
getIdForPreviousRealization
Should only be invoked ifcouldBeAPreviousRealization(Object)returned true.- See Also:
couldBeAPreviousRealization(Object)
-
createPotentialReferents
-
requireThisAnaphorResolutionStrategy