org.eclipse.viatra.query.runtime.matchers.planning

## Class SubPlan

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.planning.SubPlan

-     public class SubPlan
      extends java.lang.Object

  A plan representing a subset of (or possibly all the) constraints evaluated. A SubPlan instance is responsible for representing a state of the plan; but after it is initialized it is expected be immutable (exception: inferred constraints, see `inferConstraint(PConstraint)`).

  A SubPlan is constructed by applying a `POperation` on zero or more parent SubPlans. Important maintained information:

  - set of variables whose values are known when the runtime evaluation is at this stage,
  - set of constraints that are known to hold true at this point.

  Recommended to instantiate via a `SubPlanFactory` or subclasses, so that query planners can subclass SubPlan if needed.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SubPlan(PBody body, POperation operation, java.util.List<? extends SubPlan> parentPlans)` A SubPlan is constructed by applying a `POperation` on zero or more parent SubPlans.
    `SubPlan(PBody body, POperation operation, SubPlan... parentPlans)` A SubPlan is constructed by applying a `POperation` on zero or more parent SubPlans.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `java.util.Set<PVariable>` | `getAllDeducedVariables()` Variables which have been assigned a value; includes visible variables (see `getVisibleVariables()`) and additionally any variables hidden by a projection (see `PProject`).
    `java.util.Set<PConstraint>` | `getAllEnforcedConstraints()` All constraints that are known to hold at this point
    `java.util.Set<TypeJudgement>` | `getAllImpliedTypeJudgements(IQueryMetaContext context)` The closure of all type judgments of enforced constraints at this point.
    `PBody` | `getBody()`
    `java.util.Set<PConstraint>` | `getDeltaEnforcedConstraints()` The new constraints enforced at this stage of plan, that aren't yet enforced at parents (results are also included in `getAllEnforcedConstraints()`)
    `java.util.Set<PVariable>` | `getIntroducedVariables()` Delta compared to first parent: variables that are visible here but were not visible at the first parent.
    `POperation` | `getOperation()`
    `java.util.List<? extends SubPlan>` | `getParentPlans()`
    `java.util.Set<PVariable>` | `getVisibleVariables()` Variables which are assigned a value at this point (results are also included in `getAllDeducedVariables()`)
    `int` | `hashCode()`
    `void` | `inferConstraint(PConstraint constraint)` Indicate that a given constraint was found to be automatically satisfied at this point without additional operations.
    `java.lang.String` | `toLongString()`
    `java.lang.String` | `toShortString()`
    `java.lang.String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SubPlan

          public SubPlan(PBody body,
                         POperation operation,
                         SubPlan... parentPlans)

      A SubPlan is constructed by applying a `POperation` on zero or more parent SubPlans.

    - #### SubPlan

          public SubPlan(PBody body,
                         POperation operation,
                         java.util.List<? extends SubPlan> parentPlans)

      A SubPlan is constructed by applying a `POperation` on zero or more parent SubPlans.

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### toShortString

          public java.lang.String toShortString()

    - #### toLongString

          public java.lang.String toLongString()

    - #### getAllEnforcedConstraints

          public java.util.Set<PConstraint> getAllEnforcedConstraints()

      All constraints that are known to hold at this point

    - #### getDeltaEnforcedConstraints

          public java.util.Set<PConstraint> getDeltaEnforcedConstraints()

      The new constraints enforced at this stage of plan, that aren't yet enforced at parents (results are also included in `getAllEnforcedConstraints()`)

    - #### inferConstraint

          public void inferConstraint(PConstraint constraint)

      Indicate that a given constraint was found to be automatically satisfied at this point without additional operations. (results are also included in `getDeltaEnforcedConstraints()`)

      Warning: not propagated automatically to child plans, so best to invoke before constructing further SubPlans.

    - #### getBody

          public PBody getBody()

    - #### getVisibleVariables

          public java.util.Set<PVariable> getVisibleVariables()

      Variables which are assigned a value at this point (results are also included in `getAllDeducedVariables()`)

    - #### getAllDeducedVariables

          public java.util.Set<PVariable> getAllDeducedVariables()

      Variables which have been assigned a value; includes visible variables (see `getVisibleVariables()`) and additionally any variables hidden by a projection (see `PProject`).

    - #### getIntroducedVariables

          public java.util.Set<PVariable> getIntroducedVariables()

      Delta compared to first parent: variables that are visible here but were not visible at the first parent.

    - #### getParentPlans

          public java.util.List<? extends SubPlan> getParentPlans()

    - #### getOperation

          public POperation getOperation()

    - #### getAllImpliedTypeJudgements

          public java.util.Set<TypeJudgement> getAllImpliedTypeJudgements(IQueryMetaContext context)

      The closure of all type judgments of enforced constraints at this point.

      No subsumption applied.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`