Interface PreparatoryTransformation<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>>

Type Parameters:
N - The node type in the AST
E - The expression type
T - The type type
B - The binding type
TB - The type binding type
S - The scope type (optional)
I - The type used to represent identifiers
QI - The type used to represent qualified identifiers
R - The sub-type of related expression to use
A - The sub-type of AST-based anaphora to use
All Superinterfaces:
Strategy
All Known Implementing Classes:
AbstractPreparatoryTransformation, AddParameterToCallChain, NoPreparationRequired

public interface PreparatoryTransformation<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>>
extends Strategy
A transformation used to prepare the introduction of an ASTBasedAnaphora relation.
  • Method Summary

    Modifier and Type Method Description
    CheckResult<N,​E,​S> canPerform​(Chunk<N> chunk, E definiteExpression, S scope)
    Check whether the transformation can be performed.
    A perform​(CheckResult<N,​E,​S> checkResult, A preliminaryAnaphora)
    Perform the preparatory transformation and return a potential Anaphora relation thereafter.

    Methods inherited from interface de.monochromata.Strategy

    getKind
  • Method Details

    • canPerform

      CheckResult<N,​E,​S> canPerform​(Chunk<N> chunk, E definiteExpression, S scope)
      Check whether the transformation can be performed.

      Note that the applicability of preparatory transformations must be mutually exclusive: only one out of all preparatory transformations can be applicable to a combination of chunk, definite expression and scope.

      Parameters:
      chunk - The chunk that contains the node that may function as related expression.
      definiteExpression - The definite expression that can potentially function as anaphor.
      scope - The scope containing the definite expression. May be null if not required by the AST implementation configured via the service provider interfaces.
      Returns:
      the result of a check that might contain (hidden) implementation-specific cached information to speed up perform(CheckResult, ASTBasedAnaphora).
    • perform

      A perform​(CheckResult<N,​E,​S> checkResult, A preliminaryAnaphora)
      Perform the preparatory transformation and return a potential Anaphora relation thereafter.
      Parameters:
      checkResult - the result of an invocation of check that might contain (hidden) implementation-specific cached information to speed up perform(CheckResult, ASTBasedAnaphora)
      preliminaryAnaphora - a preliminary anaphora relation that will be used as a blue-print to create the potential anaphora. (The preliminary anaphora is based on the AST before the preparatory transformation - its related expression might be unreachable from its the definite expression.)
      Returns:
      a potential anaphora relation that in valid in the AST after the preparatory transformation has been applied.
      Throws:
      IllegalArgumentException - If the given check result has not been created by this strategy or if the given check result's CheckResult.canPerformTransformation() returns false.