Chat-Applikation/src/server/PipeTest.java

75 lines
3.2 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 server;
import utils.ArrayHelper;
import java.io.IOException;
import java.io.PipedReader;
import java.io.PipedWriter;
import utils.FifoPipe;
import utils.Message;
import utils.PipeElement;
/**
*
* @author eichehome
*/
public class PipeTest {
public static void main(String[] args) {
FifoPipe pipe = new FifoPipe();
System.out.println("Erstes Element: " + pipe.firstElement);
System.out.println("Letztes Element: " + pipe.lastElement);
Message el = new Message("Christian", "Test");
pipe.setElement(el);
System.out.println("Angehängt");
System.out.println("Erstes Element: " + pipe.firstElement);
System.out.println("Letztes Element: " + pipe.lastElement);
System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().gebeData());
System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().gebeData());
Message el2 = new Message("Christian", "Test");
pipe.setElement(el2);
System.out.println("Angehängt2");
System.out.println("Erstes Element: " + pipe.firstElement);
System.out.println("Letztes Element: " + pipe.lastElement);
System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().gebeData());
System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().gebeData());
Message pipeElement = pipe.getNextElement();
System.out.println("Oben entnommen");
System.out.println("Entnommen Inhalt: " + pipeElement.getData().gebeData());
System.out.println("Erstes Element: " + pipe.firstElement);
System.out.println("Letztes Element: " + pipe.lastElement);
System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().gebeData());
System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().gebeData());
Message pipeElement2 = pipe.getNextElement();
System.out.println("Oben entnommen2");
System.out.println("Entnommen Inhalt: " + pipeElement2.getData().gebeData());
System.out.println("Erstes Element: " + pipe.firstElement);
System.out.println("Letztes Element: " + pipe.lastElement);
//Wieso wills nicht funktionieren?
Message pipeElement3 = pipe.getNextElement();
System.out.println("Oben entnommen3");
//System.out.println(pipeElement3.getData().gebeData());
System.out.println("Erstes Element: " + pipe.firstElement);
System.out.println("Letztes Element: " + pipe.lastElement);
ArrayHelper test = new ArrayHelper();
}
}