Compare commits

...

22 Commits

Author SHA1 Message Date
5f15f03d92 small change 2024-09-14 17:41:40 +00:00
9908656813 finished uebung10 2024-06-18 13:17:01 +00:00
b439030fee Ich hasse Minas 2024-06-18 12:55:21 +00:00
7fea13b9b3 MINAS??? 2024-06-17 22:33:20 +02:00
639da57def MINAS 2024-06-17 22:33:01 +02:00
0c95c28bc4 testing 2024-06-15 23:30:02 +02:00
ac1cc19a88 finished uebung09 2024-06-15 16:20:39 +02:00
62da4a9ea5 ahhhhhhhhh 2024-06-14 12:01:59 +02:00
dad5a33695 implemented hasnext 2024-06-14 08:08:10 +00:00
93fb940a8c refactor 2024-06-14 01:13:30 +02:00
55e6561e02 ich komm nicht mehr weiter 2024-06-14 01:12:27 +02:00
7972c9088c refactor 2024-06-14 01:03:45 +02:00
e59cbb88f1 refactored testing 2024-06-14 00:33:41 +02:00
440eed0e9d started on b 2024-06-13 18:15:48 +00:00
49262c4954 refactor 2024-06-13 15:02:04 +00:00
fa85372c13 initial commit 2024-06-13 15:37:45 +02:00
8c224faa0e implemented ToTextVisitor 2024-06-08 22:04:10 +02:00
85e8396ce9 finished TableofContents 2024-06-08 19:49:45 +00:00
81ea768dca finished CountWordsVisitor 2024-06-08 12:53:20 +00:00
dcf2a95b4f implemented accept and visit 2024-06-08 12:14:16 +00:00
e518460e81 started on visitor pattern 2024-06-07 15:25:26 +02:00
753d5e2780 implemented composite pattern 2024-06-07 15:25:15 +02:00
159 changed files with 1873 additions and 5117 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/uebung08/doc/Book.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/uebung10/logo/Go.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,13 +1,18 @@
package logistics;
package test.uebung.uebung05.logistics;
import uebung05.logistics.Helicopter;
import uebung05.logistics.Manager;
import uebung05.logistics.Tank;
import uebung05.logistics.material.BulletBelts;
import uebung05.logistics.material.Grease;
import uebung05.logistics.material.LiterDiesel;
import uebung05.logistics.material.MetGallonsKerosene;
import uebung05.logistics.material.Oil;
import uebung05.logistics.material.RocketPods;
import uebung05.logistics.material.ShellBatches;
import uebung05.logistics.quantities.NeedCollector;
import logistics.material.BulletBelts;
import logistics.material.Grease;
import logistics.material.LiterDiesel;
import logistics.material.MetGallonsKerosene;
import logistics.material.Oil;
import logistics.material.RocketPods;
import logistics.material.ShellBatches;
import logistics.quantities.NeedCollector;
import org.junit.Before;
import org.junit.Test;

View File

@@ -1,6 +1,8 @@
package logistics.storage;
package test.uebung.uebung05.logistics.storage;
import uebung05.logistics.material.Oil;
import uebung05.logistics.storage.IntStorage;
import logistics.material.Oil;
import org.junit.Before;
import org.junit.Test;

View File

@@ -0,0 +1,76 @@
package test.uebung.uebung09.collection;
import java.util.Iterator;
import uebung09.collection.Set;
import uebung09.collection.SetFactory;
import java.util.NoSuchElementException;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class SetTest {
static String a = "test";
static String b = "test2";
static String c = "test3";
public static void main(String[] args) {
}
@Test
public void EmptySetTest(){
Set<String> test = SetFactory.create();
Iterator<String> i = test.iterator();
assertFalse(i.hasNext());
assertThrows(NoSuchElementException.class, i::next);
assertFalse(test.contains(a));
assertEquals(0,test.size());
assertTrue(test.isEmpty());
}
@Test
public void SingeltonSetTest(){
Set<String> test = SetFactory.create(a);
Iterator<String> i = test.iterator();
assertTrue(i.hasNext());
assertTrue(a == i.next());
assertFalse(i.hasNext());
assertThrows(NoSuchElementException.class, i::next);
assertTrue(test.contains(a));
assertEquals(1,test.size());
assertFalse(test.isEmpty());
}
@Test
public void BigSetTest() {
Set<String> test = SetFactory.create(a,b,c);
Iterator<String> i = test.iterator();
assertTrue(i.hasNext());
assertTrue(a == i.next());
assertTrue(i.hasNext());
assertTrue(a == i.next());
assertTrue(i.hasNext());
assertTrue(a == i.next());
assertFalse(i.hasNext());
assertThrows(NoSuchElementException.class, i::next);
assertTrue(test.contains(a));
assertEquals(1,test.size());
assertFalse(test.isEmpty());
}
}

View File

@@ -0,0 +1,44 @@
package test.uebung.uebung09.iterator;
import org.junit.Test;
import java.util.Iterator;
import java.util.NoSuchElementException;
import uebung09.iterator.Array2dIterator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public class Array2dIteratorTest {
@Test
public void testArray2dIterator() {
final String[][] array = {{}, {"foo", "bar"}, {"baz"}, {}};
final Iterator<String> it = new Array2dIterator<>(array);
assertTrue(it.hasNext());
assertEquals("foo", it.next());
assertTrue(it.hasNext());
assertEquals("bar", it.next());
assertTrue(it.hasNext());
assertEquals("baz", it.next());
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
@Test
public void testArray2dIteratorOnlyEmpty() {
final String[][] array = {{}, {}, {}};
final Iterator<String> it = new Array2dIterator<>(array);
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
@Test
public void testArray2dIteratorEmpty() {
final String[][] array = {};
final Iterator<String> it = new Array2dIterator<>(array);
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
}

View File

@@ -0,0 +1,124 @@
package test.uebung.uebung09.iterator;
import org.junit.Test;
import java.util.Iterator;
import java.util.NoSuchElementException;
import uebung09.iterator.*;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
public class SkipNullIteratorTest {
@Test
public void testEmpty() {
final Iterator<Object> it = new SkipNullIterator<>(emptyList().iterator());
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
@Test
public void testNull() {
final Iterator<Object> it = new SkipNullIterator<>(asList(null, null).iterator());
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
@Test
public void testNonNull() {
final Iterator<String> it = new SkipNullIterator<>(asList("foo").iterator());
assertTrue(it.hasNext());
assertEquals("foo", it.next());
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
@Test
public void testMixed() {
final Iterator<String> it = new SkipNullIterator<>(asList(null, "foo", null).iterator());
assertTrue(it.hasNext());
assertEquals("foo", it.next());
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
@Test
public void testMixed2() {
final Iterator<String> oriIt = asList("a", "b", null, "c").iterator();
Iterator<String> it = new SkipNullIterator<>(oriIt);
assertTrue(it.hasNext());
assertEquals("a", it.next());
assertTrue(it.hasNext());
assertEquals("b", it.next());
assertTrue(it.hasNext());
assertEquals("c", it.next());
assertFalse(it.hasNext());
assertThrows(NoSuchElementException.class, it::next);
}
@Test
public void testDontCallInCtor() {
final Iterator<String> dontCallNext = new Iterator<>() {
@Override
public boolean hasNext() {
throw new RuntimeException();
}
@Override
public String next() {
throw new RuntimeException();
}
};
new SkipNullIterator<>(dontCallNext);
}
@Test
public void testSkipNullIteratorInfinity() {
final Iterator<String> oriIt = new Iterator<>() {
@Override
public boolean hasNext() {
return true;
}
@Override
public String next() {
return "infinity";
}
};
final Iterator<String> it = new SkipNullIterator<>(oriIt);
for (int i = 0; i < 1000; i++) {
assertTrue(it.hasNext());
assertEquals("infinity", it.next());
}
}
@Test
public void testPathological() {
final Iterator<String> oriIt = new Iterator<>() {
private int ctr;
@Override
public boolean hasNext() {
return true;
}
@Override
public String next() {
return ctr++ > 100000 ? "infinity" : null;
}
};
final Iterator<String> it = new SkipNullIterator<>(oriIt);
for (int i = 0; i < 1000; i++) {
assertTrue(it.hasNext());
assertEquals("infinity", it.next());
}
}
}

View File

@@ -1,20 +1,26 @@
package uebung04;
import java.util.ArrayList;
public class ByeGame extends Game{
private String player1;
private String player2;
public ByeGame(String player1, Game player2){
public ByeGame(String player1, String player2){
this.player1 = player1;
this.player2 = player2;
}
public String getPlayer1(){return player1;}
public String getPlayer2(){return player2;}
public ??? getPlayer2(){
return player2.getAllPlayers();
@Override
public ArrayList<String> getAllPlayers() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getAllPlayers'");
}

View File

@@ -7,7 +7,7 @@ public class OrdinaryGame extends Game{
private final int id;
public OrdinaryGame(Game player1, Game player2){
public OrdinaryGame(String player1, String player2){
this.player1 = player1;
this.player2 = player2;
@@ -15,18 +15,16 @@ public class OrdinaryGame extends Game{
counter++;
}
public ArrayList<String> getPlayer1(){
return player1.getAllPlayers();
public String getPlayer1(){
return null;
}
public ArrayList<String> getPlayer2(){
return player2.getAllPlayers();
public String getPlayer2(){
return null;
}
public ArrayList<String> getAllPlayers(){
ArrayList<String> rtn = player1.getAllPlayers();
rtn.addAll(player2.getAllPlayers());
return rtn;
return null;
}
}

View File

@@ -1,10 +1,10 @@
package logistics;
package uebung05.logistics;
import logistics.material.BulletBelts;
import logistics.material.LiterDiesel;
import logistics.material.RocketPods;
import uebung05.logistics.material.BulletBelts;
import uebung05.logistics.material.LiterDiesel;
import uebung05.logistics.material.RocketPods;
class demo {
class Demo {
public static void main(String[] args) {
Manager ceo = new Manager();

View File

@@ -1,13 +1,13 @@
package logistics;
package uebung05.logistics;
import logistics.material.BulletBelts;
import logistics.material.MetGallonsKerosene;
import logistics.material.RocketPods;
import logistics.quantities.FloatUnit;
import logistics.quantities.IntUnit;
import logistics.quantities.NeedCollector;
import logistics.storage.FloatStorage;
import logistics.storage.IntStorage;
import uebung05.logistics.material.BulletBelts;
import uebung05.logistics.material.MetGallonsKerosene;
import uebung05.logistics.material.RocketPods;
import uebung05.logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.IntUnit;
import uebung05.logistics.quantities.NeedCollector;
import uebung05.logistics.storage.FloatStorage;
import uebung05.logistics.storage.IntStorage;
/**
* The Helicopter class represents a helicopter in the logistics system.

View File

@@ -1,9 +1,9 @@
package logistics;
package uebung05.logistics;
import logistics.quantities.FloatUnit;
import logistics.quantities.IntUnit;
import logistics.quantities.NeedCollector;
import logistics.quantities.Unit;
import uebung05.logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.IntUnit;
import uebung05.logistics.quantities.NeedCollector;
import uebung05.logistics.quantities.Unit;
import java.util.ArrayList;
import java.util.List;
@@ -63,7 +63,7 @@ public class Manager {
*
* @return The NeedCollector object containing the needs of all the vehicles
*/
NeedCollector collectNeeds() {
public NeedCollector collectNeeds() {
NeedCollector collector = new NeedCollector();
for (Vehicle vehicle : vehicles) {
vehicle.reportNeeds(collector);

View File

@@ -1,7 +1,7 @@
package logistics;
package uebung05.logistics;
import logistics.quantities.FloatUnit;
import logistics.quantities.IntUnit;
import uebung05.logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.IntUnit;
import java.util.HashMap;
import java.util.Map;

View File

@@ -1,13 +1,13 @@
package logistics;
package uebung05.logistics;
import logistics.material.BulletBelts;
import logistics.material.LiterDiesel;
import logistics.material.ShellBatches;
import logistics.quantities.FloatUnit;
import logistics.quantities.IntUnit;
import logistics.quantities.NeedCollector;
import logistics.storage.FloatStorage;
import logistics.storage.IntStorage;
import uebung05.logistics.material.BulletBelts;
import uebung05.logistics.material.LiterDiesel;
import uebung05.logistics.material.ShellBatches;
import uebung05.logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.IntUnit;
import uebung05.logistics.quantities.NeedCollector;
import uebung05.logistics.storage.FloatStorage;
import uebung05.logistics.storage.IntStorage;
/**
* The Tank class represents a tank in the logistics system.

View File

@@ -1,12 +1,12 @@
package logistics;
package uebung05.logistics;
import logistics.material.BulletBelts;
import logistics.material.LiterDiesel;
import logistics.quantities.FloatUnit;
import logistics.quantities.IntUnit;
import logistics.quantities.NeedCollector;
import logistics.storage.FloatStorage;
import logistics.storage.IntStorage;
import uebung05.logistics.material.BulletBelts;
import uebung05.logistics.material.LiterDiesel;
import uebung05.logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.IntUnit;
import uebung05.logistics.quantities.NeedCollector;
import uebung05.logistics.storage.FloatStorage;
import uebung05.logistics.storage.IntStorage;
/**
* The Truck class represents a truck in the logistics system.

View File

@@ -1,11 +1,11 @@
package logistics;
package uebung05.logistics;
import logistics.material.Grease;
import logistics.material.Oil;
import logistics.quantities.FloatUnit;
import logistics.quantities.IntUnit;
import logistics.quantities.NeedCollector;
import logistics.storage.IntStorage;
import uebung05.logistics.material.Grease;
import uebung05.logistics.material.Oil;
import uebung05.logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.IntUnit;
import uebung05.logistics.quantities.NeedCollector;
import uebung05.logistics.storage.IntStorage;
/**
* The Vehicle abstract class represents a vehicle in the logistics system.

View File

@@ -1,6 +1,6 @@
package logistics.material;
package uebung05.logistics.material;
import logistics.quantities.IntUnit;
import uebung05.logistics.quantities.IntUnit;
/**
* The BulletBelts class represents a unit of measurement for 7.62 bullets.
@@ -11,7 +11,7 @@ import logistics.quantities.IntUnit;
*/
public class BulletBelts implements IntUnit {
private static BulletBelts INSTANCE;
public static BulletBelts INSTANCE;
private BulletBelts() {}

View File

@@ -1,6 +1,6 @@
package logistics.material;
package uebung05.logistics.material;
import logistics.quantities.IntUnit;
import uebung05.logistics.quantities.IntUnit;
/**
* The Grease class represents a unit of measurement for grease.
@@ -11,7 +11,7 @@ import logistics.quantities.IntUnit;
*/
public class Grease implements IntUnit {
private static Grease INSTANCE;
public static Grease INSTANCE;
private Grease() {}

View File

@@ -1,6 +1,6 @@
package logistics.material;
package uebung05.logistics.material;
import logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.FloatUnit;
/**
* The LiterDiesel class represents a unit of measurement for diesel fuel.
@@ -11,7 +11,7 @@ import logistics.quantities.FloatUnit;
*/
public class LiterDiesel implements FloatUnit {
private static LiterDiesel INSTANCE;
public static LiterDiesel INSTANCE;
private LiterDiesel() {}

View File

@@ -1,6 +1,6 @@
package logistics.material;
package uebung05.logistics.material;
import logistics.quantities.FloatUnit;
import uebung05.logistics.quantities.FloatUnit;
/**
* The MetGallonsKerosene class represents a unit of measurement for kerosene.
@@ -11,7 +11,7 @@ import logistics.quantities.FloatUnit;
*/
public class MetGallonsKerosene implements FloatUnit {
private static MetGallonsKerosene INSTANCE;
public static MetGallonsKerosene INSTANCE;
private MetGallonsKerosene() {}

View File

@@ -1,6 +1,6 @@
package logistics.material;
package uebung05.logistics.material;
import logistics.quantities.IntUnit;
import uebung05.logistics.quantities.IntUnit;
/**
* The Oil class represents a unit of measurement for oil.
@@ -11,7 +11,7 @@ import logistics.quantities.IntUnit;
*/
public class Oil implements IntUnit {
private static Oil INSTANCE;
public static Oil INSTANCE;
private Oil() {}

View File

@@ -1,6 +1,6 @@
package logistics.material;
package uebung05.logistics.material;
import logistics.quantities.IntUnit;
import uebung05.logistics.quantities.IntUnit;
/**
* The RocketPods class represents a unit of measurement for 70mm rocket pods.
@@ -11,7 +11,7 @@ import logistics.quantities.IntUnit;
*/
public class RocketPods implements IntUnit {
private static RocketPods INSTANCE;
public static RocketPods INSTANCE;
private RocketPods() {}

Some files were not shown because too many files have changed in this diff Show More