public void Traverse(TraversalTypes type = TraversalTypes.InOrder)
        {
            switch (type)
            {
            case TraversalTypes.InOrder:
                InOrderTraversal(_root);
                break;

            case TraversalTypes.PostOrder:
                PostOrderTraversal(_root);
                break;

            case TraversalTypes.PreOrder:
                PreOrderTraversal(_root);
                break;

            case TraversalTypes.DFS:
                DfsTraversal(_root);
                break;

            default:
                BfsTraversal(_root);
                break;
            }
        }
Beispiel #2
0
        public void Traverse(TraversalTypes type, TraversalHandler methodToRun)
        {
            TraversalHandler methodX = methodToRun;

            if (type == TraversalTypes.PreOrder)
            {
                PreOrder(this.root, methodX);
            }

            else if (type == TraversalTypes.InOrder)
            {
                InOrder(this.root, methodX);
            }

            else if (type == TraversalTypes.PostOrder)
            {
                PostOrder(this.root, methodX);
            }
        }
Beispiel #3
0
        public Cell(Grid g, int x, int y) : base(new Rectangle(GRID_START_Y + y * (CELL_EDGE_SIZE + CELL_MARGIN)
                                                               , GRID_START_X + x * (CELL_EDGE_SIZE + CELL_MARGIN)
                                                               , CELL_EDGE_SIZE
                                                               , CELL_EDGE_SIZE)) // clickable area
        {
            cellRect = _boundingRectangle;                                        // drawn area same as clickable area

            cellBorderRect = new Rectangle(GRID_START_Y + (y * (CELL_EDGE_SIZE + CELL_MARGIN)) - 1
                                           , GRID_START_X + (x * (CELL_EDGE_SIZE + CELL_MARGIN)) - 1
                                           , CELL_EDGE_SIZE + 2
                                           , CELL_EDGE_SIZE + 2); // border area

            X = x;
            Y = y;

            parentGrid = g;

            this.TraversalType = TraversalTypes.REGULAR;
            this.IsHighway     = false;

            cellDetailHover = new CellDetailHover(this);
        }