Esempio n. 1
0
        private ArrayList CreateSubgraphs()
        {
            ArrayList subgraphList = new ArrayList();

            //for (Iterator i = graph.getNodes().iterator(); i.hasNext(); )
            foreach (DictionaryEntry obj in _graph.Nodes)
            {
                Node node = (Node)obj.Value;
                if (!node.IsVisited)
                {
                    BufferSubgraph subgraph = new BufferSubgraph(_cga);
                    subgraph.Create(node);
                    subgraphList.Add(subgraph);
                }
            }

            /**
             * Sort the subgraphs in descending order of their rightmost coordinate.
             * This ensures that when the Polygons for the subgraphs are built,
             * subgraphs for shells will have been built before the subgraphs for
             * any holes they contain.
             */
            //
            IComparer reverse = new ReverseOrder();

            object[] objarray = subgraphList.ToArray();
            Array.Sort(objarray, reverse);
            return(new ArrayList(objarray));
            //Collections.Sort(subgraphList, Collections.reverseOrder());
            //return subgraphList;
        }
Esempio n. 2
0
            private PriorityBlockingQueue <T> NewPriorityBlockingQueue()
            {
                switch (_order)
                {
                case PriorityQueueTestOrdering.Comparer:
                    _comparer = new ReverseOrder <T>();
                    return(new PriorityBlockingQueue <T>(11, _comparer));

                case PriorityQueueTestOrdering.Comparison:
                    return(new PriorityBlockingQueue <T>(11, (x, y) => ((IComparable)y).CompareTo(x)));

                default:
                    return(new PriorityBlockingQueue <T>());
                }
            }