From f32160813243aa07fc0039173a1a68be1130d3b0 Mon Sep 17 00:00:00 2001 From: Hanno Fleischer Date: Mon, 25 Nov 2024 15:07:43 +0100 Subject: [PATCH] added two lists in PossiblePiece in order to differentiate between own and enemy pieces --- .../pp.mdga/message/server/PossiblePiece.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/message/server/PossiblePiece.java b/Projekte/mdga/model/src/main/java/pp.mdga/message/server/PossiblePiece.java index 4755b9c8..27ddaf22 100644 --- a/Projekte/mdga/model/src/main/java/pp.mdga/message/server/PossiblePiece.java +++ b/Projekte/mdga/model/src/main/java/pp.mdga/message/server/PossiblePiece.java @@ -2,6 +2,7 @@ import com.jme3.network.serializing.Serializable; +import java.sql.PseudoColumnUsage; import java.util.ArrayList; import java.util.List; @@ -29,6 +30,32 @@ public PossiblePiece() { possibleEnemyPieces = new ArrayList<>(); } + /** + * Swap the possible pieces + * + * @param possibleOwnPieces the list of possible own pieces + * @param possibleEnemyPieces the list of possible enemy pieces + * @return the swapped possible pieces + */ + public static PossiblePiece swapPossiblePieces(ArrayList possibleOwnPieces, ArrayList possibleEnemyPieces) { + PossiblePiece possiblePiece = new PossiblePiece(); + possiblePiece.possibleOwnPieces.addAll(possibleOwnPieces); + possiblePiece.possibleEnemyPieces.addAll(possibleEnemyPieces); + return possiblePiece; + } + + /** + * Get the possible pieces for the shield + * + * @param possibleOwnPieces the list of possible own pieces + * @return the possible pieces for the shield + */ + public static PossiblePiece shieldPossiblePieces(ArrayList possibleOwnPieces){ + PossiblePiece possiblePiece = new PossiblePiece(); + possiblePiece.possibleOwnPieces.addAll(possibleOwnPieces); + return possiblePiece; + } + /** * Add a piece to the list of possible pieces * @@ -50,10 +77,17 @@ public void addEnemyPossiblePiece(String piece) { /** Getter for the list of possible pieces * @return the list of possible pieces */ - public List getPossiblePieces() { + public List getOwnPossiblePieces() { return possibleOwnPieces; } + /** Getter for the list of possible enemy pieces + * @return the list of possible enemy pieces + */ + public List getEnemyPossiblePieces() { + return possibleEnemyPieces; + } + /** * Accepts a visitor to process this message. *