Example #1
0
  // FIXME: This code duplicates code that is also in clojure. The clojure
  // code should eventually be used for generating the list of formatters to
  // be used for a compilation.
  public static Set<Formatter> getFormatters(String s) {

    HashSet<Formatter> formatters = new HashSet<Formatter>();

    String[] names = s.trim().split("\\s*,\\s*");
    for (String fname : names) {
      if ("text".equals(fname)) {
        formatters.add(TxtFormatter.getInstance());
      } else if ("json".equals(fname)) {
        formatters.add(JsonFormatter.getInstance());
      } else if ("json.gz".equals(fname)) {
        formatters.add(JsonGzipFormatter.getInstance());
      } else if ("dot".equals(fname)) {
        formatters.add(DotFormatter.getInstance());
      } else if ("pan".equals(fname)) {
        formatters.add(PanFormatter.getInstance());
      } else if ("pan.gz".equals(fname)) {
        formatters.add(PanGzipFormatter.getInstance());
      } else if ("xml".equals(fname)) {
        formatters.add(XmlFormatter.getInstance());
      } else if ("xml.gz".equals(fname)) {
        formatters.add(XmlGzipFormatter.getInstance());
      } else if ("dep".equals(fname)) {
        formatters.add(DepFormatter.getInstance());
      } else if ("none".equals(fname)) {
        // No-op
      }
    }

    return formatters;
  }