Пример #1
0
        public static string LogString_Set(
            Maps_OneAndOne <Finger, SySet <SyElement> > komabetuMasus
            )
        {
            StringBuilder sb = new StringBuilder();

            // 全要素
            komabetuMasus.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) =>
            {
                sb.AppendLine("駒=[" + key + "]");
                sb.AppendLine(Util_Masus <Basho> .LogString_Concrete(value));
            });

            return(sb.ToString());
        }
Пример #2
0
        public static string LogString_Concrete(
            Maps_OneAndOne <Finger, SySet <SyElement> > komabetuMasus
            )
        {
            StringBuilder sb = new StringBuilder();

            komabetuMasus.Foreach_Entry((Finger key, SySet <SyElement> value, ref bool toBreak) =>
            {
                sb.Append("[駒");
                sb.Append(key);
                sb.Append("]");

                foreach (Basho masu in value.Elements)
                {
                    sb.Append(Util_Masus <Basho> .LogString_Concrete(value));
                    //sb.Append(Masu81Array.Items[hMasu].ToString());
                }
            });


            return(sb.ToString());
        }
Пример #3
0
        /// <summary>
        /// 筋も残し、全件網羅
        /// </summary>
        /// <returns></returns>
        public static string LogString_Concrete(
            SySet <SyElement> masus
            )
        {
            StringBuilder sb = new StringBuilder();

            if (masus is SySet_Default <SyElement> )
            {
                // まず自分の要素
                foreach (SyElement hMasu1 in ((SySet_Default <SyElement>)masus).Elements_)
                {
                    int suji;
                    int dan;
                    Util_MasuNum.MasuToSuji(hMasu1, out suji);
                    Util_MasuNum.MasuToDan(hMasu1, out dan);

                    sb.Append("["
                              + suji.ToString()
                              + dan.ToString()
                              + "]");
                }

                // 次に親集合
                foreach (SySet <SyElement> superset in ((SySet_Default <SyElement>)masus).Supersets)
                {
                    sb.Append(Util_Masus <SyElement> .LogString_Concrete(superset));
                }
            }
            else if (masus is SySet_Ordered <SyElement> )
            {
                // まず自分の要素
                foreach (SyElement hMasu1 in ((SySet_Ordered <SyElement>)masus).Elements_)
                {
                    int suji;
                    int dan;
                    Util_MasuNum.MasuToSuji(hMasu1, out suji);
                    Util_MasuNum.MasuToDan(hMasu1, out dan);

                    sb.Append("["
                              + suji.ToString()
                              + dan.ToString()
                              + "]");
                }

                // 次に親集合
                foreach (SySet <SyElement> superset in ((SySet_Ordered <SyElement>)masus).Supersets)
                {
                    sb.Append(Util_Masus <SyElement> .LogString_Concrete(superset));
                }
            }
            else if (masus is SySet_DirectedSegment <SyElement> )
            {
                sb.Append("[");

                foreach (T1 hMasu1 in ((SySet_DirectedSegment <SyElement>)masus).Elements)
                {
                    int suji;
                    int dan;
                    Util_MasuNum.MasuToSuji(hMasu1, out suji);
                    Util_MasuNum.MasuToDan(hMasu1, out dan);

                    sb.Append(
                        suji.ToString()
                        + dan.ToString()
                        + "→");
                }

                // 最後の矢印は削除します。
                if ("[".Length < sb.Length)
                {
                    sb.Remove(sb.Length - 1, 1);
                }

                sb.Append("]");
            }
            else
            {
            }

            return(sb.ToString());
        }
Пример #4
0
        /// <summary>
        /// 重複をなくした表現
        /// </summary>
        /// <returns></returns>
        public static string LogString_Set(
            SySet <SyElement> masus
            )
        {
            StringBuilder sb = new StringBuilder();

            if (masus is SySet_Default <SyElement> )
            {
                HashSet <T1> set = new HashSet <T1>();

                // まず自分の要素
                foreach (T1 hMasu1 in ((SySet_Default <SyElement>)masus).Elements_)
                {
                    set.Add(hMasu1);
                }

                // 次に親集合
                foreach (SySet <T1> superset in ((SySet_Default <SyElement>)masus).Supersets)
                {
                    foreach (T1 hMasu2 in superset.Elements)
                    {
                        set.Add(hMasu2);
                    }
                }

                T1[] array = set.ToArray();
                Array.Sort(array);

                int fieldCount = 0;
                foreach (T1 masuHandle in array)
                {
                    sb.Append("[");
                    sb.Append(masuHandle);
                    sb.Append("]");

                    fieldCount++;

                    if (fieldCount % 20 == 19)
                    {
                        sb.AppendLine();
                    }
                }
            }
            else if (masus is SySet_Ordered <SyElement> )
            {
                // まず自分の要素
                foreach (T1 hMasu1 in ((SySet_Ordered <SyElement>)masus).Elements_)
                {
                    int suji;
                    int dan;
                    Util_MasuNum.MasuToSuji(hMasu1, out suji);
                    Util_MasuNum.MasuToDan(hMasu1, out dan);

                    sb.Append("["
                              + suji.ToString()
                              + dan.ToString()
                              + "]");
                }

                // 次に親集合
                foreach (SySet <SyElement> superset in ((SySet_Ordered <SyElement>)masus).Supersets)
                {
                    sb.Append(Util_Masus <Basho> .LogString_Concrete(superset));
                }
            }
            else if (masus is SySet_DirectedSegment <SyElement> )
            {
                sb.Append("[");

                foreach (T1 hMasu1 in ((SySet_DirectedSegment <SyElement>)masus).Elements)
                {
                    int suji;
                    int dan;
                    Util_MasuNum.MasuToSuji(hMasu1, out suji);
                    Util_MasuNum.MasuToDan(hMasu1, out dan);

                    sb.Append(
                        suji.ToString()
                        + dan.ToString()
                        + "→");
                }

                // 最後の矢印は削除します。
                if ("[".Length < sb.Length)
                {
                    sb.Remove(sb.Length - 1, 1);
                }

                sb.Append("]");
            }
            else
            {
            }

            return(sb.ToString());
        }