1: // @author Frank M. Carrano, Timothy M. Henry
2: // @version 5.0
3: public T removeFront()
4: {
5: T front = getFront(); // Might throw EmptyQueueException
6: // Assertion: firstNode != null
7: firstNode = firstNode.getNextNode();
9: if (firstNode == null)
10: lastNode = null;
11: else
12: firstNode.setPreviousNode(null);
14: return front;
15: } // end removeFront
17: public T removeBack()
18: {
19: T back = getBack(); // Might throw EmptyQueueException
20: // Assertion: lastNode != null
21: lastNode = lastNode.getPreviousNode();
23: if (lastNode == null)
24: firstNode = null;
25: else
26: lastNode.setNextNode(null);
27: } // end if
29: return back;
30: } // end removeBack