Class DiffView
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <L extends Label>
VariationDiff<L>badgood
(VariationDiff<L> d, Relevance rho) An alternative algorithm for generating of views on variation diffs based on (1) removing cycles in the variation diff, (2) interpreting the resulting acyclic variation diff as a colored variation tree, (3) creating a view on the variation tree, (4) and finally reintroducing the removed cycles.static <L extends Label>
BiPredicate<Time,Projection<L>> computeWhenNodesAreRelevant
(VariationDiff<L> d, Relevance rho) Translates a relevance predicate for nodes on variation trees to a relevance predicate on nodes in a variation diff.static <L extends Label>
VariationDiff<DiffLinesLabel>naive
(VariationDiff<L> d, Relevance rho) This function generates a view on the given variation diff by generating views on the underlying variation trees, and then differencing these tree views.private static <L extends Label>
VariationDiff<DiffLinesLabel>naive
(VariationDiff<L> d, Relevance rho, String[] projectionViewText) This method is not intended to be used directly and exists for optimization purposes only.static <L extends Label>
VariationDiff<DiffLinesLabel>naive
(VariationDiff<L> d, Relevance rho, BiPredicate<Time, Projection<L>> inView) This method is not intended to be used directly and exists for optimization purposes only.static <L extends Label>
VariationDiff<L>optimized
(VariationDiff<L> d, Relevance rho) This function generates a view on the given variation diff by determining the times of relevance for each node.static <L extends Label>
VariationDiff<L>optimized
(VariationDiff<L> d, Relevance rho, BiPredicate<Time, Projection<L>> inView) This method is not intended to be used directly and exists for optimization purposes only.
-
Constructor Details
-
DiffView
public DiffView()
-
-
Method Details
-
computeWhenNodesAreRelevant
public static <L extends Label> BiPredicate<Time,Projection<L>> computeWhenNodesAreRelevant(VariationDiff<L> d, Relevance rho) Translates a relevance predicate for nodes on variation trees to a relevance predicate on nodes in a variation diff. The returned predicate determines if a node in the given variation diff is relevant at a given time.- Parameters:
d
- The variation diff on which relevance of nodes should be determined.rho
- A relevance predicate for view generation.- Returns:
- A binary predicate that determines whether a node in a variation diff is relevant at a given time. The variation diff node has to be given in terms of its projection at the corresponding time.
-
naive
private static <L extends Label> VariationDiff<DiffLinesLabel> naive(VariationDiff<L> d, Relevance rho, String[] projectionViewText) throws IOException, DiffParseException This method is not intended to be used directly and exists for optimization purposes only. Instead, consider usingnaive(VariationDiff, Relevance)
.This method behaves as
naive(VariationDiff, Relevance)
but takes as additional parameter, an array of length two that contains the text representation of the views on the two variation trees of the given variation diff d. This method assumes thatprojectionViewText[Time.BEFORE.ordinal()]
represents the text ofd.project(Time.BEFORE)
and thatprojectionViewText[Time.AFTER.ordinal()]
represents the text ofd.project(Time.AFTER)
. This array is used for a text-based differencing of the two texts. The resulting diff is considered to be the view on the given variation diff d and is subsequently parsed to a variation diff and returned.- Parameters:
projectionViewText
- The text-based representation of the views on the two variation trees represented by the given diff d.- Throws:
IOException
- When the text-based diffing fails because of an IO error.DiffParseException
- When the text-based diff could not be parsed to a variation diff.
-
naive
public static <L extends Label> VariationDiff<DiffLinesLabel> naive(VariationDiff<L> d, Relevance rho, BiPredicate<Time, Projection<L>> inView) throws IOException, DiffParseExceptionThis method is not intended to be used directly and exists for optimization purposes only. Instead, consider usingnaive(VariationDiff, Relevance)
. This method is used to compare different the naive view generation to other algorithms, independently of the shared preprocessing in terms ofcomputeWhenNodesAreRelevant(VariationDiff, Relevance)
.This method behaves as
naive(VariationDiff, Relevance)
but takes as additional parameter, the translation of the given relevance predicate to a relevance on a variation diff. This additional parameter is assumed to be created from the given relevance predicate in terms ofcomputeWhenNodesAreRelevant(VariationDiff, Relevance)
.- Parameters:
inView
-computeWhenNodesAreRelevant(VariationDiff, Relevance)
for the given variation diff d and relevance predicate rho.- Throws:
IOException
- When the text-based diffing fails because of an IO error.DiffParseException
- When the text-based diff could not be parsed to a variation diff.
-
naive
public static <L extends Label> VariationDiff<DiffLinesLabel> naive(VariationDiff<L> d, Relevance rho) throws IOException, DiffParseException This function generates a view on the given variation diff by generating views on the underlying variation trees, and then differencing these tree views. Implementation of the function view_naive (Equation 8) from SPLC'23 paper - Views on Edits to Variational Software.- Parameters:
d
- The variation diff to generate a view on.rho
- A relevance predicate that determines which nodes should be contained in the view.- Returns:
- A variation diff that constitutes a view on the given variation diff.
- Throws:
IOException
- When the text-based diffing fails because of an IO error.DiffParseException
- When the text-based diff could not be parsed to a variation diff.
-
badgood
An alternative algorithm for generating of views on variation diffs based on (1) removing cycles in the variation diff, (2) interpreting the resulting acyclic variation diff as a colored variation tree, (3) creating a view on the variation tree, (4) and finally reintroducing the removed cycles.- Parameters:
d
- The variation diff to generate a view on.rho
- A relevance predicate that determines which nodes should be contained in the view.- Returns:
- A variation diff that constitutes a view on the given variation diff.
-
optimized
public static <L extends Label> VariationDiff<L> optimized(VariationDiff<L> d, Relevance rho, BiPredicate<Time, Projection<L>> inView) This method is not intended to be used directly and exists for optimization purposes only. Instead, consider usingoptimized(VariationDiff, Relevance)
. This method is used to compare different the naive view generation to other algorithms, independently of the shared preprocessing in terms ofcomputeWhenNodesAreRelevant(VariationDiff, Relevance)
.This method behaves as
optimized(VariationDiff, Relevance)
but takes as additional parameter, the translation of the given relevance predicate to a relevance on a variation diff. This additional parameter is assumed to be created from the given relevance predicate in terms ofcomputeWhenNodesAreRelevant(VariationDiff, Relevance)
.- Parameters:
inView
-computeWhenNodesAreRelevant(VariationDiff, Relevance)
for the given variation diff d and relevance predicate rho.
-
optimized
This function generates a view on the given variation diff by determining the times of relevance for each node. Implementation of the function view_smart (Equation 10) from SPLC'23 paper - Views on Edits to Variational Software.- Parameters:
d
- The variation diff to generate a view on.rho
- A relevance predicate that determines which nodes should be contained in the view.- Returns:
- A variation diff that constitutes a view on the given variation diff.
-