Compare commits
No commits in common. "7fea13b9b3878cb07a2ae3ed73131a610481be96" and "0c95c28bc4ad63961fa1344ba6267a7f560e44c2" have entirely different histories.
7fea13b9b3
...
0c95c28bc4
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.
@ -1,4 +1,4 @@
|
||||
package uebung10.logo;
|
||||
package logo;
|
||||
|
||||
public interface DarkForest {
|
||||
void breadCrumb(double x, double y);
|
||||
|
@ -1,4 +1,4 @@
|
||||
package uebung10.logo;
|
||||
package logo;
|
||||
|
||||
public class Demo {
|
||||
public static void main(String[] args) {
|
||||
|
@ -1,19 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public class Go implements Stmt{
|
||||
|
||||
public final double dist;
|
||||
|
||||
public Go(double dist) {
|
||||
if (dist < 0) {
|
||||
throw new IllegalArgumentException();
|
||||
} else {
|
||||
this.dist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T accept(Visitor<T> visitor) {
|
||||
return visitor.visit(this);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package uebung10.logo;
|
||||
package logo;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
@ -1,18 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public class HanselGretelVisitor implements Visitor<Turtle> {
|
||||
|
||||
private double gap;
|
||||
private double s;
|
||||
private Turtle turtle;
|
||||
private DarkForest forest;
|
||||
|
||||
public HanselGretelVisitor(double s, Turtle turtle, DarkForest forest) {
|
||||
this.s = s;
|
||||
this.turtle = turtle;
|
||||
this.forest = forest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public class PenDown implements Stmt{
|
||||
|
||||
@Override
|
||||
public <T> T accept(Visitor<T> visitor) {
|
||||
return visitor.visit(this);
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public class PenUp implements Stmt {
|
||||
|
||||
@Override
|
||||
public <T> T accept(Visitor<T> visitor) {
|
||||
return visitor.visit(this);
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public class Sequence implements Stmt {
|
||||
|
||||
public final Stmt[] seq;
|
||||
|
||||
public Sequence(Stmt... seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T accept(Visitor<T> visitor) {
|
||||
return visitor.visit(this);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public interface Stmt {
|
||||
|
||||
public <T> T accept(Visitor<T> visitor);
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public class Turn implements Stmt{
|
||||
|
||||
public final double angle;
|
||||
|
||||
public Turn(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T accept(Visitor<T> visitor) {
|
||||
return visitor.visit(this);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package uebung10.logo;
|
||||
package logo;
|
||||
|
||||
public class Turtle {
|
||||
private double x;
|
||||
|
@ -1,11 +0,0 @@
|
||||
package uebung10.logo;
|
||||
|
||||
public interface Visitor<T> {
|
||||
|
||||
T visit(PenUp penUp);
|
||||
T visit(PenDown penDown);
|
||||
T visit(Turn turn);
|
||||
T visit(Sequence sequence);
|
||||
T visit(Go go);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user