nenok.lc
Class Node

java.lang.Object
  extended by nenok.lc.Node
Direct Known Subclasses:
DPNode, 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:
$LastChangedRevision: 557 $
$LastChangedDate: 2008-03-26 14:23:32 +0100 (Mi, 26 Mrz 2008) $
Author:
Marc Pouly

Field Summary
protected  Adapter adapter
           
protected  Labeled content
           
 
Constructor Summary
Node(Adapter adapter)
          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()
          Executes the collect algorithm for this node.
abstract  void distribute()
          Executes the distribute algorithm for this node.
 Node findCoveringNode(Domain query)
           
protected  Domain findLargestDomain()
           
 Set<Uuid> findProcessors()
           
 Node getChild()
           
 Labeled getContent()
           
 Domain getDomain()
           
 Set<Node> getLeaves()
           
protected  Set<Node> getNodes(Set<Node> nodes)
           
 List<Node> getParents()
           
protected  Domain getTotalDomain()
           
 Valuation getValuation()
           
protected  boolean isBinary()
           
 boolean isFull()
           
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 setContent(Labeled val)
          Sets the content of this node instance.
 void setDomain(Domain domain)
          Sets the domain of this node.
 int subTreeSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

content

protected Labeled content

adapter

protected Adapter adapter
Constructor Detail

Node

public Node(Adapter adapter)
Constructor:

Parameters:
adapter - The adapter to execute valuation algebra operations.
Method Detail

collect

public abstract void collect()
                      throws LCException
Executes the collect algorithm for this node.

Throws:
LCException - Exception caused by the collect propagation.

distribute

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

Throws:
LCException - Exception caused by the distribute propagation.

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.

isFull

public boolean isFull()
Returns:
true, if this node is not empty.

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.

setContent

public void setContent(Labeled val)
Sets the content of this node instance.

Parameters:
val - The content of this node.

getValuation

public Valuation getValuation()
                       throws LCException
Returns:
The valuation that is stored in this node.
Throws:
LCException - Wrapper exception.

getContent

public Labeled getContent()
Returns:
The object stored in this node.

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<Uuid> findProcessors()
Returns:
The set of all processors assigned in the subtree of this node.

findCoveringNode

public 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)