Class IA2FStrategy<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>
de.monochromata.anaphors.ast.strategy.AbstractAnchoringStrategy<N,E,T,B,VB,FB,MB,TB,S,I,QI,EV,PP,R,A>
de.monochromata.anaphors.ast.strategy.IA2FStrategy<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>,AnchoringStrategy<N,E,T,B,TB,S,I,QI,R,A>,StoresAnchorInLocalTempVariable<N,E,T,B,TB,S,I,QI,R,A>,Strategy
public class IA2FStrategy<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 AbstractAnchoringStrategy<N,E,T,B,VB,FB,MB,TB,S,I,QI,EV,PP,R,A> implements StoresAnchorInLocalTempVariable<N,E,T,B,TB,S,I,QI,R,A>
An indirect-anaphora resolution strategy that anchors anaphors in a field
declared by the anchor.
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static List<Class<? extends RelatedExpressionStrategy>>IA2F_SUPPORTED_RELATED_EXPRESSION_STRATEGIESFields inherited from class de.monochromata.anaphors.ast.strategy.AbstractAnaphorResolutionStrategy
anaphoraResolutionSpi, anaphorsSpi, relatedExpressionsSpi, supportedRelatedExpressionStrategies -
Constructor Summary
Constructors Modifier Constructor Description protectedIA2FStrategy()Used in contract testing.IA2FStrategy(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 AcreateAnaphora(S scope, String anaphor, E anaphorExpression, R potentialRelatedExpression, Referent<TB,S,I,QI> potentialReferent, ReferentializationStrategy<E,TB,S,I,QI> refStrategy)Create a single potentialASTBasedAnaphorarelation for a pair of anaphor (TODO: definite expression) and a potential related expression.protected List<Referent<TB,S,I,QI>>createPotentialReferents(R relatedExpression, S scope, TB typeBinding)protected List<Referent<TB,S,I,QI>>createPotentialReferents(S scope, R potentialRelatedExpression)protected Referent<TB,S,I,QI>createReferent(R relatedExpression, S scope, TB typeBinding, Object memento)Referent<TB,S,I,QI>createReferent(S scope, R relatedExpression, Object memento)Re-creates a referent from a given related expression and memento.StringgetAnaphorToBeRealized(RelatedExpressionPart<N,E,T,B,TB,S,I,QI,R> relatedExpressionPart, List<AnaphorPart<N,E,T,B,TB,S,I,QI,R,A>> allAnaphorPartsRelatedToTheRelatedExpression, AnaphorPart<N,E,T,B,TB,S,I,QI,R,A> anaphorPart, S scope)To be invoked when a related expression resolved with this strategy is realized to obtain the anaphor that will be present after realization.protected StringgetAnaphorToBeRealized(I fieldName)protected StringgetAnaphorToBeRealized(String rawAnaphor)StringgetKind()Returns a short mnemonic string that uniquely identifies this strategy among the type of strategies it belongs to.Erealize(RelatedExpressionPart<N,E,T,B,TB,S,I,QI,R> relatedExpressionPart, AnaphorPart<N,E,T,B,TB,S,I,QI,R,A> anaphorPart, E replacee, Optional<I> guessedTempName, Object... support)Replaces the anaphor of the given anaphora relation.List<Perspectivation>underspecifyAnaphor(R relatedExpression, String anaphor, E anaphorExpression, Referent<TB,S,I,QI> referent, S scope)List<Perspectivation>underspecifyAnaphorForIA2F(int qualifierLength, boolean fieldNameStartsUpperCase)Only public to ease testing.protected List<Perspectivation>underspecifyAnaphorForIA2F(R relatedExpression, String anaphor, E anaphorExpression, IA2FStrategy.IA2FReferent<N,E,T,B,VB,FB,MB,TB,S,I,QI,EV,PP,R,A> referent, S scope)Methods inherited from class de.monochromata.anaphors.ast.strategy.AbstractAnchoringStrategy
getQualifierForIAMethods inherited from class de.monochromata.anaphors.ast.strategy.AbstractAnaphorResolutionStrategy
canRelateTo, couldBeAPreviousRealization, generatePotentialAnaphora, generatePotentialAnaphora, getIdForDefiniteExpression, getIdForPreviousRealization, requireThisAnaphorResolutionStrategyMethods 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
canRelateTo, generatePotentialAnaphoraMethods inherited from interface de.monochromata.anaphors.ast.strategy.StoresAnchorInLocalTempVariable
getKindOfAnaphorResolutionStrategyToBeRealized, getKindOfReferentializationStrategyToBeRealized, getLocalTempVariableContents
-
Field Details
-
IA2F_SUPPORTED_RELATED_EXPRESSION_STRATEGIES
public static final List<Class<? extends RelatedExpressionStrategy>> IA2F_SUPPORTED_RELATED_EXPRESSION_STRATEGIES
-
-
Constructor Details
-
IA2FStrategy
protected IA2FStrategy()Used in contract testing. -
IA2FStrategy
-
-
Method Details
-
createPotentialReferents
-
createPotentialReferents
-
createReferent
Description copied from interface:AnaphorResolutionStrategyRe-creates a referent from a given related expression and memento.TODO: This method should be renamed to reCreateReferent(...)
TODO: When should this method be used?
- Specified by:
createReferentin 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.relatedExpression- Related expressions that could potentially constitute an anaphora relation with the given anaphor.memento- A compiler-specific memento used to reconstruct the referent.- Returns:
- The re-constructed referent.
- See Also:
Referent.getMemento()
-
createReferent
-
createAnaphora
public A createAnaphora(S scope, String anaphor, E anaphorExpression, R potentialRelatedExpression, Referent<TB,S,I,QI> potentialReferent, ReferentializationStrategy<E,TB,S,I,QI> refStrategy)Description copied from interface:AnaphorResolutionStrategyCreate a single potentialASTBasedAnaphorarelation for a pair of anaphor (TODO: definite expression) and a potential related expression.- Specified by:
createAnaphorain 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.anaphorExpression- 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.potentialRelatedExpression- A related expression that could potentially constitute an anaphora relation with the given anaphor.potentialReferent- As e.g. returned byAbstractAnaphorResolutionStrategy.createPotentialReferents(Object, RelatedExpression)of this instance.refStrategy- The referentialization strategies to be used to generate the anaphora relation.- Returns:
- A list of potential anaphora relations.
-
realize
public E realize(RelatedExpressionPart<N,E,T,B,TB,S,I,QI,R> relatedExpressionPart, AnaphorPart<N,E,T,B,TB,S,I,QI,R,A> anaphorPart, E replacee, Optional<I> guessedTempName, Object... support)Description copied from interface:AnaphorResolutionStrategyReplaces the anaphor of the given anaphora relation. Note that this method will replace AST nodes in the given anaphora instance if realization involves replacing AST nodes.- Specified by:
realizein interfaceAnaphorResolutionStrategy<N,E,T,B,VB extends B,FB extends B,MB extends B,TB extends B,S,I>replacee- The anaphor node that will be replaced. TODO: Is this the anaphor, really?guessedTempName- If the given related expression part has aLocalTempVariableIntroducingStrategy, the strategy introduced a temporary variable that might be used by the anaphor resolution strategy to generate code for the anaphors.support- Optional compiler-specific support objects. Implementations of this method must not access the support objects but merely pass them on to SPI's they invoke.- Returns:
- The node that replaced the anaphor.
- See Also:
ASTBasedAnaphora.getAnaphor()
-
getKind
Description copied from interface:StrategyReturns a short mnemonic string that uniquely identifies this strategy among the type of strategies it belongs to. -
underspecifyAnaphor
-
underspecifyAnaphorForIA2F
-
underspecifyAnaphorForIA2F
public List<Perspectivation> underspecifyAnaphorForIA2F(int qualifierLength, boolean fieldNameStartsUpperCase)Only public to ease testing. Should be moved to a mixin interface and be hidden/separated using Java modules. -
getAnaphorToBeRealized
public String getAnaphorToBeRealized(RelatedExpressionPart<N,E,T,B,TB,S,I,QI,R> relatedExpressionPart, List<AnaphorPart<N,E,T,B,TB,S,I,QI,R,A>> allAnaphorPartsRelatedToTheRelatedExpression, AnaphorPart<N,E,T,B,TB,S,I,QI,R,A> anaphorPart, S scope)Description copied from interface:AnaphorResolutionStrategyTo be invoked when a related expression resolved with this strategy is realized to obtain the anaphor that will be present after realization.That realized anaphor will also apply when the anaphora is re-resolved. Thus setting the realized anaphor in the beginning will avoid a faux change being detected during re-resolution of the unmodified anaphora relation.
-
getAnaphorToBeRealized
-
getAnaphorToBeRealized
-