use of dagger.model.BindingGraph.Edge in project DaggerCodeParse-2.38.1base by hellogaod.
the class ExternalBindingGraphConverter method fromSpiModel.
private static ImmutableNetwork<Node, Edge> fromSpiModel(Network<dagger.spi.model.BindingGraph.Node, dagger.spi.model.BindingGraph.Edge> spiNetwork) {
MutableNetwork<Node, Edge> network = NetworkBuilder.directed().allowsParallelEdges(true).allowsSelfLoops(true).build();
ImmutableMap<dagger.spi.model.BindingGraph.Node, Node> fromSpiNodes = spiNetwork.nodes().stream().collect(toImmutableMap(spiNode -> spiNode, ExternalBindingGraphConverter::fromSpiModel));
for (Node node : fromSpiNodes.values()) {
network.addNode(node);
}
for (dagger.spi.model.BindingGraph.Edge edge : spiNetwork.edges()) {
EndpointPair<dagger.spi.model.BindingGraph.Node> edgePair = spiNetwork.incidentNodes(edge);
network.addEdge(fromSpiNodes.get(edgePair.source()), fromSpiNodes.get(edgePair.target()), fromSpiModel(edge));
}
return ImmutableNetwork.copyOf(network);
}
Aggregations