Package org.eclipse.viatra.query.runtime.rete.construction.plancompiler

## Class CompilerHelper

- java.lang.Object
- - org.eclipse.viatra.query.runtime.rete.construction.plancompiler.CompilerHelper

-     public class CompilerHelper
      extends java.lang.Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `CompilerHelper.JoinHelper` | Calculated index mappings for a join, based on the common variables of the two parent subplans.
    `static class` | `CompilerHelper.PosetTriplet` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static PlanningTrace` | `checkAndTrimEqualVariables​(SubPlan plan, PlanningTrace coreTrace)` | Makes sure that all variables in the tuple are different so that it can be used as `CompiledSubPlan`.
    `static CompilerHelper.PosetTriplet` | `computePosetInfo​(java.lang.Iterable<java.util.Set<IInputKey>> keys, IQueryMetaContext context)` |
    `static CompilerHelper.PosetTriplet` | `computePosetInfo​(java.util.List<PVariable> variables, PBody body, IQueryMetaContext context)` |
    `static CompilerHelper.PosetTriplet` | `computePosetInfo​(java.util.List<PParameter> parameters, IQueryMetaContext context)` |
    `static java.util.List<PVariable>` | `convertVariablesTuple​(EnumerablePConstraint constraint)` | Extracts the variable list representation of the variables tuple.
    `static java.util.List<PVariable>` | `convertVariablesTuple​(Tuple variablesTuple)` | Extracts the variable list representation of the variables tuple.
    `static RecipeTraceInfo` | `makeIndexerTrace​(SubPlan planToCompile, PlanningTrace parentTrace, TupleMask mask)` | Returns a compiled indexer trace according to a mask
    `static Mask` | `makeProjectionMask​(PlanningTrace compiledParent, java.lang.Iterable<PVariable> projectedVariables)` |
    `static CompiledQuery` | `makeQueryTrace​(PQuery query, java.util.Map<PBody,​RecipeTraceInfo> bodyFinalTraces, java.util.Collection<ReteNodeRecipe> bodyFinalRecipes, QueryEvaluationHint hint, IQueryMetaContext context, boolean deleteAndRederiveEvaluation, TimelyConfiguration timelyEvaluation)` | Creates a recipe for a production node and the corresponding trace.
    `protected static TrimmerRecipe` | `makeTrimmerRecipe​(PlanningTrace compiledParent, java.util.List<PVariable> projectedVariables)` | Creates a trimmer that keeps selected variables only.
    `static Mask` | `toRecipeMask​(TupleMask mask)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### checkAndTrimEqualVariables

          public static PlanningTrace checkAndTrimEqualVariables​(SubPlan plan,
                                                                 PlanningTrace coreTrace)

      Makes sure that all variables in the tuple are different so that it can be used as `CompiledSubPlan`. If a variable occurs multiple times, equality checks are applied and then the results are trimmed so that duplicates are hidden. If no manipulation is necessary, the original trace is returned.

      to be used whenever a constraint introduces new variables.

    - #### convertVariablesTuple

          public static java.util.List<PVariable> convertVariablesTuple​(EnumerablePConstraint constraint)

      Extracts the variable list representation of the variables tuple.

    - #### convertVariablesTuple

          public static java.util.List<PVariable> convertVariablesTuple​(Tuple variablesTuple)

      Extracts the variable list representation of the variables tuple.

    - #### makeIndexerTrace

          public static RecipeTraceInfo makeIndexerTrace​(SubPlan planToCompile,
                                                         PlanningTrace parentTrace,
                                                         TupleMask mask)

      Returns a compiled indexer trace according to a mask

    - #### makeTrimmerRecipe

          protected static TrimmerRecipe makeTrimmerRecipe​(PlanningTrace compiledParent,
                                                           java.util.List<PVariable> projectedVariables)

      Creates a trimmer that keeps selected variables only.

    - #### makeProjectionMask

          public static Mask makeProjectionMask​(PlanningTrace compiledParent,
                                                java.lang.Iterable<PVariable> projectedVariables)

    - #### computePosetInfo

          public static CompilerHelper.PosetTriplet computePosetInfo​(java.util.List<PVariable> variables,
                                                                     PBody body,
                                                                     IQueryMetaContext context)

      Since:
        1.6

    - #### computePosetInfo

          public static CompilerHelper.PosetTriplet computePosetInfo​(java.util.List<PParameter> parameters,
                                                                     IQueryMetaContext context)

      Since:
        1.6

    - #### computePosetInfo

          public static CompilerHelper.PosetTriplet computePosetInfo​(java.lang.Iterable<java.util.Set<IInputKey>> keys,
                                                                     IQueryMetaContext context)

      Since:
        1.6

    - #### makeQueryTrace

          public static CompiledQuery makeQueryTrace​(PQuery query,
                                                     java.util.Map<PBody,​RecipeTraceInfo> bodyFinalTraces,
                                                     java.util.Collection<ReteNodeRecipe> bodyFinalRecipes,
                                                     QueryEvaluationHint hint,
                                                     IQueryMetaContext context,
                                                     boolean deleteAndRederiveEvaluation,
                                                     TimelyConfiguration timelyEvaluation)

      Creates a recipe for a production node and the corresponding trace.

      PRE: in case this is a recursion cutoff point (see `RecursionCutoffPoint`) and bodyFinalTraces will be filled later, the object yielded now by bodyFinalTraces.values() must return up-to-date results later

      Since:
        2.4

    - #### toRecipeMask

          public static Mask toRecipeMask​(TupleMask mask)

      Since:
        1.4