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

## Class BasePConstraint

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

- All Implemented Interfaces:
    PConstraint, PTraceable
  Direct Known Subclasses:
    DeferredPConstraint, EnumerablePConstraint

      public abstract class BasePConstraint
      extends java.lang.Object
      implements PConstraint

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected PBody` | `pBody`

    - ### Fields inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.PConstraint

      `COMPARE_BY_MONOTONOUS_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasePConstraint(PBody pBody, java.util.Set<PVariable> affectedVariables)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkSanity()`
    `void` | `delete()`
    `protected abstract void` | `doReplaceVariable(PVariable obsolete, PVariable replacement)`
    `java.util.Set<PVariable>` | `getAffectedVariables()` All variables affected by this constraint.
    `PBody` | `getBody()`
    `java.util.Map<java.util.Set<PVariable>,java.util.Set<PVariable>>` | `getFunctionalDependencies(IQueryMetaContext context)` A (preferably minimal) cover of known functional dependencies between variables.
    `int` | `getMonotonousID()` Returns an integer ID that is guaranteed to increase strictly monotonously for constraints within a pBody.
    `PBody` | `getPSystem()` For backwards compatibility.
    `void` | `replaceVariable(PVariable obsolete, PVariable replacement)`
    `java.lang.String` | `toString()`
    `protected abstract java.lang.String` | `toStringRest()`

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

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

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.PConstraint

      `getDeducedVariables`

- - ### Field Detail

    - #### pBody

          protected PBody pBody

  - ### Constructor Detail

    - #### BasePConstraint

          public BasePConstraint(PBody pBody,
                                 java.util.Set<PVariable> affectedVariables)

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

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

    - #### toStringRest

          protected abstract java.lang.String toStringRest()

    - #### getAffectedVariables

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

      Description copied from interface: `PConstraint`
      All variables affected by this constraint.
      Specified by:
        `getAffectedVariables` in interface `PConstraint`

    - #### getFunctionalDependencies

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

      Description copied from interface: `PConstraint`
      A (preferably minimal) cover of known functional dependencies between variables.
      Specified by:
        `getFunctionalDependencies` in interface `PConstraint`
      Returns:
        non-trivial functional dependencies in the form of {variables} --> {variables}, where dependencies with the same lhs are unified.

    - #### replaceVariable

          public void replaceVariable(PVariable obsolete,
                                      PVariable replacement)

      Specified by:
        `replaceVariable` in interface `PConstraint`

    - #### doReplaceVariable

          protected abstract void doReplaceVariable(PVariable obsolete,
                                                    PVariable replacement)

    - #### delete

          public void delete()

      Specified by:
        `delete` in interface `PConstraint`

    - #### checkSanity

          public void checkSanity()

      Specified by:
        `checkSanity` in interface `PConstraint`

    - #### getPSystem

          public PBody getPSystem()

      For backwards compatibility. Equivalent to `getBody()`

    - #### getBody

          public PBody getBody()

      Specified by:
        `getBody` in interface `PConstraint`
      Returns:
        the query body this constraint belongs to
      Since:
        2.1

    - #### getMonotonousID

          public int getMonotonousID()

      Description copied from interface: `PConstraint`
      Returns an integer ID that is guaranteed to increase strictly monotonously for constraints within a pBody.
      Specified by:
        `getMonotonousID` in interface `PConstraint`