Package jltk.struc
Class Queue<ContentType>
- java.lang.Object
-
- jltk.struc.Queue<ContentType>
-
public class Queue<ContentType> extends Object
The generic class Queue is a linear data structure that stores elements in a FIFO (First In, First Out) order. Elements a added at the end of the queue and removed from the front.- Version:
- 23.08.2022
- Author:
- ms
-
-
Field Summary
Fields Modifier and Type Field Description (package private) jltk.struc.Queue.Node<ContentType>headStringseparator(package private) jltk.struc.Queue.Node<ContentType>tail
-
Constructor Summary
Constructors Constructor Description Queue()Objects managed by this queue must be of type ContentType
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddequeue()Remove the first node from queue.voidenqueue(ContentType pContent)The specified content of type ContentType is append to this queue.ContentTypefront()Return the content of the first node.booleanisEmpty()Return true, if the queue is empty, else true,StringtoString()Return the string representation of this queue.
-
-
-
Field Detail
-
head
jltk.struc.Queue.Node<ContentType> head
-
tail
jltk.struc.Queue.Node<ContentType> tail
-
separator
public String separator
-
-
Method Detail
-
enqueue
public void enqueue(ContentType pContent)
The specified content of type ContentType is append to this queue. If pContent is null, othing happen.- Parameters:
pContent- The new content.
-
dequeue
public void dequeue()
Remove the first node from queue.
-
front
public ContentType front()
Return the content of the first node. If the queue is empty will return null.- Returns:
- The content of the first node.
-
isEmpty
public boolean isEmpty()
Return true, if the queue is empty, else true,- Returns:
- true, if this queue is empty, else false.
-
toString
public String toString()
Return the string representation of this queue. To represent an element, the toString() method pf the content is used. Each element is seperated by a semicolon. You can change the seperator by changing the attribut separator.
-
-