01: /*
02: * Create a graphviz graph based on the classes in the specified java
03: * source files.
04: *
05: * (C) Copyright 2002-2005 Diomidis Spinellis
06: *
07: * Permission to use, copy, and distribute this software and its
08: * documentation for any purpose and without fee is hereby granted,
09: * provided that the above copyright notice appear in all copies and that
10: * both that copyright notice and this permission notice appear in
11: * supporting documentation.
12: *
13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
14: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
15: * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16: *
17: * $Id: ClassInfo.java,v 1.62 2007/11/27 09:04:22 dds Exp $
18: *
19: */
20:
21: package org.umlgraph.doclet;
22:
23: import java.util.HashMap;
24: import java.util.List;
25: import java.util.Map;
26:
27: /**
28: * Class's dot-comaptible alias name (for fully qualified class names)
29: * and printed information
30: * @version $Revision: 1.62 $
31: * @author <a href="http://www.spinellis.gr">Diomidis Spinellis</a>
32: */
33: class ClassInfo {
34: private static int classNumber;
35: /** Alias name for the class */
36: String name;
37: /** True if the class class node has been printed */
38: boolean nodePrinted;
39: /** True if the class class node is hidden */
40: boolean hidden;
41: /**
42: * The list of classes that share a relation with this one. Contains
43: * all the classes linked with a bi-directional relation , and the ones
44: * referred by a directed relation
45: */
46: Map<String, RelationPattern> relatedClasses = new HashMap<String, RelationPattern>();
47:
48: ClassInfo(boolean p, boolean h) {
49: nodePrinted = p;
50: hidden = h;
51: name = "c" + (new Integer(classNumber)).toString();
52: classNumber++;
53: }
54:
55: public void addRelation(String dest, RelationType rt,
56: RelationDirection d) {
57: RelationPattern ri = relatedClasses.get(dest);
58: if (ri == null) {
59: ri = new RelationPattern(RelationDirection.NONE);
60: relatedClasses.put(dest, ri);
61: }
62: ri.addRelation(rt, d);
63: }
64:
65: public RelationPattern getRelation(String dest) {
66: return relatedClasses.get(dest);
67: }
68:
69: /** Start numbering from zero. */
70: public static void reset() {
71: classNumber = 0;
72: }
73:
74: }
|