Пример #1
0
  protected String groupsToString(StringBuffer buf, Collection<CallGraphNode> clusters) {
    int groupNumber = 1;
    String clusterFormat =
        parameters.getParameter(
            ParameterConstants.CLUSTER_TEXT_FORMAT_KEY, ClusterTextFormatEnum.NEWICK.toString());
    ClusterTextFormatEnum textFormatEnum = ClusterTextFormatEnum.valueOf(clusterFormat);

    for (CallGraphNode node : clusters) {
      buf.append("Group ").append(groupNumber).append(": ");
      buf.append(node.getSimpleName()).append(":\n");
      if (node instanceof CallGraphCluster) {
        CallGraphCluster cluster = (CallGraphCluster) node;

        if (ClusterTextFormatEnum.FLAT.equals(textFormatEnum)) {
          clusterToFlatGroupString(buf, cluster);
        } else {
          cluster.toNestedString(1, buf);
        }
      } else { // Regular CallGraphNode
        buf.append("  ").append(node.getSimpleName()).append("\n");
      }
      groupNumber++;
    }
    String clustersString = buf.toString();
    return clustersString;
  }
Пример #2
0
  protected void clusterToFlatGroupString(StringBuffer buf, CallGraphCluster cluster) {
    SortedSet<CallGraphNode> subnodes = cluster.getElements();
    ArrayList<CallGraphNode> subNodeList = new ArrayList<CallGraphNode>(subnodes);
    Collections.sort(subNodeList, nodeNameComparator);

    for (CallGraphNode subnode : subNodeList) {
      buf.append("  ").append(subnode.getSimpleName()).append("\n");
    }
  }