class_b = structures.BasicClass()
class_b.name = 'ClassB'
class_b.type = ''
class_b.attributes = "object_b, object_c"
class_b.functions = [function_a]

typed = structures.TypeDef()
types = structures.TypeDef()

class_c = structures.BasicClass()
class_c.name = 'ClassC'
class_c.type = ''
class_c.attributes = "object_b, object_c"
class_c.functions = [function_a]

relation = structures.Relation()
relation.start_object = types
relation.end_object = class_b
relation.type = "set_of"

relation2 = structures.Relation()
relation2.start_object = typed
relation2.end_object = class_b

classes_list = [class_a, class_b, class_c]
relations_list = [relation, relation2]
types_list = [types, typed]
outfile = "uml.uxf"
generator = UMLBuilder(classes_list, relations_list, types_list)
generator.gen_uml(outfile)
Пример #2
0
__authors__ = 'Sam Sorensen', 'Keith Smith', 'Anna Andriyanova'
__date__ = 'Spring 2012'

import sys
from xml_parser import XMLParser
from uml_builder import UMLBuilder

if sys.argv:
    parser = XMLParser(sys.argv[1])
    builder = UMLBuilder(parser.classes_list, parser.relations_list, parser.types_list)
    print "##########"
    print "Lists:"
    print "Classes found: %s" % parser.classes_list
    print "Relations found: %s" % parser.relations_list
    print "Types found: %s" % parser.types_list
    print "##########"
    builder.gen_uml('uml.uxf')
else:
    print "No input file specified. Please specify the location of a TOZE Object-Z specification as argument 1."