diff --git a/.project b/.project
new file mode 100644
index 0000000..598122f
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+
+
+ oop_crashkurs
+
+
+
+
+
+
+
+
diff --git a/SimpleLinkedList/src/solution/ICommand.java b/SimpleLinkedList/src/solution/ICommand.java
new file mode 100644
index 0000000..99d0804
--- /dev/null
+++ b/SimpleLinkedList/src/solution/ICommand.java
@@ -0,0 +1,5 @@
+package solution;
+
+public interface ICommand {
+ void execute(E e);
+}
diff --git a/SimpleLinkedList/src/solution/ISimpleList.java b/SimpleLinkedList/src/solution/ISimpleList.java
new file mode 100644
index 0000000..5b7b300
--- /dev/null
+++ b/SimpleLinkedList/src/solution/ISimpleList.java
@@ -0,0 +1,47 @@
+package solution;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Iterator;
+
+public interface ISimpleList {
+ int size(); // Anzahl der Elemente in der Liste
+
+ boolean add(E e); // fügt das Element e am Ende der Liste ein, sofern es ungleich null ist:
+ // Liefert true, falls ein Element eingefügt wurde (false sonst)
+
+ boolean add(Collection c); // fügt alle Elemente der Collection c ein (sofern diese nicht null sind).
+
+ boolean contains(Object o); // prüft, ob das Objekt o in der Liste enthalten ist (o == null führt zur
+ // Rückgabe false)
+
+ boolean remove(Object o); // entfernt das Objekt o aus der Liste // true: Ein Element wurde entfernt,
+ // false sonst
+
+ void forAll(ICommand command); // Durchläuft alle Elemente der Liste und wendet command.execute auf jedes
+ // Element an
+
+ default void add(int i, E e) throws IndexOutOfBoundsException {
+ } // fügt das Element an der Position i ein, sofern es
+ // nicht null ist und 0 <= i <= Anzahl an Elementen
+ // gilt. Rückgabe true, false sonst.
+
+ default E get(int i) throws IndexOutOfBoundsException {
+ return null;
+ }
+
+// Liefert das Element, das an Position i steht, null falls i keinen gültigen Index darstellt.
+ default void set(int i, E e) throws IndexOutOfBoundsException {
+ }
+
+// Ersetzt das i-te Element durch e, sofern es vorhanden ist (Index gültig)
+ default boolean remove(int i) {
+ return false;
+ } // Löscht das i-te Element, sofern der Index gültig ist. Rückgabe true, false
+ // sonst.
+
+ default void sort(Comparator comparator) {
+
+ }
+
+}
\ No newline at end of file
diff --git a/SimpleLinkedList/src/solution/Node.java b/SimpleLinkedList/src/solution/Node.java
new file mode 100644
index 0000000..2e0991e
--- /dev/null
+++ b/SimpleLinkedList/src/solution/Node.java
@@ -0,0 +1,31 @@
+package solution;
+
+public class Node {
+ private Node predecessor; // Vorgänger
+ private Node successor; // Nachfolger
+ private E payload; // Nutzlast
+
+ public Node(E payload) {
+ super();
+ this.payload = payload;
+ }
+ public Node getPredecessor() {
+ return predecessor;
+ }
+ public void setPredecessor(Node predecessor) {
+ this.predecessor = predecessor;
+ }
+ public Node getSuccessor() {
+ return successor;
+ }
+ public void setSuccessor(Node successor) {
+ this.successor = successor;
+ }
+ public E getPayload() {
+ return payload;
+ }
+ public void setPayload(E payload) {
+ this.payload = payload;
+ }
+
+}
diff --git a/SimpleLinkedList/src/solution/SimpleLinkedList11111.java b/SimpleLinkedList/src/solution/SimpleLinkedList11111.java
new file mode 100644
index 0000000..5af5764
--- /dev/null
+++ b/SimpleLinkedList/src/solution/SimpleLinkedList11111.java
@@ -0,0 +1,182 @@
+package solution;
+
+public class SimpleLinkedList11111 extends AbstractSimpleList {
+
+ private Node firstNode;
+ private int size;
+
+ private Node get(Object o) {
+
+ if (firstNode == null)
+ return null;
+
+ boolean loop = true;
+ Node tmp = firstNode;
+
+ while (loop) { // hier kann auf die Nutzlast zugegriffen werden (payolad) if(Nachfolger von
+
+ if (o == null & tmp.getSuccessor() == null) {
+ return tmp;
+ }
+
+ if (o != null & tmp.getPayload().equals(o)) {
+ return tmp;
+ }
+
+ loop = tmp.getSuccessor() != null;
+ tmp = tmp.getSuccessor();
+ }
+ return null;
+
+ }
+
+ @Override
+ public int size() {
+ return size;
+
+ }
+
+ @Override
+ public boolean add(E e) {
+ if (e == null)
+ return false;
+ if (firstNode == null) {
+ firstNode = new Node(e);
+ size++;
+ return true;
+ }
+
+ boolean loop = true;
+ Node tmp = firstNode;
+
+ while (loop) {
+
+ loop = tmp.getSuccessor() != null;
+
+ if (!loop) {
+ Node tmp2 = new Node(e);
+ tmp.setSuccessor(tmp2);
+ tmp2.setPredecessor(tmp);
+ size++;
+ return true;
+ }
+
+ tmp = tmp.getSuccessor();
+ }
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+// return this.get(o) != null;
+
+ if (o == null)
+ return false;
+ Node currentNode = firstNode;
+ while (currentNode != null) {
+ if (o.equals(currentNode.getPayload())) {
+ return true;
+ }
+ currentNode = currentNode.getSuccessor();
+ }
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+// if(this.contains(o)) {
+// this.get(o).setPayload(null);
+// return true;
+// };
+// return false;
+//
+ if (o == null)
+ return false;
+ Node currentNode = firstNode;
+
+ while (currentNode != null) {
+ if (o.equals(currentNode.getPayload())) {
+ currentNode.setPayload(null);
+ size--;
+ return true;
+ }
+ currentNode = currentNode.getSuccessor();
+ }
+ return false;
+ }
+
+ @Override
+ public void forAll(ICommand command) {
+ if (command != null) {
+ Node currentNode = firstNode;
+ while (currentNode != null) {
+ command.execute(currentNode.getPayload());
+ currentNode = currentNode.getSuccessor();
+ }
+ }
+ }
+
+ private Node getIndex(int i) {
+ Node currentNode = firstNode;
+ int currIndex = 0;
+ while (currentNode != null) {
+
+ if (currIndex >= i) {
+ if (currentNode.getPayload() != null) {
+ return currentNode;
+ }
+ }
+ currentNode = currentNode.getSuccessor();
+ currIndex++;
+ }
+ return null;
+
+ }
+
+ public E get(int i) throws IndexOutOfBoundsException {
+ return getIndex(i).getPayload();
+ }
+
+ public void set(int i, E e) throws IndexOutOfBoundsException {
+ getIndex(i).setPayload(e);
+ }
+
+ public void add(int i, E e) throws IndexOutOfBoundsException {
+ if (size == 0) {
+ if (i != 0) {
+ throw new IndexOutOfBoundsException("Index " + " out of bounds!");
+ }
+ set(0, e);
+ } else if (i == size) {
+ add(e);
+ } else if (size > 0 && i < size) {
+ Node newNode = new Node(e);
+ Node tempNode = getIndex(i);
+ Node preTempNode = getIndex(i).getPredecessor();
+
+ preTempNode.setSuccessor(newNode);
+ newNode.setPredecessor(preTempNode);
+ newNode.setSuccessor(tempNode);
+ tempNode.setPredecessor(newNode);
+ }
+ }
+
+ private void checkIndex(int i) throws IndexOutOfBoundsException {
+ if (i < 0 | i > size) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+ public boolean remove(int i) throws IndexOutOfBoundsException {
+ this.checkIndex(i);
+
+ if (getIndex(i) != null) {
+ getIndex(i).setPayload(null);
+ size--;
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/SimpleLinkedList/src/solution/SimpleLinkedListTest11111.java b/SimpleLinkedList/src/solution/SimpleLinkedListTest11111.java
new file mode 100644
index 0000000..d60b49b
--- /dev/null
+++ b/SimpleLinkedList/src/solution/SimpleLinkedListTest11111.java
@@ -0,0 +1,11 @@
+package solution;
+
+public class SimpleLinkedListTest11111 extends SimpleListTest90 {
+
+ @Override
+ protected ISimpleList getInstance1() {
+ // TODO Auto-generated method stub
+ return new SimpleLinkedList11111();
+ }
+
+}