From ef277a1043e0704a4e6321e0deedefea69c2b16f Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 07:42:24 +0200 Subject: [PATCH 01/19] pom with jre 11 --- .classpath | 56 +++++++++++------------ .settings/org.eclipse.jdt.core.prefs | 8 ++-- pom.xml | 4 +- src/main/java/edu/ncsu/monopoly/Card.java | 2 +- 4 files changed, 36 insertions(+), 34 deletions(-) diff --git a/.classpath b/.classpath index 23eec2b1..3e536e17 100644 --- a/.classpath +++ b/.classpath @@ -1,28 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index b8947ec6..2af1e7b9 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,6 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=11 diff --git a/pom.xml b/pom.xml index 9939ae1e..f6f4f048 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,8 @@ http://maven.apache.org - 1.8 - 1.8 + 11 + 11 diff --git a/src/main/java/edu/ncsu/monopoly/Card.java b/src/main/java/edu/ncsu/monopoly/Card.java index bf40ccf7..487a8dd8 100644 --- a/src/main/java/edu/ncsu/monopoly/Card.java +++ b/src/main/java/edu/ncsu/monopoly/Card.java @@ -1,5 +1,5 @@ package edu.ncsu.monopoly; -//updated 2021 +//A new comment public abstract class Card { public static final int TYPE_CHANCE = 1; From f017135442aa709e14cb171b3f1e66e04a66bb30 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 07:47:38 +0200 Subject: [PATCH 02/19] Bew message From 3d8a2b9f10586ba963b534e059076eaef4bda517 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 08:00:51 +0200 Subject: [PATCH 03/19] desde el viejo --- .classpath | 1 + src/main/java/edu/ncsu/monopoly/Card.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.classpath b/.classpath index 3e536e17..b71dc065 100644 --- a/.classpath +++ b/.classpath @@ -20,6 +20,7 @@ + diff --git a/src/main/java/edu/ncsu/monopoly/Card.java b/src/main/java/edu/ncsu/monopoly/Card.java index 487a8dd8..b92da885 100644 --- a/src/main/java/edu/ncsu/monopoly/Card.java +++ b/src/main/java/edu/ncsu/monopoly/Card.java @@ -1,5 +1,5 @@ package edu.ncsu.monopoly; -//A new comment +//From Git repository public abstract class Card { public static final int TYPE_CHANCE = 1; From 0a7ac56d3982c239c70c9d3a2a97c843dcac2cd3 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 12:54:06 +0200 Subject: [PATCH 04/19] Corrected Parametrized Bad Smell --- .classpath | 1 - pom.xml | 136 +++++++++++++++--- .../edu/ncsu/monopoly/gui/BuyHouseDialog.java | 10 +- 3 files changed, 118 insertions(+), 29 deletions(-) diff --git a/.classpath b/.classpath index b71dc065..3e536e17 100644 --- a/.classpath +++ b/.classpath @@ -20,7 +20,6 @@ - diff --git a/pom.xml b/pom.xml index f6f4f048..bb30850d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,26 +1,116 @@ - + 4.0.0 - - Monopoly - Monopoly + upv-ehu-iso2 + MonopolyCI 0.0.1-SNAPSHOT - jar - - Monopoly - http://maven.apache.org - - - 11 - 11 - - - - - junit - junit - 3.8.1 - test - - + + + + + org.jacoco + jacoco-maven-plugin + 0.8.6 + + + prepare-agent + + prepare-agent + + + + report + + report + + + + + + + + + objectdb + ObjectDB Repository + https://m2.objectdb.com + + + + + 11 + 11 + maiteurreta + https://sonarcloud.io + MonopolyCI + 6e245c0c0c5097aef76947d68c622a8410a1d90f + + + + + + junit + junit + 4.5 + test + + + com.toedter + jcalendar + 1.4 + + + + + jakarta.xml.bind + jakarta.xml.bind-api + 2.3.2 + + + + + org.glassfish.jaxb + jaxb-runtime + 2.3.2 + + + + + + jakarta.xml.ws + jakarta.xml.ws-api + 2.3.2 + + + + + com.sun.xml.ws + jaxws-rt + 2.3.2 + + + + com.objectdb + objectdb + 2.8.1 + + + org.eclipse.persistence + javax.persistence + 2.1.0 + + + javax.transaction + jta + 1.1 + + + + + org.mockito + mockito-all + 1.9.5 + test + + + + diff --git a/src/main/java/edu/ncsu/monopoly/gui/BuyHouseDialog.java b/src/main/java/edu/ncsu/monopoly/gui/BuyHouseDialog.java index 899c44b8..20dba769 100644 --- a/src/main/java/edu/ncsu/monopoly/gui/BuyHouseDialog.java +++ b/src/main/java/edu/ncsu/monopoly/gui/BuyHouseDialog.java @@ -15,8 +15,8 @@ public class BuyHouseDialog extends JDialog { - private JComboBox cboMonopoly; - private JComboBox cboNumber; + private JComboBox cboMonopoly; + private JComboBox cboNumber; private Player player; @@ -44,12 +44,12 @@ public void actionPerformed(ActionEvent e) { return btn; } - private JComboBox buildMonopolyComboBox() { - cboMonopoly = new JComboBox(player.getMonopolies()); + private JComboBox buildMonopolyComboBox() { + cboMonopoly = new JComboBox<>(player.getMonopolies()); return cboMonopoly; } - private JComboBox buildNumberComboBox() { + private JComboBox buildNumberComboBox() { cboNumber = new JComboBox(new Integer[]{ new Integer(1), new Integer(2), From c47466c67d14b4a54fd49d31ce272da0647daa6c Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 14:40:51 +0200 Subject: [PATCH 05/19] Prueba para comprobar funcionamiento de Github Actions --- src/main/java/edu/ncsu/monopoly/Card.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/ncsu/monopoly/Card.java b/src/main/java/edu/ncsu/monopoly/Card.java index b92da885..2315d2c0 100644 --- a/src/main/java/edu/ncsu/monopoly/Card.java +++ b/src/main/java/edu/ncsu/monopoly/Card.java @@ -1,5 +1,5 @@ package edu.ncsu.monopoly; -//From Git repository +//Prueba para comprobar funcionamiento de Github Actions public abstract class Card { public static final int TYPE_CHANCE = 1; From 645c314b9aa91f0bcf9e66777085bc6e2268ef91 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 14:43:46 +0200 Subject: [PATCH 06/19] Github ACtions: sin -Dsonar --- .github/workflow/build.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflow/build.yml diff --git a/.github/workflow/build.yml b/.github/workflow/build.yml new file mode 100644 index 00000000..819dd38f --- /dev/null +++ b/.github/workflow/build.yml @@ -0,0 +1,36 @@ +name: Build +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ No newline at end of file From d1fe9d18f8c285d386301160d87d6750dff01598 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 14:52:09 +0200 Subject: [PATCH 07/19] =?UTF-8?q?nueva=20acci=C3=B3n=20maven=20(la=20anter?= =?UTF-8?q?ior)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edu/ncsu/monopoly/Card.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/ncsu/monopoly/Card.java b/src/main/java/edu/ncsu/monopoly/Card.java index 2315d2c0..cac400d1 100644 --- a/src/main/java/edu/ncsu/monopoly/Card.java +++ b/src/main/java/edu/ncsu/monopoly/Card.java @@ -1,5 +1,5 @@ package edu.ncsu.monopoly; -//Prueba para comprobar funcionamiento de Github Actions +//PNueva acción maven public abstract class Card { public static final int TYPE_CHANCE = 1; From 8d34ba7dbe1e546d2b29753474c27441c2501329 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 14:52:26 +0200 Subject: [PATCH 08/19] subido --- .github/workflow/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflow/build.yml b/.github/workflow/build.yml index 819dd38f..265fc384 100644 --- a/.github/workflow/build.yml +++ b/.github/workflow/build.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ No newline at end of file + run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file From a14f6576290e9cd6a527f214b7f1dbabf4e92811 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 14:58:13 +0200 Subject: [PATCH 09/19] =?UTF-8?q?A=C3=B1adido=20-D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflow/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflow/build.yml b/.github/workflow/build.yml index 265fc384..d07fac1f 100644 --- a/.github/workflow/build.yml +++ b/.github/workflow/build.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file + run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file From f05e2c21f24e9143e94cf39d150abdc9fa0b5663 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:04:00 +0200 Subject: [PATCH 10/19] install org.jacoco:jacoco-maven-plugin:report --- .github/workflow/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflow/build.yml b/.github/workflow/build.yml index d07fac1f..b835af90 100644 --- a/.github/workflow/build.yml +++ b/.github/workflow/build.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file + run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report \ No newline at end of file From ca333b883aa545b9475978fea2cb773ce5b242f2 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:14:03 +0200 Subject: [PATCH 11/19] workflow NO es workflows --- .github/workflow/build.yml | 2 +- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflow/build.yml b/.github/workflow/build.yml index b835af90..d07fac1f 100644 --- a/.github/workflow/build.yml +++ b/.github/workflow/build.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report \ No newline at end of file + run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..d07fac1f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file From 6433b10c2589d8c4b4873289b2671bcb59b2a4ed Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:16:00 +0200 Subject: [PATCH 12/19] Eliminado wrokflow --- .github/workflow/build.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .github/workflow/build.yml diff --git a/.github/workflow/build.yml b/.github/workflow/build.yml deleted file mode 100644 index d07fac1f..00000000 --- a/.github/workflow/build.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build -on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened] -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Cache SonarCloud packages - uses: actions/cache@v1 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache Maven packages - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file From 22f3024e5096bab9b74dbf88a33a703ec5d7a106 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:22:52 +0200 Subject: [PATCH 13/19] Eliminada toda la carpeta .github --- .github/workflows/build.yml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index d07fac1f..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build -on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened] -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Cache SonarCloud packages - uses: actions/cache@v1 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache Maven packages - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file From f175a090ff161ee9fc5671f1bd933183a4aefac4 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:24:29 +0200 Subject: [PATCH 14/19] =?UTF-8?q?A=C3=B1adida=20carpeta=20.github=20comple?= =?UTF-8?q?ta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..d07fac1f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file From a5d847d13e6b58d2d2227f1443be744321d4fc63 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:34:58 +0200 Subject: [PATCH 15/19] parametrized in GUITradeDialog --- src/main/java/edu/ncsu/monopoly/GameMaster.java | 2 +- .../java/edu/ncsu/monopoly/gui/GUITradeDialog.java | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/edu/ncsu/monopoly/GameMaster.java b/src/main/java/edu/ncsu/monopoly/GameMaster.java index f7eb8244..e211355d 100644 --- a/src/main/java/edu/ncsu/monopoly/GameMaster.java +++ b/src/main/java/edu/ncsu/monopoly/GameMaster.java @@ -12,7 +12,7 @@ public class GameMaster { private GameBoard gameBoard; private MonopolyGUI gui; private int initAmountOfMoney; - private ArrayList players = new ArrayList(); + private ArrayList players = new ArrayList<>(); private int turn = 0; private int utilDiceRoll; private boolean testMode; diff --git a/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java b/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java index aae46d01..b1bc39f8 100644 --- a/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java +++ b/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java @@ -14,12 +14,10 @@ import javax.swing.JLabel; import edu.ncsu.monopoly.*; -import edu.ncsu.monopoly.TradeDeal; -import edu.ncsu.monopoly.TradeDialog; public class GUITradeDialog extends JDialog implements TradeDialog { private JButton btnOK, btnCancel; - private JComboBox cboSellers, cboProperties; + private JComboBox cboSellers, cboProperties; private TradeDeal deal; private JTextField txtAmount; @@ -28,8 +26,8 @@ public GUITradeDialog(Frame parent) { super(parent); setTitle("Trade Property"); - cboSellers = new JComboBox(); - cboProperties = new JComboBox(); + cboSellers = new JComboBox<>(); + cboProperties = new JComboBox<>(); txtAmount = new JTextField(); btnOK = new JButton("OK"); btnCancel = new JButton("Cancel"); @@ -91,9 +89,9 @@ public void actionPerformed(ActionEvent e) { } private void buildSellersCombo() { - List sellers = GameMaster.instance().getSellerList(); - for (Iterator iter = sellers.iterator(); iter.hasNext();) { - Player player = (Player) iter.next(); + List sellers = GameMaster.instance().getSellerList(); + for (Iterator iter = sellers.iterator(); iter.hasNext();) { + Player player = iter.next(); //(Player) cboSellers.addItem(player); } if(sellers.size() > 0) { From 0572e8c415af85b77c0133716a92dc90e46cec29 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:40:48 +0200 Subject: [PATCH 16/19] Nuevas correcciones paremetrized Player y Cell --- src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java b/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java index b1bc39f8..4b94bb3c 100644 --- a/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java +++ b/src/main/java/edu/ncsu/monopoly/gui/GUITradeDialog.java @@ -17,7 +17,8 @@ public class GUITradeDialog extends JDialog implements TradeDialog { private JButton btnOK, btnCancel; - private JComboBox cboSellers, cboProperties; + private JComboBox cboSellers; + private JComboBox cboProperties; private TradeDeal deal; private JTextField txtAmount; From fe15cafe337bab62be0faf5f6e140b9b5cec2a7c Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 15:47:24 +0200 Subject: [PATCH 17/19] Unnecessary cast eliminated --- src/main/java/edu/ncsu/monopoly/GameMaster.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/edu/ncsu/monopoly/GameMaster.java b/src/main/java/edu/ncsu/monopoly/GameMaster.java index e211355d..1186fe5d 100644 --- a/src/main/java/edu/ncsu/monopoly/GameMaster.java +++ b/src/main/java/edu/ncsu/monopoly/GameMaster.java @@ -166,17 +166,17 @@ public int getNumberOfSellers() { } public Player getPlayer(int index) { - return (Player)players.get(index); + return players.get(index); //(Player) } public int getPlayerIndex(Player player) { return players.indexOf(player); } - public ArrayList getSellerList() { - ArrayList sellers = new ArrayList(); - for (Iterator iter = players.iterator(); iter.hasNext();) { - Player player = (Player) iter.next(); + public ArrayList getSellerList() { + ArrayList sellers = new ArrayList<>(); + for (Iterator iter = players.iterator(); iter.hasNext();) { + Player player = iter.next(); //(Player) if(player != getCurrentPlayer()) sellers.add(player); } return sellers; @@ -191,7 +191,7 @@ public int getUtilDiceRoll() { } public void movePlayer(int playerIndex, int diceValue) { - Player player = (Player)players.get(playerIndex); + Player player = players.get(playerIndex); //(Player) movePlayer(player, diceValue); } @@ -227,7 +227,7 @@ public void playerMoved(Player player) { public void reset() { for(int i = 0; i < getNumberOfPlayers(); i++){ - Player player = (Player)players.get(i); + Player player = players.get(i); //(Player) player.setPosition(gameBoard.getCell(0)); } if(gameBoard != null) gameBoard.removeCards(); From 7362a492ce6f37c6d3d17d5f3784796d80ae109b Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 18:44:06 +0200 Subject: [PATCH 18/19] yml initial &more Bad Smell updated --- .github/workflows/build.yml | 2 +- src/main/java/edu/ncsu/monopoly/RailRoadCell.java | 2 +- src/main/java/edu/ncsu/monopoly/gui/MainWindow.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d07fac1f..029bf701 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file + run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=MonopolyCI \ No newline at end of file diff --git a/src/main/java/edu/ncsu/monopoly/RailRoadCell.java b/src/main/java/edu/ncsu/monopoly/RailRoadCell.java index fe5d9ec2..3ecea578 100644 --- a/src/main/java/edu/ncsu/monopoly/RailRoadCell.java +++ b/src/main/java/edu/ncsu/monopoly/RailRoadCell.java @@ -18,7 +18,7 @@ public int getPrice() { } public int getRent() { - return RailRoadCell.baseRent * (int)Math.pow(2, owner.numberOfRR() - 1); + return RailRoadCell.baseRent * (int)Math.pow(2, owner.numberOfRR() - 1.0); } public void playAction() { diff --git a/src/main/java/edu/ncsu/monopoly/gui/MainWindow.java b/src/main/java/edu/ncsu/monopoly/gui/MainWindow.java index 86f87277..d5301a4d 100644 --- a/src/main/java/edu/ncsu/monopoly/gui/MainWindow.java +++ b/src/main/java/edu/ncsu/monopoly/gui/MainWindow.java @@ -118,8 +118,8 @@ public boolean isTradeButtonEnabled(int i) { public void movePlayer(int index, int from, int to) { GUICell fromCell = queryCell(from); GUICell toCell = queryCell(to); - fromCell.removePlayer(index); - toCell.addPlayer(index); + if (fromCell!=null) fromCell.removePlayer(index); + if (toCell!=null) toCell.addPlayer(index); } public RespondDialog openRespondDialog(TradeDeal deal) { From b41f0b81fe9a53d399a031952c0a7ec09c058345 Mon Sep 17 00:00:00 2001 From: Maite Date: Thu, 2 Sep 2021 18:46:18 +0200 Subject: [PATCH 19/19] =?UTF-8?q?mvn=20con=20clean=20install=20y=20dem?= =?UTF-8?q?=C3=A1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 029bf701..d07fac1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,4 +33,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=MonopolyCI \ No newline at end of file + run: mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report install sonar:sonar \ No newline at end of file