diff --git a/bin/test/uebung/uebung09/collection/SetTest.class b/bin/test/uebung/uebung09/collection/SetTest.class new file mode 100644 index 0000000..1aa1f92 Binary files /dev/null and b/bin/test/uebung/uebung09/collection/SetTest.class differ diff --git a/bin/uebung07/quantities/plain/Length.class b/bin/uebung07/quantities/plain/Length.class deleted file mode 100644 index 028c707..0000000 Binary files a/bin/uebung07/quantities/plain/Length.class and /dev/null differ diff --git a/bin/uebung07/quantities/plain/LengthUnit.class b/bin/uebung07/quantities/plain/LengthUnit.class deleted file mode 100644 index f51a92f..0000000 Binary files a/bin/uebung07/quantities/plain/LengthUnit.class and /dev/null differ diff --git a/bin/uebung07/quantities/plain/PlainQuantitiesDemo.class b/bin/uebung07/quantities/plain/PlainQuantitiesDemo.class deleted file mode 100644 index df63b4d..0000000 Binary files a/bin/uebung07/quantities/plain/PlainQuantitiesDemo.class and /dev/null differ diff --git a/bin/uebung07/quantities/plain/Quantity.class b/bin/uebung07/quantities/plain/Quantity.class deleted file mode 100644 index 503cd51..0000000 Binary files a/bin/uebung07/quantities/plain/Quantity.class and /dev/null differ diff --git a/bin/uebung07/quantities/plain/Time.class b/bin/uebung07/quantities/plain/Time.class deleted file mode 100644 index 73a6f04..0000000 Binary files a/bin/uebung07/quantities/plain/Time.class and /dev/null differ diff --git a/bin/uebung07/quantities/plain/Unit.class b/bin/uebung07/quantities/plain/Unit.class deleted file mode 100644 index ddea055..0000000 Binary files a/bin/uebung07/quantities/plain/Unit.class and /dev/null differ diff --git a/bin/uebung09/collection/BigSet$1.class b/bin/uebung09/collection/BigSet$1.class new file mode 100644 index 0000000..5479c6d Binary files /dev/null and b/bin/uebung09/collection/BigSet$1.class differ diff --git a/bin/uebung09/collection/BigSet.class b/bin/uebung09/collection/BigSet.class new file mode 100644 index 0000000..9997eb4 Binary files /dev/null and b/bin/uebung09/collection/BigSet.class differ diff --git a/bin/uebung09/collection/EmptySet$1.class b/bin/uebung09/collection/EmptySet$1.class new file mode 100644 index 0000000..d2706cf Binary files /dev/null and b/bin/uebung09/collection/EmptySet$1.class differ diff --git a/bin/uebung09/collection/EmptySet.class b/bin/uebung09/collection/EmptySet.class new file mode 100644 index 0000000..73456b7 Binary files /dev/null and b/bin/uebung09/collection/EmptySet.class differ diff --git a/bin/uebung09/collection/SetFactory.class b/bin/uebung09/collection/SetFactory.class index 15c139e..4762368 100644 Binary files a/bin/uebung09/collection/SetFactory.class and b/bin/uebung09/collection/SetFactory.class differ diff --git a/bin/uebung09/collection/SingeltonSet$1.class b/bin/uebung09/collection/SingeltonSet$1.class new file mode 100644 index 0000000..427fab0 Binary files /dev/null and b/bin/uebung09/collection/SingeltonSet$1.class differ diff --git a/bin/uebung09/collection/SingeltonSet.class b/bin/uebung09/collection/SingeltonSet.class new file mode 100644 index 0000000..8624d52 Binary files /dev/null and b/bin/uebung09/collection/SingeltonSet.class differ diff --git a/bin/uebung10/logo/BlackForest.class b/bin/uebung10/logo/BlackForest.class new file mode 100644 index 0000000..14b9deb Binary files /dev/null and b/bin/uebung10/logo/BlackForest.class differ diff --git a/bin/uebung10/logo/HanselGretelTest.class b/bin/uebung10/logo/HanselGretelTest.class index 36adb1b..bec3a7b 100644 Binary files a/bin/uebung10/logo/HanselGretelTest.class and b/bin/uebung10/logo/HanselGretelTest.class differ diff --git a/bin/uebung10/logo/HanselGretelVisitor$1.class b/bin/uebung10/logo/HanselGretelVisitor$1.class index 5daac03..2236119 100644 Binary files a/bin/uebung10/logo/HanselGretelVisitor$1.class and b/bin/uebung10/logo/HanselGretelVisitor$1.class differ diff --git a/bin/uebung10/logo/HanselGretelVisitor$2.class b/bin/uebung10/logo/HanselGretelVisitor$2.class new file mode 100644 index 0000000..a0d727f Binary files /dev/null and b/bin/uebung10/logo/HanselGretelVisitor$2.class differ diff --git a/bin/uebung10/logo/HanselGretelVisitor$3.class b/bin/uebung10/logo/HanselGretelVisitor$3.class new file mode 100644 index 0000000..52ceb07 Binary files /dev/null and b/bin/uebung10/logo/HanselGretelVisitor$3.class differ diff --git a/bin/uebung10/logo/HanselGretelVisitor$DownState.class b/bin/uebung10/logo/HanselGretelVisitor$DownState.class deleted file mode 100644 index 23584b2..0000000 Binary files a/bin/uebung10/logo/HanselGretelVisitor$DownState.class and /dev/null differ diff --git a/bin/uebung10/logo/HanselGretelVisitor$ShortUpState.class b/bin/uebung10/logo/HanselGretelVisitor$ShortUpState.class deleted file mode 100644 index ba642a7..0000000 Binary files a/bin/uebung10/logo/HanselGretelVisitor$ShortUpState.class and /dev/null differ diff --git a/bin/uebung10/logo/HanselGretelVisitor$State.class b/bin/uebung10/logo/HanselGretelVisitor$State.class index 823ded1..8dbdd87 100644 Binary files a/bin/uebung10/logo/HanselGretelVisitor$State.class and b/bin/uebung10/logo/HanselGretelVisitor$State.class differ diff --git a/bin/uebung10/logo/HanselGretelVisitor.class b/bin/uebung10/logo/HanselGretelVisitor.class index 5a1d894..c04b278 100644 Binary files a/bin/uebung10/logo/HanselGretelVisitor.class and b/bin/uebung10/logo/HanselGretelVisitor.class differ diff --git a/src/uebung07/quantities/plain/Length.java b/src/uebung07/quantities/plain/Length.java deleted file mode 100644 index 5efacf3..0000000 --- a/src/uebung07/quantities/plain/Length.java +++ /dev/null @@ -1,46 +0,0 @@ -package uebung07.quantities.plain; - -import static uebung07.quantities.plain.LengthUnit.METER; -import static uebung07.quantities.plain.TimeUnit.SECOND; -import static uebung07.quantities.plain.VelocityUnit.METER_PER_SECOND; - -public class Length extends Quantity { - private final LengthUnit unit; - - public Length(double value, LengthUnit unit) { - super(value, unit); - this.unit = unit; - } - - public Length plus(Length other) { - return new Length(value + other.getBaseValue() / unit.baseFactor, unit); - } - - public Length minus(Length other) { - return new Length(value - other.getBaseValue() / unit.baseFactor, unit); - } - - public Length mult(double f) { - return new Length(value * f, unit); - } - - public Length div(double f) { - return new Length(value / f, unit); - } - - public Length to(LengthUnit unit) { - return new Length(getBaseValue() / unit.baseFactor, unit); - } - - public double div(Length other) { - return getBaseValue() / other.getBaseValue(); - } - - public Velocity div(Time t) { - return new Velocity(this.value(METER) / t.value(SECOND), METER_PER_SECOND); - } - - public Time div(Velocity v) { - return new Time(this.value(METER) / v.value(METER_PER_SECOND), SECOND); - } -} diff --git a/src/uebung07/quantities/plain/LengthUnit.java b/src/uebung07/quantities/plain/LengthUnit.java deleted file mode 100644 index c98102b..0000000 --- a/src/uebung07/quantities/plain/LengthUnit.java +++ /dev/null @@ -1,14 +0,0 @@ -package uebung07.quantities.plain; - -public class LengthUnit extends Unit { - public LengthUnit(String name, double baseFactor) { - super(name, baseFactor); - } - - public static final LengthUnit METER = new LengthUnit("m", 1); - public static final LengthUnit MILLIMETER = new LengthUnit("mm", 0.001); - public static final LengthUnit KILOMETER = new LengthUnit("km", 1000); - public static final LengthUnit MILE = new LengthUnit("mi", 1609.344); - public static final LengthUnit LIGHTYEAR = new LengthUnit("ly", 9460730472580800.0); - public static final LengthUnit PARSEC = new LengthUnit("pc", 3.0856776e16); -} diff --git a/src/uebung07/quantities/plain/PlainQuantitiesDemo.java b/src/uebung07/quantities/plain/PlainQuantitiesDemo.java deleted file mode 100644 index bfa6924..0000000 --- a/src/uebung07/quantities/plain/PlainQuantitiesDemo.java +++ /dev/null @@ -1,60 +0,0 @@ -package uebung07.quantities.plain; - -import static uebung07.quantities.plain.LengthUnit.KILOMETER; -import static uebung07.quantities.plain.LengthUnit.MILE; -import static uebung07.quantities.plain.LengthUnit.MILLIMETER; -import static uebung07.quantities.plain.LengthUnit.PARSEC; -import static uebung07.quantities.plain.TimeUnit.HOUR; -import static uebung07.quantities.plain.TimeUnit.MINUTE; -import static uebung07.quantities.plain.TimeUnit.SECOND; -import static uebung07.quantities.plain.VelocityUnit.KMH; -import static uebung07.quantities.plain.VelocityUnit.METER_PER_SECOND; -import static uebung07.quantities.plain.VelocityUnit.MPH; - -public class PlainQuantitiesDemo { - public static void main(String[] args) { - final Length l1 = new Length(1, KILOMETER); - final Length l2 = new Length(1200, MILLIMETER); - final Length l3 = new Length(1, MILE); - - System.out.println(l1); - System.out.println(l2); - System.out.println(l1 + " + " + l2 + " = " + l1.plus(l2)); - System.out.println(l1 + " + " + l2 + " (in mm) = " + l1.plus(l2).to(MILLIMETER)); - - System.out.println(l3 + " / " + l1 + " = " + l3.div(l1)); - - final Time t1 = new Time(100, SECOND); - final Time t2 = new Time(5, HOUR); - - System.out.println(t1); - System.out.println(t2); - System.out.println(t1.plus(t2)); - System.out.println(t1.plus(t2).to(MINUTE)); - - final Velocity v1 = new Velocity(12, KMH); - final Velocity v2 = new Velocity(100, METER_PER_SECOND); - - System.out.println(v1); - System.out.println(v2); - System.out.println(v2.to(KMH)); - System.out.println(v1.plus(v2)); - - final Length l4 = new Length(300, KILOMETER).to(PARSEC); - final Time t3 = new Time(2, HOUR); - final Velocity v3 = l4.div(t3); - System.out.println(l4 + " / " + l3 + " = " + v3); - - System.out.println(v1 + " * " + t1 + " = " + v1.mult(t1).to(KILOMETER)); - - final Length l5 = v3.mult(t1.to(HOUR)); - System.out.println(v3 + " * " + t1 + " = " + l5); - - final Time t5 = l4.div(v2); - System.out.println(l4 + " / " + v2 + " = " + t5.to(MINUTE)); - - Velocity v5 = new Velocity(55, MPH); - System.out.println(v5 + " = " + v5.format("%4.1f %s", KMH)); - System.out.println((v5.mult(new Time(30, MINUTE)).to(MILE))); - } -} diff --git a/src/uebung07/quantities/plain/Quantity.java b/src/uebung07/quantities/plain/Quantity.java deleted file mode 100644 index b2d6e70..0000000 --- a/src/uebung07/quantities/plain/Quantity.java +++ /dev/null @@ -1,28 +0,0 @@ -package uebung07.quantities.plain; - -public abstract class Quantity { - public final double value; - public final Unit unit; - - protected Quantity(double value, Unit unit) { - this.value = value; - this.unit = unit; - } - - public double getBaseValue() { - return value * unit.baseFactor; - } - - public double value(Unit unit) { - return getBaseValue() / unit.baseFactor; - } - - @Override - public String toString() { - return value + " " + unit; - } - - public String format(String fmt, Unit unit) { - return String.format(fmt, value(unit), unit); - } -} diff --git a/src/uebung07/quantities/plain/Time.java b/src/uebung07/quantities/plain/Time.java deleted file mode 100644 index 99c2044..0000000 --- a/src/uebung07/quantities/plain/Time.java +++ /dev/null @@ -1,41 +0,0 @@ -package uebung07.quantities.plain; - -import static uebung07.quantities.plain.LengthUnit.METER; - -public class Time extends Quantity{ - private final TimeUnit unit; - - public Time(double value, TimeUnit unit) { - super(value, unit); - this.unit = unit; - } - - public Time plus(Time other) { - return new Time( value + other.getBaseValue() / unit.baseFactor, unit); - } - - public Time minus(Time other) { - return new Time( value - other.getBaseValue() / unit.baseFactor, unit); - } - - public Time mult(double f) { - return new Time( value * f, unit); - } - - public Time div(double f) { - return new Time( value / f, unit); - } - - public Time to(TimeUnit unit) { - return new Time(getBaseValue() / unit.baseFactor, unit) - } - - public double div(Time other) { - return getBaseValue() / other.getBaseValue(); - } - - public Length mult(Velocity v) { - return new Length(this.value(METER), METER); - } - -} diff --git a/src/uebung07/quantities/plain/Unit.java b/src/uebung07/quantities/plain/Unit.java deleted file mode 100644 index efaa8d7..0000000 --- a/src/uebung07/quantities/plain/Unit.java +++ /dev/null @@ -1,16 +0,0 @@ -package uebung07.quantities.plain; - -public abstract class Unit { - public final String name; - public final double baseFactor; - - public Unit(String name, double baseFactor) { - this.name = name; - this.baseFactor = baseFactor; - } - - @Override - public String toString() { - return name; - } -} diff --git a/src/uebung10/logo/BlackForest.java b/src/uebung10/logo/BlackForest.java new file mode 100644 index 0000000..cefb8d9 --- /dev/null +++ b/src/uebung10/logo/BlackForest.java @@ -0,0 +1,11 @@ +package uebung10.logo; + +public class BlackForest implements DarkForest{ + + @Override + public void breadCrumb(double x, double y) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'breadCrumb'"); + } + +} diff --git a/src/uebung10/logo/HanselGretelVisitor.java b/src/uebung10/logo/HanselGretelVisitor.java index 8fe1f5c..70921f0 100644 --- a/src/uebung10/logo/HanselGretelVisitor.java +++ b/src/uebung10/logo/HanselGretelVisitor.java @@ -47,23 +47,21 @@ public class HanselGretelVisitor implements Visitor { } private void breadCrumb() { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'breadCrumb'"); + forest.breadCrumb(turtle.getX(), turtle.getY()); } private void layTrail(double d) { - forest.breadCrumb(turtle.getX(), turtle.getY()); + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'layTrail'"); } private abstract class State { abstract void go(double dist); - void up() {} - void down() {} + abstract void up(); + abstract void down(); } - private final State shortUp = new ShortUpState();// muss nicht geschrieben werden - private final State down = new DownState();// muss nicht geschrieben werden - private final State longUp = new State(){ + private final State longUpState = new State(){ @Override void go(double d) {turtle.go(d);} @@ -71,25 +69,52 @@ public class HanselGretelVisitor implements Visitor { @Override void down(){ breadCrumb(); - state = down; + state = downState; } + @Override + void up() {} + }; - private class DownState extends State{ + private final State downState = new State(){ + + @Override void go(double d){ layTrail(d); } - void up(){state = shortUp;} - } + @Override + void up(){state = shortUpState;} - //TODO - private class ShortUpState extends State { - void go(double d){} - void up(){} - void down(){} - } + @Override + void down() {} + }; + + private final State shortUpState = new State() { + + @Override + void go(double dist) { + turtle.go(dist); + gap = gap + dist; + + if (gap < s) { + + } else { + gap = 0; + state = longUpState; + } + } + + @Override + void up() {} + + @Override + void down() { + state = downState; + } + + }; private void go(double d) {