org.modeshape.graph.query.model
Class SetQuery

java.lang.Object
  extended by org.modeshape.graph.query.model.Command
      extended by org.modeshape.graph.query.model.QueryCommand
          extended by org.modeshape.graph.query.model.SetQuery
All Implemented Interfaces:
Serializable, LanguageObject, Visitable

@Immutable
public class SetQuery
extends 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<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)
           
 boolean equals(Object obj)
          
 QueryCommand getLeft()
          Get the left-hand query.
 SetQuery.Operation getOperation()
          Get the set operation for this query.
 QueryCommand getRight()
          Get the right-hand query.
 int hashCode()
          
 boolean isAll()
          Return whether this set query is a 'UNION ALL' or 'INTERSECT ALL' or 'EXCEPT ALL' query.
 String toString()
          
 SetQuery withLimit(int rowLimit)
           
 SetQuery withOffset(int offset)
           
 
Methods inherited from class org.modeshape.graph.query.model.QueryCommand
getLimits, getOrderings
 
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<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

getLeft

public final QueryCommand getLeft()
Get the left-hand query.

Returns:
the left-hand query; never null

getRight

public final QueryCommand getRight()
Get the right-hand query.

Returns:
the right-hand query; never null

getOperation

public final SetQuery.Operation getOperation()
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.

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

withLimit

public SetQuery withLimit(int rowLimit)

withOffset

public SetQuery withOffset(int offset)

adding

public SetQuery adding(Ordering... orderings)


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