nenok.lc
Class Node

java.lang.Object
  extended by nenok.lc.Node
Direct Known Subclasses:
HNode, IDNode, LSNode, SSNode

public abstract class Node
extends Object

This abstract class represents nodes of a join tree. The tree itself is built from a double linked set of Node objects and the JoinTree object points to the root node of the tree.

Version:
1.1
Author:
Marc Pouly

Field Summary
protected  TaskFactory factory
           
protected  Locator locator
           
 
Constructor Summary
Node(TaskFactory factory)
          Constructor:
 
Method Summary
 void addParent(Node parent)
          Adds a new parent node to this node instance.
 void addParents(List<Node> parents)
          Adds new new parent nodes to this node instance.
abstract  void collect(Allocator allocator)
          Executes the collect algorithm for this node.
abstract  void distribute()
          Executes the distribute algorithm for this node.
protected  Node findCoveringNode(Domain query)
           
protected  Domain findLargestDomain()
           
 Set<Processor> findProcessors()
           
 Node getChild()
           
 Domain getDomain()
           
 Set<Node> getLeaves()
           
 Locator getLocator()
           
protected  Set<Node> getNodes(Set<Node> nodes)
           
 List<Node> getParents()
           
 Processor getProcessor()
           
protected  Domain getTotalDomain()
           
 Valuation getValuation()
           
protected  boolean isBinary()
           
protected  void makeBinary(JoinTree.Construction data)
          Transforms the subtree of this to a binary tree.
protected  void removeParent(Node parent)
          Removes a parent node from this node instance.
 void setChild(Node child)
          Assigns a unique child element to this node.
 void setDomain(Domain domain)
          Sets the domain of this node.
 void setLocator(Locator loc)
          Sets the content locator of this node instance.
 boolean setProcessor(Processor proc)
          Assigns a processor to this node.
 int subTreeSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locator

protected Locator locator

factory

protected TaskFactory factory
Constructor Detail

Node

public Node(TaskFactory factory)
Constructor:

Parameters:
factory - The task factory to construct new tasks.
Method Detail

collect

public abstract void collect(Allocator allocator)
                      throws LCException,
                             RemoteException
Executes the collect algorithm for this node.

Parameters:
allocator - The processor allocation strategy for this node.
Throws:
LCException - Exception caused by the collect propagation.
RemoteException - Exceptions caused by communication problems when accessing processors.

distribute

public abstract void distribute()
                         throws LCException,
                                RemoteException
Executes the distribute algorithm for this node.

Throws:
LCException - Exception caused by the distribute propagation.
RemoteException - Exceptions caused by communication problems when accessing processors.

setChild

public void setChild(Node child)
Assigns a unique child element to this node.

Parameters:
child - The node's new child element.

getChild

public Node getChild()
Returns:
This node's unique child node.

addParent

public void addParent(Node parent)
Adds a new parent node to this node instance.

Parameters:
parent - The new parent node to add.

addParents

public void addParents(List<Node> parents)
Adds new new parent nodes to this node instance.

Parameters:
parents - A list of new parent nodes to add.

getParents

public List<Node> getParents()
Returns:
The parent nodes of this node instance.

removeParent

protected void removeParent(Node parent)
Removes a parent node from this node instance.

Parameters:
parent - The parent to remove.

getLeaves

public Set<Node> getLeaves()
Returns:
The leaf nodes in the subtree of this node.

getDomain

public Domain getDomain()
Returns:
Returns the domain of this node.

setDomain

public void setDomain(Domain domain)
Sets the domain of this node.

Parameters:
domain - The domain to set.

getValuation

public Valuation getValuation()
                       throws RemoteException
Returns:
Returns the node content of this node.
Throws:
RemoteException - Exception thrown while reading the node content from the remote processor.

setLocator

public void setLocator(Locator loc)
Sets the content locator of this node instance.

Parameters:
loc - The locator pointing to the content of this node.

getLocator

public Locator getLocator()
Returns:
The locator that points to this node's valuation.

getProcessor

public Processor getProcessor()
Returns:
The processor assigned to this node.

setProcessor

public boolean setProcessor(Processor proc)
                     throws RemoteException
Assigns a processor to this node. The method's behaviour is:

Parameters:
proc - The processor to assign.
Returns:
true, if the processor assigned to this nodes changes.
Throws:
RemoteException - Exception caused by communication proclems when the new processor is accessed.

subTreeSize

public int subTreeSize()
Returns:
The number of nodes in the subtree of this node.

isBinary

protected boolean isBinary()
Returns:
true, if this node's subtree is binary.

findLargestDomain

protected Domain findLargestDomain()
Returns:
The largest node domain within the subtree of this node.

getTotalDomain

protected Domain getTotalDomain()
Returns:
The union of all node domains within the subtree of this node.

findProcessors

public Set<Processor> findProcessors()
Returns:
The set of all processors assigned in the subtree of this node.

findCoveringNode

protected Node findCoveringNode(Domain query)
Parameters:
query - The query domain to find.
Returns:
A node whose domain equals the query or null.

makeBinary

protected void makeBinary(JoinTree.Construction data)
Transforms the subtree of this to a binary tree.

Parameters:
data - The information for the join tree construction process.

getNodes

protected Set<Node> getNodes(Set<Node> nodes)