Esempio n. 1
0
 public void AddStereotype(Stereotype type)
 {
     types.Add(type.Name, type);
 }
Esempio n. 2
0
        public void ReadXml(XmlReader reader)
        {
            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                    case "Stereotype":
                        Stereotype type = new Stereotype(reader["Name"]);
                        AddStereotype(type);
                        break;

                    case "Socket":
                        Socket so = new Socket((Component)GetUmlObject(reader["Parent"]),
                                               (InterfaceObject)GetUmlObject(reader["AttachedInterface"]), reader["Name"]);

                        if (reader["Stereotype"] != null)
                        {
                            so.Type = types[reader["Stereotype"]];
                        }
                        AddSocket(so);
                        break;

                    case "SMarty":
                        SMartyBindingTimeTypes btype = default(SMartyBindingTimeTypes);

                        switch (reader["BindingTime"])
                        {
                        case "Runtime":
                            btype = SMartyBindingTimeTypes.Runtime;
                            break;

                        case "LinkingTime":
                            btype = SMartyBindingTimeTypes.LinkingTime;
                            break;

                        case "CompileTime":
                            btype = SMartyBindingTimeTypes.CompileTime;
                            break;

                        case "UpdateTime":
                            btype = SMartyBindingTimeTypes.UpdateTime;
                            break;
                        }

                        SMarty smar = new SMarty(reader["Name"], btype, GetUmlObject(reader["Parent"]));
                        smar.MinSelection = int.Parse(reader["MinSelection"]);
                        smar.MaxSelection = int.Parse(reader["MaxSelection"]);
                        AddAttachment(smar);
                        break;

                    case "InterfaceObject":
                        InterfaceObject io = new InterfaceObject(reader["Name"],
                                                                 (Component)umlObjects[reader["Parent"]]);
                        if (reader["Stereotype"] != null)
                        {
                            io.Type = types[reader["Stereotype"]];
                        }
                        AddInterface(io);
                        break;

                    case "Component":
                        Component comp = new Component(reader["Name"]);
                        if (reader["Stereotype"] != null)
                        {
                            comp.Type = types[reader["Stereotype"]];
                        }
                        AddComponent(comp);
                        break;

                    case "Comment":
                        Comment com = new Comment(reader["Name"], GetUmlObject(reader["Parent"]));
                        reader.Read();
                        com.Content = reader.Value;
                        AddAttachment(com);
                        break;

                    case "Association":
                        Association link = new Association(GetUmlObject(reader["Source"]),
                                                           GetUmlObject(reader["Target"]));
                        if (reader["Stereotype"] != null)
                        {
                            link.Type = types[reader["Stereotype"]];
                        }
                        if (reader["Type"] != null)
                        {
                            link.Type = types[reader["Type"]];
                        }
                        AddAssociation(link);
                        break;
                    }
                }
            }
        }
Esempio n. 3
0
        public object Clone()
        {
            Stereotype type = new Stereotype(name);

            return(type);
        }