org.eclipse.viatra.query.runtime.matchers.psystem

## Class PBody

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.psystem.PBody

- All Implemented Interfaces:
    PTraceable

      public class PBody
      extends java.lang.Object
      implements PTraceable

  A set of constraints representing a pattern body

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `VIRTUAL_VARIABLE_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PBody(PQuery query)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<PVariable,java.util.Set<TypeJudgement>>` | `getAllUnaryTypeRestrictions(IQueryMetaContext context)` All unary input keys directly prescribed by constraints, grouped by variable.
    `java.util.Set<PVariable>` | `getAllVariables()`
    `java.util.Set<PConstraint>` | `getConstraints()`
    `<ConstraintType> java.util.Set<ConstraintType>` | `getConstraintsOfType(java.lang.Class<ConstraintType> constraintClass)`
    `PDisjunction` | `getContainerDisjunction()` Returns the disjunction the body is contained with.
    `PVariable` | `getOrCreateVariableByName(java.lang.String name)` Finds and returns a PVariable by name.
    `PQuery` | `getPattern()`
    `java.util.List<ExportedParameter>` | `getSymbolicParameters()` Returns the exported parameter constraints of the body.
    `java.util.List<PVariable>` | `getSymbolicParameterVariables()` Returns the symbolic parameters of the body.
    `java.util.Set<PVariable>` | `getUniqueVariables()`
    `PVariable` | `getVariableByNameChecked(java.lang.Object name)` Find a PVariable by name
    `boolean` | `isMutable()`
    `PVariable` | `newConstantVariable(java.lang.Object value)`
    `PVariable` | `newVirtualVariable()`
    `PVariable` | `newVirtualVariable(java.lang.String name)`
    `void` | `setContainerDisjunction(PDisjunction containerDisjunction)`
    `void` | `setStatus(PQuery.PQueryStatus status)` Sets a specific status for the body.
    `void` | `setSymbolicParameters(java.util.List<ExportedParameter> symbolicParameters)` Sets the exported parameter constraints of the body, if this instance is mutable.

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

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

- - ### Field Detail

    - #### VIRTUAL_VARIABLE_PREFIX

          public static final java.lang.String VIRTUAL_VARIABLE_PREFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PBody

          public PBody(PQuery query)

  - ### Method Detail

    - #### getConstraintsOfType

          public <ConstraintType> java.util.Set<ConstraintType> getConstraintsOfType(java.lang.Class<ConstraintType> constraintClass)

    - #### newVirtualVariable

          public PVariable newVirtualVariable()

    - #### newVirtualVariable

          public PVariable newVirtualVariable(java.lang.String name)

    - #### newConstantVariable

          public PVariable newConstantVariable(java.lang.Object value)

    - #### getAllVariables

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

    - #### getUniqueVariables

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

    - #### getVariableByNameChecked

          public PVariable getVariableByNameChecked(java.lang.Object name)
                                             throws java.lang.IllegalArgumentException

      Find a PVariable by name
      Parameters:
        `name` -
      Returns:
        the found variable
      Throws:
        `java.lang.IllegalArgumentException` - if no PVariable is found with the selected name

    - #### getOrCreateVariableByName

          public PVariable getOrCreateVariableByName(java.lang.String name)

      Finds and returns a PVariable by name. If no PVariable exists with the name in the body, a new one is created. If the name of the variable starts with ".virtual", the created variable will be considered virtual.
      Parameters:
        `name` -
      Returns:
        a PVariable with the selected name; never null

    - #### getConstraints

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

    - #### getPattern

          public PQuery getPattern()

    - #### getSymbolicParameterVariables

          public java.util.List<PVariable> getSymbolicParameterVariables()

      Returns the symbolic parameters of the body.

      Warning: if two PVariables are unified, the returned list changes. If you want to have a stable version, consider using `getSymbolicParameters()`.

      Returns:
        a non-null, but possibly empty list

    - #### getSymbolicParameters

          public java.util.List<ExportedParameter> getSymbolicParameters()

      Returns the exported parameter constraints of the body.
      Returns:
        a non-null, but possibly empty list

    - #### setSymbolicParameters

          public void setSymbolicParameters(java.util.List<ExportedParameter> symbolicParameters)

      Sets the exported parameter constraints of the body, if this instance is mutable.
      Parameters:
        `symbolicParameters` - the new value

    - #### setStatus

          public void setStatus(PQuery.PQueryStatus status)

      Sets a specific status for the body. If set, the parent PQuery status will not be checked; if set to null, its corresponding PQuery status is checked for mutability.
      Parameters:
        `status` - the status to set

    - #### isMutable

          public boolean isMutable()

    - #### getContainerDisjunction

          public PDisjunction getContainerDisjunction()

      Returns the disjunction the body is contained with. This disjunction may either be the `canonical disjunction of the corresponding query` or something equivalent.
      Returns:
        the container disjunction of the body. Can be null if body is not in a disjunction yet.

    - #### setContainerDisjunction

          public void setContainerDisjunction(PDisjunction containerDisjunction)

      Parameters:
        `containerDisjunction` - the containerDisjunction to set

    - #### getAllUnaryTypeRestrictions

          public java.util.Map<PVariable,java.util.Set<TypeJudgement>> getAllUnaryTypeRestrictions(IQueryMetaContext context)

      All unary input keys directly prescribed by constraints, grouped by variable.

      to supertype inference or subsumption applied at this point.