org.modeshape.jcr.query.optimize

## Class ReorderSortAndRemoveDuplicates

- java.lang.Object
- - org.modeshape.jcr.query.optimize.ReorderSortAndRemoveDuplicates

- All Implemented Interfaces:
    OptimizerRule

      @Immutable
      public class ReorderSortAndRemoveDuplicates
      extends Object
      implements OptimizerRule

  An `optimizer rule` that looks for a `PlanNode.Type.SORT` plan node below a `PlanNode.Type.DUP_REMOVE`, and swaps them. This ensures that the duplicate removal is always lower in the tree. This is advantageous because many sort algorithms can also efficiently remove duplicates, so it is often better for the `PlanNode.Type.SORT` plan node to appear higher in the optimized plan.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ReorderSortAndRemoveDuplicates` | `INSTANCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReorderSortAndRemoveDuplicates()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PlanNode` | `execute(QueryContext context, PlanNode plan, LinkedList<OptimizerRule> ruleStack)` Optimize the supplied plan using the supplied context, hints, and yet-to-be-run rules.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### INSTANCE

          public static final ReorderSortAndRemoveDuplicates INSTANCE

  - ### Constructor Detail

    - #### ReorderSortAndRemoveDuplicates

          public ReorderSortAndRemoveDuplicates()

  - ### Method Detail

    - #### execute

          public PlanNode execute(QueryContext context,
                         PlanNode plan,
                         LinkedList<OptimizerRule> ruleStack)

      Description copied from interface: `OptimizerRule`
      Optimize the supplied plan using the supplied context, hints, and yet-to-be-run rules.
      Specified by:
        `execute` in interface `OptimizerRule`
      Parameters:
        `context` - the context in which the query is being optimized; never null
        `plan` - the plan to be optimized; never null
        `ruleStack` - the stack of rules that will be run after this rule; never null
      Returns:
        the optimized plan; never null

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.