com.metamatrix.query.optimizer
Class CommandTreeNode

java.lang.Object
  extended by com.metamatrix.query.optimizer.CommandTreeNode

public class CommandTreeNode
extends java.lang.Object

A tree node object used to hold state during command planning and optimizing.


Field Summary
static int TYPE_BATCHED_UPDATE_COMMAND
          The command type is a batched update command.
static int TYPE_DYNAMIC_COMMAND
          The command type is a dynamic command.
static int TYPE_PREPARED_BATCH_UPDATE_COMMAND
          The command type is a prepared batched update command.
static int TYPE_PROCEDURAL_COMMAND
          The command type is a procedural command
static int TYPE_RELATIONAL_COMMAND
          The command type is a relational command
static int TYPE_XML_COMMAND
          The command type is an XML query
static int TYPE_XQUERY_COMMAND
          The command type is an XQuery command
 
Constructor Summary
CommandTreeNode()
           
 
Method Summary
 void addChildren(java.util.List otherChildren)
           
 void addFirstChild(CommandTreeNode child)
           
 void addLastChild(CommandTreeNode child)
           
 java.util.Map getAllProperties()
          Get the Map of all planner-specific properties
 java.lang.Object getCanonicalPlan()
          Retrieve the planner-specific canonical plan
 int getChildCount()
           
 java.util.List getChildren()
           
 Command getCommand()
          Returns the Command object.
 int getCommandType()
          Get the type of this command
 CommandTreeNode getFirstChild()
           
 CommandTreeNode getLastChild()
           
 CommandTreeNode getParent()
           
 ProcessorPlan getProcessorPlan()
          Returns the planner-specific ProcessorPlan implementation.
 java.lang.Object getProperty(java.lang.Integer propertyID)
          Retrieve one of the CommandPlanner-specific properties stored at this node, or null if no property of the given key exists.
 boolean hasChild(CommandTreeNode child)
           
 java.lang.String nodeToString()
          Just print single node to string instead of node+recursive plan.
 boolean removeChild(CommandTreeNode child)
           
 void removeProperty(java.lang.Integer propertyID)
          Remove one of the planner-specific properties.
 void setCanonicalPlan(java.lang.Object canonicalPlan)
          Set the planner-specific canonical plan
 void setCommand(Command command)
          Sets the Command object.
 void setCommandType(int commandType)
          Set the type of this command
 void setParent(CommandTreeNode parent)
           
 void setProcessorPlan(ProcessorPlan processorPlan)
          Sets the planner-specific ProcessorPlan implementation for the Command represented by this node.
 void setProperty(java.lang.Integer propertyID, java.lang.Object value)
          Set a CommandPlanner-specific property.
 java.lang.String toString()
          Print CommandTreeNode structure starting at this node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_RELATIONAL_COMMAND

public static final int TYPE_RELATIONAL_COMMAND
The command type is a relational command

See Also:
Constant Field Values

TYPE_XML_COMMAND

public static final int TYPE_XML_COMMAND
The command type is an XML query

See Also:
Constant Field Values

TYPE_PROCEDURAL_COMMAND

public static final int TYPE_PROCEDURAL_COMMAND
The command type is a procedural command

See Also:
Constant Field Values

TYPE_XQUERY_COMMAND

public static final int TYPE_XQUERY_COMMAND
The command type is an XQuery command

See Also:
Constant Field Values

TYPE_BATCHED_UPDATE_COMMAND

public static final int TYPE_BATCHED_UPDATE_COMMAND
The command type is a batched update command.

See Also:
Constant Field Values

TYPE_DYNAMIC_COMMAND

public static final int TYPE_DYNAMIC_COMMAND
The command type is a dynamic command.

See Also:
Constant Field Values

TYPE_PREPARED_BATCH_UPDATE_COMMAND

public static final int TYPE_PREPARED_BATCH_UPDATE_COMMAND
The command type is a prepared batched update command.

See Also:
Constant Field Values
Constructor Detail

CommandTreeNode

public CommandTreeNode()
Method Detail

getCommandType

public int getCommandType()
Get the type of this command

Returns:
int one of three type constants defined in this class
See Also:
TYPE_RELATIONAL_COMMAND, TYPE_XML_COMMAND, TYPE_PROCEDURAL_COMMAND

setCommandType

public void setCommandType(int commandType)
Set the type of this command

Parameters:
commandType - one of three type constants defined in this class
See Also:
TYPE_RELATIONAL_COMMAND, TYPE_XML_COMMAND, TYPE_PROCEDURAL_COMMAND

getCommand

public Command getCommand()
Returns the Command object.

Returns:
Command

setCommand

public void setCommand(Command command)
Sets the Command object.

Parameters:
command - The command to set

getCanonicalPlan

public java.lang.Object getCanonicalPlan()
Retrieve the planner-specific canonical plan

Returns:
Object planner-specific canonical plan

setCanonicalPlan

public void setCanonicalPlan(java.lang.Object canonicalPlan)
Set the planner-specific canonical plan

Parameters:
canonicalPlan - Object

getProcessorPlan

public ProcessorPlan getProcessorPlan()
Returns the planner-specific ProcessorPlan implementation. This ProcessorPlan may be needed by the planner of this node's parent node - in other words a planner may need access to the ProcessorPlans of subcommands or other nested commands.

Returns:
ProcessorPlan at this node, or null if none

setProcessorPlan

public void setProcessorPlan(ProcessorPlan processorPlan)
Sets the planner-specific ProcessorPlan implementation for the Command represented by this node.

Parameters:
processorPlan - The processorPlan to set

getParent

public CommandTreeNode getParent()

setParent

public void setParent(CommandTreeNode parent)

getChildren

public java.util.List getChildren()

getChildCount

public int getChildCount()

getFirstChild

public CommandTreeNode getFirstChild()

getLastChild

public CommandTreeNode getLastChild()

addFirstChild

public void addFirstChild(CommandTreeNode child)

addLastChild

public void addLastChild(CommandTreeNode child)

addChildren

public void addChildren(java.util.List otherChildren)

hasChild

public boolean hasChild(CommandTreeNode child)

removeChild

public boolean removeChild(CommandTreeNode child)

getProperty

public java.lang.Object getProperty(java.lang.Integer propertyID)
Retrieve one of the CommandPlanner-specific properties stored at this node, or null if no property of the given key exists.

Parameters:
propertyID - key of the property
Returns:
Object property value

getAllProperties

public java.util.Map getAllProperties()
Get the Map of all planner-specific properties

Returns:
Map property keys to property values

setProperty

public void setProperty(java.lang.Integer propertyID,
                        java.lang.Object value)
Set a CommandPlanner-specific property. Each planner may have conflicting property keys, so an object of this Class should only be used for one CommandPlanner at a time.

Parameters:
propertyID - planner-specific property key
value - property value

removeProperty

public void removeProperty(java.lang.Integer propertyID)
Remove one of the planner-specific properties. No action is taken if the indicated property doesn't exist.

Parameters:
propertyID - key of the property

toString

public java.lang.String toString()
Print CommandTreeNode structure starting at this node

Overrides:
toString in class java.lang.Object
Returns:
String representing this node and all children under this node

nodeToString

public java.lang.String nodeToString()
Just print single node to string instead of node+recursive plan.

Returns:
String representing just this node


Copyright © 2009. All Rights Reserved.