org.modeshape.graph.query.plan
Class PlanNode

java.lang.Object
  extended by org.modeshape.graph.query.plan.PlanNode
All Implemented Interfaces:
Serializable, Cloneable, Iterable<PlanNode>, Readable

@NotThreadSafe
public final class PlanNode
extends Object
implements Iterable<PlanNode>, Readable, Cloneable, Serializable

A representation of a single node within a plan tree.

See Also:
Serialized Form

Nested Class Summary
static class PlanNode.Property
          An enumeration dictating the type of plan tree nodes.
static class PlanNode.Traversal
           
static class PlanNode.Type
          An enumeration dictating the type of plan tree nodes.
 
Constructor Summary
PlanNode(PlanNode.Type type)
          Create a new plan node with the supplied initial type.
PlanNode(PlanNode.Type type, Iterable<SelectorName> selectors)
          Create a new plan node with the supplied initial type ad that is a child of the supplied parent.
PlanNode(PlanNode.Type type, PlanNode parent)
          Create a new plan node with the supplied initial type ad that is a child of the supplied parent.
PlanNode(PlanNode.Type type, PlanNode parent, Iterable<SelectorName> selectors)
          Create a new plan node with the supplied initial type ad that is a child of the supplied parent.
PlanNode(PlanNode.Type type, PlanNode parent, SelectorName... selectors)
          Create a new plan node with the supplied initial type ad that is a child of the supplied parent.
PlanNode(PlanNode.Type type, SelectorName... selectors)
          Create a new plan node with the supplied initial type ad that is a child of the supplied parent.
 
Method Summary
 void addChildren(Iterable<PlanNode> otherChildren)
          Add the supplied nodes at the end of the list of children.
 void addChildren(PlanNode first, PlanNode second)
          Add the supplied nodes at the end of the list of children.
 void addChildren(PlanNode first, PlanNode second, PlanNode third)
          Add the supplied nodes at the end of the list of children.
 void addFirstChild(PlanNode child)
          Add the supplied node to the front of the list of children.
 void addLastChild(PlanNode child)
          Add the supplied node to the end of the list of children.
 void addSelector(SelectorName symbol)
          Add a selector to this plan node.
 void addSelector(SelectorName first, SelectorName second)
          Add the selectors to this plan node.
 void addSelectors(Iterable<SelectorName> names)
          Add the selectors to this plan node.
 PlanNode clone()
           This class returns a new clone of the plan tree rooted at this node.
 boolean equals(Object obj)
          
 void extractChild(PlanNode child)
          Remove the child node from this node, and replace that child with its first child (if there is one).
 void extractFromParent()
          Extract this node from its parent, but replace this node with its child (if there is one).
 List<PlanNode> findAllAtOrBelow()
          Find all of the nodes that are at or below this node.
 List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order)
          Find all of the nodes that are at or below this node.
 List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order, PlanNode.Type typeToFind)
          Find all of the nodes of the specified type that are at or below this node.
 List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order, PlanNode.Type firstTypeToFind, PlanNode.Type... additionalTypesToFind)
          Find all of the nodes with one of the specified types that are at or below this node.
 List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order, Set<PlanNode.Type> typesToFind)
          Find all of the nodes with one of the specified types that are at or below this node.
 List<PlanNode> findAllAtOrBelow(PlanNode.Type typeToFind)
          Find all of the nodes of the specified type that are at or below this node.
 List<PlanNode> findAllAtOrBelow(PlanNode.Type firstTypeToFind, PlanNode.Type... additionalTypesToFind)
          Find all of the nodes with one of the specified types that are at or below this node.
 List<PlanNode> findAllAtOrBelow(Set<PlanNode.Type> typesToFind)
          Find all of the nodes with one of the specified types that are at or below this node.
 PlanNode findAncestor(PlanNode.Type typeToFind)
          Starting at the parent of this node, find the lowest (also closest) ancestor that has the specified type.
 PlanNode findAncestor(PlanNode.Type firstTypeToFind, PlanNode.Type... additionalTypesToFind)
          Starting at the parent of this node, find the lowest (also closest) ancestor that has one of the specified types.
 PlanNode findAncestor(Set<PlanNode.Type> typesToFind)
          Starting at the parent of this node, find the lowest (also closest) ancestor that has one of the specified types.
 PlanNode findAtOrBelow(PlanNode.Traversal order, PlanNode.Type typeToFind)
          Find the first node with the specified type that are at or below this node.
 PlanNode findAtOrBelow(PlanNode.Traversal order, PlanNode.Type firstTypeToFind, PlanNode.Type... additionalTypesToFind)
          Find the first node with one of the specified types that are at or below this node.
 PlanNode findAtOrBelow(PlanNode.Traversal order, Set<PlanNode.Type> typesToFind)
          Find the first node with one of the specified types that are at or below this node.
 PlanNode findAtOrBelow(PlanNode.Type typeToFind)
          Find the first node with the specified type that are at or below this node.
 PlanNode findAtOrBelow(PlanNode.Type firstTypeToFind, PlanNode.Type... additionalTypesToFind)
          Find the first node with one of the specified types that are at or below this node.
 PlanNode findAtOrBelow(Set<PlanNode.Type> typesToFind)
          Find the first node with one of the specified types that are at or below this node.
 PlanNode getChild(int index)
          Get the child at the supplied index.
 int getChildCount()
          Get the number of child nodes.
 List<PlanNode> getChildren()
          Get the unmodifiable list of child nodes.
 PlanNode getFirstChild()
          Get the first child.
 PlanNode getLastChild()
          Get the last child.
 PlanNode getParent()
          Get the parent of this node.
 LinkedList<PlanNode> getPathTo(PlanNode descendant)
          Get the path from this node (inclusive) to the supplied descendant node (inclusive)
 Object getProperty(PlanNode.Property propertyId)
          Get the node's value for this supplied property.
<ValueType>
ValueType
getProperty(PlanNode.Property propertyId, Class<ValueType> type)
          Get the node's value for this supplied property, casting the result to the supplied type.
<ValueType>
Collection<ValueType>
getPropertyAsCollection(PlanNode.Property propertyId, Class<ValueType> type)
          Get the node's value for this supplied property, casting the result to a Collection of the supplied type.
<ValueType>
List<ValueType>
getPropertyAsList(PlanNode.Property propertyId, Class<ValueType> type)
          Get the node's value for this supplied property, casting the result to a List of the supplied type.
 Set<PlanNode.Property> getPropertyKeys()
          Get the keys for the property values that are set on this node.
 Set<SelectorName> getSelectors()
          Get the selectors that are referenced by this plan node.
 String getString()
          Get the string representation of this query object.
 PlanNode.Type getType()
          Get the type for this node.
 boolean hasAncestorOfType(PlanNode.Type type)
          Determine whether this node has an ancestor with the supplied type.
 boolean hasAncestorOfType(PlanNode.Type firstType, PlanNode.Type... additionalTypes)
          Determine whether this node has an ancestor with any of the supplied types.
 boolean hasAncestorOfType(Set<PlanNode.Type> types)
          Determine whether this node has an ancestor with any of the supplied types.
 boolean hasBooleanProperty(PlanNode.Property propertyId)
          Indicates if there is a non-null property value that equates to a true boolean value.
 boolean hasCollectionProperty(PlanNode.Property propertyId)
          Indicates if there is a non-null and non-empty Collection value for the property.
 boolean hasProperty(PlanNode.Property propertyId)
          Indicates if there is a non-null value for the property.
 void insertAsParent(PlanNode newParent)
          Insert the supplied node into the plan node tree immediately above this node.
 boolean is(PlanNode.Type type)
          Return true if this node's type does match the supplied type
 boolean isAbove(PlanNode possibleDescendant)
          Determine if the supplied node is a descendant of this node.
 boolean isBelow(PlanNode possibleAncestor)
          Determine if the supplied node is an ancestor of this node.
 boolean isNot(PlanNode.Type type)
          Return true if this node's type does not match the supplied type
 boolean isNotOneOf(PlanNode.Type first, PlanNode.Type... rest)
          Return true if this node's type does not match any of the supplied types
 boolean isNotOneOf(Set<PlanNode.Type> types)
          Return true if this node's type does not match any of the supplied types
 boolean isOneOf(PlanNode.Type first, PlanNode.Type... rest)
          Return true if this node's type matches one of the supplied types
 boolean isOneOf(Set<PlanNode.Type> types)
          Return true if this node's type matches one of the supplied types
 boolean isSameAs(PlanNode other)
          Determine whether the supplied plan is equivalent to this plan.
 Iterator<PlanNode> iterator()
           This iterator is immutable.
 List<PlanNode> removeAllChildren()
          Remove all children from this node.
 boolean removeChild(PlanNode child)
          Remove the node from this node.
 PlanNode removeFromParent()
          Remove this node from its parent, and return the node that used to be the parent of this node.
 Object removeProperty(Object propertyId)
          Remove the node's value for this supplied property.
 boolean replaceChild(PlanNode child, PlanNode replacement)
          Replace the supplied child with another node.
 void setParent(PlanNode parent)
          Set the parent for this node.
 Object setProperty(PlanNode.Property propertyId, Object value)
          Set the node's value for the supplied property.
 void setType(PlanNode.Type type)
          Set the type for this node.
 String toString()
          
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlanNode

public PlanNode(PlanNode.Type type)
Create a new plan node with the supplied initial type.

Parameters:
type - the type of the node; may not be null

PlanNode

public PlanNode(PlanNode.Type type,
                PlanNode parent)
Create a new plan node with the supplied initial type ad that is a child of the supplied parent.

Parameters:
type - the type of the node; may not be null
parent - the parent node, or null if there is no parent

PlanNode

public PlanNode(PlanNode.Type type,
                SelectorName... selectors)
Create a new plan node with the supplied initial type ad that is a child of the supplied parent.

Parameters:
type - the type of the node; may not be null
selectors - the selectors that should be assigned to this node

PlanNode

public PlanNode(PlanNode.Type type,
                Iterable<SelectorName> selectors)
Create a new plan node with the supplied initial type ad that is a child of the supplied parent.

Parameters:
type - the type of the node; may not be null
selectors - the selectors that should be assigned to this node

PlanNode

public PlanNode(PlanNode.Type type,
                PlanNode parent,
                SelectorName... selectors)
Create a new plan node with the supplied initial type ad that is a child of the supplied parent.

Parameters:
type - the type of the node; may not be null
parent - the parent node, or null if there is no parent
selectors - the selectors that should be assigned to this node

PlanNode

public PlanNode(PlanNode.Type type,
                PlanNode parent,
                Iterable<SelectorName> selectors)
Create a new plan node with the supplied initial type ad that is a child of the supplied parent.

Parameters:
type - the type of the node; may not be null
parent - the parent node, or null if there is no parent
selectors - the selectors that should be assigned to this node
Method Detail

getType

public PlanNode.Type getType()
Get the type for this node.

Returns:
the node type, or null if there is no node type

setType

public void setType(PlanNode.Type type)
Set the type for this node.

Parameters:
type - Sets type to the specified value; may not be null

isNot

public boolean isNot(PlanNode.Type type)
Return true if this node's type does not match the supplied type

Parameters:
type - the type to compare
Returns:
true if this node's type is different than that supplied, or false if they are the same

isNotOneOf

public boolean isNotOneOf(PlanNode.Type first,
                          PlanNode.Type... rest)
Return true if this node's type does not match any of the supplied types

Parameters:
first - the type to compare
rest - the additional types to compare
Returns:
true if this node's type is different than all of those supplied, or false if matches one of the supplied types

isNotOneOf

public boolean isNotOneOf(Set<PlanNode.Type> types)
Return true if this node's type does not match any of the supplied types

Parameters:
types - the types to compare
Returns:
true if this node's type is different than all of those supplied, or false if matches one of the supplied types

is

public boolean is(PlanNode.Type type)
Return true if this node's type does match the supplied type

Parameters:
type - the type to compare
Returns:
true if this node's type is the same as that supplied, or false if the types are different

isOneOf

public boolean isOneOf(PlanNode.Type first,
                       PlanNode.Type... rest)
Return true if this node's type matches one of the supplied types

Parameters:
first - the type to compare
rest - the additional types to compare
Returns:
true if this node's type is one of those supplied, or false otherwise

isOneOf

public boolean isOneOf(Set<PlanNode.Type> types)
Return true if this node's type matches one of the supplied types

Parameters:
types - the types to compare
Returns:
true if this node's type is one of those supplied, or false otherwise

isBelow

public boolean isBelow(PlanNode possibleAncestor)
Determine if the supplied node is an ancestor of this node.

Parameters:
possibleAncestor - the node that is to be determined if it is an ancestor
Returns:
true if the supplied node is indeed an ancestor, or false if it is not an ancestor

isAbove

public boolean isAbove(PlanNode possibleDescendant)
Determine if the supplied node is a descendant of this node.

Parameters:
possibleDescendant - the node that is to be determined if it is a descendant
Returns:
true if the supplied node is indeed an ancestor, or false if it is not an ancestor

getParent

public PlanNode getParent()
Get the parent of this node.

Returns:
the parent node, or null if this node has no parent

setParent

public void setParent(PlanNode parent)
Set the parent for this node. If this node already has a parent, this method will remove this node from the current parent. If the supplied parent is not null, then this node will be added to the supplied parent's children.

Parameters:
parent - the new parent, or null if this node is to have no parent

insertAsParent

public void insertAsParent(PlanNode newParent)
Insert the supplied node into the plan node tree immediately above this node. If this node has a parent when this method is called, the new parent essentially takes the place of this node within the list of children of the old parent. This method does nothing if the supplied new parent is null.

For example, consider a plan node tree before this method is called:

        A
      / | \
     /  |  \
    B   C   D
 
Then after this method is called with c.insertAsParent(e), the resulting plan node tree will be:
        A
      / | \
     /  |  \
    B   E   D
        |
        |
        C
 

Also note that the node on which this method is called ('C' in the example above) will always be added as the last child to the new parent. This allows the new parent to already have children before this method is called.

Parameters:
newParent - the new parent; method does nothing if this is null

removeFromParent

public PlanNode removeFromParent()
Remove this node from its parent, and return the node that used to be the parent of this node. Note that this method removes the entire subgraph under this node.

Returns:
the node that was the parent of this node, or null if this node had no parent
See Also:
extractChild(PlanNode), extractFromParent()

getChildren

public List<PlanNode> getChildren()
Get the unmodifiable list of child nodes. This list will immediately reflect any changes made to the children (via other methods), but this list cannot be used to add or remove children.

Returns:
the list of children, which immediately reflects changes but which cannot be modified directly; never null

iterator

public Iterator<PlanNode> iterator()

This iterator is immutable.

Specified by:
iterator in interface Iterable<PlanNode>
See Also:
Iterable.iterator()

removeAllChildren

public List<PlanNode> removeAllChildren()
Remove all children from this node. All nodes immediately become orphaned. The resulting list will be mutable.

Returns:
a copy of all the of the children that were removed (and which have no parent); never null

replaceChild

public boolean replaceChild(PlanNode child,
                            PlanNode replacement)
Replace the supplied child with another node. If the replacement is already a child of this node, this method effectively swaps the position of the child and replacement nodes.

Parameters:
child - the node that is already a child and that is to be replaced; may not be null and must be a child
replacement - the node that is to replace the 'child' node; may not be null
Returns:
true if the child was successfully replaced

getChildCount

public int getChildCount()
Get the number of child nodes.

Returns:
the number of children; never negative

getFirstChild

public PlanNode getFirstChild()
Get the first child.

Returns:
the first child, or null if there are no children

getLastChild

public PlanNode getLastChild()
Get the last child.

Returns:
the last child, or null if there are no children

getChild

public PlanNode getChild(int index)
Get the child at the supplied index.

Parameters:
index - the index
Returns:
the child, or null if there are no children
Throws:
IndexOutOfBoundsException - if the index is not valid given the number of children

addFirstChild

public void addFirstChild(PlanNode child)
Add the supplied node to the front of the list of children.

Parameters:
child - the node that should be added as the first child; may not be null

addLastChild

public void addLastChild(PlanNode child)
Add the supplied node to the end of the list of children.

Parameters:
child - the node that should be added as the last child; may not be null

addChildren

public void addChildren(Iterable<PlanNode> otherChildren)
Add the supplied nodes at the end of the list of children.

Parameters:
otherChildren - the children to add; may not be null

addChildren

public void addChildren(PlanNode first,
                        PlanNode second)
Add the supplied nodes at the end of the list of children.

Parameters:
first - the first child to add
second - the second child to add

addChildren

public void addChildren(PlanNode first,
                        PlanNode second,
                        PlanNode third)
Add the supplied nodes at the end of the list of children.

Parameters:
first - the first child to add
second - the second child to add
third - the third child to add

removeChild

public boolean removeChild(PlanNode child)
Remove the node from this node.

Parameters:
child - the child node; may not be null
Returns:
true if the child was removed from this node, or false if the supplied node was not a child of this node

extractChild

public void extractChild(PlanNode child)
Remove the child node from this node, and replace that child with its first child (if there is one).

Parameters:
child - the child to be extracted; may not be null and must have at most 1 child
See Also:
extractFromParent()

extractFromParent

public void extractFromParent()
Extract this node from its parent, but replace this node with its child (if there is one).

See Also:
extractChild(PlanNode)

getPropertyKeys

public Set<PlanNode.Property> getPropertyKeys()
Get the keys for the property values that are set on this node.

Returns:
the property keys; never null but possibly empty

getProperty

public Object getProperty(PlanNode.Property propertyId)
Get the node's value for this supplied property.

Parameters:
propertyId - the property identifier
Returns:
the value, or null if there is no property on this node

getProperty

public <ValueType> ValueType getProperty(PlanNode.Property propertyId,
                                         Class<ValueType> type)
Get the node's value for this supplied property, casting the result to the supplied type.

Type Parameters:
ValueType - the type of the value expected
Parameters:
propertyId - the property identifier
type - the class denoting the type of value expected; may not be null
Returns:
the value, or null if there is no property on this node

getPropertyAsCollection

public <ValueType> Collection<ValueType> getPropertyAsCollection(PlanNode.Property propertyId,
                                                                 Class<ValueType> type)
Get the node's value for this supplied property, casting the result to a Collection of the supplied type.

Type Parameters:
ValueType - the type of the value expected
Parameters:
propertyId - the property identifier
type - the class denoting the type of value expected; may not be null
Returns:
the value, or null if there is no property on this node

getPropertyAsList

public <ValueType> List<ValueType> getPropertyAsList(PlanNode.Property propertyId,
                                                     Class<ValueType> type)
Get the node's value for this supplied property, casting the result to a List of the supplied type.

Type Parameters:
ValueType - the type of the value expected
Parameters:
propertyId - the property identifier
type - the class denoting the type of value expected; may not be null
Returns:
the value, or null if there is no property on this node

setProperty

public Object setProperty(PlanNode.Property propertyId,
                          Object value)
Set the node's value for the supplied property.

Parameters:
propertyId - the property identifier
value - the value, or null if the property is to be removed
Returns:
the previous value that was overwritten by this call, or null if there was prior value

removeProperty

public Object removeProperty(Object propertyId)
Remove the node's value for this supplied property.

Parameters:
propertyId - the property identifier
Returns:
the value that was removed, or null if there was no property on this node

hasProperty

public boolean hasProperty(PlanNode.Property propertyId)
Indicates if there is a non-null value for the property.

Parameters:
propertyId - the property identifier
Returns:
true if this node has a non-null value for that property, or false if the value is null or there is no property

hasCollectionProperty

public boolean hasCollectionProperty(PlanNode.Property propertyId)
Indicates if there is a non-null and non-empty Collection value for the property.

Parameters:
propertyId - the property identifier
Returns:
true if this node has value for the supplied property and that value is a non-empty Collection

hasBooleanProperty

public boolean hasBooleanProperty(PlanNode.Property propertyId)
Indicates if there is a non-null property value that equates to a true boolean value.

Parameters:
propertyId - the property identifier
Returns:
true if this node has value for the supplied property and that value is a boolean value of true

addSelector

public void addSelector(SelectorName symbol)
Add a selector to this plan node. This method does nothing if the supplied selector is null.

Parameters:
symbol - the symbol of the selector

addSelector

public void addSelector(SelectorName first,
                        SelectorName second)
Add the selectors to this plan node. This method does nothing for any supplied selector that is null.

Parameters:
first - the first symbol to be added
second - the second symbol to be added

addSelectors

public void addSelectors(Iterable<SelectorName> names)
Add the selectors to this plan node. This method does nothing for any supplied selector that is null.

Parameters:
names - the symbols to be added

getSelectors

public Set<SelectorName> getSelectors()
Get the selectors that are referenced by this plan node.

Returns:
the names of the selectors; never null but possibly empty

getPathTo

public LinkedList<PlanNode> getPathTo(PlanNode descendant)
Get the path from this node (inclusive) to the supplied descendant node (inclusive)

Parameters:
descendant - the descendant; may not be null, and must be a descendant of this node
Returns:
the path from this node to the supplied descendant node; never null

hasAncestorOfType

public boolean hasAncestorOfType(PlanNode.Type type)
Determine whether this node has an ancestor with the supplied type.

Parameters:
type - the type; may not be null
Returns:
true if there is at least one ancestor of the supplied type, or false otherwise

hasAncestorOfType

public boolean hasAncestorOfType(PlanNode.Type firstType,
                                 PlanNode.Type... additionalTypes)
Determine whether this node has an ancestor with any of the supplied types.

Parameters:
firstType - the first type; may not be null
additionalTypes - the additional types; may not be null
Returns:
true if there is at least one ancestor that has any of the supplied types, or false otherwise

hasAncestorOfType

public boolean hasAncestorOfType(Set<PlanNode.Type> types)
Determine whether this node has an ancestor with any of the supplied types.

Parameters:
types - the types; may not be null
Returns:
true if there is at least one ancestor that has any of the supplied types, or false otherwise

toString

public String toString()

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

equals

public final boolean equals(Object obj)

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

clone

public PlanNode clone()

This class returns a new clone of the plan tree rooted at this node. However, the top node of the resulting plan tree (that is, the node returned from this method) has no parent.

Overrides:
clone in class Object
See Also:
Object.clone()

isSameAs

public boolean isSameAs(PlanNode other)
Determine whether the supplied plan is equivalent to this plan.

Parameters:
other - the other plan to compare with this instance
Returns:
true if the two plans are equivalent, or false otherwise

getString

public String getString()
Get the string representation of this query object.

Specified by:
getString in interface Readable
Returns:
the string representation; never null
See Also:
Readable.getString()

findAncestor

public PlanNode findAncestor(PlanNode.Type typeToFind)
Starting at the parent of this node, find the lowest (also closest) ancestor that has the specified type.

Parameters:
typeToFind - the type of the node to find; may not be null
Returns:
the node with the specified type, or null if there is no such ancestor

findAncestor

public PlanNode findAncestor(PlanNode.Type firstTypeToFind,
                             PlanNode.Type... additionalTypesToFind)
Starting at the parent of this node, find the lowest (also closest) ancestor that has one of the specified types.

Parameters:
firstTypeToFind - the first type to find; may not be null
additionalTypesToFind - additional types to find; may not be null
Returns:
the node with the specified type, or null if there is no such ancestor

findAncestor

public PlanNode findAncestor(Set<PlanNode.Type> typesToFind)
Starting at the parent of this node, find the lowest (also closest) ancestor that has one of the specified types.

Parameters:
typesToFind - the set of types to find; may not be null
Returns:
the node with one of the specified types, or null if there is no such ancestor

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow()
Find all of the nodes that are at or below this node.

Returns:
the collection of nodes that are at or below this node; never null and never empty

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order)
Find all of the nodes that are at or below this node.

Parameters:
order - the order to traverse; may not be null
Returns:
the collection of nodes that are at or below this node; never null and never empty

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow(PlanNode.Type typeToFind)
Find all of the nodes of the specified type that are at or below this node.

Parameters:
typeToFind - the type of node to find; may not be null
Returns:
the collection of nodes that are at or below this node that all have the supplied type; never null but possibly empty

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow(PlanNode.Type firstTypeToFind,
                                       PlanNode.Type... additionalTypesToFind)
Find all of the nodes with one of the specified types that are at or below this node.

Parameters:
firstTypeToFind - the first type of node to find; may not be null
additionalTypesToFind - the additional types of node to find; may not be null
Returns:
the collection of nodes that are at or below this node that all have one of the supplied types; never null but possibly empty

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow(Set<PlanNode.Type> typesToFind)
Find all of the nodes with one of the specified types that are at or below this node.

Parameters:
typesToFind - the types of node to find; may not be null
Returns:
the collection of nodes that are at or below this node that all have one of the supplied types; never null but possibly empty

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order,
                                       PlanNode.Type typeToFind)
Find all of the nodes of the specified type that are at or below this node.

Parameters:
order - the order to traverse; may not be null
typeToFind - the type of node to find; may not be null
Returns:
the collection of nodes that are at or below this node that all have the supplied type; never null but possibly empty

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order,
                                       PlanNode.Type firstTypeToFind,
                                       PlanNode.Type... additionalTypesToFind)
Find all of the nodes with one of the specified types that are at or below this node.

Parameters:
order - the order to traverse; may not be null
firstTypeToFind - the first type of node to find; may not be null
additionalTypesToFind - the additional types of node to find; may not be null
Returns:
the collection of nodes that are at or below this node that all have one of the supplied types; never null but possibly empty

findAllAtOrBelow

public List<PlanNode> findAllAtOrBelow(PlanNode.Traversal order,
                                       Set<PlanNode.Type> typesToFind)
Find all of the nodes with one of the specified types that are at or below this node.

Parameters:
order - the order to traverse; may not be null
typesToFind - the types of node to find; may not be null
Returns:
the collection of nodes that are at or below this node that all have one of the supplied types; never null but possibly empty

findAtOrBelow

public PlanNode findAtOrBelow(PlanNode.Type typeToFind)
Find the first node with the specified type that are at or below this node.

Parameters:
typeToFind - the type of node to find; may not be null
Returns:
the first node that is at or below this node that has the supplied type; or null if there is no such node

findAtOrBelow

public PlanNode findAtOrBelow(PlanNode.Type firstTypeToFind,
                              PlanNode.Type... additionalTypesToFind)
Find the first node with one of the specified types that are at or below this node.

Parameters:
firstTypeToFind - the first type of node to find; may not be null
additionalTypesToFind - the additional types of node to find; may not be null
Returns:
the first node that is at or below this node that has one of the supplied types; or null if there is no such node

findAtOrBelow

public PlanNode findAtOrBelow(Set<PlanNode.Type> typesToFind)
Find the first node with one of the specified types that are at or below this node.

Parameters:
typesToFind - the types of node to find; may not be null
Returns:
the first node that is at or below this node that has one of the supplied types; or null if there is no such node

findAtOrBelow

public PlanNode findAtOrBelow(PlanNode.Traversal order,
                              PlanNode.Type typeToFind)
Find the first node with the specified type that are at or below this node.

Parameters:
order - the order to traverse; may not be null
typeToFind - the type of node to find; may not be null
Returns:
the first node that is at or below this node that has the supplied type; or null if there is no such node

findAtOrBelow

public PlanNode findAtOrBelow(PlanNode.Traversal order,
                              PlanNode.Type firstTypeToFind,
                              PlanNode.Type... additionalTypesToFind)
Find the first node with one of the specified types that are at or below this node.

Parameters:
order - the order to traverse; may not be null
firstTypeToFind - the first type of node to find; may not be null
additionalTypesToFind - the additional types of node to find; may not be null
Returns:
the first node that is at or below this node that has one of the supplied types; or null if there is no such node

findAtOrBelow

public PlanNode findAtOrBelow(PlanNode.Traversal order,
                              Set<PlanNode.Type> typesToFind)
Find the first node with one of the specified types that are at or below this node.

Parameters:
order - the order to traverse; may not be null
typesToFind - the types of node to find; may not be null
Returns:
the first node that is at or below this node that has one of the supplied types; or null if there is no such node


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