Exemplo n.º 1
0
        internal Set<CompoundTerm> processGoal(ModelProgram mp, Set<CompoundTerm> goals)
        {
            Set<CompoundTerm> processedGoals = Set<CompoundTerm>.EmptySet;
            if (typeof(LibraryModelProgram) == mp.GetType())
            {
                //we ignore it for the moment
                Console.Error.WriteLine("Goals involving LibraryModelPrograms currently not supported. ");
                Console.Error.WriteLine("Currently searching for a match for '" + goals.ToString() + "'. ");
            }
            else if (typeof(FsmModelProgram) == mp.GetType()) {
                FsmModelProgram fsm = (FsmModelProgram)mp;
                foreach (CompoundTerm ct in goals)
                {
                    Console.WriteLine("Checking FSM: " + ct.ToString() + "; " + fsm.Name);
                    if (ct.FunctionSymbol.ToString() == fsm.Name) {
                        processedGoals = processedGoals.Add(CompoundTerm.Parse("FsmState(Set(" + ct.Arguments[0].ToString() + "))"));
                        goals = goals.Remove(ct);
                    }
                    Console.WriteLine("Current processedGoals: " + processedGoals.ToString());
                }

            }
            else if (typeof(ProductModelProgram) == mp.GetType())
            {
                ProductModelProgram pmp = (ProductModelProgram)mp;
                processedGoals = processedGoals.Union(processGoal(pmp.M1,goals));
                processedGoals = processedGoals.Union(processGoal(pmp.M2,goals));

            }
            return processedGoals;
        }