コード例 #1
0
        //default parameters sync=false
        public GlobalActivityBehavior(GlobalActivity gActivity, InstanceSpecification host, Dictionary<string, ValueSpecification> p)
            : base(gActivity.globalActivity, host, p)
        {
            stateActivity = 0;
            this.activity = gActivity.globalActivity;
            affectations = new Dictionary<string, InstanceSpecification>();

            /* Affectation des parametres */
            MascaretApplication.Instance.VRComponentFactory.Log("BUILD AFFECTATIONS ........ " + activity.name + " : " + activity.Partitions.Count);

            foreach (ActivityPartition currentPartition in activity.Partitions)
            {
                if (currentPartition.name == "this")
                {
                    affectations.Add("this", host);
                    // MascaretApplication.Instance.VRComponentFactory.Log("Affectation de this a : " + host.name);
                }
                else
                {
                    if (p.ContainsKey(currentPartition.name))
                    {
                        InstanceValue val = (InstanceValue)p[currentPartition.name];
                        affectations.Add(currentPartition.name, val.SpecValue);
                    }
                    else
                    {
                        if (host.Slots.ContainsKey(currentPartition.name))
                            affectations.Add(currentPartition.name, host.getProperty(currentPartition.name).getValue().valueSpecificationToInstanceSpecification());
                        else
                            MascaretApplication.Instance.VRComponentFactory.Log("[ActivityBehaviorExecution.cpp] Affectation Partition de " + currentPartition.name + " impossible ...");
                    }
                }

            }
        }
コード例 #2
0
        //default parameters sync=false
        public ActivityBehaviorExecution(Activity activity, InstanceSpecification host, Dictionary<string, ValueSpecification> p, bool sync)
            : base(activity, host, p, sync)
        {
            stateActivity = 0;
            this.activity = activity;
            affectations = new Dictionary<string, InstanceSpecification>();

            /* Affectation des parametres */
            MascaretApplication.Instance.VRComponentFactory.Log("BUILD AFFECTATIONS ........ "+ activity.name + " : " + activity.Partitions.Count);

            foreach (ActivityPartition currentPartition in activity.Partitions)
            {
                if (currentPartition.name == "this")
                {
                    affectations.Add("this", host);
                   // MascaretApplication.Instance.VRComponentFactory.Log("Affectation de this a : " + host.name);
                }
                else
                {
                    if (p.ContainsKey(currentPartition.name))
                    {
                        InstanceValue val = (InstanceValue)p[currentPartition.name];
                        affectations.Add(currentPartition.name, val.SpecValue);
                    }
                    else
                    {
                        if (host.Slots.ContainsKey(currentPartition.name))
                            affectations.Add(currentPartition.name, host.getProperty(currentPartition.name).getValue().valueSpecificationToInstanceSpecification());
                        else
                            MascaretApplication.Instance.VRComponentFactory.Log("[ActivityBehaviorExecution.cpp] Affectation Partition de " + currentPartition.name + " impossible ...");
                    }
                }

                foreach (ActivityNode currentNode in currentPartition.Node)
                {
                    if (currentNode.Kind == "object")
                    {
                        MascaretApplication.Instance.VRComponentFactory.Log(" Parameters size : "+p.Count);
                        if (p.ContainsKey(currentNode.name))
                        {
                            InstanceValue val = (InstanceValue)p[currentNode.name];
                            affectations.Add(currentNode.name, val.SpecValue);
                        }
                        else
                        {
                            MascaretApplication.Instance.VRComponentFactory.Log("Slot ? " + currentNode.name);
                            if (host.Slots.ContainsKey(currentNode.name))
                            {
                                try
                                {
                                    MascaretApplication.Instance.VRComponentFactory.Log("Find");
                                    affectations.Add(currentNode.name, ((InstanceValue)(host.getProperty(currentNode.name).getValue())).SpecValue);
                                }
                                catch (Exception)
                                {
                                   // MascaretApplication.Instance.VRComponentFactory.Log("Multiple relation found, not supported, get the last one");
                                    foreach (ValueSpecification currentValue in host.getProperty(currentNode.name).Values.Values)
                                    {
                                        affectations.Add(currentNode.name, currentValue.valueSpecificationToInstanceSpecification());

                                    }
                                }
                            }
                           // else
                              //  MascaretApplication.Instance.VRComponentFactory.Log("[ActivityBehaviorExecution.cpp] Affectation Object de " + currentNode.name + " impossible ...");
                        }

                    }
                    else
                    {
                        if (currentNode.Kind == "action")
                        {
                            Action action = ((ActionNode)currentNode).Action;
                            if (action.Kind == "SendSignal")
                            {
                                SendSignalAction sendAct = (SendSignalAction)action;
                                MascaretApplication.Instance.VRComponentFactory.Log("SendSignal to affect");
                                if (sendAct.Target != null && sendAct.Target.targetName != "")
                                {
                                    MascaretApplication.Instance.VRComponentFactory.Log("Look for : " + sendAct.Target.targetName);

                                    if (p.ContainsKey(sendAct.Target.targetName))
                                    {
                                        InstanceValue val = (InstanceValue)p[sendAct.Target.targetName];
                                        affectations.Add(sendAct.Target.targetName, val.SpecValue);
                                    }
                                    else
                                    {
                                        if (host.Slots.ContainsKey(sendAct.Target.targetName))
                                        {
                                            InstanceSpecification instance = ((InstanceValue)(host.getProperty(sendAct.Target.targetName).getValue())).SpecValue;
                                            MascaretApplication.Instance.VRComponentFactory.Log("Affecttion : " + sendAct.Target.targetName + " a " + instance.getFullName());

                                            affectations.Add(sendAct.Target.targetName, instance);
                                            sendAct.Target.target = instance;
                                            //affectations.Add(sendAct.Target.targetName, host.getProperty(sendAct.Target.targetName).getValue().valueSpecificationToInstanceSpecification());
                                            //sendAct.Target.target = host.getProperty(sendAct.Target.targetName).getValue().valueSpecificationToInstanceSpecification();
                                        }
                                        else
                                        MascaretApplication.Instance.VRComponentFactory.Log("[ActivityBehaviorExecution.cpp] Affectation SendAction de " + sendAct.Target.targetName + " impossible ...");
                                    }
                                }
                            }
                        }
                    }
                }

            }

            //OCLParser::Context function called
            /* OclParser::Context context;
             map<string, shared_ptr<InstanceSpecification> >::iterator it;
             for(it=_affectations.begin();it!=_affectations.end();it++)
             {
                     context[it->first]=it->second;
             }
             _activity->setContext(context);*/
        }
コード例 #3
0
ファイル: ModelLoader2.cs プロジェクト: FlorianPRN/Mascaret
        public void addActivityToClass(XElement activityNode, Class cl)
        {
            string name = activityNode.Attribute("name").Value;

            //Debug.Log(" ###### Adding Activity to class : " + cl.getFullName() + " : " + name);

            bool hasSpecification = false;
            string idoperation = "";
            if (activityNode.Attribute("specification") != null)
            {
                idoperation = activityNode.Attribute("specification").Value;
                hasSpecification = true;
            }

            Activity activity = new Activity(name);

            foreach (XElement child in activityNode.Elements())
            {
                if (child.Name.LocalName.CompareTo("group") == 0)
                    addActivityGroup(child, activity);
            }
            foreach (XElement child in activityNode.Elements())
            {
                if (child.Name.LocalName.CompareTo("node") == 0)
                    addActivityNode(child, activity);
                else if (child.Name.LocalName.CompareTo("ownedParameter") == 0)
                    addActivityParameter(child, activity);
            }
            foreach (XElement child in activityNode.Elements())
            {
                if (child.Name.LocalName.CompareTo("edge") == 0)
                    addActivityEdge(child, activity);
            }

            if (hasSpecification)
            {
                if (_idOperations.ContainsKey(idoperation))
                    _idOperations[idoperation].Method = activity;
                //else
                //Debug.Log("[ModelLoader2 Warning] Operation : " + idoperation
                //+ " not found for activity " + name );
            }
            else
            {
                if (cl.hasOperation(name))
                {
                    Operation op = cl.Operations[name];
                    op.Method = activity;
                }
            }
            //	pkg->addActivity(activity);
            activity.Description = getComment(activityNode);
            activity.Summary = getSummary(activityNode);
            activity.Tags = getTags(activityNode);
        }
コード例 #4
0
ファイル: ModelLoader2.cs プロジェクト: FlorianPRN/Mascaret
        //TODO
        public void addActivityParameter(XElement paramNode, Activity activity)
        {
            string attrName;
            attrName = paramNode.Attribute("name").Value;

            XElement typeNode = paramNode.Element("type");

            Classifier attributeType = null;
            if (typeNode != null && typeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value == "uml:Class")
            {
                string typeId = typeNode.Attribute("idref").Value;
                if (_classifiers.ContainsKey(typeId))
                {
                    attributeType = _classifiers[typeId];
                }
                else
                    attributeType = model.getBasicType(typeId);
            }
            else if (typeNode != null && typeNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value == "uml:PrimitiveType")
            {
                string href = typeNode.Attribute("href").Value;
                string strType = href.Substring(href.LastIndexOf('#') + 1);
                attributeType = model.getBasicType(strType);
            }
            else if (typeNode == null)
            {
                typeNode = paramNode;
                string typeId = typeNode.Attribute("type").Value;
                if (_classifiers.ContainsKey(typeId))
                {
                    attributeType = _classifiers[typeId];
                }
                else
                {
                    if (typeId != "")
                    {
                        attributeType = model.getBasicType(typeId);
                    }
                }
            }

            //cerr << " Adding Parameter : " << attrName << " : " << attributeType->getName() << " dans " << activity->getName() << endl;
            ActivityParameterNode parameterNode = new ActivityParameterNode(attrName);
            Parameter parameter = new Parameter(attrName, "read", attributeType);
            parameterNode.Parameter = parameter;
            activity.addNode(parameterNode);
        }
コード例 #5
0
ファイル: ModelLoader2.cs プロジェクト: FlorianPRN/Mascaret
 public void addActivityNode(XNode node, LoopNode loopNode, Activity activity)
 {
 }
コード例 #6
0
ファイル: ModelLoader2.cs プロジェクト: FlorianPRN/Mascaret
        //FinalNode, Merge et Decision devraent �tre des activityNode !!
        public void addActivityNode(XElement node, Activity activity)
        {
            MascaretApplication.Instance.VRComponentFactory.Log("New activity node");
            string type = "";
            string id = "";
            if (node.Attribute("{http://schema.omg.org/spec/XMI/2.1}type") != null)
                type = node.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value;
            else
                type = node.Attribute("{http://www.omg.org/spec/XMI/20131001}type").Value;

            MascaretApplication.Instance.VRComponentFactory.Log(" Type : " + type);

            if (node.Attribute("{http://schema.omg.org/spec/XMI/2.1}id") != null)
                id = node.Attribute("{http://schema.omg.org/spec/XMI/2.1}id").Value;
            else
                id = node.Attribute("{http://www.omg.org/spec/XMI/20131001}id").Value;
            MascaretApplication.Instance.VRComponentFactory.Log(" ID : " + id);

            string name = "";
            if (node.Attribute("name") != null)
                name = node.Attribute("name").Value;
            else name = id;
            MascaretApplication.Instance.VRComponentFactory.Log(" Name : " + name);

            string idPartition = "";
            if (node.Attribute("inPartition") != null)
                idPartition = node.Attribute("inPartition").Value;

            MascaretApplication.Instance.VRComponentFactory.Log(id);
            MascaretApplication.Instance.VRComponentFactory.Log(type);
            MascaretApplication.Instance.VRComponentFactory.Log(name);
            MascaretApplication.Instance.VRComponentFactory.Log(idPartition);

            ActivityNode actNode = null;

            //Debug.Log(" TYPE NODE : " + type);

            if (type == "uml:InitialNode")
            {
                actNode = new InitialNode();
                activity.Initial = actNode;
                actNode.name = "Initial";
            }
            else if (type == "uml:FinalNode" || type == "uml:ActivityFinalNode")
            {
                actNode = new FinalNode();
            }
            else if (type == "uml:LoopNode")
            {
                addActivityGroup(node, activity);
            }
            else if (type == "uml:ForkNode")
            {
                actNode = new ForkNode();
            }
            else if (type == "uml:JoinNode")
            {
                actNode = new JoinNode();
            }
            else if (type == "uml:MergeNode")
            {
                actNode = new MergeNode();
            }
            /*else if (type == "uml:DecisionNode")
            {
                actNode = new DecisionNode();
            }*/
            else if (type == "uml:ObjectNode" || type == "uml:CentralBufferNode")
            {

                ObjectNode objNode = new ObjectNode(name);
                Classifier ressourceType = getObjectNodeType(node);
                if (ressourceType != null)
                    objNode.ResourceType = ressourceType;
                actNode = objNode;
                string type2 = node.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value;
                if (_idClass.ContainsKey(type2))
                    ((ObjectNode)actNode).ResourceType = _idClass[type2];
            }
            else if (type == "uml:ValueSpecificationAction")
            {
                /*
                shared_ptr<XmlNode> valueNode = node->getChildByName("value");
                string expressionValue = valueNode->getProperty("value");
                shared_ptr<Expression> expression = make_shared<Expression>(expressionValue, _model->getBasicType("boolean"));
                _activityExpressions[node->getProperty("id")] = expression;
                */
            }
            else if (type == "uml:OpaqueAction")
            {
                if (isStereotypedPlayAnimation(node))
                {
                    string animationName = getAnimName(node);
                    MascaretApplication.Instance.VRComponentFactory.Log("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NEW PLAY ANIMATION : " + name + "    " + animationName);

                    ActionNode an = new ActionNode(name, "action");
                    PlayAnimationAction ap = new PlayAnimationAction();
                    ap.Description = getComment(node);
                    ap.name = name;
                    ap.Owner = activity;
                    ap.animationName = animationName;

                    an.Action = ap;
                    addPins(an, node);
                    actNode = an;
                }
            }
            else if (type == "uml:CallBehaviorAction")
            {

                ActionNode an = new ActionNode(name, "action");
                CallBehaviorAction cb = new CallBehaviorAction();
                cb.Description = getComment(node);
                cb.name = name;
                cb.Owner = activity;
                XElement beNode = node.Element("behavior");

                string opid;

                if (beNode != null) opid = beNode.Attribute("idref").Value;
                else opid = node.Attribute("behavior").Value;

                if (_idBehaviors.ContainsKey(opid))
                {
                    cb.Behavior = _idBehaviors[opid];
                }
                else
                {
                    // Debug.Log("[ModelLoader2 Info] Behavior " + opid
                    //           + " not yet found for ActionNode " + name + ". Postbone...");
                    _callBehaviors.Add(cb, opid);
                }

                an.Action = cb;
                addPins(an, node);
                actNode = an;

            }
            else if (type == "uml:CallOperationAction")
            {

                ActionNode an = new ActionNode(name, "action");
                //Debug.Log("Action Node : " +name);
                CallOperationAction act = new CallOperationAction();
                act.Description = getComment(node);
                an.Fml = getFML(node);

                act.name = name;

                act.Owner = activity;

                XElement opNode = node.Element("operation");
                if (opNode != null)
                {
                    string opid;
                    opid = opNode.Attribute("idref").Value;
                    //MascaretApplication.Instance.logfile.WriteLine("Operation ID : " + opid); MascaretApplication.Instance.logfile.Flush();
                    string stereo = getStereotype(opid);
                    MascaretApplication.Instance.VRComponentFactory.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + name + " : " + opid + " " + stereo);
                    if (stereo != "")
                    {

                        an.Stereotype = stereo;
                    }

                    if (_idOperations.ContainsKey(opid))
                        act.Operation = _idOperations[opid];
                    else
                    {
                        //cerr << "ERREUR PAS OPERATION... " << opid<< endl;
                        _callOperations.Add(act, opid);
                    }
                }
                else
                {
                    string opid;
                    opid = node.Attribute("operation").Value;
                    // MascaretApplication.Instance.logfile.WriteLine("Operation ID : " + opid); MascaretApplication.Instance.logfile.Flush();
                    string stereo = getStereotype(opid);
                    MascaretApplication.Instance.VRComponentFactory.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + name + " : " + opid + " " + stereo);
                    if (stereo != "")
                    {

                        an.Stereotype = stereo;
                    }

                    // MascaretApplication.Instance.logfile.WriteLine("Operation ID : " + opid); MascaretApplication.Instance.logfile.Flush();

                    if (_idOperations.ContainsKey(opid))
                    {
                        act.Operation = _idOperations[opid];
                        // MascaretApplication.Instance.logfile.WriteLine("Operation Name : " + act.Operation); MascaretApplication.Instance.logfile.Flush();

                    }
                    else
                        _callOperations.Add(act, opid);
                }
                an.Action = act;
                addPins(an, node);
                actNode = an;
            }
            else if (type == "uml:SendSignalAction")
            {
                MascaretApplication.Instance.VRComponentFactory.Log("SendSignalAction");
                ActionNode an = new ActionNode(name, "action");
                SendSignalAction act = new SendSignalAction();
                XElement sigNode = node.Element("signal");
                if (sigNode != null)
                {
                    string signame = sigNode.Attribute("name").Value;
                    if (!_signals.ContainsKey(signame))
                    {
                        Signal ns = new Signal(signame);
                        _signals.Add(signame, ns);
                    }
                    act.SignalClass = _signals[signame];
                }
                else
                {
                    string signame = "";
                    if (node.Attribute("signal") != null)
                        signame = node.Attribute("signal").Value;
                    if (!_signals.ContainsKey(signame))
                    {
                        Signal ns = new Signal(signame);
                        _signals.Add(signame, ns);
                    }

                    act.SignalClass = _signals[signame];
                }

                XElement targetNode = node.Element("argument");
                if (targetNode != null)
                {
                    string targetName = targetNode.Attribute("name").Value;
                    XElement typeNode = targetNode.Element("type");
                    string classid = "";
                    if (typeNode != null)
                        classid = typeNode.Attribute("idref").Value;
                    else
                        classid = targetNode.Attribute("type").Value;
                    act.Target = new SendSignalTarget();
                    act.Target.targetName = targetName;
                    act.Target.targetClass = _idClass[classid];
                }
                else
                {
                    targetNode = node.Element("target");
                    if (targetNode != null)
                    {
                        MascaretApplication.Instance.VRComponentFactory.Log("SendSignal Target");
                        string targetName = targetNode.Attribute("name").Value;
                        string classid = targetNode.Attribute("type").Value;
                        MascaretApplication.Instance.VRComponentFactory.Log("name : " + targetName);
                        MascaretApplication.Instance.VRComponentFactory.Log("name : " + targetName + " : " + _idClass[classid]);

                        act.Target = new SendSignalTarget();
                        act.Target.targetName = targetName;
                        act.Target.targetClass = _idClass[classid];

                    }
                    else MascaretApplication.Instance.VRComponentFactory.Log("No target");
                }
                an.Action = act;
                addPins(an, node);
                actNode = an;
            }
            else if (type == "uml:AddStructuralFeatureValueAction")
            {
                //cerr << " ############# Found a AddStructuralFeatureValueAction : " << endl;
                /*
                shared_ptr<ActionNode> an = make_shared<ActionNode>(name);
                shared_ptr<Classifier> type;
                shared_ptr<XmlNode> pinNode = node->getChildByName("object");

                string attrName = pinNode->getProperty("name");

                cerr << " Name == " << attrName << endl;

                shared_ptr<XmlNode> typeNode = pinNode->getChildByName("type");
                if (typeNode && typeNode->getProperty("type") == "uml:PrimitiveType")
                {
                    string href = typeNode->getProperty("href");
                    string strType = href.substr(href.rfind('#') + 1);
                    boost::to_lower(strType);
                    type = _model->getBasicType(strType);
                }

                shared_ptr<XmlNode> valueNode = pinNode->getChildByName("value");
                if (valueNode)
                {
                    string value = valueNode->getProperty("value");
                    cerr << "    VALUE : " << value << endl;
                    shared_ptr<Expression> expression = make_shared<Expression>(value, type);
                    shared_ptr<AddStructuralFeatureValueAction> act =
                        make_shared<AddStructuralFeatureValueAction>();
                    act->setValue(expression);
                    act->setProperty(attrName);
                    an->setAction(act);
                }
                actNode = an;
                */

            }
            else if (type == "uml:AcceptEventAction")
            {
                MascaretApplication.Instance.VRComponentFactory.Log("New uml:AcceptEventAction");
                ActionNode an = new ActionNode(name, "action");
                AcceptEventAction act = new AcceptEventAction();

                XElement triggerNode = node.Element("trigger");
                if (triggerNode != null)
                {
                    MascaretApplication.Instance.VRComponentFactory.Log("trigger node found");

                    Trigger trigger = new Trigger(name);
                    MascaretApplication.Instance.VRComponentFactory.Log("Debug : " + name);
                    string idT = "";
                    if (triggerNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id") != null)
                        idT = triggerNode.Attribute("{http://schema.omg.org/spec/XMI/2.1}id").Value;
                    else
                        idT = triggerNode.Attribute("{http://www.omg.org/spec/XMI/20131001}id").Value;

                    trigger.Id = idT;
                    MascaretApplication.Instance.VRComponentFactory.Log(trigger.Id);

                    if (triggerNode.Attribute("event") != null)
                    {
                        string idEvent = triggerNode.Attribute("event").Value;

                        if (_events.ContainsKey(idEvent))
                        {
                            trigger.MEvent = _events[idEvent];
                            act.setTrigger(trigger);
                        }
                        else
                            MascaretApplication.Instance.VRComponentFactory.Log("Could not find event : " + idEvent);
                    }
                }
                an.Action = act;
                addPins(an, node);
                actNode = an;

                MascaretApplication.Instance.VRComponentFactory.Log(" Fin AcceptEventAction");

            }
            // ...
            else
            {
                //Debug.Log("Unknown state: " + type);
            }

            if (actNode != null)
            {
                _activityNodes.Add(id, actNode);
                activity.addNode(actNode);
                //cerr << "searching _partitions for '" << idPartition << "'" << endl;
                if (_partitions.ContainsKey(idPartition))
                {
                    actNode.Partitions.Add(_partitions[idPartition]);
                    _partitions[idPartition].Node.Add(actNode);
                }
                actNode.Summary = getSummary(node);
                actNode.Description = getComment(node);
                actNode.Tags = getTags(node);
            }
        }
コード例 #7
0
ファイル: ModelLoader2.cs プロジェクト: FlorianPRN/Mascaret
        //TODO
        public void addActivityGroup(XElement node, Activity activity)
        {
            string type = "";
            if (node.Attribute("{http://schema.omg.org/spec/XMI/2.1}type") != null)
                type = node.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value;
            else
                type = node.Attribute("{http://www.omg.org/spec/XMI/20131001}type").Value;

            if (type == "uml:ActivityPartition")
            {
                string name = node.Attribute("name").Value;
                ActivityPartition partition = new ActivityPartition(name);
                //Debug.Log("   ---> Partition : " + name);
                string id = "";
                if (node.Attribute("{http://schema.omg.org/spec/XMI/2.1}id") != null)
                    id = node.Attribute("{http://schema.omg.org/spec/XMI/2.1}id").Value;
                else
                    id = node.Attribute("{http://www.omg.org/spec/XMI/20131001}id").Value;

                _partitions.Add(id, partition);
                activity.addPartition(partition);
            }
            else if (type == "uml:LoopNode")
            {
                LoopNode loopNode = new LoopNode(node.Attribute("name").Value, "Loop");
                loopNode.Description = getComment(node);

                activity.addNode(loopNode);

                string idPartition = node.Attribute("inPartition").Value;
                if (_partitions.ContainsKey(idPartition))
                {
                    loopNode.Partitions.Add(_partitions[idPartition]);
                    _partitions[idPartition].Node.Add(loopNode);
                }

                /*
                string isTestedFirst = node.Attribute("isTestedFirst").Value;
                if (isTestedFirst == "true")
                {
                    loopNode.setTestedFirst(true);
                }
                else
                {
                    loopNode->setTestedFirst(false);
                }*/

                _activityNodes.Add(node.Attribute("{http://schema.omg.org/spec/XMI/2.1}id").Value, loopNode);
                //string testId = node.Attribute("test").Value;
                /*
                map<string, shared_ptr<Expression> >::iterator it =	_activityExpressions.find(testId);
                if (it != _activityExpressions.end())
                {
                    loopNode->setCondition(it->second);
                }
                else
                    cerr << "Test for LoopNode : " << loopNode->getName()
                        << " not found" << endl;
                */

                foreach (XElement child in node.Elements())
                {
                    if (child.Name.LocalName == "node")
                    {
                        string inPart = node.Attribute("inPartition").Value;
                        //child.->setProperty(string("inPartition"), inPart);
                        //cerr << "././././././././././. transferring property: " << inPart << endl;
                        addActivityNode(child, loopNode, activity);
                    }
                }
                foreach (XElement child in node.Elements())
                {
                    if (child.Name.LocalName == "edge")
                        addActivityEdge(child, loopNode);
                }
            }
        }
コード例 #8
0
ファイル: ModelLoader2.cs プロジェクト: FlorianPRN/Mascaret
        //TODO: containedEdge avec des ObjectFlow
        //Gerer diff entre ObjectFlow et ControlFlow
        public void addActivityEdge(XElement node, Activity activity)
        {
            string sourceid = node.Attribute("source").Value;
            string targetid = node.Attribute("target").Value;

            //MascaretApplication.Instance.logfile.WriteLine("sourceid : " + sourceid); MascaretApplication.Instance.logfile.Flush();
            //MascaretApplication.Instance.logfile.WriteLine("targetid : " + targetid); MascaretApplication.Instance.logfile.Flush();

            string type = "";
            if (node.Attribute("{http://schema.omg.org/spec/XMI/2.1}type") != null)
                type = node.Attribute("{http://schema.omg.org/spec/XMI/2.1}type").Value;// "uml:ObjectFlow" "uml:ControlFlow"
            else
                type = node.Attribute("{http://www.omg.org/spec/XMI/20131001}type").Value;

            string id = "";
            if (node.Attribute("{http://schema.omg.org/spec/XMI/2.1}id") != null)
                id = node.Attribute("{http://schema.omg.org/spec/XMI/2.1}id").Value;
            else
                id = node.Attribute("{http://www.omg.org/spec/XMI/20131001}id").Value;
            string name = "";
            if (node.Attribute("name") != null)
                name = node.Attribute("name").Value;
            //Debug.Log(" ????????????????????????????????? " + type + " "+id);

            ActivityNode source = null;
            ActivityNode target = null;

            if (!_activityNodes.ContainsKey(sourceid))
            {
                if (!_objectNodes.ContainsKey(sourceid))
                {
                    //MascaretApplication.Instance.logfile.WriteLine("erreur source"); MascaretApplication.Instance.logfile.Flush();

                    //Debug.Log("edge source not found : " + sourceid);
                    return;
                }
                else
                    source = _objectNodes[sourceid];
            }
            else
                source = _activityNodes[sourceid];

            if (!_activityNodes.ContainsKey(targetid))
            {
                if (!_objectNodes.ContainsKey(targetid))
                {
                    //MascaretApplication.Instance.logfile.WriteLine("erreur cible"); MascaretApplication.Instance.logfile.Flush();

                    //Debug.Log("edge Target not found: " + targetid);
                    return;
                }
                else
                    target = _objectNodes[targetid];
            }
            else
                target = _activityNodes[targetid];

            ActivityEdge edge = null;
            if (type == "uml:ControlFlow") edge = new ControlFlow(name);
            else if (type == "uml:ObjectFlow") edge = new ObjectFlow(name);
            else edge = new ActivityEdge(name);

            source.Outgoing.Add(edge);
            target.Incoming.Add(edge);
            edge.Source = source;
            edge.Target = target;

            //Debug.Log("Source : " + source.name + " / Target : " + target.name);

            activity.addEdge(edge);

            edge.Description = getComment(node);
            edge.Summary = getSummary(node);
            edge.Tags = getTags(node);
        }
コード例 #9
0
ファイル: ModelLoader2.cs プロジェクト: FlorianPRN/Mascaret
        public Activity addActivity(XElement activityNode)
        {
            /* Add Activity pour Structure Organisation */
            string name = activityNode.Attribute("name").Value;

            //Debug.Log("Parsing Activity : " + name);

            Activity activity = new Activity(name);
            foreach (XElement child in activityNode.Elements())
            {
                if (child.Name.LocalName == "group")
                    addActivityGroup(child, activity);
            }

            foreach (XElement child in activityNode.Elements())
            {
                if (child.Name.LocalName == "node") //actionNode
                    addActivityNode(child, activity);
                else if (child.Name.LocalName == "ownedParameter")
                    addActivityParameter(child, activity);
            }

            foreach (XElement child in activityNode.Elements())
            {
                if (child.Name.LocalName == "edge")
                    addActivityEdge(child, activity);
            }

            activity.Description = getComment(activityNode);
            activity.Summary = getSummary(activityNode);
            activity.Tags = getTags(activityNode);

            return activity;
        }
コード例 #10
0
 public ActivityExecution(Activity activity)
 {
     this.activity = activity;
     toExecetuteNodes = activity.Initial.getOutgoingActionNode();
 }
コード例 #11
0
 public void buildAffectations(InstanceSpecification host, Activity activity)
 {
 }
コード例 #12
0
ファイル: GlobalActivity.cs プロジェクト: FlorianPRN/Mascaret
 public GlobalActivity(Activity activity)
     : base(activity.name)
 {
     this.activity = activity;
 }