public BTConditionSingleOperation(ConditionOperationType operation, V targetValue, Func <V> getter) : base()
 {
     mTargetValueCondition = GenericValue.CreateConditionValue <V>("", targetValue, operation);
     mGetter = getter;
     DebugUtils.Assert(mGetter != null, "");
     DebugUtils.Assert(mTargetValueCondition != null, "");
 }
Exemplo n.º 2
0
        public override bool CompareTo(GenericValue param)
        {
            StateGenericValue <T> p = param as StateGenericValue <T>;

            DebugUtils.Assert(p != null, "");
            return(CompareTo(p.Value));
        }
Exemplo n.º 3
0
        public bool CheckCondition(GenericValue condition)
        {
            DebugUtils.Assert(condition != null, "wrong condition");
            GenericValue param = mParameters[condition.Name];

            DebugUtils.Assert(param != null, "wrong parameter");
            return(condition.CompareTo(param));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="parameterName">条件参数名</param>
        /// <param name="comType">比较类别</param>
        /// <param name="value">目标值</param>
        /// <returns></returns>
        public StateConditions With <T>(string parameterName, ConditionOperationType cot, T value)
        {
            // 这里不去重复
            // 比如 条件是一个区间
            GenericValue condition = GenericValue.CreateConditionValue(parameterName, value, cot);

            mConditions.Add(condition);
            return(this);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 该控制参数名不能重复
 /// </summary>
 /// <param name="paraName">参数名</param>
 /// <param name="dataType">参数类型</param>
 /// <param name="ctlValue">参数控制值</param>
 /// <returns></returns>
 public StateController <T> AddParameter <P>(string paraName, P ctlValue)
 {
     if (!mParameters.ContainsKey(paraName))
     {
         GenericValue value = GenericValue.CreateGenericValue(paraName, ctlValue);
         mParameters.Add(paraName, value);
     }
     else
     {
         // duplicated
     }
     return(this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// StateConditionValue.CompareTo(StateGenericValue<T>)
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public virtual bool CompareTo(GenericValue param)
 {
     return(false);
 }