Kommentierung von den Klassen der FIFO-Pipe und formatierung
This commit is contained in:
parent
0ffffe257e
commit
39b03fdf61
3 changed files with 46 additions and 17 deletions
|
@ -17,6 +17,7 @@
|
||||||
package server;
|
package server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Dummy für den inhalt der FIFO-Pipe
|
||||||
*
|
*
|
||||||
* @author eichehome
|
* @author eichehome
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,18 +17,20 @@
|
||||||
package server;
|
package server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Diese Klasse stellt eine FIFO-Pipe dar.
|
||||||
*
|
*
|
||||||
* @author eichehome
|
* @author eichehome
|
||||||
*/
|
*/
|
||||||
public class FifoPipe {
|
public class FifoPipe {
|
||||||
|
|
||||||
public PipeElement firstElement;
|
private PipeElement firstElement;
|
||||||
public PipeElement lastElement;
|
private PipeElement lastElement;
|
||||||
|
|
||||||
public FifoPipe() {
|
/**
|
||||||
|
* Diese Funktion dient zum Einreihen von Elementen in die FIFO-Pipe
|
||||||
}
|
*
|
||||||
|
* @param element ein Element, welches eingereiht werden soll
|
||||||
|
*/
|
||||||
public void queuElement(Element element) {
|
public void queuElement(Element element) {
|
||||||
PipeElement pipeElement = new PipeElement(element);
|
PipeElement pipeElement = new PipeElement(element);
|
||||||
try {
|
try {
|
||||||
|
@ -39,7 +41,12 @@ public class FifoPipe {
|
||||||
lastElement = pipeElement;
|
lastElement = pipeElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Diese funktion gibt das erste Element der FIFO-Pipe zurück
|
||||||
|
*
|
||||||
|
* @return Erstes Element der FIFO-Pipe
|
||||||
|
*/
|
||||||
public PipeElement getNextElement() {
|
public PipeElement getNextElement() {
|
||||||
PipeElement result = null;
|
PipeElement result = null;
|
||||||
if (firstElement == null) {
|
if (firstElement == null) {
|
||||||
|
@ -55,9 +62,9 @@ public class FifoPipe {
|
||||||
PipeElement next = firstElement.getNext();
|
PipeElement next = firstElement.getNext();
|
||||||
firstElement = next;
|
firstElement = next;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,29 +17,50 @@
|
||||||
package server;
|
package server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Diese Klasse stellt eine Element aus der FIFO-Pipe dar.
|
||||||
*
|
*
|
||||||
* @author eichehome
|
* @author eichehome
|
||||||
*/
|
*/
|
||||||
public class PipeElement {
|
public class PipeElement {
|
||||||
|
|
||||||
private PipeElement next;
|
private PipeElement next;
|
||||||
private Element data;
|
private Element data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Der Constructor, welcher ein neues Element erstellt
|
||||||
|
*
|
||||||
|
* @param el Der Inhalt, welcher in diesem Element gespeichert ist.
|
||||||
|
*/
|
||||||
public PipeElement(Element el) {
|
public PipeElement(Element el) {
|
||||||
data = el;
|
data = el;
|
||||||
next = null;
|
next = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Diese Funktion gubt einen Zeiger auf das nächste Objekt zurück
|
||||||
|
*
|
||||||
|
* @return Einen Zeiger auf das nächste Objekt
|
||||||
|
*/
|
||||||
public PipeElement getNext() {
|
public PipeElement getNext() {
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Diese Funktion reiht ein Element nach diesem ein.
|
||||||
|
*
|
||||||
|
* @param element Das einzureihende Element
|
||||||
|
*/
|
||||||
public void setNextElement(PipeElement element) {
|
public void setNextElement(PipeElement element) {
|
||||||
next = element;
|
next = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eine Funktion, die den Inhalt diese Elements zurück gibt
|
||||||
|
*
|
||||||
|
* @return Inhalt diese Elements
|
||||||
|
*/
|
||||||
public Element getData() {
|
public Element getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue