DirectedGraph<AddonVertex, AddonDependencyEdge> toGraph(AddonInfo info)
{
DirectedGraph<AddonVertex, AddonDependencyEdge> graph = new DefaultDirectedGraph<AddonVertex, AddonDependencyEdge>(
AddonDependencyEdge.class);
AddonId addon = info.getAddon();
AddonVertex rootVertex = new AddonVertex(addon.getName(), addon.getVersion());
graph.addVertex(rootVertex);
for (AddonDependencyEntry entry : info.getDependencyEntries())
{
AddonVertex depVertex = new AddonVertex(entry.getName(), entry.getVersionRange().getMax());
graph.addVertex(depVertex);
graph.addEdge(rootVertex, depVertex,
new AddonDependencyEdge(entry.getVersionRange(), entry.isExported()));
}
if (includeTransitiveAddons)