diff --git a/nbproject/project.properties b/nbproject/project.properties
index d61b665..557becf 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -1,9 +1,10 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
-annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=ChatApplication
+application.vendor=eichehome
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
@@ -32,6 +33,7 @@ dist.jar=${dist.dir}/ChatApplication.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/ChatApplication
+endorsed.classpath=
excludes=
includes=**
jar.compress=false
@@ -76,6 +78,7 @@ manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
+project.license=gpl30
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
diff --git a/src/client/MainClient.java b/src/client/MainClient.java
index 049dc7d..3a7f6e2 100644
--- a/src/client/MainClient.java
+++ b/src/client/MainClient.java
@@ -1,7 +1,18 @@
/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * 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 .
*/
package client;
diff --git a/src/client/MainClient1.java b/src/client/MainClient1.java
index f7df1e1..3760182 100644
--- a/src/client/MainClient1.java
+++ b/src/client/MainClient1.java
@@ -1,7 +1,18 @@
/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * 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 .
*/
package client;
diff --git a/src/server/Element.java b/src/server/Element.java
new file mode 100644
index 0000000..63baae3
--- /dev/null
+++ b/src/server/Element.java
@@ -0,0 +1,32 @@
+/*
+ * 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 .
+ */
+package server;
+
+/**
+ *
+ * @author eichehome
+ */
+public class Element {
+ private String bezeichner;
+
+ public Element(String inhalt) {
+ bezeichner = inhalt;
+ }
+ public String gebeData() {
+ return bezeichner;
+ }
+}
diff --git a/src/server/FifoPipe.java b/src/server/FifoPipe.java
index abce64e..896fd36 100644
--- a/src/server/FifoPipe.java
+++ b/src/server/FifoPipe.java
@@ -1,7 +1,18 @@
/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * 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 .
*/
package server;
@@ -11,15 +22,42 @@ package server;
*/
public class FifoPipe {
- private PipeElement firstElement;
- private PipeElement lastElement;
+ public PipeElement firstElement;
+ public PipeElement lastElement;
public FifoPipe() {
}
- public queuElement(Object element) {
-
+ public void queuElement(Element element) {
+ PipeElement pipeElement = new PipeElement(element);
+ try {
+ lastElement.setNextElement(pipeElement);
+ lastElement = pipeElement;
+ } catch (NullPointerException ex) {
+ firstElement = pipeElement;
+ lastElement = pipeElement;
+ }
+ }
+
+ public PipeElement getNextElement() {
+ PipeElement result = null;
+ if (firstElement == null) {
+ return result;
+ } else {
+ if (firstElement == lastElement) {
+ result = firstElement;
+ firstElement = null;
+ lastElement = null;
+ return result;
+ } else {
+ result = firstElement;
+ PipeElement next = firstElement.getNext();
+ firstElement = next;
+ return result;
+
+ }
+ }
}
}
diff --git a/src/server/PipeElement.java b/src/server/PipeElement.java
index 3d7010e..e318f68 100644
--- a/src/server/PipeElement.java
+++ b/src/server/PipeElement.java
@@ -1,7 +1,18 @@
/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * 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 .
*/
package server;
@@ -11,9 +22,24 @@ package server;
*/
public class PipeElement {
- private PipeElement naechster;
- private Object data;
+ private PipeElement next;
+ private Element data;
- public void setNextElement(Obj)
+ public PipeElement(Element el) {
+ data = el;
+ next = null;
+ }
+
+ public PipeElement getNext() {
+ return next;
+ }
+
+ public void setNextElement(PipeElement element) {
+ next = element;
+ }
+
+ public Element getData() {
+ return data;
+ }
}
diff --git a/src/server/PipeTest.java b/src/server/PipeTest.java
new file mode 100644
index 0000000..0d95087
--- /dev/null
+++ b/src/server/PipeTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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 .
+ */
+package server;
+
+/**
+ *
+ * @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);
+ Element el = new Element("Test");
+ pipe.queuElement(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());
+ Element el2 = new Element("Test2");
+ pipe.queuElement(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());
+ PipeElement 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());
+ PipeElement 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?
+ PipeElement 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);
+ }
+}