Пример #1
0
        public bool IsPotentiallyEnabled(State state, ActionSymbol actionSymbol)
        {
            ActionInfo a = this.actionMethodMap[actionSymbol];

            SetState(state);
            return(a.IsPotentiallyEnabled());
        }
Пример #2
0
        /// <summary>
        /// Get MethodInfo associated with a given action symbol
        /// </summary>
        /// <param name="actionSymbol">Given action symbol</param>
        public MethodInfo GetMethodInfo(ActionSymbol actionSymbol)
        {
            ActionInfo actionInfo;

            if (actionMethodMap.TryGetValue(actionSymbol, out actionInfo))
            {
                return(actionInfo.method);
            }
            return(null);
        }
Пример #3
0
        public IEnumerable <Action> GetActions(State state, ActionSymbol actionSymbol)
        {
            //enumerate over the parameter domains, check
            //enabling conditions and yield the actions
            ActionInfo actionMethod = this.actionMethodMap[actionSymbol];

            SetState(state);
            List <Action> res = new List <Action>();

            foreach (object[] args in actionMethod.inputParameterCombinations.GetParameters())
            {
                if (actionMethod.IsEnabled(args))
                {
                    res.Add(new Action(actionSymbol, args));
                }
            }
            return(res);
        }
Пример #4
0
        internal ActionInfo(object model, MethodInfo method, ActionKind kind, ModelProgramProvider mpp)
        {
            this.actionSymbol                   = new ActionSymbol(GetActionName(method), GetActionArity(method, kind), kind);
            this.model                          = model;
            this.method                         = method;
            this.inputParameterTypes            = GetInputParameterTypes(method);
            this.parameterlessEnablingCondition = new EnablingCondition(this, true, true);
            this.enablingCondition              = new EnablingCondition(this, true, false);
            this.parameterInfos                 = method.GetParameters();

            defaultInputParameters = new object[inputParameterTypes.Length];
            for (int i = 0; i < defaultInputParameters.Length; i++)
            {
                defaultInputParameters[i] =
                    (mpp.GetEnumDomain(inputParameterTypes[i]).Values.Length == 0 ? 0 :
                     mpp.GetEnumDomain(inputParameterTypes[i]).Values[0]);
            }

            //Create input parameter generators
            InitializeInputParameterCombinations(mpp, new EnablingCondition(this, false, false));
        }
Пример #5
0
        internal ActionInfo(object model, MethodInfo method, ActionKind kind, ModelProgramProvider mpp)
        {
            this.actionSymbol = new ActionSymbol(GetActionName(method), GetActionArity(method, kind), kind);
            this.model = model;
            this.method = method;
            this.inputParameterTypes = GetInputParameterTypes(method);
            this.parameterlessEnablingCondition = new EnablingCondition(this, true, true);
            this.enablingCondition = new EnablingCondition(this, true, false);
            this.parameterInfos = method.GetParameters();

            defaultInputParameters = new object[inputParameterTypes.Length];
            for (int i = 0; i < defaultInputParameters.Length; i++)
                defaultInputParameters[i] =
                    (mpp.GetEnumDomain(inputParameterTypes[i]).Values.Length == 0 ? 0 :
                     mpp.GetEnumDomain(inputParameterTypes[i]).Values[0]);

            //Create input parameter generators
            InitializeInputParameterCombinations(mpp, new EnablingCondition(this, false, false));
        }
Пример #6
0
 public bool IsPotentiallyEnabled(State state, ActionSymbol actionSymbol)
 {
     ActionInfo a = this.actionMethodMap[actionSymbol];
     SetState(state);
     return a.IsPotentiallyEnabled();
 }
Пример #7
0
 /// <summary>
 /// Get MethodInfo associated with a given action symbol
 /// </summary>
 /// <param name="actionSymbol">Given action symbol</param>
 public MethodInfo GetMethodInfo(ActionSymbol actionSymbol)
 {
     ActionInfo actionInfo;
     if (actionMethodMap.TryGetValue(actionSymbol, out actionInfo))
         return actionInfo.method;
     return null;
 }
Пример #8
0
 public IEnumerable<Action> GetActions(State state, ActionSymbol actionSymbol)
 {
     //enumerate over the parameter domains, check
     //enabling conditions and yield the actions
     ActionInfo actionMethod = this.actionMethodMap[actionSymbol];
     SetState(state);
     List<Action> res = new List<Action>();
     foreach (object[] args in actionMethod.inputParameterCombinations.GetParameters())
     {
         if (actionMethod.IsEnabled(args))
             res.Add(new Action(actionSymbol, args));
     }
     return res;
 }