From b06b209488fda42e9f75a2d6f61bd69757439236 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Mon, 26 Aug 2002 06:32:10 +0000 Subject: [PATCH] Support for the @stereotype tag. --- .../spinellis/umlgraph/doclet/ClassGraph.java | 19 +++++++++++++++++++ .../spinellis/umlgraph/doclet/ClassInfo.java | 19 +++++++++++++++++++ src/gr/spinellis/umlgraph/doclet/Options.java | 19 +++++++++++++++++++ .../spinellis/umlgraph/doclet/StringUtil.java | 19 +++++++++++++++++++ .../spinellis/umlgraph/doclet/UmlGraph.java | 19 +++++++++++++++++++ src/org/umlgraph/doclet/ClassGraph.java | 19 +++++++++++++++++++ src/org/umlgraph/doclet/ClassInfo.java | 19 +++++++++++++++++++ src/org/umlgraph/doclet/Options.java | 19 +++++++++++++++++++ src/org/umlgraph/doclet/StringUtil.java | 19 +++++++++++++++++++ src/org/umlgraph/doclet/UmlGraph.java | 19 +++++++++++++++++++ 10 files changed, 190 insertions(+) diff --git a/src/gr/spinellis/umlgraph/doclet/ClassGraph.java b/src/gr/spinellis/umlgraph/doclet/ClassGraph.java index 9e842af..e869233 100644 --- a/src/gr/spinellis/umlgraph/doclet/ClassGraph.java +++ b/src/gr/spinellis/umlgraph/doclet/ClassGraph.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/gr/spinellis/umlgraph/doclet/ClassInfo.java b/src/gr/spinellis/umlgraph/doclet/ClassInfo.java index 9e842af..e869233 100644 --- a/src/gr/spinellis/umlgraph/doclet/ClassInfo.java +++ b/src/gr/spinellis/umlgraph/doclet/ClassInfo.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/gr/spinellis/umlgraph/doclet/Options.java b/src/gr/spinellis/umlgraph/doclet/Options.java index 9e842af..e869233 100644 --- a/src/gr/spinellis/umlgraph/doclet/Options.java +++ b/src/gr/spinellis/umlgraph/doclet/Options.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/gr/spinellis/umlgraph/doclet/StringUtil.java b/src/gr/spinellis/umlgraph/doclet/StringUtil.java index 9e842af..e869233 100644 --- a/src/gr/spinellis/umlgraph/doclet/StringUtil.java +++ b/src/gr/spinellis/umlgraph/doclet/StringUtil.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/gr/spinellis/umlgraph/doclet/UmlGraph.java b/src/gr/spinellis/umlgraph/doclet/UmlGraph.java index 9e842af..e869233 100644 --- a/src/gr/spinellis/umlgraph/doclet/UmlGraph.java +++ b/src/gr/spinellis/umlgraph/doclet/UmlGraph.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/org/umlgraph/doclet/ClassGraph.java b/src/org/umlgraph/doclet/ClassGraph.java index 9e842af..e869233 100644 --- a/src/org/umlgraph/doclet/ClassGraph.java +++ b/src/org/umlgraph/doclet/ClassGraph.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/org/umlgraph/doclet/ClassInfo.java b/src/org/umlgraph/doclet/ClassInfo.java index 9e842af..e869233 100644 --- a/src/org/umlgraph/doclet/ClassInfo.java +++ b/src/org/umlgraph/doclet/ClassInfo.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/org/umlgraph/doclet/Options.java b/src/org/umlgraph/doclet/Options.java index 9e842af..e869233 100644 --- a/src/org/umlgraph/doclet/Options.java +++ b/src/org/umlgraph/doclet/Options.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/org/umlgraph/doclet/StringUtil.java b/src/org/umlgraph/doclet/StringUtil.java index 9e842af..e869233 100644 --- a/src/org/umlgraph/doclet/StringUtil.java +++ b/src/org/umlgraph/doclet/StringUtil.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; } diff --git a/src/org/umlgraph/doclet/UmlGraph.java b/src/org/umlgraph/doclet/UmlGraph.java index 9e842af..e869233 100644 --- a/src/org/umlgraph/doclet/UmlGraph.java +++ b/src/org/umlgraph/doclet/UmlGraph.java @@ -209,6 +209,7 @@ class ClassGraph { /** Print the visibility adornment of element e */ private void visibility(ProgramElementDoc e) { + opt.w.print(stereotype(e, 'l')); if (!opt.showVisibility) return; if (e.isPrivate()) @@ -273,6 +274,21 @@ class ClassGraph { } } + /** Return as a string the stereotypes associated with c */ + private static String stereotype(Doc c, char term) { + String r = ""; + Tag tags[] = c.tags("stereotype"); + for (int i = 0; i < tags.length; i++) { + String t[] = StringFuns.tokenize(tags[i].text()); + if (t.length != 1) { + System.err.println("@stereotype expects one field: " + tags[i].text()); + return (""); + } + r += StringFuns.guilopen + t[0] + StringFuns.guilclose + '\\' + term; + } + return (r); + } + /** Return true if c has a @hidden tag associated with it */ private static boolean hidden(Doc c) { Tag tags[] = c.tags("hidden"); @@ -311,6 +327,7 @@ class ClassGraph { } // Create label opt.w.print("\t" + ci.name + " ["); + r = stereotype(c, 'n') + r; if (c.isInterface()) r = StringFuns.guilopen + "interface" + StringFuns.guilclose + "\\n" + r; boolean showMembers = @@ -426,6 +443,8 @@ public class UmlGraph { option.equals("-types") || option.equals("-all")) return 1; + else if(option.equals("-nodefillcolor")) + return 2; else return 0; }