Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The FlatViewController can be reused, but the target extraction mechanism wasn't generic enough for this. Other fixes : - Node and Entry aggregation fixed a bit - new Node aggregator which aggregates a node and its descendants into a Flat aggregation - TreeView is being prepared to show the aggregated flat view of a selected node at the bottom
- Loading branch information
Showing
11 changed files
with
192 additions
and
73 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...insightfullogic/honest_profiler/core/aggregation/aggregator/NodeDescendantAggregator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,44 @@ | |||
package com.insightfullogic.honest_profiler.core.aggregation.aggregator; | |||
|
|||
import static java.util.stream.Collector.of; | |||
import static java.util.stream.Collectors.groupingBy; | |||
|
|||
import java.util.ArrayList; | |||
import java.util.List; | |||
|
|||
import com.insightfullogic.honest_profiler.core.aggregation.result.straight.Entry; | |||
import com.insightfullogic.honest_profiler.core.aggregation.result.straight.Flat; | |||
import com.insightfullogic.honest_profiler.core.aggregation.result.straight.Node; | |||
import com.insightfullogic.honest_profiler.core.profiles.lean.LeanNode; | |||
|
|||
/** | |||
* Aggregator which takes a {@link Node}, and aggregates the values of the {@link Node} and its descendants into a list | |||
* of {@link Entry}s. | |||
*/ | |||
public class NodeDescendantAggregator implements Aggregator<Node<String>, String, Entry<String>> | |||
{ | |||
/** | |||
* This method aggregates a {@link Node} and all its all descendants. | |||
* | |||
* @see Aggregator#aggregate(Object, LeanNode) | |||
*/ | |||
@Override | |||
public Flat<String> aggregate(Node<String> parent, LeanNode reference) | |||
{ | |||
List<Entry<String>> result = new ArrayList<>(); | |||
Flat<String> aggregation = new Flat<>(result, reference); | |||
|
|||
parent.flatten().collect( | |||
groupingBy( | |||
Node::getKey, | |||
of( | |||
// Supplier | |||
() -> new Entry<String>(aggregation), | |||
// Accumulator | |||
(x, y) -> x.combine(y), | |||
// Combiner | |||
(x, y) -> x.combine(y)) | |||
)); | |||
return aggregation; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.