Exemplo n.º 1
0
        public override object Execute(Reasoner ts, Unifier un, ITerm[] args)
        {
            CheckArguments(args);
            Circumstance C = ts.GetCircumstance();

            C.ClearRunningIntentions();
            C.ClearPendingIntentions();
            C.ClearPendingActions();

            // drop intentions in E
            IEnumerator <Event> ie = C.GetEventsPlusAtomic();

            while (ie.Current != null)
            {
                Event e = ie.Current;
                if (e.IsInternal())
                {
                    C.RemoveEvent(e);
                }
            }

            //drop intentions in PE
            foreach (string ek in C.GetPendingEvents().Keys)
            {
                Event e = C.GetPendingEvents()[ek];
                if (e.IsInternal())
                {
                    C.RemovePendingEvent(ek);
                }
            }

            AtStdLib atia = ts.GetAgent().GetIA(AtStdLib.atAtom) as AtStdLib;

            atia.CancelAts();
            return(true);
        }