Beispiel #1
0
        public async Task SequenceDiagramRead2()
        {
            UMLInterface i1     = new("ns1", "i1", new List <UMLDataType>());
            UMLClass     class2 = new("", "ns2", true, "c1", null, i1);

            i1.Methods.Add(new UMLMethod("Method1", new VoidDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType())));
            class2.Methods.Add(new UMLMethod(class2, UMLVisibility.Public));

            class2.Methods.Add(new UMLMethod("Method1", new IntDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType())));

            UMLClassDiagram cd = new("a", "");

            cd.DataTypes.Add(i1);
            cd.DataTypes.Add(class2);

            UMLSequenceDiagram d = new("my diagram", "");

            UMLSequenceLifeline l1 = new UMLSequenceLifeline("participant", "i1", "ss", i1.Id, 1);
            UMLSequenceLifeline l2 = new UMLSequenceLifeline("participant", "c1", "cS", class2.Id, 2);

            d.LifeLines.Add(l1);
            d.LifeLines.Add(l2);

            d.AddConnection(null, l1, 3).Action = i1.Methods[0];

            UMLSequenceBlockSection pg = new UMLSequenceBlockSection("if z = 1", UMLSequenceBlockSection.SectionTypes.If, 4);

            d.Entities.Add(pg);

            pg.AddConnection(l1, l2, 5).Action = class2.Methods[0];

            UMLSequenceBlockSection elsesection = new UMLSequenceBlockSection("else", UMLSequenceBlockSection.SectionTypes.Else, 6);

            elsesection.AddConnection(l2, l2, 7).Action = class2.Methods[1];

            UMLSequenceConnection x = d.AddConnection(l2, l1, 8);

            x.Action = new UMLReturnFromMethod(class2.Methods[0]);

            UMLSequenceConnection x2 = d.AddConnection(l1, l1, 9);

            x2.Action = i1.Methods[0];

            d.AddConnection(l1, null, 10).Action = new UMLReturnFromMethod(i1.Methods[0]);

            string s = PlantUMLGenerator.Create(d);

            _ = await UMLSequenceDiagramParser.ReadString(s, new LockedList <UMLClassDiagram>(new[] { cd }), false);
        }
Beispiel #2
0
        public void ClassDiagram1()
        {
            UMLInterface i1     = new("", "i1", new List <UMLDataType>());
            UMLClass     class2 = new("", "ns", true, "c1", null, i1);

            class2.Properties.Add(new UMLProperty("prop1", i1, UMLVisibility.Public, ListTypes.List, false, false, false));

            i1.Methods.Add(new UMLMethod("Method1", new VoidDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType())));
            class2.Methods.Add(new UMLMethod(class2, UMLVisibility.Public));

            class2.Methods.Add(new UMLMethod("Method1", new IntDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType())));

            UMLClassDiagram d = new UMLClassDiagram("test", "");

            d.DataTypes.Add(i1);
            d.DataTypes.Add(class2);
            _ = PlantUMLGenerator.Create(d);
        }
Beispiel #3
0
        public async Task ClassDiagramRead1()
        {
            UMLInterface i1     = new("", "i1", new List <UMLDataType>());
            UMLClass     class2 = new("", "ns", true, "c1", null, i1);

            class2.Properties.Add(new UMLProperty("prop1", i1, UMLVisibility.Public, ListTypes.List, false, false, false));

            i1.Methods.Add(new UMLMethod("Method1", new VoidDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType()),
                                         new UMLParameter("parm2", new BoolDataType()),
                                         new UMLParameter("parm3", new StringDataType(), ListTypes.IReadOnlyCollection)));
            class2.Methods.Add(new UMLMethod(class2, UMLVisibility.Public));

            class2.Methods.Add(new UMLMethod("Method1", new IntDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType())));

            UMLClassDiagram d = new UMLClassDiagram("test", "");

            d.DataTypes.Add(i1);
            d.DataTypes.Add(class2);

            string s = PlantUMLGenerator.Create(d);

            _ = await UMLClassDiagramParser.ReadString(s);
        }
Beispiel #4
0
        public void SequenceDiagram1()
        {
            UMLInterface i1     = new("ns1", "i1", new List <UMLDataType>());
            UMLClass     class2 = new("", "ns2", true, "c1", null, i1);

            i1.Methods.Add(new UMLMethod("Method1", new VoidDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType())));
            class2.Methods.Add(new UMLMethod(class2, UMLVisibility.Public));

            class2.Methods.Add(new UMLMethod("Method1", new IntDataType(), UMLVisibility.Public, new UMLParameter("parm1", new StringDataType())));

            UMLSequenceDiagram d = new("my diagram", "");

            UMLSequenceLifeline l1 = new UMLSequenceLifeline("participant", "i1", "i1a", i1.Id, 1);
            UMLSequenceLifeline l2 = new UMLSequenceLifeline("participant", "c2", "c2a", class2.Id, 2);

            d.LifeLines.Add(l1);
            d.LifeLines.Add(l2);

            d.AddConnection(null, l1, 3).Action = i1.Methods[0];
            d.AddConnection(l1, l2, 4).Action   = class2.Methods[0];
            d.AddConnection(l2, l1, 5).Action   = new UMLReturnFromMethod(class2.Methods[0]);
            d.AddConnection(l1, null, 6).Action = new UMLReturnFromMethod(i1.Methods[0]);
            _ = PlantUMLGenerator.Create(d);
        }