public bool IsPotentiallyEnabled(State state, ActionSymbol actionSymbol) { ActionInfo a = this.actionMethodMap[actionSymbol]; SetState(state); return(a.IsPotentiallyEnabled()); }
/// <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); }
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); }
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)); }
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)); }
public bool IsPotentiallyEnabled(State state, ActionSymbol actionSymbol) { ActionInfo a = this.actionMethodMap[actionSymbol]; SetState(state); return a.IsPotentiallyEnabled(); }
/// <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; }
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; }