Interface Relevance
- All Superinterfaces:
Predicate<VariationNode<?,
?>>
Abstract definition of relevance predicates as defined in Section 3 in our SPLC'23 paper - Views on Edits to Variational Software.
A relevance predicate decides which nodes within a variation tree are interesting for,
and hence should be included in, a view on that variation tree.
Thus, a relevance predicate is a predicate on nodes in a variation trees.
Moreover, this interface provides methods to access a predicates metadata for debugging
and (de-)serialization.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <TreeNode extends VariationNode<TreeNode,
?>>
voidcomputeViewNodes
(TreeNode v, Consumer<TreeNode> markRelevant) Delegates tocomputeViewNodesCheckAll(Relevance, VariationNode, Consumer)
with this relevance as the first parameter.static <TreeNode extends VariationNode<TreeNode,
?>>
voidcomputeViewNodesCheckAll
(Relevance rho, TreeNode v, Consumer<TreeNode> markRelevant) Marks all nodes that should be contained within a view on the given tree.static String
Default implementation forObject.toString()
that can be reused by implementing classes.
-
Method Details
-
getFunctionName
String getFunctionName()- Returns:
- The name of this relevance predicate's type.
-
parametersToString
String parametersToString()- Returns:
- The parameters set for this particular relevance predicate, as a comma-separated string (without braces).
-
computeViewNodes
default <TreeNode extends VariationNode<TreeNode,?>> void computeViewNodes(TreeNode v, Consumer<TreeNode> markRelevant) Delegates tocomputeViewNodesCheckAll(Relevance, VariationNode, Consumer)
with this relevance as the first parameter. -
computeViewNodesCheckAll
static <TreeNode extends VariationNode<TreeNode,?>> void computeViewNodesCheckAll(Relevance rho, TreeNode v, Consumer<TreeNode> markRelevant) Marks all nodes that should be contained within a view on the given tree. In particular, this function checks each node in the given tree v on relevance. For each node that is deemed relevant by the given relevance predicate rho, that node and all its ancestors are marked as relevant by invoking the given callback markRelevant. This function tests the relevance predicate on all nodes separately and performs no optimizations.- Type Parameters:
TreeNode
- The type of the nodes within the given tree.- Parameters:
rho
- The relevance predicate to test on all nodes.v
- The root node the tree to test for relevance.markRelevant
- Callback that is invoked on each tree node that is deemed relevant.
-
toString
Default implementation forObject.toString()
that can be reused by implementing classes. The produced string will look like a function call.- Parameters:
relevance
- The relevance predicate to turn into a string.- Returns:
getFunctionName()
+ "(" +parametersToString()
+ ")"
-