-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueueNode.java
34 lines (29 loc) · 881 Bytes
/
QueueNode.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
public class QueueNode // Facilitator class for the Queue class
{
// Data members
private Object element; // Queue element
private QueueNode next; // Pointer to the next element
// because there are no access labels (public, private or protected),
// access is limited to the package where these methods are declared
// Constructor
QueueNode ( Object elem, QueueNode nextPtr )
{
element = elem;
next = nextPtr;
}
// Class methods --
// LQueue needs to know about next and element
// must be able to set the nextPtr as needed
QueueNode getNext( )
{
return next;
}
Object getElement( )
{
return element;
}
void setNext( QueueNode nextPtr)
{
next = nextPtr;
}
} // Class QueueNode