예제 #1
0
        // closest out of 'nodes' set
        int closest(int node, CmpCache_Owners nodes)
        {
            int   best      = -1;
            int   best_dist = m_N;
            Coord here      = new Coord(node);

            for (int i = 0; i < m_N; i++)
            {
                if (nodes.is_set(i))
                {
                    int dist = (int)Simulator.distance(new Coord(i), here);
                    if (dist < best_dist)
                    {
                        best      = i;
                        best_dist = dist;
                    }
                }
            }

            return(best);
        }
예제 #2
0
        // closest out of 'nodes' set
        int closest(int node, CmpCache_Owners nodes)
        {
            int best = -1;
            int best_dist = m_N;
            Coord here = new Coord(node);

            for (int i = 0; i < m_N; i++)
                if (nodes.is_set(i))
                {
                    int dist = (int)Simulator.distance(new Coord(i), here);
                    if (dist < best_dist)
                    {
                        best = i;
                        best_dist = dist;
                    }
                }

            return best;
        }