diff --git a/Programmierung2/src/BankSystemGUI/Controller.java b/Programmierung2/src/BankSystemGUI/Controller.java index 7b925f5..ac7c5af 100644 --- a/Programmierung2/src/BankSystemGUI/Controller.java +++ b/Programmierung2/src/BankSystemGUI/Controller.java @@ -3,7 +3,7 @@ package BankSystemGUI; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class Controller { +public class Controller { private User user; private Konto konto; private Bank bank; @@ -20,6 +20,7 @@ public class Controller { action_login(); action_Einzahlen(); Einzahlen(); + } public void login() { @@ -75,7 +76,4 @@ public class Controller { } }); } - - - } diff --git a/Programmierung2/src/DesignPatterns/.~lock.All Design Patterns.odt# b/Programmierung2/src/DesignPatterns/.~lock.All Design Patterns.odt# deleted file mode 100644 index 9a3cd25..0000000 --- a/Programmierung2/src/DesignPatterns/.~lock.All Design Patterns.odt# +++ /dev/null @@ -1 +0,0 @@ -,OBAI/obaya,obai,21.09.2024 22:26,file:///C:/Users/obaya/AppData/Roaming/LibreOffice/4; \ No newline at end of file diff --git a/Programmierung2/src/DesignPatterns/All Design Patterns.odt b/Programmierung2/src/DesignPatterns/All Design Patterns.odt index 6d12157..ccc36b0 100644 Binary files a/Programmierung2/src/DesignPatterns/All Design Patterns.odt and b/Programmierung2/src/DesignPatterns/All Design Patterns.odt differ diff --git a/Programmierung2/src/DesignPatterns/Erzeugungsmuster_CreationalPatterns/Prototype/Cloneable Interface.pdf b/Programmierung2/src/DesignPatterns/Erzeugungsmuster_CreationalPatterns/Prototype/Cloneable Interface.pdf new file mode 100644 index 0000000..75a9692 Binary files /dev/null and b/Programmierung2/src/DesignPatterns/Erzeugungsmuster_CreationalPatterns/Prototype/Cloneable Interface.pdf differ diff --git a/Programmierung2/src/DesignPatterns/Erzeugungsmuster_CreationalPatterns/Prototype/Prototype-Entwurfsmuster.odt b/Programmierung2/src/DesignPatterns/Erzeugungsmuster_CreationalPatterns/Prototype/Prototype-Entwurfsmuster.odt new file mode 100644 index 0000000..36aff0d Binary files /dev/null and b/Programmierung2/src/DesignPatterns/Erzeugungsmuster_CreationalPatterns/Prototype/Prototype-Entwurfsmuster.odt differ diff --git a/Programmierung2/src/Graphen/Graphen.odt b/Programmierung2/src/Graphen/Graphen.odt deleted file mode 100644 index 7413b59..0000000 Binary files a/Programmierung2/src/Graphen/Graphen.odt and /dev/null differ diff --git a/Programmierung2/src/MyCollections/List/JTest.java b/Programmierung2/src/MyCollections/List/JTest.java new file mode 100644 index 0000000..841ebfb --- /dev/null +++ b/Programmierung2/src/MyCollections/List/JTest.java @@ -0,0 +1,30 @@ +package MyCollections.List; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class JTest { + + My_ArrayList test; + + @BeforeEach + void erstelle_objekt() { + test = new My_ArrayList<>(); + } + + @Test + void add_atIndex_test() { + assertTrue(test.add(2,2.2)); + } + + + @Test + void add_test() { + assertTrue(test.add(12.2)); + } + + + +} diff --git a/Programmierung2/src/MyCollections/List/MyList.java b/Programmierung2/src/MyCollections/List/MyList.java new file mode 100644 index 0000000..c9864ee --- /dev/null +++ b/Programmierung2/src/MyCollections/List/MyList.java @@ -0,0 +1,26 @@ +package MyCollections.List; + +import MyCollections.MyCollection; + +public interface MyList extends MyCollection { + + boolean add(V e); + boolean add(int index, V element); + + int get(int index); + + boolean set(int index, V element); + + boolean remove(Object o); + boolean remove(int index); + + int size(); + + boolean isEmpty(); + + boolean contains(Object o); + + int indexOf(Object o); + + void printAll(); +} diff --git a/Programmierung2/src/MyCollections/List/My_ArrayList.java b/Programmierung2/src/MyCollections/List/My_ArrayList.java new file mode 100644 index 0000000..cb816c2 --- /dev/null +++ b/Programmierung2/src/MyCollections/List/My_ArrayList.java @@ -0,0 +1,102 @@ +package MyCollections.List; + +public class My_ArrayList implements MyList { + + private int size; + private V[] arr; + private int index; + + My_ArrayList(){ + size = 10; + index = 0; + arr = (V[]) new Object[size]; + } + + + @Override + public boolean add(V e) { + if (index >= arr.length) + erstell_neue_array(); + + arr[index] = e; + index++; + return true; + } + public void erstell_neue_array() { + size *= 2; + V[] neuarr = (V[]) new Object[size]; + for (int i = 0; i < arr.length ; i++) + neuarr[i] = arr[i]; + arr = neuarr; + } + + @Override + public boolean add(int i, V element) { + if (arr[i] == null) { + arr[i] =element ; + return true; + } + + + return false; + } + + @Override + public int get(int index) { + return 0; + } + + @Override + public boolean set(int index, V element) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean remove(Object o) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean remove(int index) { + // TODO Auto-generated method stub + return false; + } + + @Override + public int size() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean isEmpty() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean contains(Object o) { + // TODO Auto-generated method stub + return false; + } + + @Override + public int indexOf(Object o) { + // TODO Auto-generated method stub + return 0; + } + + + @Override + public void printAll() { + int i = 0; + System.out.print("["); + while(arr[i] != null && i < arr.length) { + System.out.println(arr[i] + " "); + i++; + } + System.out.print("]"); + } +} diff --git a/Programmierung2/src/MyCollections/List/Test.java b/Programmierung2/src/MyCollections/List/Test.java new file mode 100644 index 0000000..f57871c --- /dev/null +++ b/Programmierung2/src/MyCollections/List/Test.java @@ -0,0 +1,20 @@ +package MyCollections.List; + +import java.util.ArrayList; + +public class Test { + + public static void main(String[] args) { + + ArrayList test = new ArrayList<>(); + + test.add(12); + test.add(13); + + System.out.println(test); + + test.add(0, 14); + System.out.println(test); + } + +} diff --git a/Programmierung2/src/MyCollections/MyArrayList.java b/Programmierung2/src/MyCollections/MyArrayList.java new file mode 100644 index 0000000..74c962f --- /dev/null +++ b/Programmierung2/src/MyCollections/MyArrayList.java @@ -0,0 +1,53 @@ +package MyCollections; + +public class MyArrayList { + + private int size; + private v[] arr; + private int index; + + MyArrayList(){ + + size = 10; + index = 0; + arr =(v[]) new Object[size]; + } + + public void add(v value) { + if (index >= arr.length) + erzeuge_neue_array(); + + arr[index] = value; + index++; + } + + public void erzeuge_neue_array() { + + size *=2; + v[] neuArray =(v[]) new Object[size]; + for (int i = 0; i < arr.length; i++) + neuArray[i] = arr[i]; + + arr = neuArray; + } + + public void printall() { + int i = 0; + while(arr[i] != null) { + System.out.print(arr[i] + " "); + i++; + } + + + } + + + public static void main(String[] args) { + MyArrayList mylist = new MyArrayList<>(); + for (int i = 1; i <= 30; i++) + mylist.add(i); + + mylist.printall(); + } + +} diff --git a/Programmierung2/src/MyCollections/MyCollection.java b/Programmierung2/src/MyCollections/MyCollection.java new file mode 100644 index 0000000..66c5173 --- /dev/null +++ b/Programmierung2/src/MyCollections/MyCollection.java @@ -0,0 +1,25 @@ +package MyCollections; + +public interface MyCollection { + boolean add(V e); + boolean add(int index, V element); + + int get(int index); + + boolean set(int index, V element); + + boolean remove(Object o); + boolean remove(int index); + + int size(); + + boolean isEmpty(); + + boolean contains(Object o); + + int indexOf(Object o); + + void printAll(); + + +} diff --git a/Programmierung2/src/MyGraphen/Graph.java b/Programmierung2/src/MyGraphen/Graph.java new file mode 100644 index 0000000..70b810d --- /dev/null +++ b/Programmierung2/src/MyGraphen/Graph.java @@ -0,0 +1,18 @@ +package MyGraphen; + +import java.util.ArrayList; + +public class Graph { + + ArrayList knoten; + + Graph(){ + knoten = new ArrayList<>(); + } + + public void add_Knoten(Knoten knote) { + knoten.add(knote); + } + + +} diff --git a/Programmierung2/src/MyGraphen/Kanten.java b/Programmierung2/src/MyGraphen/Kanten.java new file mode 100644 index 0000000..e1fab9d --- /dev/null +++ b/Programmierung2/src/MyGraphen/Kanten.java @@ -0,0 +1,20 @@ +package MyGraphen; + +public class Kanten { + Knoten knote1; + Knoten knote2; + + Kanten(Knoten knote1, Knoten knote2){ + this.knote1 = knote1; + this.knote2 = knote2; + + this.knote1.add_Kante(this); + this.knote2.add_Kante(this); + } + + + public Knoten getpartner(Knoten knote) { + Knoten partner = (knote == knote1)? knote2 : knote1; + return partner; + } +} diff --git a/Programmierung2/src/MyGraphen/Knoten.java b/Programmierung2/src/MyGraphen/Knoten.java new file mode 100644 index 0000000..073584d --- /dev/null +++ b/Programmierung2/src/MyGraphen/Knoten.java @@ -0,0 +1,26 @@ +package MyGraphen; + +import java.util.ArrayList; + +public class Knoten { + + int value; + ArrayList kanten; + Knoten(int value){ + + this.value = value; + kanten = new ArrayList<>(); + } + + public void add_Kante(Kanten kante) { + + this.kanten.add(kante); + } + + public ArrayList get_partner() { + ArrayList alle_knoten = new ArrayList<>(); + for (Kanten k : kanten) + alle_knoten.add(k.getpartner(this)); + return alle_knoten; + } +} diff --git a/Programmierung2/src/MyGraphen/Main.java b/Programmierung2/src/MyGraphen/Main.java new file mode 100644 index 0000000..351ae9a --- /dev/null +++ b/Programmierung2/src/MyGraphen/Main.java @@ -0,0 +1,23 @@ +package MyGraphen; + +public class Main { + + public static void main(String[] args) { + Graph graph = new Graph(); + + Knoten knote1 = new Knoten(1); + Knoten knote2 = new Knoten(2); + Kanten k1 = new Kanten(knote1,knote2); + + Knoten knote3 = new Knoten(3); + Kanten k2 = new Kanten(knote1,knote3); + + System.out.println(knote1.get_partner()); + + graph.add_Knoten(knote1); + graph.add_Knoten(knote2); + graph.add_Knoten(knote3); + System.out.println(graph.knoten); + } + +} diff --git a/Programmierung2/src/Teste/kopieArray.java b/Programmierung2/src/Teste/kopieArray.java index e0572a9..125c51a 100644 --- a/Programmierung2/src/Teste/kopieArray.java +++ b/Programmierung2/src/Teste/kopieArray.java @@ -1,8 +1,12 @@ package Teste; +import java.util.ArrayList; + public class kopieArray { public static void main(String[] args) { + + ArrayList test; // /* // * das ein falsches Verfahren, um ein Array in einem anderen Array // * zu koopieren, in dem Fall kopieArray ist ein RefrenzVariable, die auf das selbe Array zeigt @@ -20,6 +24,6 @@ public class kopieArray { // System.out.println(2 % 7); - + } } \ No newline at end of file diff --git a/Programmierung2/src/oop/Generics/Wildcard-Zeichen.odt b/Programmierung2/src/oop/Generics/Wildcard-Zeichen.odt deleted file mode 100644 index 0d4ceec..0000000 Binary files a/Programmierung2/src/oop/Generics/Wildcard-Zeichen.odt and /dev/null differ diff --git a/Programmierung2/src/oop/Generics/Wildcard-Zeichen.pdf b/Programmierung2/src/oop/Generics/Wildcard-Zeichen.pdf new file mode 100644 index 0000000..280d56e Binary files /dev/null and b/Programmierung2/src/oop/Generics/Wildcard-Zeichen.pdf differ