Beispiel #1
0
 /// <summary>
 /// It combines module instances with other, this should be done at the end, since all modules' instances should had
 /// been created
 /// </summary>
 /// <param name="kpType"></param>
 private static void buildInstanceConnections(MType kpType, MInstance kpInstance)
 {
     if (kpType != null)
     {
         Module module = nuSMV.getModule(kpType, kpInstance);
         module.Instance.ConnectedTo = BInstances.getInstanceConnections(nuSMV, kpSystem, kpInstance);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Check if type includes any communication, division, or dissolution rules
        /// </summary>
        /// <param name="module"></param>
        /// <param name="kpType"></param>
        private static void prepareSMVModule(Module module, MType kpType, MInstance kpInstance)
        {
            module.Type = kpType.Name;
            module.setModuleName(kpType.Name, kpInstance.Name);
            ExecutionStrategy kpES      = kpType.ExecutionStrategy;
            bool communicationRuleExist = false;

            while (kpES != null)
            {
                if (kpES.Operator == StrategyOperator.CHOICE)
                {
                    module.HasChoiceStrategy = true;
                    module.TurnOrder.Add(TurnStates.CHOICE);
                }
                //check strategies needs substeps( seq, abrt, or max)
                else if (kpES.Operator == StrategyOperator.SEQUENCE)
                {
                    module.HasSequenceStrategy = true;
                    module.TurnOrder.Add(TurnStates.SEQUENCE);
                }
                else if (kpES.Operator == StrategyOperator.ARBITRARY)
                {
                    module.HasArbitraryStrategy = true;
                    module.TurnOrder.Add(TurnStates.ARBITRARY);
                }
                else if (kpES.Operator == StrategyOperator.MAX)
                {
                    module.HasMaxStrategy = true;
                    module.TurnOrder.Add(TurnStates.MAX);
                }
                //check types if they have comm, division or dissolution rules
                foreach (var rule in kpES.Rules)
                {
                    if (rule.Type == RuleType.REWRITE_COMMUNICATION)
                    {
                        communicationRuleExist = true;
                    }
                    else if (rule.Type == RuleType.MEMBRANE_DIVISION)
                    {
                        module.HasDivisionRule = true;
                    }
                    else if (rule.Type == RuleType.MEMBRANE_DISSOLUTION)
                    {
                        module.HasDissolutionRule = true;
                    }
                }
                kpES = kpES.Next;
            }
            bool connectionExist = false;

            foreach (MInstance minstance in kpInstance.Connections)
            {
                connectionExist = true;
                break;
            }
            // if module instances has connection and there is a communication rule, then it needs,
            //connection variable
            module.HasConnection = connectionExist && communicationRuleExist;
            // Build instances, give a name if there is not given
            BInstances.generateSMVInstances(nuSMV, module, kpType, kpInstance);
        }