Initial commit

This commit is contained in:
Jonas Neugebauer
2020-09-09 22:37:01 +02:00
commit 74bc7fce51
8 changed files with 459 additions and 0 deletions

43
Queue.java Normal file
View File

@@ -0,0 +1,43 @@
public class Queue<ContentType> {
private QueueNode<ContentType> head = null;
private QueueNode<ContentType> tail = null;
public Queue() {
}
public void enqueue( ContentType pContentObject ) {
// TODO: Implementiere enqueue
}
public void dequeue() {
// TODO: Implementiere dequeue
}
/**
* Liefert das Inhaltsobjekt vom ersten Knotens der Schlange
* vom Typ ContentType, falls die Schlange nicht leer ist,
* ansonsten null.
*
* @return Das Inhaltsobjekt oder null.
*/
public ContentType front() {
if( !isEmpty() ) {
return head.getContent();
} else {
return null;
}
}
/**
* Prüft, ob die Schlange leer ist.
*
* @return true, wenn die Schlange keine Knoten enthaelt
*/
public boolean isEmpty() {
return (head == null);
}
}