コード例 #1
0
        public override object Execute(Reasoner ts, Unifier un, ITerm[] args)
        {
            CheckArguments(args);

            //try to get the intention from the "body"
            Intention i = ts.GetCircumstance().GetSelectedIntention();

            if (i == null)
            {
                //try to get the intention from the event
                Event evt = ts.GetCircumstance().GetSelectedEvent();
                if (evt != null)
                {
                    i = evt.GetIntention();
                }
            }
            if (i != null)
            {
                return(un.Unifies(i.GetAsTerm(), args[0]));
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
            //public Unifier Next()
            //{
            //    if (solution == null) Find();
            //    Unifier b = solution;
            //    Find(); // find next response
            //    return b;
            //}

            bool IsSolution()
            {
                solution = un.Clone();
                if (curInt.HasTrigger(g, solution))
                {
                    if (intAsTerm != null)
                    {
                        return(solution.Unifies(intAsTerm, curInt.GetAsTerm()));
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }