예제 #1
0
 // makes copy of searched
 public ActionConversion(PluginEnvironment plugenv, IArgumentType resultType, Dictionary <IAction, int> searched, Aborter aborter)
 {
     this.plugenv    = plugenv;
     this.resultType = resultType;
     this.searched   = new Dictionary <IAction, int>(searched);
     this.aborter    = aborter;
 }
 // makes copy of searched
 public ActionConversion(PluginEnvironment plugenv, IArgumentType resultType, Dictionary<IAction, int> searched, Aborter aborter)
 {
     this.plugenv = plugenv;
     this.resultType = resultType;
     this.searched = new Dictionary<IAction, int>(searched);
     this.aborter = aborter;
 }
예제 #3
0
        // faillet: Look for ways to get to these inputs, to get that result type
        public bool RecurseConversionAttempt(IArena arena, double salience, string reason, IContinuation skip, params object[] args)
        { // params: object value, IEnumerable<IAction> actions, IContinuation succ
            if (aborter.IsAborted)
            {
                return(true);   // abort!
            }
            // Can we go down another level?
            Aborter next = new Aborter(aborter);

            if (next.IsAborted)
            {
                return(true);
            }

            object value = args[0];
            IEnumerable <IAction> actions = (IEnumerable <IAction>)args[1];
            IContinuation         succ    = (IContinuation)args[2];

            foreach (IAction action in actions)
            {
                arena.Call(new ActionConversion(plugenv, action.Input, searched, next), salience * .9, value,
                           new CallableAsContinuation(action, succ), new NopCallable());
            }

            return(true);
        }
예제 #4
0
        public static Aborter NewAborter(int maxlevel)
        {
            Aborter common = new Aborter(maxlevel);
            Aborter child = new Aborter(common);
            child.level = 1;

            return child;
        }
예제 #5
0
        public static Aborter NewAborter(int maxlevel)
        {
            Aborter common = new Aborter(maxlevel);
            Aborter child  = new Aborter(common);

            child.level = 1;

            return(child);
        }
        // faillet: Look for ways to get to these inputs, to get that result type
        public int RecurseConversionAttempt(IArena arena, double salience, string reason, IContinuation skip, params object[] args)
        {
            // params: object value, IEnumerable<IAction> actions, IContinuation succ
            if (aborter.IsAborted)
                return 1;   // abort!

            // Can we go down another level?
            Aborter next = new Aborter(aborter);
            if (next.IsAborted)
                return 1;

            object value = args[0];
            IEnumerable<IAction> actions = (IEnumerable<IAction>)args[1];
            IContinuation succ = (IContinuation)args[2];

            int used = 1;
            foreach (IAction action in actions)
                used += arena.Call(new ActionConversion(plugenv, action.Input, searched, next), salience * .9, value,
                    new CallableAsContinuation(action, succ), new NopCallable());

            return used;
        }
예제 #7
0
 protected Aborter(int maxlevel)
 {
     this.level = maxlevel;
     this.common = this;
 }
예제 #8
0
 public Aborter(Aborter parent)
 {
     this.level = parent.level + 1;
     this.common = parent.common;
 }
예제 #9
0
 public Aborter(Aborter parent)
 {
     this.level  = parent.level + 1;
     this.common = parent.common;
 }
예제 #10
0
 protected Aborter(int maxlevel)
 {
     this.level  = maxlevel;
     this.common = this;
 }