/**
   * Print the specified relation
   *
   * @param from the source class (may be null)
   * @param fromName the source class's name
   * @param to the destination class (may be null)
   * @param toName the destination class's name
   */
  private void relation(
      Options opt,
      RelationType rt,
      ClassDoc from,
      String fromName,
      ClassDoc to,
      String toName,
      String tailLabel,
      String label,
      String headLabel) {

    // print relation
    String edgetype = associationMap.get(rt);
    w.println("\t// " + fromName + " " + rt.toString() + " " + toName);
    w.println(
        "\t"
            + relationNode(from, fromName)
            + " -> "
            + relationNode(to, toName)
            + " ["
            + "taillabel=\""
            + tailLabel
            + "\", "
            + "label=\""
            + guillemize(opt, label)
            + "\", "
            + "headlabel=\""
            + headLabel
            + "\", "
            + "fontname=\""
            + opt.edgeFontName
            + "\", "
            + "fontcolor=\""
            + opt.edgeFontColor
            + "\", "
            + "fontsize="
            + opt.edgeFontSize
            + ", "
            + "color=\""
            + opt.edgeColor
            + "\", "
            + edgetype
            + "];");

    // update relation info
    RelationDirection d = RelationDirection.BOTH;
    if (rt == RelationType.NAVASSOC || rt == RelationType.DEPEND) d = RelationDirection.OUT;
    getClassInfo(fromName).addRelation(toName, rt, d);
    getClassInfo(toName).addRelation(fromName, rt, d.inverse());
  }
Esempio n. 2
-1
  /**
   * Print all relations for a given's class's tag
   *
   * @param tagname the tag containing the given relation
   * @param from the source class
   * @param edgetype the dot edge specification
   */
  private void allRelation(Options opt, RelationType rt, ClassDoc from) {
    String tagname = rt.toString().toLowerCase();
    for (Tag tag : from.tags(tagname)) {
      String t[] = StringUtil.tokenize(tag.text()); // l-src label l-dst target
      if (t.length != 4) {
        System.err.println(
            "Error in "
                + from
                + "\n"
                + tagname
                + " expects four fields (l-src label l-dst target): "
                + tag.text());
        return;
      }
      ClassDoc to = from.findClass(t[3]);

      if (to != null) {
        if (hidden(to)) continue;
        relation(opt, rt, from, to, t[0], t[1], t[2]);
      } else {
        if (hidden(t[3])) continue;
        relation(opt, rt, from, from.toString(), to, t[3], t[0], t[1], t[2]);
      }
    }
  }