org.eclipse.viatra.query.runtime.localsearch.operations

## Class ExtendOperationExecutor<T>

- java.lang.Object
- - org.eclipse.viatra.query.runtime.localsearch.operations.ExtendOperationExecutor<T>

- All Implemented Interfaces:
    ISearchOperation.ISearchOperationExecutor
  Direct Known Subclasses:
    SingleValueExtendOperationExecutor

      public abstract class ExtendOperationExecutor<T>
      extends java.lang.Object
      implements ISearchOperation.ISearchOperationExecutor

  An operation that can be used to enumerate all possible values for a single position based on a constraint
  Since:
    2.0
  No Extend:
    This class is not intended to be subclassed by clients.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExtendOperationExecutor()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `cleanup(MatchingFrame frame, ISearchContext context)` Restores the frame to the state before `fillInValue(Object, MatchingFrame, ISearchContext)`.
    `boolean` | `execute(MatchingFrame frame, ISearchContext context)`
    `protected abstract boolean` | `fillInValue(T newValue, MatchingFrame frame, ISearchContext context)` Updates the frame with the next element of the iterator.
    `protected abstract java.util.Iterator<? extends T>` | `getIterator(MatchingFrame frame, ISearchContext context)` Returns an iterator with the possible options from the current state
    `void` | `onBacktrack(MatchingFrame frame, ISearchContext context)` After the execution of the operation failed and `ISearchOperation.ISearchOperationExecutor.execute(MatchingFrame, ISearchContext)` returns false, the onBacktrack callback is evaluated.
    `void` | `onInitialize(MatchingFrame frame, ISearchContext context)` During the execution of the corresponding plan, the onInitialize callback is evaluated before the execution of the operation may begin.

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

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

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.localsearch.operations.ISearchOperation.ISearchOperationExecutor

      `getOperation`

- - ### Constructor Detail

    - #### ExtendOperationExecutor

          public ExtendOperationExecutor()

  - ### Method Detail

    - #### getIterator

          protected abstract java.util.Iterator<? extends T> getIterator(MatchingFrame frame,
                                                                         ISearchContext context)

      Returns an iterator with the possible options from the current state
      Since:
        2.0

    - #### fillInValue

          protected abstract boolean fillInValue(T newValue,
                                                 MatchingFrame frame,
                                                 ISearchContext context)

      Updates the frame with the next element of the iterator. Called during `execute(MatchingFrame, ISearchContext)`.
      Returns:
        true if the update is successful or false otherwise; in case of false is returned, the next element should be taken from the iterator.
      Since:
        2.0

    - #### cleanup

          protected abstract void cleanup(MatchingFrame frame,
                                          ISearchContext context)

      Restores the frame to the state before `fillInValue(Object, MatchingFrame, ISearchContext)`. Called during `onBacktrack(MatchingFrame, ISearchContext)`.
      Since:
        2.0

    - #### onInitialize

          public void onInitialize(MatchingFrame frame,
                                   ISearchContext context)

      Description copied from interface: `ISearchOperation.ISearchOperationExecutor`
      During the execution of the corresponding plan, the onInitialize callback is evaluated before the execution of the operation may begin. Operations may use this method to initialize its internal data structures.
      Specified by:
        `onInitialize` in interface `ISearchOperation.ISearchOperationExecutor`

    - #### onBacktrack

          public void onBacktrack(MatchingFrame frame,
                                  ISearchContext context)

      Description copied from interface: `ISearchOperation.ISearchOperationExecutor`
      After the execution of the operation failed and `ISearchOperation.ISearchOperationExecutor.execute(MatchingFrame, ISearchContext)` returns false, the onBacktrack callback is evaluated. Operations may use this method to clean up any temporary structures, and make the operation ready for a new execution.
      Specified by:
        `onBacktrack` in interface `ISearchOperation.ISearchOperationExecutor`

    - #### execute

          public boolean execute(MatchingFrame frame,
                                 ISearchContext context)

      Specified by:
        `execute` in interface `ISearchOperation.ISearchOperationExecutor`
      Returns:
        true if successful, or false if backtracking needed