From 4faf99f2011f668f3e9ad7d5add2d4d152bc62d2 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Wed, 6 Jul 2005 17:31:01 +0000 Subject: [PATCH] Display generic classes using <> symbols. --- .../spinellis/umlgraph/doclet/ClassGraph.java | 17 +++++++++++++++-- src/gr/spinellis/umlgraph/doclet/ClassInfo.java | 17 +++++++++++++++-- src/gr/spinellis/umlgraph/doclet/Options.java | 17 +++++++++++++++-- .../spinellis/umlgraph/doclet/StringUtil.java | 17 +++++++++++++++-- src/gr/spinellis/umlgraph/doclet/UmlGraph.java | 17 +++++++++++++++-- src/org/umlgraph/doclet/ClassGraph.java | 17 +++++++++++++++-- src/org/umlgraph/doclet/ClassInfo.java | 17 +++++++++++++++-- src/org/umlgraph/doclet/Options.java | 17 +++++++++++++++-- src/org/umlgraph/doclet/StringUtil.java | 17 +++++++++++++++-- src/org/umlgraph/doclet/UmlGraph.java | 17 +++++++++++++++-- 10 files changed, 150 insertions(+), 20 deletions(-) diff --git a/src/gr/spinellis/umlgraph/doclet/ClassGraph.java b/src/gr/spinellis/umlgraph/doclet/ClassGraph.java index ac19529..3dace27 100644 --- a/src/gr/spinellis/umlgraph/doclet/ClassGraph.java +++ b/src/gr/spinellis/umlgraph/doclet/ClassGraph.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/gr/spinellis/umlgraph/doclet/ClassInfo.java b/src/gr/spinellis/umlgraph/doclet/ClassInfo.java index ac19529..3dace27 100644 --- a/src/gr/spinellis/umlgraph/doclet/ClassInfo.java +++ b/src/gr/spinellis/umlgraph/doclet/ClassInfo.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/gr/spinellis/umlgraph/doclet/Options.java b/src/gr/spinellis/umlgraph/doclet/Options.java index ac19529..3dace27 100644 --- a/src/gr/spinellis/umlgraph/doclet/Options.java +++ b/src/gr/spinellis/umlgraph/doclet/Options.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/gr/spinellis/umlgraph/doclet/StringUtil.java b/src/gr/spinellis/umlgraph/doclet/StringUtil.java index ac19529..3dace27 100644 --- a/src/gr/spinellis/umlgraph/doclet/StringUtil.java +++ b/src/gr/spinellis/umlgraph/doclet/StringUtil.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/gr/spinellis/umlgraph/doclet/UmlGraph.java b/src/gr/spinellis/umlgraph/doclet/UmlGraph.java index ac19529..3dace27 100644 --- a/src/gr/spinellis/umlgraph/doclet/UmlGraph.java +++ b/src/gr/spinellis/umlgraph/doclet/UmlGraph.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/org/umlgraph/doclet/ClassGraph.java b/src/org/umlgraph/doclet/ClassGraph.java index ac19529..3dace27 100644 --- a/src/org/umlgraph/doclet/ClassGraph.java +++ b/src/org/umlgraph/doclet/ClassGraph.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/org/umlgraph/doclet/ClassInfo.java b/src/org/umlgraph/doclet/ClassInfo.java index ac19529..3dace27 100644 --- a/src/org/umlgraph/doclet/ClassInfo.java +++ b/src/org/umlgraph/doclet/ClassInfo.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/org/umlgraph/doclet/Options.java b/src/org/umlgraph/doclet/Options.java index ac19529..3dace27 100644 --- a/src/org/umlgraph/doclet/Options.java +++ b/src/org/umlgraph/doclet/Options.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/org/umlgraph/doclet/StringUtil.java b/src/org/umlgraph/doclet/StringUtil.java index ac19529..3dace27 100644 --- a/src/org/umlgraph/doclet/StringUtil.java +++ b/src/org/umlgraph/doclet/StringUtil.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else diff --git a/src/org/umlgraph/doclet/UmlGraph.java b/src/org/umlgraph/doclet/UmlGraph.java index ac19529..3dace27 100644 --- a/src/org/umlgraph/doclet/UmlGraph.java +++ b/src/org/umlgraph/doclet/UmlGraph.java @@ -345,6 +345,18 @@ class ClassGraph { return r; } + /** Escape < and > characters in the string with a backslash. */ + private String escapeLG(String s) { + StringBuffer r = new StringBuffer(s); + for (int i = 0; i < r.length(); i++) + switch (r.charAt(i)) { + case '<': + case '>': + r.insert(i++, '\\'); + } + return r.toString(); + } + /** * Convert < and > characters in the string to the respective guillemot characters, * or return the same string if the use of those characters has been disabled. @@ -551,7 +563,7 @@ class ClassGraph { opt.w.println("\t// " + r); // Create label opt.w.print("\t" + ci.name + " ["); - r = stereotype(c, 'n') + qualifiedName(r); + r = stereotype(c, 'n') + escapeLG(qualifiedName(r)); if (c.isInterface()) r = guilWrap("interface") + " \\n" + r; if (c.isEnum()) @@ -676,7 +688,7 @@ class ClassGraph { String r = entry.getKey().toString(); opt.w.println("\t// " + r); - opt.w.print("\t" + info.name + "[label=\"" + qualifiedName(r) + "\""); + opt.w.print("\t" + info.name + "[label=\"" + escapeLG(qualifiedName(r)) + "\""); opt.w.print(", fontname=\"" + opt.nodeFontName + "\""); nodeProperties(entry.getKey().toString()); } @@ -711,6 +723,7 @@ class ClassGraph { private String mapApiDocRoot(String className) { String root = null; + /* If no packages are specified, we use apiDocRoot for all of them. */ if (specifiedPackages.isEmpty() || isSpecifiedPackage(className)) root = apiDocRoot; else