Example #1
0
        public void addClass(XElement classNode, Package pkg)
        {
            //StreamWriter file = new StreamWriter("log2.txt");

            string type = "", className = "", id = "";

            XAttribute attr = (XAttribute)classNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
            if (attr == null) attr = (XAttribute)classNode.Attribute("{http://www.omg.org/spec/XMI/20131001}type");

            if (attr != null) type = attr.Value;

            attr = (XAttribute)classNode.Attribute("name");
            if (attr != null) className = attr.Value;

            attr = (XAttribute)classNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id");
            if (attr == null) attr = (XAttribute)classNode.Attribute("{http://www.omg.org/spec/XMI/20131001}id");

            if (attr != null) id = attr.Value;

            if (type.CompareTo("uml:Class") != 0 && type.CompareTo("uml:Interface") != 0)
            {

                return;
            }

            Class cl = null;

            // file.WriteLine(" Class : " + className);
            // file.Flush();
            // file.Close();

            if (isStereotypedEntity(classNode))
            {
                cl = new EntityClass(className);
            }
            else if (isStereotypedBlock(classNode))
            {
                cl = new Block(className);
            }
            else if (isStereotypedAgent(classNode))
            {
                cl = new AgentClass(className);
            }
            else if (isStereotypedVirtualHuman(classNode))
            {
                cl = new VirtualHumanClass(className);
            }
            else if (isStereotypedRole(classNode))
            {
                cl = new RoleClass(className);
            }
            else
            {
                cl = new EntityClass(className);
            }

            _idClass.Add(id, cl);

            _classifiers.Add(id, cl);
            //Debug.Log (" Adding Class : " + _classifiers.convertToDictionary().Count + " : " + id);
            if (pkg != null)
                pkg.addClasses(cl);
            cl.Description = getComment(classNode);
            cl.Summary = getSummary(classNode);
            cl.Tags = getTags(classNode);

            foreach (XElement child in classNode.Elements())
            {
                if (child.Name.LocalName.CompareTo("ownedOperation") == 0)
                    addOperation(child, cl);
                else if (child.Name.LocalName.CompareTo("ownedAttribute") == 0)
                    addAttribute(child, cl);
                else if (child.Name.LocalName.CompareTo("generalization") == 0)
                {
                    XAttribute attr2 = (XAttribute)child.Attribute("general");
                    if (attr2 != null)
                        _toGeneralize.Add(new KeyValuePair<string, string>(id, attr2.Value));
                }
            }

            foreach (KeyValuePair<CallEvent, string> pair in _callEvents)
            {

                if (_idOperations.ContainsKey(pair.Value))
                {
                    Operation oper = _idOperations[pair.Value];
                    // TO DO_callEvents.getKey(pair.Key).Operation=oper;
                }
            }

            foreach (XElement child in classNode.Elements())
            {
                //Debug.Log(" Parsing class : " + cl.getFullName() + "/ Child : " + child.Name.LocalName);

                if (child.Name.LocalName.CompareTo("ownedBehavior") == 0 || child.Name.LocalName.CompareTo("nestedClassifier") == 0)
                {
                    // MascaretApplication.Instance.logfile.WriteLine(" Owned Behavior"); MascaretApplication.Instance.logfile.Flush();
                    XAttribute attr2 = (XAttribute)child.Attribute("{http://schema.omg.org/spec/XMI/2.1}type");
                    if (attr2 == null) attr2 = (XAttribute)child.Attribute("{http://www.omg.org/spec/XMI/20131001}type");
                    // MascaretApplication.Instance.logfile.WriteLine(attr2.Value); MascaretApplication.Instance.logfile.Flush();

                    //Debug.Log(" Parsing class : " + cl.getFullName() + "/ Attr : " + attr2);
                    if (attr2 != null && attr2.Value.CompareTo("uml:StateMachine") == 0)
                        addStateMachineToClass(child, cl);

                    if (attr2 != null && attr2.Value.CompareTo("uml:Activity") == 0)
                        addActivityToClass(child, cl);
                }
            }

            // Bouml preserved body end 0001F5E7
        }
Example #2
0
 public Role(string name)
     : base(name)
 {
     roleClass = new RoleClass();
 }
Example #3
0
 public Role(string name)
     : base(name)
 {
     roleClass = new RoleClass();
 }