Skip to content

fix checkstyle errors in audio, model and controller packages #132

Merged
merged 2 commits into from
May 18, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Audio/Audio.java

This file was deleted.

This file was deleted.

This file was deleted.

77 changes: 56 additions & 21 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Millions.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
package edu.ntnu.idi.idatt2003.gruppe42;

import edu.ntnu.idi.idatt2003.gruppe42.Controller.GameController;
import edu.ntnu.idi.idatt2003.gruppe42.Controller.PopupsController;
import edu.ntnu.idi.idatt2003.gruppe42.Controller.ViewControllers.DesktopViewController;
import edu.ntnu.idi.idatt2003.gruppe42.Controller.ViewControllers.StartViewController;
import edu.ntnu.idi.idatt2003.gruppe42.Model.Difficulty;
import edu.ntnu.idi.idatt2003.gruppe42.Model.GameFactory;
import edu.ntnu.idi.idatt2003.gruppe42.Model.Player;
import edu.ntnu.idi.idatt2003.gruppe42.View.Views.DesktopView;
import edu.ntnu.idi.idatt2003.gruppe42.View.Views.StartView;
import edu.ntnu.idi.idatt2003.gruppe42.controller.GameController;
import edu.ntnu.idi.idatt2003.gruppe42.controller.PopupsController;
import edu.ntnu.idi.idatt2003.gruppe42.controller.viewcontrollers.DesktopViewController;
import edu.ntnu.idi.idatt2003.gruppe42.controller.viewcontrollers.StartViewController;
import edu.ntnu.idi.idatt2003.gruppe42.model.Difficulty;
import edu.ntnu.idi.idatt2003.gruppe42.model.GameFactory;
import edu.ntnu.idi.idatt2003.gruppe42.model.Player;
import edu.ntnu.idi.idatt2003.gruppe42.view.views.DesktopView;
import edu.ntnu.idi.idatt2003.gruppe42.view.views.StartView;
import java.nio.file.Path;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;

/** JavaFX application entry point. */
/**
* Main JavaFX application entry point for the Millions game.
*
* <p>This class is responsible for:
* <ul>
* <li>Launching the JavaFX application</li>
* <li>Initializing the start screen</li>
* <li>Starting and resetting game sessions</li>
* <li>Switching between StartView and DesktopView</li>
* <li>Managing global game state lifecycle</li>
* </ul>
*
* <p>It acts as the top-level coordinator between views and controllers.
*/
public class Millions extends Application {

private Scene scene;
Expand All @@ -25,7 +38,11 @@ public class Millions extends Application {
private DesktopView desktopView;
private DesktopViewController desktopViewController;

/** Start method. */
/**
* Initializes and displays the start screen when the application launches.
*
* @param stage the primary JavaFX stage
*/
@Override
public void start(final Stage stage) {
StartView startView = installStartView();
Expand All @@ -38,19 +55,35 @@ public void start(final Stage stage) {
stage.show();
}

/** Begins a new game session. */
public void initGame(final String username, final Difficulty difficulty, Path userSelectedPath, PopupsController popupsController) {
/**
* Initializes a new game session using the selected settings.
*
* <p>This includes creating the player, starting the game controller,
* and switching the scene to the desktop view.
*
* @param username the player name
* @param difficulty selected game difficulty
* @param userSelectedPath path to stock data file
* @param popupsController controller managing popups
*/
public void initGame(final String username, final Difficulty difficulty,
Path userSelectedPath, PopupsController popupsController) {
player = GameFactory.createPlayer(username, difficulty);
gameController = new GameController();
gameController.startGame();

desktopViewController = new DesktopViewController(player, gameController, userSelectedPath, popupsController);
desktopViewController = new DesktopViewController(player, gameController,
userSelectedPath, popupsController);
desktopViewController.setOnGameOver(this::resetGame);
desktopView = desktopViewController.getDesktopView();
scene.setRoot(desktopView.getRoot());
}

/** Centralised reset path. */
/**
* Resets the game back to the start screen.
*
* <p>Stops the running game controller and clears all active state.
*/
public void resetGame() {
if (gameController != null) {
gameController.stopGame();
Expand All @@ -64,22 +97,24 @@ public void resetGame() {
scene.setRoot(startView.getRoot());
}

/** Builds a fresh StartView. */
/**
* Creates and initializes a fresh StartView instance.
*
* @return a new StartView connected to its controller
*/
private StartView installStartView() {
StartView startView = new StartView();
new StartViewController(this, startView);
return startView;
}

/** Stop method. */
/**
* Stops the application and terminates any running game session.
*/
@Override
public void stop() {
if (gameController != null) {
gameController.stopGame();
}
}

public static void main(final String[] args) {
launch(args);
}
}
8 changes: 0 additions & 8 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Day.java

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/EventBus.java

This file was deleted.

107 changes: 0 additions & 107 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Exchange.java

This file was deleted.

This file was deleted.

This file was deleted.

Loading