void writeDotFile(TypeElement module, Map<String, Binding<?>> bindings) throws IOException { JavaFileManager.Location location = StandardLocation.SOURCE_OUTPUT; String path = getPackage(module).getQualifiedName().toString(); String file = module.getQualifiedName().toString().substring(path.length() + 1) + ".dot"; FileObject resource = processingEnv.getFiler().createResource(location, path, file, module); Writer writer = resource.openWriter(); GraphVizWriter dotWriter = new GraphVizWriter(writer); new GraphVisualizer().write(bindings, dotWriter); dotWriter.close(); }
public void write(Map<String, Binding<?>> bindings, GraphVizWriter writer) throws IOException { Map<Binding<?>, String> namesIndex = buildNamesIndex(bindings); writer.beginGraph("concentrate", "true"); for (Map.Entry<Binding<?>, String> entry : namesIndex.entrySet()) { Binding<?> sourceBinding = entry.getKey(); String sourceName = entry.getValue(); Set<Binding<?>> dependencies = new TreeSet<Binding<?>>(new BindingComparator()); sourceBinding.getDependencies(dependencies, dependencies); for (Binding<?> targetBinding : dependencies) { String targetName = namesIndex.get(targetBinding); if (targetName == null) { targetName = "Unbound:" + targetBinding.provideKey; } writer.edge(sourceName, targetName); } } writer.endGraph(); }
String key = entry.getKey(); Binding<?> binding = entry.getValue(); String shortName = shortName(key); Binding<?> collision = shortNameToBinding.put(shortName, binding); if (collision != null && collision != binding) { if (collisions.contains(binding)) { String key = entry.getKey(); String shortName = shortName(key); shortNameToBinding.remove(shortName); shortNameToBinding.put(key, binding);
void writeDotFile(TypeElement module, Map<String, Binding<?>> bindings) throws IOException { JavaFileManager.Location location = StandardLocation.SOURCE_OUTPUT; String path = CodeGen.getPackage(module).getQualifiedName().toString(); String file = module.getQualifiedName().toString().substring(path.length() + 1) + ".dot"; FileObject resource = processingEnv.getFiler().createResource(location, path, file, module); Writer writer = resource.openWriter(); DotWriter dotWriter = new DotWriter(writer); new GraphVisualizer().write(bindings, dotWriter); dotWriter.close(); } }
public void write(Map<String, Binding<?>> bindings, DotWriter writer) throws IOException { Map<Binding<?>, String> namesIndex = buildNamesIndex(bindings); writer.beginGraph("concentrate", "true"); for (Map.Entry<Binding<?>, String> entry : namesIndex.entrySet()) { Binding<?> sourceBinding = entry.getKey(); String sourceName = entry.getValue(); Set<Binding<?>> dependencies = new HashSet<Binding<?>>(); sourceBinding.getDependencies(dependencies, dependencies); for (Binding<?> targetBinding : dependencies) { String targetName = namesIndex.get(targetBinding); writer.edge(sourceName, targetName); } } writer.endGraph(); }
String key = entry.getKey(); Binding<?> binding = entry.getValue(); String shortName = shortName(key); Binding<?> collision = shortNameToBinding.put(shortName, binding); if (collision != null && collision != binding) { if (collisions.contains(binding)) { String key = entry.getKey(); String shortName = shortName(key); shortNameToBinding.remove(shortName); shortNameToBinding.put(key, binding);