Skip to content

Commit

Permalink
Docs: JavaDoc and AI declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyah committed May 26, 2026
1 parent 90a253f commit e658f84
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public void start(final Stage stage) throws Exception {
// triggered when a new save file is loaded.
// We define this implementation here, because
// this class has the highest level overview of the application.
// SOLUTION SUGGESTED BY AI.
// REVIEWED AND TESTED BY THE TEAM BEFORE IMPLEMENTATION.
eventManager.addSubscriber(new EventSubscriber() {
@Override
public <T> void handleEvent(final EventData<T> eventData) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package edu.ntnu.idi.idatt2003.g40.mappe.view.ingame;

/**
* Action set for the in game controller.
* */
public enum InGameActions {
BUY_SHARES,
SELL_SHARES;
// Empty, no direct actions.
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventType;
import edu.ntnu.idi.idatt2003.g40.mappe.view.ViewController;
import edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.WidgetEnum;
import javafx.scene.Node;
import java.util.EnumMap;
import javafx.scene.Node;

/**
* Controller for {@link InGameView}.
*
* <p>Extends {@link ViewController}</p>
* */
public final class InGameController extends ViewController<InGameView>
implements EventSubscriber {

/**
* Map of widgets, used to identify and switch between center nodes.
* */
private final EnumMap<WidgetEnum, Node> widgetMap = new EnumMap<>(WidgetEnum.class);

/**
Expand All @@ -24,6 +32,12 @@ public InGameController(final InGameView viewElement,
eventManager.addSubscriber(this, EventType.CHANGE_INGAME_CENTER);
}

/**
* Adds a widget to the widget map.
*
* @param widgetEnum the name of the widget.
* @param widgetRoot the root node of the widget.
* */
public void addwidget(final WidgetEnum widgetEnum, final Node widgetRoot) {
widgetMap.put(widgetEnum, widgetRoot);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;

/**
* In game view.
*
* <p>Extends {@link ViewElement}</p>
* */
public class InGameView extends ViewElement<VBox, InGameActions> {

private final TopBarView topBarView;
Expand Down Expand Up @@ -77,13 +82,4 @@ public void hideSettingsOverlay() {
settingsOverlay = null;
}
}

/**
* Returns whether a settings overlay is currently shown.
*
* @return {@code true} if the settings overlay is visible.
* */
public boolean isSettingsOverlayVisible() {
return settingsOverlay != null;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
package edu.ntnu.idi.idatt2003.g40.mappe.view.mainmenu;

/**
* Action set for the main menu.
* */
public enum MainMenuActions {
/**
* Action for starting the game.
* */
START_GAME,

/**
* Action for opening the settings panel.
* */
SETTINGS,

/**
* Action for exiting the application.
* */
EXIT;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package edu.ntnu.idi.idatt2003.g40.mappe.view.mainmenu;

import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventData;
import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventManager;
import edu.ntnu.idi.idatt2003.g40.mappe.service.event.EventType;
import edu.ntnu.idi.idatt2003.g40.mappe.view.ViewController;
import edu.ntnu.idi.idatt2003.g40.mappe.view.ViewData;
import edu.ntnu.idi.idatt2003.g40.mappe.view.ViewEnum;
import javafx.application.Platform;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
package edu.ntnu.idi.idatt2003.g40.mappe.view.playgame;

/**
* Action set in the {@link PlayGameView} section.
* */
public enum PlayGameActions {

/**
* Creating a new game.
* */
NEW_GAME,

/**
* Returning to the main menu.
* */
BACK,

/**
* Uploading a save file.
* */
UPLOAD_SAVE,
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
package edu.ntnu.idi.idatt2003.g40.mappe.view.settings;

/**
* Action set for {@link SettingsView}.
* */
public enum SettingsActions {
/**
* Audio panel.
* */
AUDIO,

/**
* Video panel.
* */
VIDEO,

/**
* Hotkeys panel.
* */
HOTKEYS,

/**
* Return to main menu.
* */
BACK;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package edu.ntnu.idi.idatt2003.g40.mappe.view.widgets.financialsummary;

/**
* Action set for {@link SummaryView}.
* */
public enum SummaryActions {
/**
* Advance week.
* */
NEXT_WEEK;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,27 @@
import java.util.ArrayList;
import java.util.List;

/**
* Controller for the {@link SummaryView}.
*
* <p>Extends {@link ViewController}</p>
* */
public class SummaryController extends ViewController<SummaryView>
implements EventSubscriber {

/**
* Exchange to call when advancing week.
* */
private Exchange exchange;

/**
* Player object.
* */
private Player player;

/**
* Player net-worth history.
* */
private List<BigDecimal> playerNetWorthHistory;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
/**
* Strategy interface defining the central
* logic and layout for individual minigames.
*
* <p>DESIGN SUGGESTED BY AI</p>
*/
public interface GameGimmick {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ private void renderCanvas() {
gc.strokeArc(centerX - radius, centerY - radius, radius * 2, radius * 2, successZoneStart, successZoneExtent, javafx.scene.shape.ArcType.OPEN);

// Calculates and draws the indicator line based on radius and angle.
// ROTATION ALGORITHM SUGGESTED BY AI.
// CODE HAS BEEN REVIEWED AND TESTED.
double rad = Math.toRadians(-indicatorAngle);
double startX = centerX + (radius - 15) * Math.cos(rad);
double startY = centerY + (radius - 15) * Math.sin(rad);
Expand Down

0 comments on commit e658f84

Please sign in to comment.