Can specify options in-line

Can specify multiple inheritance
Navigatable association.
This commit is contained in:
Diomidis Spinellis 2002-07-26 12:58:49 +00:00
parent b2a4cf95b4
commit 90ad5b1ac6
10 changed files with 260 additions and 0 deletions

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {

View File

@ -29,6 +29,7 @@ class Options {
boolean showAttributes;
boolean showOperations;
boolean showVisibility;
boolean horizontal;
boolean showType;
Options() {
@ -46,6 +47,17 @@ class Options {
showType = true;
}
/** Set the options based on the tag elements of the ClassDoc parameter */
public void setOptions(ClassDoc p) {
if (p == null)
return;
Tag tags[] = p.tags("opt");
for (int i = 0; i < tags.length; i++)
if (UmlGraph.optionLength("-" + tags[i].text()) != 1)
System.err.println("Unknown option " + tags[i].text());
}
public void openFile() throws IOException, UnsupportedEncodingException {
FileOutputStream fos = new FileOutputStream("graph.dot");
w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fos)));
@ -242,6 +254,12 @@ class ClassGraph {
opt.w.print("\t" + name(s) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + s);
}
// Print generalization (through @extends tags)
Tag tags[] = c.tags("extends");
for (int i = 0; i < tags.length; i++) {
opt.w.print("\t" + name(tags[i].text()) + " -> " + cs + " [dir=back,arrowtail=empty];");
opt.w.println("\t//" + c + " extends " + tags[i].text());
}
// Print realizations (Java interfaces)
ClassDoc ifs[] = c.interfaces();
for (int i = 0; i < ifs.length; i++) {
@ -250,6 +268,7 @@ class ClassGraph {
}
// Print other associations
relation("assoc", c, cs, "arrowhead=none");
relation("navassoc", c, cs, "arrowhead=open");
relation("has", c, cs, "arrowhead=none, arrowtail=ediamond");
relation("composed", c, cs, "arrowhead=none, arrowtail=diamond");
}
@ -261,6 +280,7 @@ public class UmlGraph {
public static boolean start(RootDoc root)
throws IOException, UnsupportedEncodingException {
opt.openFile();
opt.setOptions(root.classNamed("UMLOptions"));
prologue();
ClassDoc[] classes = root.classes();
for (int i = 0; i < classes.length; i++) {
@ -276,6 +296,10 @@ public class UmlGraph {
opt.showQualified = true;
return 1;
}
if(option.equals("-horizontal")) {
opt.horizontal = true;
return 1;
}
if(option.equals("-attributes")) {
opt.showAttributes = true;
return 1;
@ -311,6 +335,8 @@ public class UmlGraph {
"\tnode [fontname=\"Helvetica\",fontsize=8,shape=record];"
);
if (opt.horizontal)
opt.w.println("\trankdir=LR;");
}
private static void epilogue() {