org.modeshape.jcr.query.process

## Class JoinComponent

- java.lang.Object
- - org.modeshape.jcr.query.process.ProcessingComponent
  - - org.modeshape.jcr.query.process.JoinComponent

- Direct Known Subclasses:
    MergeJoinComponent, NestedLoopJoinComponent

      public abstract class JoinComponent
      extends ProcessingComponent

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static interface` | `JoinComponent.Joinable` Interface defining the value of a tuple that is used in the join condition.
    `protected static interface` | `JoinComponent.TupleMerger` A component that will merge the supplied tuple on the left side of a join with the supplied tuple on the right side of the join, to produce a single tuple with all components from the left and right tuples.
    `protected static interface` | `JoinComponent.ValueSelector` Interface defining the value of a tuple that is used in the join condition.

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.query.process.ProcessingComponent

      `ProcessingComponent.DynamicOperation`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Comparator<QueryResults.Location>` | `LOCATION_COMPARATOR`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JoinComponent(QueryContext context, ProcessingComponent left, ProcessingComponent right, JoinCondition condition, JoinType joinType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static Comparator<Object>` | `arrayAwareComparator(Comparator<Object> comparator)`
    `protected static Comparator<Object>` | `comparatorFor(QueryContext context, ProcessingComponent left, ProcessingComponent right, JoinCondition condition)` Create a `Comparable` that can be used to compare the values required to evaluate the supplied join condition.
    `protected static JoinComponent.TupleMerger` | `createMerger(QueryResults.Columns joinColumns, QueryResults.Columns leftColumns, QueryResults.Columns rightColumns)` Create a `JoinComponent.TupleMerger` implementation that will combine a tuple fitting the left columns with a tuple fitting the right columns.
    `JoinCondition` | `getJoinCondition()` Get the join condition.
    `JoinType` | `getJoinType()` Get the type of join this processor represents.
    `protected static JoinComponent.Joinable` | `joinableFor(ProcessingComponent left, ProcessingComponent right, JoinCondition condition)` Create a `JoinComponent.ValueSelector` that obtains the value required to use the supplied join condition.
    `protected ProcessingComponent` | `left()` Get the processing component that serves as the left side of the join.
    `protected QueryResults.Columns` | `leftColunns()` Get the columns definition for the results from the left side of the join.
    `protected ProcessingComponent` | `right()` Get the processing component that serves as the right side of the join.
    `protected QueryResults.Columns` | `rightColumns()` Get the columns definition for the results from the right side of the join.
    `protected static JoinComponent.ValueSelector` | `valueSelectorFor(ProcessingComponent source, JoinCondition condition)` Create a `JoinComponent.ValueSelector` that obtains the value required to use the supplied join condition.

    - ### Methods inherited from class org.modeshape.jcr.query.process.ProcessingComponent

      `close, createDynamicOperation, createSortComparator, emptyTuples, execute, getColumns, getContext, getLocationIndexes, problems`

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

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

- - ### Field Detail

    - #### LOCATION_COMPARATOR

          protected static final Comparator<QueryResults.Location> LOCATION_COMPARATOR

  - ### Constructor Detail

    - #### JoinComponent

          protected JoinComponent(QueryContext context,
                       ProcessingComponent left,
                       ProcessingComponent right,
                       JoinCondition condition,
                       JoinType joinType)

  - ### Method Detail

    - #### getJoinType

          public final JoinType getJoinType()

      Get the type of join this processor represents.
      Returns:
        the join type; never null

    - #### getJoinCondition

          public final JoinCondition getJoinCondition()

      Get the join condition.
      Returns:
        the join condition; never null

    - #### left

          protected final ProcessingComponent left()

      Get the processing component that serves as the left side of the join.
      Returns:
        the left-side processing component; never null

    - #### right

          protected final ProcessingComponent right()

      Get the processing component that serves as the right side of the join.
      Returns:
        the right-side processing component; never null

    - #### leftColunns

          protected final QueryResults.Columns leftColunns()

      Get the columns definition for the results from the left side of the join.
      Returns:
        the left-side columns that feed this join; never null

    - #### rightColumns

          protected final QueryResults.Columns rightColumns()

      Get the columns definition for the results from the right side of the join.
      Returns:
        the right-side columns that feed this join; never null

    - #### createMerger

          protected static JoinComponent.TupleMerger createMerger(QueryResults.Columns joinColumns,
                                               QueryResults.Columns leftColumns,
                                               QueryResults.Columns rightColumns)

      Create a `JoinComponent.TupleMerger` implementation that will combine a tuple fitting the left columns with a tuple fitting the right columns. This merger will properly place all of the values, locations, and scores such that the tuples always have this arrangement:

              [ v1, v2, ..., vM, loc1, loc2, ..., locN, s1, s2, ..., sN ]

      where M is the number of values in the tuple, and N is the number of sources in the tuple.

      Note that this merger does not actually reduce or combine values. That is done with a particular `JoinComponent` subclass.

      Parameters:
        `joinColumns` - the Columns specification for the joined/merged tuples; may not be null
        `leftColumns` - the Columns specification for the tuple on the left side of the join; may not be null
        `rightColumns` - the Columns specification for the tuple on the right side of the join; may not be null
      Returns:
        the merger implementation that will combine tuples from the left and right to form the merged tuples; never null

    - #### valueSelectorFor

          protected static JoinComponent.ValueSelector valueSelectorFor(ProcessingComponent source,
                                                     JoinCondition condition)

      Create a `JoinComponent.ValueSelector` that obtains the value required to use the supplied join condition.
      Parameters:
        `source` - the source component; may not be null
        `condition` - the join condition; may not be null
      Returns:
        the value selector; never null

    - #### joinableFor

          protected static JoinComponent.Joinable joinableFor(ProcessingComponent left,
                                           ProcessingComponent right,
                                           JoinCondition condition)

      Create a `JoinComponent.ValueSelector` that obtains the value required to use the supplied join condition.
      Parameters:
        `left` - the left source component; may not be null
        `right` - the left source component; may not be null
        `condition` - the join condition; may not be null
      Returns:
        the value selector; never null

    - #### arrayAwareComparator

          protected static Comparator<Object> arrayAwareComparator(Comparator<Object> comparator)

    - #### comparatorFor

          protected static Comparator<Object> comparatorFor(QueryContext context,
                                         ProcessingComponent left,
                                         ProcessingComponent right,
                                         JoinCondition condition)

      Create a `Comparable` that can be used to compare the values required to evaluate the supplied join condition.
      Parameters:
        `context` - the context in which this query is being evaluated; may not be null
        `left` - the left source component; may not be null
        `right` - the left source component; may not be null
        `condition` - the join condition; may not be null
      Returns:
        the comparator; never null

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