示例#1
0
        ////TODO 响应函数,获得数据后在函数内调用程序计算再返回进行输出
        //public ResponseDataPost postPairAndResponse(RequestDataPost rData)
        //{
        //    var data = rData.pair;
        //    ResponseDataPost pathList =new ResponseDataPost();
        //    //json返回测试
        //    List<int> a = new List<int>(){ 1, 2 };
        //    List<int> b = new List<int>() { 1, 3, 2 };
        //    pathList.pathList = new List<List<int>>() { a, b };
        //    return pathList;
        //    //json返回测试
        //}

        //TODO,响应函数,GET方式,等主程序修好后在这里调用并进行最后的答案处理。
        public List <List <UInt64> > getPairAndResponseIdId(UInt64 id1 = 0, UInt64 id2 = 0, UInt64 auid1 = 0, UInt64 auid2 = 0)
        {
            List <KeyValuePair <string, UInt64> > pair = new List <KeyValuePair <string, ulong> >();

            //判断输入参数是id还是AuId
            if (is_id_auid(id1))
            {
                pair.Add(new KeyValuePair <string, ulong>("AA.AuId", id1));
            }
            else
            {
                pair.Add(new KeyValuePair <string, ulong>("Id", id1));
            }
            if (is_id_auid(id2))
            {
                pair.Add(new KeyValuePair <string, ulong>("AA.AuId", id2));
            }
            else
            {
                pair.Add(new KeyValuePair <string, ulong>("Id", id2));
            }
            //
            //TODO:z在这里调用主程序,返回List<List<UInt64>>
            //
            //json 返回测试
            algorithm2byWang.algorithm2byWang test     = new algorithm2byWang.algorithm2byWang();
            List <List <UInt64> >             pathList = test.solve(pair[0], pair[1]);

            return(pathList);
            //json返回测试
        }
示例#2
0
        static void Main(string[] args)
        {
            StreamWriter     sw   = new StreamWriter(@"ConsoleOutput.txt");
            algorithm2byWang test = new algorithm2byWang();
            KeyValuePair <string, UInt64> node1;
            KeyValuePair <string, UInt64> node2;

            node1 = new KeyValuePair <string, UInt64>("Id", 2131653836);
            node2 = new KeyValuePair <string, UInt64>("Id", 2016266703);
            List <List <UInt64> > pathList = test.solve(node1, node2);

            Console.WriteLine("number of path:{0}", pathList.Count);
            Console.SetOut(sw);
            lock (pathList)
                foreach (var i in pathList)
                {
                    Console.WriteLine(string.Join(" - ", i));
                }
            sw.Flush();
            sw.Close();
        }