Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine(TimePoint.FromTicks(16087186800000000).ToString());

            return;


#if true
            var h = new HashSet <TimePoint>();
            var d = new Dictionary <TimePoint, int>();
            h.Add(new TimePoint(2));
            h.Add(new TimePoint(2));

            d.Add(new TimePoint(302342342341), 2);
            d.Add(new TimePoint(302342342340), 3);

            foreach (var i in d)
            {
                Console.WriteLine(i.Key.ToString() + i.Value);
            }
#elif true // Json
            var jsonObjectCollection = (JsonDataObject)JsonParser.Parse("{\"a\" : FalSe}");

            Console.WriteLine(jsonObjectCollection["a"].GetBool());

            //foreach (var i in jsonObjectCollection)
            //{
            //    var a = (JsonDataArray)i;
            //    foreach (var jj in a)
            //    {
            //        var n = (JsonDataNumber)jj;
            //        var Number = n.GetUInt32();
            //        Console.WriteLine(Number);
            //    }
            //}
            return;

            string JsonStr = @"

[3],
[4]

";

            var j = JsonParser.Parse(JsonStr);
            Console.WriteLine(j.ToString());

//            string JsonStr = @"{
//    """" : """",
//  ""boolName"" : true,
//  ""boolName2"" : True,
//  ""boolName3"" : false,
//  ""boolName4"" : False,
//    ""name"" : ""string: ,@'  t value"",
//    ""name2"":12.34 ,
//    ""name3"" :5667,
//    ""objname"" :{},
//    ""array"": [123,2234,""ok"",false,true,{},[]]
//}";

//            var j = JsonParser.Parse(JsonStr);

            // 중첩 컨테이너 가능할 때까지 아래 테스트 불가.
            //var pa = new SPoint[2];
            //for (int i = 0; i < pa.Length; ++i)
            //    pa[i] = new SPoint(1, 2);
            //j.Push("PointArray", pa);

            //var sa = new string[2];
            //for (int i = 0; i < sa.Length; ++i)
            //    sa[i] = i.ToString();
            //j.Push("StringArray", sa);

            //var sl = new List<string>();
            //for (int i = 0; i < 2; ++i)
            //    sl.Add(i.ToString());
            //j.Push("StringList", sl);

            //var hs = new HashSet<string>();
            //for (int i = 0; i < 2; ++i)
            //    hs.Add(i.ToString());
            //j.Push("StringHashSet", hs);

            //var mss = new MultiSet<string>();
            //for (int i = 0; i < 2; ++i)
            //    mss.Add(i.ToString());
            //j.Push("StringMultiSet", mss);

            //var pd = new Dictionary<string, SPoint>();
            //for (int i = 0; i < 2; ++i)
            //    pd.Add(i.ToString(), new SPoint(1, 1));
            //j.Push("PointDictionary", pd);

            //var pmm = new CMultiMap<string, SPoint>();
            //for (int i = 0; i < 2; ++i)
            //    pmm.Add(i.ToString(), new SPoint(i, i));
            //j.Push("PointMultiMap", pmm);

            //var l = new List<int>();
            //l.Add(1000);
            //l.Add(2000);
            //j.Push("ListList", l);

            //var dd = new Dictionary<int, int>();
            //dd.Add(1000, 1000);
            //dd.Add(2000, 2000);
            //var dhs = new HashSet<Dictionary<int, int>>();
            //for (int i = 0; i < 2; ++i)
            //    dhs.Add(dd);
            //j.Push("DictionaryHashSet", dhs);

//            Console.WriteLine(j.ToString());
#elif false // MultiMap
            int v;

            Console.WriteLine("MultiSet");
            var ms = new MultiSet <int>();
            ms.Add(3);
            ms.Add(3);
            ms.Add(3);
            ms.Add(2);
            ms.Add(4);
            Console.WriteLine("Count : " + ms.Count);
            ms.RemoveLast();
            ms.RemoveLast();
            ms.RemoveLast();
            ms.RemoveLast();

            Console.WriteLine("All Datas");
            foreach (var i in ms)
            {
                Console.WriteLine(i);
            }

            Console.WriteLine("MultiMap");
            var mm = new MultiMap <int, int>();
            mm.Add(3, 4);
            mm.Add(3, 5);
            mm.Add(3, 6);
            mm.Add(2, 2);

            Console.WriteLine("All Datas : " + mm.Count);
            foreach (var i in mm)
            {
                Console.WriteLine(i);
            }

            Console.WriteLine("ToArray");
            var a = mm.ToArray(3);
            foreach (var i in a)
            {
                Console.WriteLine(i);
            }

            var it = mm.First();
            Console.WriteLine("First");
            Console.WriteLine(it);
            mm.RemoveFirst();
            Console.WriteLine("First Removed Count : " + mm.Count);
            foreach (var i in mm)
            {
                Console.WriteLine(i);
            }
#elif true // Resize
            var l = new List <int>();
            l.Resize(4);
#endif
        }