//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="parent_Expression"></param> /// <param name="cur_Conf">生成時に指定できないものもある。</param> public Expression_Node_StringImpl(Expression_Node_String parent_Expression, Configuration_Node cur_Conf) { this.parent_Expression = parent_Expression; this.cur_Configuration = cur_Conf; enumHitcount = EnumHitcount.Unconstraint; this.ecList_Child = new List_Expression_Node_StringImpl(this); this.dictionary_Expression_Attribute = new Dictionary_Expression_Node_StringImpl(this.Cur_Configuration); }
/// <summary> /// コンストラクター。 /// </summary> public Expression_Leaf_StringImpl(string sHumanInput, Expression_Node_String parent_Expression, Configuration_Node cur_Conf) { this.sHumanInput = sHumanInput; this.parent_Expression = parent_Expression; this.cur_Configuration = cur_Conf; this.enumHitcount = EnumHitcount.Unconstraint; this.dictionary_Expression_Attribute = new Dictionary_Expression_Node_StringImpl(this.Cur_Configuration); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public Expression_TexttemplateP1pImpl(Expression_Node_String parent_Expr, Configurationtree_Node cur_Conf) { this.parent_Expression = parent_Expr; this.cur_Configurationtree = cur_Conf; this.requestItems = EnumHitcount.Unconstraint; this.dictionary_P1p = new Dictionary<int, string>(); this.list_Expression_Child = new List_Expression_Node_StringImpl(this);//使いません。 this.dictionary_Expression_Attribute = new Dictionary_Expression_Node_StringImpl(this.Cur_Configuration); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="parent_Expression">生成時はヌルを入れておいて、#NewInstanceで後から設定することもできます。</param> /// <param name="cur_Conf">生成時はヌルを入れておいて、#NewInstanceで後から設定することもできます。</param> public Expression_Node_FunctionImpl( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, List<string> list_NameArgumentInitializer ) : base(parent_Expression, cur_Conf) { this.dictionary_Expression_Parameter = new Dictionary_Expression_Node_StringImpl(cur_Conf); this.functionparameterset = new FunctionparametersetImpl(); this.list_NameArgumentInitializer = list_NameArgumentInitializer;// new List<string>(); }
/// <summary> /// 登録されている「%1%」、「%2%」といった記号の数字を一覧します。 /// リストに「1」、「2」といった数字に置き換えて返します。 /// </summary> /// <returns></returns> public List<int> ExistsP1pNumbers( Dictionary_Expression_Node_String ecDic_Attr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "GetP1pNumbers",log_Reports); // // // // List<int> list = new List<int>(); Dictionary<string,Expression_Node_String>.KeyCollection ecDic_Key = ecDic_Attr.Keys(log_Reports); foreach (string sKey in ecDic_Key) { // // // // p1p,p2p,p3p...といった名前かどうかを判定。 // // // int nParamNameMatchedCount = 0; int nP1pNumber = 0; { //正規表現 System.Text.RegularExpressions.Regex regexp = new System.Text.RegularExpressions.Regex( @"p([0-9])+p", // @"p[0-9]+p", System.Text.RegularExpressions.RegexOptions.IgnoreCase ); //文字列検索を1回する。 System.Text.RegularExpressions.Match match = regexp.Match(sKey); while (match.Success) { nParamNameMatchedCount++; bool parsedSuccessful = int.TryParse( match.Groups[1].Value, out nP1pNumber); match = match.NextMatch(); } } if (1 == nParamNameMatchedCount) { // // // // p1p,p2p,p3p...といった名前。 // // // list.Add(nP1pNumber); } else { } } // // log_Method.EndMethod(log_Reports); return list; }
/// <summary> /// 登録されている「%1%」、「%2%」といった記号の数字を一覧します。 /// リストに「1」、「2」といった数字に置き換えて返します。 /// </summary> /// <returns></returns> public List <int> ExistsP1pNumbers( Dictionary_Expression_Node_String ecDic_Attr, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "GetP1pNumbers", log_Reports); // // // // List <int> list = new List <int>(); Dictionary <string, Expression_Node_String> .KeyCollection ecDic_Key = ecDic_Attr.Keys(log_Reports); foreach (string sKey in ecDic_Key) { // // // // p1p,p2p,p3p...といった名前かどうかを判定。 // // // int nParamNameMatchedCount = 0; int nP1pNumber = 0; { //正規表現 System.Text.RegularExpressions.Regex regexp = new System.Text.RegularExpressions.Regex( @"p([0-9])+p", // @"p[0-9]+p", System.Text.RegularExpressions.RegexOptions.IgnoreCase ); //文字列検索を1回する。 System.Text.RegularExpressions.Match match = regexp.Match(sKey); while (match.Success) { nParamNameMatchedCount++; bool parsedSuccessful = int.TryParse(match.Groups[1].Value, out nP1pNumber); match = match.NextMatch(); } } if (1 == nParamNameMatchedCount) { // // // // p1p,p2p,p3p...といった名前。 // // // list.Add(nP1pNumber); } else { } } // // log_Method.EndMethod(log_Reports); return(list); }