Removed Generics, pray nothing breaks.

This commit is contained in:
2025-12-12 15:53:24 +01:00
parent 0132981d94
commit fa9c2ce32b
30 changed files with 116 additions and 113 deletions

View File

@@ -2,6 +2,6 @@ package org.toop.framework.gameFramework.model.game;
import org.toop.framework.gameFramework.model.player.Player;
public interface PlayerProvider<T extends TurnBasedGame<T>> {
Player<T> getPlayer(int index);
public interface PlayerProvider {
Player getPlayer(int index);
}

View File

@@ -1,6 +1,6 @@
package org.toop.framework.gameFramework.model.game;
public interface TurnBasedGame<T extends TurnBasedGame<T>> extends Playable, DeepCopyable<T>, PlayerProvider<T>, BoardProvider {
public interface TurnBasedGame extends Playable, PlayerProvider, BoardProvider, DeepCopyable<TurnBasedGame> {
int getCurrentTurn();
int getPlayerCount();
int getWinner();

View File

@@ -16,14 +16,14 @@ import java.util.function.Consumer;
* a running flag, a game reference, and a logger.
* Subclasses implement the actual game-loop logic.
*/
public abstract class AbstractThreadBehaviour<T extends TurnBasedGame<T>> implements ThreadBehaviour {
public abstract class AbstractThreadBehaviour implements ThreadBehaviour {
private LongPairConsumer onSendMove;
private Runnable onUpdateUI;
/** Indicates whether the game loop or event processing is active. */
protected final AtomicBoolean isRunning = new AtomicBoolean();
/** The game instance controlled by this behaviour. */
protected final T game;
protected final TurnBasedGame game;
/** Logger for the subclass to report errors or debug info. */
protected final Logger logger = LogManager.getLogger(this.getClass());
@@ -33,7 +33,7 @@ public abstract class AbstractThreadBehaviour<T extends TurnBasedGame<T>> implem
*
* @param game the turn-based game to control
*/
public AbstractThreadBehaviour(T game) {
public AbstractThreadBehaviour(TurnBasedGame game) {
this.game = game;
}

View File

@@ -3,5 +3,5 @@ package org.toop.framework.gameFramework.model.player;
import org.toop.framework.gameFramework.model.game.DeepCopyable;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
public interface AI<T extends TurnBasedGame<T>> extends MoveProvider<T>, DeepCopyable<AI<T>> {
public interface AI extends MoveProvider, DeepCopyable<AI> {
}

View File

@@ -12,6 +12,6 @@ import org.toop.framework.gameFramework.model.game.TurnBasedGame;
*
* @param <T> the specific type of game this AI can play, extending {@link GameR}
*/
public abstract class AbstractAI<T extends TurnBasedGame<T>> implements AI<T> {
public abstract class AbstractAI implements AI {
// Concrete AI implementations should override findBestMove(T game, int depth)
}

View File

@@ -15,7 +15,7 @@ import org.toop.framework.gameFramework.model.game.TurnBasedGame;
* specific move logic.
* </p>
*/
public abstract class AbstractPlayer<T extends TurnBasedGame<T>> implements Player<T> {
public abstract class AbstractPlayer implements Player {
private final Logger logger = LogManager.getLogger(this.getClass());
private final String name;
@@ -24,7 +24,7 @@ public abstract class AbstractPlayer<T extends TurnBasedGame<T>> implements Play
this.name = name;
}
protected AbstractPlayer(AbstractPlayer<T> other) {
protected AbstractPlayer(AbstractPlayer other) {
this.name = other.name;
}
/**
@@ -39,7 +39,7 @@ public abstract class AbstractPlayer<T extends TurnBasedGame<T>> implements Play
* @return an integer representing the chosen move
* @throws UnsupportedOperationException if the method is not overridden
*/
public long getMove(T gameCopy) {
public long getMove(TurnBasedGame gameCopy) {
logger.error("Method getMove not implemented.");
throw new UnsupportedOperationException("Not supported yet.");
}

View File

@@ -2,6 +2,6 @@ package org.toop.framework.gameFramework.model.player;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
public interface MoveProvider<T extends TurnBasedGame<T>> {
long getMove(T game);
public interface MoveProvider {
long getMove(TurnBasedGame game);
}

View File

@@ -3,5 +3,5 @@ package org.toop.framework.gameFramework.model.player;
import org.toop.framework.gameFramework.model.game.DeepCopyable;
import org.toop.framework.gameFramework.model.game.TurnBasedGame;
public interface Player<T extends TurnBasedGame<T>> extends NameProvider, MoveProvider<T>, DeepCopyable<Player<T>> {
public interface Player extends NameProvider, MoveProvider, DeepCopyable<Player> {
}