algebraTree
Class QENode

java.lang.Object
  |
  +--algebraTree.QENode

public class QENode
extends java.lang.Object


Field Summary
private  java.util.Vector children
          Vector of QENodes.
private  SchemaSQLOperator operator
          the associated Operator object
 
Constructor Summary
QENode(SchemaSQLOperator myOperator)
          constructs a QENode with an existing operator attached to it.
 
Method Summary
 boolean addChild(QENode baby)
          add a child node to the current Node
 void computeResult()
           
 boolean dropLocalTable()
          asks this node to drop its local table (mainly used for the root node)
 void executeUpdate(Update upd)
          kicks off update propagation of a certain update.
 QENode getChild(int index)
          return a child.
 SchemaSQLOperator getOperator()
          needed by Builder::findFlatAttName2
 java.lang.String getRelName()
          returns the name of the local relation of this node
(package private) static java.util.Vector mergeVectors(java.util.Vector a, java.util.Vector b)
          a helper function that merges two Vectors
 void printTree(java.lang.String indent)
          this function prints the algebra tree in a somewhat primitive fashion
private  java.util.Vector recursiveUpdate(QENode tmpNode, Update upd)
          propagates upd all the way down to the leaves and then recursively collects updates up the operator tree.
 void setRelName(java.lang.String s)
          sets the name if this node's operator.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

operator

private SchemaSQLOperator operator
the associated Operator object

children

private java.util.Vector children
Vector of QENodes. This is a n-ary tree
Constructor Detail

QENode

public QENode(SchemaSQLOperator myOperator)
constructs a QENode with an existing operator attached to it. Children have to be added explicitly using the addChild() method. Therefore, the tree has to be built starting from the leaves!
Method Detail

computeResult

public void computeResult()

executeUpdate

public void executeUpdate(Update upd)
kicks off update propagation of a certain update. The update concerns a certain relation which has to be found (and its operator has to be identified). If this function is called in any other than the root node of the algebra tree, the query evaluation will not be correct.

recursiveUpdate

private java.util.Vector recursiveUpdate(QENode tmpNode,
                                         Update upd)
propagates upd all the way down to the leaves and then recursively collects updates up the operator tree. Each leaf must be able to decide if the update affects it or not.
Returns:
result which contains a vector of vectors. Each sub-vector is a list of updates from a certain node. The affected tables/attributes are stored in each update.

mergeVectors

static java.util.Vector mergeVectors(java.util.Vector a,
                                     java.util.Vector b)
a helper function that merges two Vectors

dropLocalTable

public boolean dropLocalTable()
asks this node to drop its local table (mainly used for the root node)

getRelName

public java.lang.String getRelName()
returns the name of the local relation of this node

setRelName

public void setRelName(java.lang.String s)
sets the name if this node's operator. Make sure that you use this only for the root node (not essential, but it's not needed for any other purpose

getOperator

public SchemaSQLOperator getOperator()
needed by Builder::findFlatAttName2

getChild

public QENode getChild(int index)
return a child. Should not be used except for that one hack in the treeBuilder

addChild

public boolean addChild(QENode baby)
add a child node to the current Node

printTree

public void printTree(java.lang.String indent)
this function prints the algebra tree in a somewhat primitive fashion

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object