EOS 2  1.1.0
Einfache Objektbasierte Sprache
Welt.java
gehe zur Dokumentation dieser Datei
1 package eos;
2 
3 import de.lathanda.eos.robot.World;
4 import de.lathanda.eos.robot.exceptions.CubeImmutableException;
5 import de.lathanda.eos.robot.exceptions.CubeMissingException;
6 import de.lathanda.eos.robot.exceptions.RobotEntranceMissingException;
7 import de.lathanda.eos.robot.exceptions.RobotException;
8 import de.lathanda.eos.robot.exceptions.RobotNoSpaceException;
9 import de.lathanda.eos.robot.exceptions.UnknownWorldVersionException;
10 import de.lathanda.eos.robot.exceptions.WorldLoadFailedException;
11 import de.lathanda.eos.robot.exceptions.WorldNotFoundException;
12 import eos.ausnahmen.EingangFehltAusnahme;
13 import eos.ausnahmen.KeinPlatzAusnahme;
14 import eos.ausnahmen.KeinSteinVorhandenAusnahme;
15 import eos.ausnahmen.RoboterAusnahme;
16 import eos.ausnahmen.SteinFeststehendAusnahme;
17 import eos.ausnahmen.WeltKorruptAusnahme;
18 import eos.ausnahmen.WeltNichtGefundenAusnahme;
19 
25 public class Welt {
26  World world;
27  public Welt() {
28  world = new World();
29  }
30  public Welt(String filename) {
31  this();
32  try {
33  world.load(filename);
35  throw new WeltKorruptAusnahme(cwe);
36  } catch (WorldNotFoundException wnfe) {
37  throw new WeltNichtGefundenAusnahme(wnfe);
38  }
39  }
40  public void betreten(Roboter roboter) {
41  try {
42  world.enter(roboter.robot);
43  } catch (RobotEntranceMissingException nle) {
44  throw new EingangFehltAusnahme(nle);
45  } catch (RobotNoSpaceException rnse) {
46  throw new KeinPlatzAusnahme(rnse);
47  } catch (RobotException re) {
48  throw new RoboterAusnahme(re);
49  }
50  }
51  public void steinSetzen(int x, int y, int z) {
52  try {
53  world.setStone(x,y,z);
54  } catch (RobotException re) {
55  throw new RoboterAusnahme(re);
56  }
57  }
58  public void steinFarbeSetzen(Farbe farbe) {
59  world.setStoneColor(farbe.getColor());
60  }
61  public void steinHinlegen(int x, int y) {
62  try {
63  world.dropStone(x, y);
64  } catch (RobotException re) {
65  throw new RoboterAusnahme(re);
66  }
67  }
68  public void steinEntfernen(int x, int y, int z) {
69  try {
70  world.removeStone(x,y,z);
71  } catch (CubeImmutableException e) {
72  throw new SteinFeststehendAusnahme(e);
73  } catch (RobotException re) {
74  throw new RoboterAusnahme(re);
75  }
76  }
77  public void steinAufheben(int x, int y) {
78  try {
79  world.pickupStone(x,y);
80  } catch (CubeMissingException cme) {
81  throw new KeinSteinVorhandenAusnahme(cme);
82  } catch (CubeImmutableException cie) {
83  throw new SteinFeststehendAusnahme(cie);
84  } catch (RobotException re) {
85  throw new RoboterAusnahme(re);
86  }
87  }
88  public void laden(String name) {
89  try {
90  world.load(name);
92  throw new WeltKorruptAusnahme(cwe);
93  } catch (WorldNotFoundException wnfe) {
94  throw new WeltNichtGefundenAusnahme(wnfe);
95  }
96  }
97  public void ziegelVerstreuen(int links, int oben, int rechts, int unten, double dichte) {
98  try {
99  world.fillRandom(links, oben, rechts, unten, dichte);
100  } catch (RobotException re) {
101  throw new RoboterAusnahme(re);
102  }
103  }
104 }
void dropStone(int x, int y)
Definition: World.java:636
void load(String filename)
Definition: World.java:119
void setStoneColor(MutableColor c)
Definition: World.java:606
void fillRandom(int left, int top, int right, int bottom, double density)
Definition: World.java:437
void setStone(int x, int y, int z)
Definition: World.java:564
void removeStone(int x, int y, int z)
Definition: World.java:655
void pickupStone(int x, int y)
Definition: World.java:689
Robot robot
Definition: Roboter.java:34
void steinHinlegen(int x, int y)
Definition: Welt.java:61
Welt(String filename)
Definition: Welt.java:30
void laden(String name)
Definition: Welt.java:88
void steinSetzen(int x, int y, int z)
Definition: Welt.java:51
void betreten(Roboter roboter)
Definition: Welt.java:40
void ziegelVerstreuen(int links, int oben, int rechts, int unten, double dichte)
Definition: Welt.java:97
Welt()
Definition: Welt.java:27
void steinFarbeSetzen(Farbe farbe)
Definition: Welt.java:58
void steinEntfernen(int x, int y, int z)
Definition: Welt.java:68
void steinAufheben(int x, int y)
Definition: Welt.java:77
Impressum