- final String dotFilePath = desktopPath + resultFileName + ".dot";
- final String imageFilePath = desktopPath + resultFileName + ".png";
+ generateGraph(desktopPath, resultFileName, keepDotFile);
+ }
+
+ /**
+ * @param targetDirectory
+ * target directory name
+ *
+ * @param resultFileName
+ * file name for the generated graph. File extension will be
+ * added automatically. Existing file with the same name will be
+ * overwritten.
+ *
+ * @param keepDotFile
+ * if set to <code>true</code> then intermediary GraphViz DOT
+ * file will be kept.
+ */
+
+ public void generateGraph(String targetDirectory,
+ final String resultFileName, final boolean keepDotFile) {
+
+ if (!targetDirectory.endsWith("/"))
+ targetDirectory += "/";
+
+ final String dotFilePath = targetDirectory + resultFileName + ".dot";
+ final String imageFilePath = targetDirectory + resultFileName + ".png";