Chat-Applikation/src/utils/PipeElement.java

67 lines
1.7 KiB
Java

/*
* Copyright (C) 2021 eichehome
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package utils;
/**
* Diese Klasse stellt eine Element aus der FIFO-Pipe dar.
*
* @author eichehome
*/
public class PipeElement<T> {
private PipeElement<T> next;
private T data;
/**
* Der Constructor, welcher ein neues Element erstellt
*
* @param el Der Inhalt, welcher in diesem Element gespeichert ist.
*/
public PipeElement(T el) {
data = el;
next = null;
}
/**
* Diese Funktion gubt einen Zeiger auf das nächste Objekt zurück
*
* @return Einen Zeiger auf das nächste Objekt
*/
public PipeElement<T> getNext() {
return next;
}
/**
* Diese Funktion reiht ein Element nach diesem ein.
*
* @param element Das einzureihende Element
*/
public void setNextElement(PipeElement<T> element) {
next = element;
}
/**
* Eine Funktion, die den Inhalt diese Elements zurück gibt
*
* @return Inhalt diese Elements
*/
public T getData() {
return data;
}
}