public class MinimalFulfillingSubsetVisitor extends java.lang.Object implements Visitor<ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>>>
| Constructor and Description |
|---|
MinimalFulfillingSubsetVisitor(java.util.Set<java.lang.Integer> setOfShareIdentifers) |
| Modifier and Type | Method and Description |
|---|---|
ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>> |
getResultOfCurrentNode()
If the threshold of the visited node is fulfilled, this method computes
a pair containing the number of fulfilled leaf nodes reachable from the visited node
(at most the node's threshold), as well a
ArrayList containing
the share identifiers of the fulfilled leaves. |
MinimalFulfillingSubsetVisitor |
getVisitorForNextChild()
Returns a visitor for the next child.
|
void |
putResultOfChild(ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>> result)
If the given result contains a fulfilled child,
numberOfFulfilledChildren is incremented,
and, if the current node's threshold is reached, it is marked as fulfilled. |
void |
visit(TreeNode currentNode)
Sets
threshold to the threshold of the given tree node. |
public MinimalFulfillingSubsetVisitor(java.util.Set<java.lang.Integer> setOfShareIdentifers)
public ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>> getResultOfCurrentNode()
ArrayList containing
the share identifiers of the fulfilled leaves.
This identifies a minimal subset of shares necessary to fulfill this node.getResultOfCurrentNode in interface Visitor<ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>>>public MinimalFulfillingSubsetVisitor getVisitorForNextChild()
VisitorgetVisitorForNextChild in interface Visitor<ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>>>public void putResultOfChild(ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>> result)
numberOfFulfilledChildren is incremented,
and, if the current node's threshold is reached, it is marked as fulfilled.
Furthermore, the result is added to fulfilledChildrenInfo.putResultOfChild in interface Visitor<ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>>>result - the result of visiting the child of the node currently being visitedpublic void visit(TreeNode currentNode) throws WrongAccessStructureException
threshold to the threshold of the given tree node.
If the given node is a leaf node (threshold is zero), this method additionally uses the set of share
identifiers specified in this MinimalFulfillingSubsetVisitor instance to check whether one of them
fulfills the share requirement of the given leaf node.visit in interface Visitor<ComparablePair<java.lang.Integer,java.util.ArrayList<java.lang.Integer>>>currentNode - The tree node to visit.WrongAccessStructureException - if an inner node in the tree has threshold 0