|
From: <ki...@us...> - 2003-02-01 02:09:08
|
Update of /cvsroot/pymerase/pymerase/output
In directory sc8-pr-cvs1:/tmp/cvs-serv12532
Modified Files:
CreateGraphvizUML.py
Log Message:
Generates links but not inheritance
Index: CreateGraphvizUML.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/output/CreateGraphvizUML.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CreateGraphvizUML.py 1 Feb 2003 01:15:06 -0000 1.2
--- CreateGraphvizUML.py 1 Feb 2003 02:09:05 -0000 1.3
***************
*** 45,48 ****
--- 45,49 ----
TRANSLATOR_NAME='CreateGraphvizUML'
+ classLinks = {}
def getAttributeString(attrib):
***************
*** 51,54 ****
--- 52,76 ----
return text
+ def getAssocString(assoc, class2num):
+ thisClassName = assoc.getClassName(TRANSLATOR_NAME)
+ oppositeClassName = assoc.getOppositeEnd().getClassName(TRANSLATOR_NAME)
+
+ if thisClassName not in classLinks[oppositeClassName]:
+ text = "c%s -> c%s [taillabel=\"<TAIL_LABEL>\", label=\"\", " \
+ "headlabel=\"<HEAD_LABEL>\", arrowhead=<ARROW_HEAD>, " \
+ "arrowtail=<ARROW_TAIL>]" % (class2num[thisClassName],
+ class2num[oppositeClassName])
+
+ text = re.sub("<TAIL_LABEL>", assoc.getOppositeEnd().getName(TRANSLATOR_NAME), text)
+ text = re.sub("<HEAD_LABEL>", assoc.getName(TRANSLATOR_NAME), text)
+ text = re.sub("<ARROW_TAIL>", "none", text)
+ text = re.sub("<ARROW_HEAD>", "none", text)
+ classLinks[thisClassName].append(oppositeClassName)
+ classLinks[oppositeClassName].append(thisClassName)
+ return text
+ else:
+ return None
+
+
############################
# Writer components
***************
*** 58,61 ****
--- 80,84 ----
Create graphviz output in destination dirctory.
"""
+ class2num = {}
indent = " " * 8
***************
*** 71,75 ****
--- 94,109 ----
text.append(indent + "node [fontname=\"Helvetica\",fontsize=10,shape=record];")
+ #Create class2num dictionary
counter = 0
+ for tbl in tables:
+ class2num[tbl.getName(TRANSLATOR_NAME)] = counter
+ counter += 1
+
+ #dict for keeping track of linking
+ classLinks[tbl.getName(TRANSLATOR_NAME)] = []
+
+ #reset counter
+ counter = 0
+
#Iterate through the tables/classes and process the data
for tbl in tables:
***************
*** 88,91 ****
--- 122,130 ----
text.append(label)
counter += 1
+
+ for assocEnd in tbl.getAssociationEnds().values():
+ linkage = getAssocString(assocEnd, class2num)
+ if linkage is not None:
+ text.append(linkage)
text.append("}")
|