示例#1
0
        private static avgBestSizes getAverageBestSizes(Destination d, List <UInt32> stubs, List <UInt32> nonstubs, List <UInt32> ASNs, StreamWriter output)
        {
            double allavg    = 0;
            double allpoints = 0;
            double savg      = 0;
            double spoints   = 0;
            double nsavg     = 0;
            double nspoints  = 0;

            for (int a = 0; a < ASNs.Count; a++)
            {
                UInt32 i = ASNs[a];
                if (d.Best[i] != null)
                {
                    double currVal = d.Best[i].Count;
                    allavg += currVal;
                    allpoints++;
                    //  output.WriteLine("{0},{1},{2}", currVal, i,d.destination);
                    if (stubs.Contains(i))
                    {
                        savg += currVal;
                        spoints++;
                        output.WriteLine("stub,{0},{1},{2}", currVal, i, d.destination);
                    }
                    else if (nonstubs.Contains(i))
                    {
                        output.WriteLine("nonstub,{0},{1},{2}", currVal, i, d.destination);
                        nsavg += currVal;
                        nspoints++;
                    }
                }
            }
            avgBestSizes toreturn = new avgBestSizes();

            toreturn.all      = allavg / allpoints;
            toreturn.stubs    = savg / spoints;
            toreturn.nonstubs = nsavg / nspoints;
            return(toreturn);
        }
示例#2
0
        private static avgBestSizes getAverageBestSizes(Destination d, List<UInt32> stubs, List<UInt32> nonstubs,List<UInt32> ASNs,StreamWriter output)
        {
            double allavg = 0;
            double allpoints = 0;
            double savg = 0;
            double spoints = 0;
            double nsavg = 0;
            double nspoints = 0;
            for (int a = 0; a < ASNs.Count; a++)
            {
                UInt32 i = ASNs[a];
                if (d.Best[i] != null)
                {
                    double currVal = d.Best[i].Count;
                    allavg += currVal;
                    allpoints++;
                  //  output.WriteLine("{0},{1},{2}", currVal, i,d.destination);
                   if (stubs.Contains(i))
                    {
                        savg += currVal;
                        spoints++;
                        output.WriteLine("stub,{0},{1},{2}", currVal, i, d.destination);
                    }
                    else if (nonstubs.Contains(i))
                    {
                        output.WriteLine("nonstub,{0},{1},{2}", currVal, i, d.destination);
                        nsavg += currVal;
                        nspoints++;
                    }

                }
            }
            avgBestSizes toreturn = new avgBestSizes();
            toreturn.all = allavg / allpoints;
            toreturn.stubs = savg  /spoints;
            toreturn.nonstubs = nsavg/ nspoints;
            return toreturn;
        }