Class WeightedTreeUtils
java.lang.Object
org.eclipse.tracecompass.incubator.analysis.core.weighted.tree.WeightedTreeUtils
Utility methods to operate on
WeightedTree
objects- Author:
- Geneviève Bastien
-
Method Summary
Modifier and TypeMethodDescriptionstatic <@NonNull T>
Collection<DifferentialWeightedTree<T>>diffTrees
(Collection<WeightedTree<@NonNull T>> first, Collection<WeightedTree<@NonNull T>> second) Does the differential between 2 weighted trees, ie what happened in tree2 differently than in tree1.static <@NonNull N>
@Nullable DifferentialWeightedTreeProvider<N>diffTreeSets
(IWeightedTreeProvider<@NonNull N, ?, WeightedTree<@NonNull N>> provider, IWeightedTreeSet<@NonNull N, @NonNull ?, WeightedTree<@NonNull N>> first, IWeightedTreeSet<@NonNull N, @NonNull ?, WeightedTree<@NonNull N>> second) Does the differential between 2 weighted tree sets, ie for each comparable elements, what happened in tree set 2 differently than in tree set 1.
-
Method Details
-
diffTrees
public static <@NonNull T> Collection<DifferentialWeightedTree<T>> diffTrees(Collection<WeightedTree<@NonNull T>> first, Collection<WeightedTree<@NonNull T>> second) Does the differential between 2 weighted trees, ie what happened in tree2 differently than in tree1. The base weight come from the second tree and the differential value will show the difference with the first tree.- Type Parameters:
T
- The type of element in the tree- Parameters:
first
- The tree that will be differentiated.second
- The tree to use as the base- Returns:
- The differential weighted tree
-
diffTreeSets
public static <@NonNull N> @Nullable DifferentialWeightedTreeProvider<N> diffTreeSets(IWeightedTreeProvider<@NonNull N, ?, WeightedTree<@NonNull N>> provider, IWeightedTreeSet<@NonNull N, @NonNull ?, WeightedTree<@NonNull N>> first, IWeightedTreeSet<@NonNull N, @NonNull ?, WeightedTree<@NonNull N>> second) Does the differential between 2 weighted tree sets, ie for each comparable elements, what happened in tree set 2 differently than in tree set 1. The base weight come from the second tree set and the differential value will show the difference with the first tree.Calling this method assumes the tree sets are comparable. It is the caller's responsibility to make sure the parameters make sense. If the 2 tree sets come from different
IWeightedTreeProvider
, they should be of similar types, otherwise, the comparison may not make sense.The elements of each tree set are paired as follows:
1- If there is only one element in each tree, they will be paired.
2- If the same elements are present in both tree sets, they will be paired, all other elements are ignored
3- If no elements are paired, they will be paired by name (and hierarchical names, if it applies). Unmatched elements will be ignored.
If elements are not paired at this point, it will return
null
- Type Parameters:
N
- The type of element in the tree- Parameters:
provider
- The base provider of one of the trees, it will be used by the differential weighted tree provider to display the metrics and titles, etc.. It could be the provider of the second tree set, as it serves as the base values.first
- The first treeset to compare tosecond
- The second treeset to compare.- Returns:
- A differential weighted tree provider wrapping the resulting tree
set, or
null
if the 2 treesets have no elements in common
-