MINAS
This commit is contained in:
parent
0c95c28bc4
commit
639da57def
Binary file not shown.
Binary file not shown.
BIN
bin/uebung10/logo/Go.class
Normal file
BIN
bin/uebung10/logo/Go.class
Normal file
Binary file not shown.
BIN
bin/uebung10/logo/HanselGretelFrame$1.class
Normal file
BIN
bin/uebung10/logo/HanselGretelFrame$1.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/uebung10/logo/HanselGretelVisitor.class
Normal file
BIN
bin/uebung10/logo/HanselGretelVisitor.class
Normal file
Binary file not shown.
BIN
bin/uebung10/logo/PenDown.class
Normal file
BIN
bin/uebung10/logo/PenDown.class
Normal file
Binary file not shown.
BIN
bin/uebung10/logo/PenUp.class
Normal file
BIN
bin/uebung10/logo/PenUp.class
Normal file
Binary file not shown.
BIN
bin/uebung10/logo/Sequence.class
Normal file
BIN
bin/uebung10/logo/Sequence.class
Normal file
Binary file not shown.
BIN
bin/uebung10/logo/Stmt.class
Normal file
BIN
bin/uebung10/logo/Stmt.class
Normal file
Binary file not shown.
BIN
bin/uebung10/logo/Turn.class
Normal file
BIN
bin/uebung10/logo/Turn.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/uebung10/logo/Visitor.class
Normal file
BIN
bin/uebung10/logo/Visitor.class
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
package logo;
|
package uebung10.logo;
|
||||||
|
|
||||||
public interface DarkForest {
|
public interface DarkForest {
|
||||||
void breadCrumb(double x, double y);
|
void breadCrumb(double x, double y);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package logo;
|
package uebung10.logo;
|
||||||
|
|
||||||
public class Demo {
|
public class Demo {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
19
src/uebung10/logo/Go.java
Normal file
19
src/uebung10/logo/Go.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
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 logo;
|
package uebung10.logo;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
18
src/uebung10/logo/HanselGretelVisitor.java
Normal file
18
src/uebung10/logo/HanselGretelVisitor.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
9
src/uebung10/logo/PenDown.java
Normal file
9
src/uebung10/logo/PenDown.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package uebung10.logo;
|
||||||
|
|
||||||
|
public class PenDown implements Stmt{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T accept(Visitor<T> visitor) {
|
||||||
|
return visitor.visit(this);
|
||||||
|
}
|
||||||
|
}
|
9
src/uebung10/logo/PenUp.java
Normal file
9
src/uebung10/logo/PenUp.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package uebung10.logo;
|
||||||
|
|
||||||
|
public class PenUp implements Stmt {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T accept(Visitor<T> visitor) {
|
||||||
|
return visitor.visit(this);
|
||||||
|
}
|
||||||
|
}
|
15
src/uebung10/logo/Sequence.java
Normal file
15
src/uebung10/logo/Sequence.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
7
src/uebung10/logo/Stmt.java
Normal file
7
src/uebung10/logo/Stmt.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package uebung10.logo;
|
||||||
|
|
||||||
|
public interface Stmt {
|
||||||
|
|
||||||
|
public <T> T accept(Visitor<T> visitor);
|
||||||
|
|
||||||
|
}
|
15
src/uebung10/logo/Turn.java
Normal file
15
src/uebung10/logo/Turn.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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 logo;
|
package uebung10.logo;
|
||||||
|
|
||||||
public class Turtle {
|
public class Turtle {
|
||||||
private double x;
|
private double x;
|
||||||
|
11
src/uebung10/logo/Visitor.java
Normal file
11
src/uebung10/logo/Visitor.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
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