Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.query.model
Class SetQuery

    java.lang.Object
      org.modeshape.graph.query.model.SetQuery

All Implemented Interfaces:
  Serializable, Command, LanguageObject, QueryCommand, Visitable

Direct Known Subclasses:
  JcrSetQuery

    @Immutable
    public class SetQuery

extends Object
implements QueryCommand

This object acts as a Set operator on multiple `queries`, such as performing UNION, INTERSECT, and EXCEPT operations.

The two `queries` are expected to have the same number and order of columns, and the corresponding columns types must be compatible.

See Also:
  Serialized Form

Nested Class Summary
`static class` | `SetQuery.Operation`

Constructor Summary
`SetQuery(QueryCommand left, SetQuery.Operation operation, QueryCommand right, boolean all)` Create a set query involving the supplied left- and right-hand-side queries.
`SetQuery(QueryCommand left, SetQuery.Operation operation, QueryCommand right, boolean all, List<? extends Ordering> orderings, Limit limit)` Create a set query involving the supplied left- and right-hand-side queries.

Method Summary
`void` | `accept(Visitor visitor)` Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.
`SetQuery` | `adding(Ordering... orderings)`
`List<? extends Column>` | `columns()` Return the columns defining the query results.
`boolean` | `equals(Object obj)`
`int` | `hashCode()`
`boolean` | `isAll()` Return whether this set query is a 'UNION ALL' or 'INTERSECT ALL' or 'EXCEPT ALL' query.
`QueryCommand` | `left()` Get the left-hand query.
`Limit` | `limits()` Get the limits associated with this query.
`SetQuery.Operation` | `operation()` Get the set operation for this query.
`List<? extends Ordering>` | `orderings()` Return the orderings for this query.
`QueryCommand` | `right()` Get the right-hand query.
`String` | `toString()`
`protected static boolean` | `unionableColumns(List<? extends Column> left, List<? extends Column> right)`
`SetQuery` | `withLimit(int rowLimit)` Create a copy of this query, but one that uses the supplied limit on the number of result rows.
`SetQuery` | `withOffset(int offset)` Create a copy of this query, but one that uses the supplied offset.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SetQuery

    public SetQuery(QueryCommand left,
                    SetQuery.Operation operation,
                    QueryCommand right,
                    boolean all)

  Create a set query involving the supplied left- and right-hand-side queries.

  Parameters:
    `left` - the left-hand-side query being combined
    `operation` - the set operation
    `right` - the right-hand-side query being combined
    `all` - true if all of the results should be included
  Throws:
    `IllegalArgumentException` - if the left-hand-side query, right-hand-side query, or operation are null

### SetQuery

    public SetQuery(QueryCommand left,
                    SetQuery.Operation operation,
                    QueryCommand right,
                    boolean all,
                    List<? extends Ordering> orderings,
                    Limit limit)

  Create a set query involving the supplied left- and right-hand-side queries.

  Parameters:
    `left` - the left-hand-side query being combined
    `operation` - the set operation
    `right` - the right-hand-side query being combined
    `all` - true if all of the results should be included
    `orderings` - the specification of the order of the result rows, or null if the results need not be ordered
    `limit` - the limit for the result rows, or null if there are no limits
  Throws:
    `IllegalArgumentException` - if the left-hand-side query, right-hand-side query, or operation are null

Method Detail

### unionableColumns

    protected static boolean unionableColumns(List<? extends Column> left,
                                              List<? extends Column> right)

### columns

    public List<? extends Column> columns()

  Return the columns defining the query results. If there are no columns, then the columns are implementation determined.

  Specified by:
    `columns` in interface `QueryCommand`
  Returns:
    the list of columns; never null
  See Also:
    `QueryCommand.columns()`

### limits

    public Limit limits()

  Get the limits associated with this query.

  Specified by:
    `limits` in interface `QueryCommand`
  Returns:
    the limits; never null but possibly `unlimited`
  See Also:
    `QueryCommand.limits()`

### orderings

    public List<? extends Ordering> orderings()

  Return the orderings for this query.

  Specified by:
    `orderings` in interface `QueryCommand`
  Returns:
    the list of orderings; never null
  See Also:
    `QueryCommand.orderings()`

### left

    public QueryCommand left()

  Get the left-hand query.

  Returns:
    the left-hand query; never null

### right

    public QueryCommand right()

  Get the right-hand query.

  Returns:
    the right-hand query; never null

### operation

    public final SetQuery.Operation operation()

  Get the set operation for this query.

  Returns:
    the operation; never null

### isAll

    public final boolean isAll()

  Return whether this set query is a 'UNION ALL' or 'INTERSECT ALL' or 'EXCEPT ALL' query.

  Returns:
    true if this is an 'ALL' query, or false otherwise

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`
  See Also:
    `Object.toString()`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`
  See Also:
    `Object.hashCode()`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`
  See Also:
    `Object.equals(java.lang.Object)`

### accept

    public void accept(Visitor visitor)

  Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.

  Specified by:
    `accept` in interface `Visitable`
  Parameters:
    `visitor` - the visitor; never null
  See Also:
    `Visitable.accept(org.modeshape.graph.query.model.Visitor)`

### withLimit

    public SetQuery withLimit(int rowLimit)

  Description copied from interface: `QueryCommand`
  Create a copy of this query, but one that uses the supplied limit on the number of result rows.

  Specified by:
    `withLimit` in interface `QueryCommand`
  Parameters:
    `rowLimit` - the limit that should be used; must be a positive number
  Returns:
    the copy of the query that uses the supplied limit; never null

### withOffset

    public SetQuery withOffset(int offset)

  Description copied from interface: `QueryCommand`
  Create a copy of this query, but one that uses the supplied offset.

  Specified by:
    `withOffset` in interface `QueryCommand`
  Parameters:
    `offset` - the limit that should be used; may not be negative
  Returns:
    the copy of the query that uses the supplied offset; never null

### adding

    public SetQuery adding(Ordering... orderings)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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