org.eclipse.incquery.runtime.localsearch.operations.extend

## Class CountOperation

- java.lang.Object
- - org.eclipse.incquery.runtime.localsearch.operations.extend.ExtendOperation<java.lang.Integer>
  - - org.eclipse.incquery.runtime.localsearch.operations.extend.CountOperation

- All Implemented Interfaces:
    IMatcherBasedOperation, ISearchOperation

      public class CountOperation
      extends ExtendOperation<java.lang.Integer>
      implements IMatcherBasedOperation

  Calculates the count of matches for a called matcher
  Author:
    Zoltan Ujhelyi

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CountOperation(PQuery calledQuery, java.util.Map<java.lang.Integer,java.lang.Integer> frameMapping, int position)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `LocalSearchMatcher` | `getAndPrepareCalledMatcher(MatchingFrame frame, ISearchContext context)` Gets the called matcher based on the context and the current adornment and stores it in the corresponding field of the operation
    `LocalSearchMatcher` | `getCalledMatcher()` Gets the called matcher associated with the operation
    `java.util.List<java.lang.Integer>` | `getVariablePositions()`
    `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.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.eclipse.incquery.runtime.localsearch.operations.extend.ExtendOperation

      `execute, onBacktrack`

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

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

- - ### Constructor Detail

    - #### CountOperation

          public CountOperation(PQuery calledQuery,
                                java.util.Map<java.lang.Integer,java.lang.Integer> frameMapping,
                                int position)

  - ### Method Detail

    - #### getAndPrepareCalledMatcher

          public LocalSearchMatcher getAndPrepareCalledMatcher(MatchingFrame frame,
                                                               ISearchContext context)

      Description copied from interface: `IMatcherBasedOperation`
      Gets the called matcher based on the context and the current adornment and stores it in the corresponding field of the operation
      Specified by:
        `getAndPrepareCalledMatcher` in interface `IMatcherBasedOperation`
      Parameters:
        `frame` - the current matching frame
        `context` - the search context
      Returns:
        the called local search matcher

    - #### getCalledMatcher

          public LocalSearchMatcher getCalledMatcher()

      Description copied from interface: `IMatcherBasedOperation`
      Gets the called matcher associated with the operation
      Specified by:
        `getCalledMatcher` in interface `IMatcherBasedOperation`
      Returns:
        the called local search matcher or null if no matcher assigned

    - #### onInitialize

          public void onInitialize(MatchingFrame frame,
                                   ISearchContext context)
                            throws LocalSearchException

      Description copied from interface: `ISearchOperation`
      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`
      Throws:
        `LocalSearchException`

    - #### toString

          public java.lang.String toString()

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

    - #### getVariablePositions

          public java.util.List<java.lang.Integer> getVariablePositions()

      Specified by:
        `getVariablePositions` in interface `ISearchOperation`
      Returns:
        the ordered list of the variable numbers that are affected by the search operation