public void AdjustBracket(TKTProcDesc that) { //if (this.Bracket == null || that.Bracket == null) return; //that.Bracket = this.Bracket.Adjust(that.Bracket); for (int i = 0; i < this.Parts.Count; i++) { if ((this.Parts[i] is TKTProcBracket) && (this.Parts[i] is TKTProcBracket)) { TKTProcBracket bracket = this.Parts[i] as TKTProcBracket; var bracket2 = bracket.Adjust(that.Parts[i] as TKTProcBracket); this.Parts[i] = bracket2; } } procArgs.Clear(); for (int i = 0; i < this.Parts.Count; i++) { if (this.Parts[i] is TKTProcArg) { procArgs.Add(this.Parts[i] as TKTProcArg); } else if (this.Parts[i] is TKTProcBracket) { procArgs.AddRange((this.Parts[i] as TKTProcBracket).ListArgs); } } }
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++; } }
public void Add(List <TKTProcArg> args) { if (args.Count() > 1) { TKTProcBracket bracket = new TKTProcBracket(args); Parts.Add(bracket); procArgs.AddRange(args); } else if (args.Count() == 1) { Add(args[0]); } }
public void Add(TKTProcBracket bracket) { var args = bracket.ListArgs; if (args.Count() > 1) { Parts.Add(bracket); procArgs.AddRange(args); } else if (args.Count() == 1) { Add(args[0]); } }
bool eq_dict(TKTProcBracket anthor) { if (this.DictArgs.Count != anthor.DictArgs.Count) { return(false); } foreach (var key in this.DictArgs.Keys) { if (!this.DictArgs[key].Eq(anthor.DictArgs[key])) { return(false); } } return(true); }
bool eq_list(TKTProcBracket anthor) { if (this.ListArgs.Count != anthor.ListArgs.Count) { return(false); } for (int i = 0; i < ListArgs.Count; i++) { if (!this.ListArgs[i].Eq(anthor.ListArgs[i])) { 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 bool Eq(TKTProcBracket anthor) { if (this.HasArgName) { if (anthor.HasArgName) { return(eq_dict(anthor) /* && eq_list(anthor)*/); } else { return(eq_list(anthor)); } } else { return(eq_list(anthor)); } //return eq_dict(anthor); /* * if (BracketType == 0) * { * return (anthor.BracketType == 0); * } * else if (BracketType == 1) * { * return eq_single(anthor); * } * else if (BracketType == 2 || anthor.BracketType==2) * { * return eq_list(anthor); * } * else if (BracketType == 3 || BracketType == 4) * { * return eq_dict(anthor); * }*/ throw new RTException("TKTProcBracket有问题"); }
public TKTConstructorDesc(IEnumerable <TKTProcArg> args) { //Parts = new List<object>(); //Add(args); Bracket = new TKTProcBracket(args); }