First methods during class

This commit is contained in:
mathisdebard 2024-05-07 17:27:06 +02:00
parent 22022f5568
commit b136a1a634
2 changed files with 19 additions and 3 deletions

11
src/Simulator.java Normal file
View File

@ -0,0 +1,11 @@
public class Simulator {
private int width;
private int height;
public Simulator(int numRows, int numColumns) {
// Calculate the width and height based on the number of rows and columns
this.width = numColumns;
this.height = numRows;
}
}

View File

@ -24,6 +24,7 @@ public class Simulator extends Thread {
private boolean loopingBorder;
private boolean clickActionFlag;
private int loopDelay = 150;
//TODO : add missing attribute(s)
@ -51,12 +52,12 @@ public class Simulator extends Thread {
public int getWidth() {
//TODO : replace with proper return
return 0;
return width;
}
public int getHeight() {
//TODO : replace with proper return
return 0;
return height;
}
//Should probably stay as is
@ -137,6 +138,7 @@ public class Simulator extends Thread {
*/
public void togglePause() {
// TODO : actually toggle the corresponding flag
pauseFlag = !pauseFlag; // Toggles the value of pauseFlag
}
/**
@ -253,16 +255,19 @@ public class Simulator extends Thread {
public boolean isLoopingBorder() {
//TODO : complete method with proper return
return false;
return loopingBorder;
}
public void toggleLoopingBorder() {
//TODO : complete method
loopingBorder = !loopingBorder; // Toggles the value of loopingBorder
}
public void setLoopDelay(int delay) {
//TODO : complete method
loopDelay = delay;
}
public void toggleClickAction() {