Пример #1
0
        public override Process ClearConstant(Dictionary <string, Expression> constMapping)
        {
            if (FirstProcess is Skip || (FirstProcess is AtomicProcess && (FirstProcess as AtomicProcess).Process is Skip))
            {
                return(SecondProcess.ClearConstant(constMapping));
            }

            return(new Sequence(FirstProcess.ClearConstant(constMapping), SecondProcess.ClearConstant(constMapping)));
        }
        public override Process ClearConstant(Dictionary <string, Expression> constMapping)
        {
            Expression newCon = ConditionalExpression.ClearConstant(constMapping);

            Process newFirstProc = FirstProcess.ClearConstant(constMapping);

            return(new ConditionalChoiceBlocking(newFirstProc, newCon));
        }
Пример #3
0
        public override Process ClearConstant(Dictionary <string, Expression> constMapping)
        {
            Expression[] newExpression = new Expression[ExpressionList.Length];
            for (int i = 0; i < ExpressionList.Length; i++)
            {
                newExpression[i] = ExpressionList[i].ClearConstant(constMapping);
            }

            return(new ChannelOutput(ChannelName, newExpression, Process.ClearConstant(constMapping)));
        }
Пример #4
0
 public override Process ClearConstant(Dictionary <string, Expression> constMapping)
 {
     return(new Hiding(Process.ClearConstant(constMapping), HidingAlphabets.ClearConstant(constMapping)));
 }
Пример #5
0
 public override Process ClearConstant(Dictionary <string, Expression> constMapping)
 {
     return(new Interrupt(FirstProcess.ClearConstant(constMapping), SecondProcess.ClearConstant(constMapping)));
 }
Пример #6
0
        public override void MoveOneStep(Valuation GlobalEnv, List <Configuration> list)
        {
            System.Diagnostics.Debug.Assert(list.Count == 0);

            ChannelQueue Buffer = null;

            if (GlobalEnv.Channels.TryGetValue(this.ChannelName, out Buffer))
            {
                if (Buffer.Count > 0)
                {
                    ChannelQueue      newBuffer = Buffer.Clone();
                    ExpressionValue[] values    = newBuffer.Dequeue();

                    if (values.Length == ExpressionList.Length)
                    {
                        Dictionary <string, Expression> mapping = new Dictionary <string, Expression>(values.Length);

                        Valuation newEnv = GlobalEnv.GetChannelClone();
                        newEnv.Channels[ChannelName] = newBuffer;

                        string eventName = ChannelName + "?";
                        string eventID   = ChannelName + "?";


                        for (int i = 0; i < ExpressionList.Length; i++)
                        {
                            ExpressionValue v = values[i];
                            if (i == ExpressionList.Length - 1)
                            {
                                eventName += v;
                                eventID   += v.ExpressionID;//.GetID();
                            }
                            else
                            {
                                eventName += v + ".";
                                eventID   += v.ExpressionID + ".";
                            }

                            if (ExpressionList[i] is Variable)
                            {
                                mapping.Add(ExpressionList[i].ExpressionID, v); //.GetID()
                            }
                            else
                            {
                                if (v.ExpressionID != ExpressionList[i].ExpressionID) //.GetID() .GetID()
                                {
                                    return;                                           //list
                                }
                            }
                        }

                        Process newProcess = mapping.Count > 0 ? Process.ClearConstant(mapping) : Process;

                        if (eventID != eventName)
                        {
                            list.Add(new Configuration(newProcess, eventID, eventName, newEnv, false));
                        }
                        else
                        {
                            list.Add(new Configuration(newProcess, eventID, null, newEnv, false));
                        }
                    }
                }
            }

            //return list;
        }
Пример #7
0
        public override Process ClearConstant(Dictionary <string, Expression> constMapping)
        {
            Expression newCon = Condition.ClearConstant(constMapping);

            return(new GuardProcess(Process.ClearConstant(constMapping), newCon));
        }
Пример #8
0
 public override Process ClearConstant(Dictionary <string, Expression> constMapping)
 {
     return(new AtomicProcess(Process.ClearConstant(constMapping), Started));
 }
Пример #9
0
        public override Process ClearConstant(Dictionary <string, Expression> constMapping)
        {
            Expression newAssign = AssignmentExpr.ClearConstant(constMapping);

            return(new DataOperationPrefix(Event.ClearConstant(constMapping), newAssign, Process.ClearConstant(constMapping), LocalVariables));
        }
Пример #10
0
 public override Process ClearConstant(Dictionary <string, Expression> constMapping)
 {
     return(new EventPrefix(Event.ClearConstant(constMapping), Process.ClearConstant(constMapping)));
 }
Пример #11
0
 public Definition ClearConstant(Dictionary <string, Expression> constMapping)
 {
     Process = Process.ClearConstant(constMapping);
     return(this);
 }
Пример #12
0
        public List <Process> GetIndexedProcesses(Dictionary <string, Expression> constMapping)
        {
            List <ParallelDefinition> newDefinitions = new List <ParallelDefinition>();

            foreach (ParallelDefinition definition in Definitions)
            {
                ParallelDefinition newPD = definition.ClearConstant(constMapping);
                newDefinitions.Add(newPD);
            }

            List <Process> processes = new List <Process>(16);

            foreach (ParallelDefinition pd in newDefinitions)
            {
                pd.DomainValues.Sort();
            }

            List <List <Expression> > list = new List <List <Expression> >();

            foreach (int v in newDefinitions[0].DomainValues)
            {
                List <Expression> l = new List <Expression>(newDefinitions.Count);
                l.Add(new IntConstant(v));
                list.Add(l);
            }

            for (int i = 1; i < newDefinitions.Count; i++)
            {
                List <List <Expression> > newList = new List <List <Expression> >();
                List <int> domain = newDefinitions[i].DomainValues;

                for (int j = 0; j < list.Count; j++)
                {
                    foreach (int i1 in domain)
                    {
                        List <Expression> cList = new List <Expression>(list[j]);
                        cList.Add(new IntConstant(i1));
                        newList.Add(cList);
                    }
                }
                list = newList;
            }

            foreach (List <Expression> constants in list)
            {
                Dictionary <string, Expression> constMappingNew = new Dictionary <string, Expression>(constMapping);
                //Dictionary<string, Expression> constMappingNew = new Dictionary<string, Expression>();
                for (int i = 0; i < constants.Count; i++)
                {
                    Expression constant = constants[i];

                    if (constMappingNew.ContainsKey(newDefinitions[i].Parameter))
                    {
                        constMappingNew[newDefinitions[i].Parameter] = constant;
                    }
                    else
                    {
                        constMappingNew.Add(newDefinitions[i].Parameter, constant);
                    }
                }

                Process newProcess = Process.ClearConstant(constMappingNew);
                processes.Add(newProcess);
            }

            return(processes);
        }