Commit 1dddcd4e authored by Stefan Michel's avatar Stefan Michel

final commit

parent 3f472c37
......@@ -9,5 +9,14 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/derby.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
\ No newline at end of file
......@@ -60,44 +60,21 @@ public class DerbyDatabase {
* @param conn
*/
private void createTables(Connection conn) {
PreparedStatement preparedStatement;
try {
conn.prepareStatement(createExampleTable).execute();
preparedStatement = conn.prepareStatement(insertExample);
preparedStatement.setString(1, "der Code");
preparedStatement.setString(2, "das Terrain");
preparedStatement.execute();
preparedStatement = conn.prepareStatement(insertExample);
preparedStatement.setString(1, "anderer Code");
preparedStatement.setString(2, "anderes Terrain");
preparedStatement.execute();
} catch (SQLException e) {
}
try {
conn.prepareStatement(createTagTable).execute();
preparedStatement = conn.prepareStatement(insertTag);
preparedStatement.setString(1, "berg");
preparedStatement.execute();
} catch (SQLException e) {
}
try {
conn.prepareStatement(createExampleTagsTable).execute();
preparedStatement = conn.prepareStatement(insertExampleTag);
preparedStatement.setInt(1, 1);
preparedStatement.setInt(2, 1);
preparedStatement.execute();
preparedStatement = conn.prepareStatement(insertExampleTag);
preparedStatement.setInt(1, 2);
preparedStatement.setInt(2, 1);
preparedStatement.execute();
} catch (SQLException e) {
}
}
......
......@@ -65,6 +65,10 @@ public class Hamster extends Thread {
return terrain.getCornAmount(nextCol, nextRow) != -1;
}
public boolean findCorn() {
return terrain.foundCorn() > 0;
}
@Invisible
private int getNextCol() {
switch (terrain.getHamsterDirection()) {
......@@ -114,6 +118,7 @@ public class Hamster extends Thread {
terrain.notifyObservers();
}
@Invisible
public void stopHamster() {
running = false;
terrain.setChanged();
......@@ -121,6 +126,7 @@ public class Hamster extends Thread {
super.stop();
}
@Invisible
public boolean isRunning() {
return this.running;
}
......
......@@ -13,7 +13,10 @@ import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
import javafx.stage.FileChooser.ExtensionFilter;
import javafx.stage.Stage;
import model.*;
import model.DatabaseManager;
import model.Invisible;
import model.Terrain;
import model.ThreadManager;
import network.CodeTerrain;
import network.NetworkManager;
......@@ -107,7 +110,7 @@ public class MainViewCreationFX extends BorderPane implements Observer {
public void buildContextMenu() {
contextMenu = new ContextMenu();
setUpContextMenu(Hamster.class);
// setUpContextMenu(Hamster.class);
setUpContextMenu(terrain.getHamster().getClass());
}
......@@ -141,7 +144,7 @@ public class MainViewCreationFX extends BorderPane implements Observer {
e.printStackTrace();
}
});
if (method.getParameterCount() > 0)
if (method.getReturnType() != void.class)
menuItem.setDisable(true);
contextMenu.getItems().add(menuItem);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment