Ejemplo n.º 1
0
    /*
     * dequeue method will remove the top Node from the Queue and return the AIPolygon being
     *      held inside the node being removed
     * Parameters:	None
     * Return:	(AIPolygon)
     *							null if the queue is empty
     *							the AIPolygon being held if the queue is not empty
     */
    public AIPolygon dequeue()
    {
        AIPolygonNode temp = front;

        front = temp.getNextNode();
        size--;
        return(temp.getPolygon());
    }
Ejemplo n.º 2
0
    /*
     *	getPolygonAtIndex will find a AIPolygonNode at a certian point inside the Queue
     *		and return the AIPolygon being held inside the node. It will not remove the
     *		Node from the Queue
     *	Parameters:	(int)index is the index in the Queue that the caller wants sent back
     *	Return:			(AIPolygon)
     *									the AIPolygon at the index in the Queue
     */
    public AIPolygon getPolygonAtIndex(int index)
    {
        if (index == 0)
        {
            return(front.getPolygon());
        }
        AIPolygonNode temp = front;

        for (int count = 0; count < index; count++)
        {
            temp = temp.getNextNode();
        }
        return(temp.getPolygon());
    }