Skip to content

Commit

Permalink
♻️ Refactor code to get a random track for fake sessions to be more g…
Browse files Browse the repository at this point in the history
…eneric

Signed-off-by: Marcus Fihlon <[email protected]>
  • Loading branch information
McPringle committed Nov 3, 2024
1 parent 20bab70 commit 7d5459b
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public final class EventDemoPlugin implements EventPlugin {
private static final Locale LOCALE = Locale.getDefault();
private static final Random RANDOM = new Random();
private static final int AROUND_THE_CLOCK = 24;
private static final List<Track> DEFAULT_TRACKS =
List.of(Track.ARCHITECTURE, Track.CLOUD, Track.CORE, Track.INFRASTRUCTURE, Track.SECURITY, Track.TOOLS);

private final int roomCount;
private final List<Session> sessions;
Expand Down Expand Up @@ -110,14 +112,6 @@ public boolean isEnabled() {
}

private @NotNull Track getRandomTrack() {
return switch (RANDOM.nextInt(6)) {
case 0 -> Track.ARCHITECTURE;
case 1 -> Track.CLOUD;
case 2 -> Track.CORE;
case 3 -> Track.INFRASTRUCTURE;
case 4 -> Track.SECURITY;
case 5 -> Track.TOOLS;
default -> Track.NONE;
};
return DEFAULT_TRACKS.get(RANDOM.nextInt(DEFAULT_TRACKS.size()));
}
}

0 comments on commit 7d5459b

Please sign in to comment.