public void SetArg(int k, TKTProcArg newArg) { procArgs[k] = newArg; int j = 0; int i = 0; for (; i < this.Parts.Count;) { object thisPart = this.Parts[i]; if (thisPart is TKTProcArg) { if (j == k) { Parts[i] = newArg; break; } j++; } else if (thisPart is TKTProcBracket) { TKTProcBracket bracket = thisPart as TKTProcBracket; for (int m = 0; i < bracket.ListArgs.Count; m++) { if (j == k) { Parts[i] = newArg; bracket.SetArg(m, newArg); break; } j++; } } i++; } }
bool EqArgType(TKTProcArg anthorArg) { if (this.ArgType == null || anthorArg.ArgType == null) { return(true); } if (this.ArgType == TKTLambda.ActionType || anthorArg.ArgType == TKTLambda.ActionType) { return(true); } if ((this.ArgType == TKTLambda.CondtionType) || (anthorArg.ArgType == TKTLambda.CondtionType)) { if (eqCondiType(this, anthorArg) || eqCondiType(anthorArg, this)) { return(true); } return(false); } if (ReflectionUtil.IsNumberType(this.ArgType) && ReflectionUtil.IsNumberType(anthorArg.ArgType)) { return(ReflectionUtil.MoreEqNumberType(this.ArgType, anthorArg.ArgType)); } if (ReflectionUtil.IsExtends(anthorArg.ArgType, this.ArgType)) { return(true); } return(false); }
private List <TKTProcArg> GetSpecialArgs(int getType, List <object> objs) { List <TKTProcArg> list = new List <TKTProcArg>(); foreach (var part in objs) { if (part is TKTProcArg) { TKTProcArg arg = part as TKTProcArg; if (getType == 0) { list.Add(arg); } else if (getType == 1 && !arg.IsGenericArg) { list.Add(arg); } else if (getType == 2 && arg.IsGenericArg) { list.Add(arg); } } } return(list); }
public void SetArg(int i, TKTProcArg newArg) { string name = ListArgs[i].ArgName; ListArgs[i] = newArg; DictArgs.Remove(name); DictArgs.Add(newArg.ArgName, newArg); }
static bool eqCondiType(TKTProcArg arg1, TKTProcArg arg2) { if (arg1.ArgType == TKTLambda.CondtionType) { if (arg2.ArgType == TKTLambda.CondtionType || arg2.ArgType == typeof(bool)) { return(true); } else { return(false); } } return(false); }
public bool Eq(TKTProcArg anthorArg) { if (!EqArgType(anthorArg)) { return(false); } if (anthorArg.ArgName != null && this.ArgName != null) { return(anthorArg.ArgName == this.ArgName); } if (this.IsGenericArg != anthorArg.IsGenericArg) { return(false); } return(true); }
public TKTProcBracket Adjust(TKTProcBracket that) { if (!this.CanAjust || !that.CanAjust) { return(this); } List <TKTProcArg> list = new List <TKTProcArg>(); foreach (var arg in this.ListArgs) { string name = arg.ArgName; TKTProcArg thatArg = that.DictArgs[name]; list.Add(thatArg); } return(new TKTProcBracket(list)); }
public void Add(TKTProcArg obj) { Parts.Add(obj); procArgs.Add(obj); }