Skip to content

Commit

Permalink
Merge pull request #17 from BME-MIT-IET/fixes
Browse files Browse the repository at this point in the history
Refactoring and fixes
  • Loading branch information
voroscsoki authored May 22, 2024
2 parents d2769ea + 5824aa4 commit 3f5ddc6
Show file tree
Hide file tree
Showing 33 changed files with 192 additions and 192 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ name: SonarCloud
on:
push:
branches:
- main
- Manuális-és-statikus-ellenőrzés
- Sonar-Fixes
- maven
- '**'
pull_request:
types: [opened, synchronize, reopened]
jobs:
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/Drawing/CisternDraw.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main.java.Drawing;

import main.java.Controll.ViewGame;
package main.java.drawing;

import javax.swing.*;

import main.java.control.ViewGame;

import java.awt.*;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Drawing/Drawable.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main.java.Drawing;
package main.java.drawing;

import javax.swing.*;
import java.awt.*;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/Drawing/MechanicDraw.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package main.java.Drawing;
package main.java.drawing;

import main.java.Controll.Controller;
import main.java.Controll.ViewGame;
import main.java.Fields.ActiveFields.Cistern;
import main.java.Fields.ActiveFields.Pump;
import main.java.Fields.ActiveFields.Spring;
import main.java.Fields.Field;
import main.java.Fields.Pipe;
import main.java.Players.Mechanic;
import main.java.Players.Player;
import main.java.control.Controller;
import main.java.control.ViewGame;
import main.java.fields.Field;
import main.java.fields.Pipe;
import main.java.fields.activefields.Cistern;
import main.java.fields.activefields.Pump;
import main.java.fields.activefields.Spring;
import main.java.players.Mechanic;
import main.java.players.Player;

import javax.swing.*;
import java.awt.*;
Expand Down Expand Up @@ -40,7 +40,7 @@ public MechanicDraw(int tmpX, int tmpY) {
@Override
public void Draw(JPanel panel, Graphics2D g) {
Mechanic m = (Mechanic)ViewGame.objectDrawNames.get(this);
Player current = Controller.GetActivePlayer();
Player current = Controller.getActivePlayer();
mecName = Controller.objectReverseNames.get(m);
mec.setText(mecName);
Field f = m.getStandingField();
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/Drawing/PipeDraw.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main.java.Drawing;

import main.java.Controll.ViewGame;
package main.java.drawing;

import javax.swing.*;

import main.java.control.ViewGame;

import java.awt.*;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/Drawing/PumpDraw.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main.java.Drawing;
package main.java.drawing;

import main.java.Controll.ViewGame;
import main.java.Fields.ActiveFields.Pump;
import main.java.control.ViewGame;
import main.java.fields.activefields.Pump;

import javax.swing.*;
import java.awt.*;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/Drawing/SaboteurDraw.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package main.java.Drawing;
package main.java.drawing;

import main.java.Controll.Controller;
import main.java.Controll.ViewGame;
import main.java.Fields.ActiveFields.Cistern;
import main.java.Fields.ActiveFields.Pump;
import main.java.Fields.ActiveFields.Spring;
import main.java.Fields.Field;
import main.java.Fields.Pipe;
import main.java.Players.Player;
import main.java.Players.Saboteur;
import main.java.control.Controller;
import main.java.control.ViewGame;
import main.java.fields.Field;
import main.java.fields.Pipe;
import main.java.fields.activefields.Cistern;
import main.java.fields.activefields.Pump;
import main.java.fields.activefields.Spring;
import main.java.players.Player;
import main.java.players.Saboteur;

import javax.swing.*;
import java.awt.*;
Expand Down Expand Up @@ -42,7 +42,7 @@ public SaboteurDraw(int tmpX, int tmpY) {
@Override
public void Draw(JPanel panel, Graphics2D g) {
Saboteur s = (Saboteur)ViewGame.objectDrawNames.get(this);
Player current = Controller.GetActivePlayer();
Player current = Controller.getActivePlayer();
sabName = Controller.objectReverseNames.get(s);
sab.setText(sabName);
Field f = s.getStandingField();
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/Drawing/SpringDraw.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main.java.Drawing;

import main.java.Controll.ViewGame;
package main.java.drawing;

import javax.swing.*;

import main.java.control.ViewGame;

import java.awt.*;

public class SpringDraw extends Drawable {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Enums/Fluid.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main.java.Enums;
package main.java.enums;

public enum Fluid {
DRY, STICKY, SLIPPERY
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/Fields/ActiveFields/ActiveFields.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main.java.Fields.ActiveFields;
package main.java.fields.activefields;

import main.java.Fields.Field;
import main.java.Fields.Pipe;
import main.java.Players.Player;
import main.java.fields.Field;
import main.java.fields.Pipe;
import main.java.players.Player;

import java.util.ArrayList;

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/Fields/ActiveFields/Cistern.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main.java.Fields.ActiveFields;
package main.java.fields.activefields;

import main.java.Controll.Controller;
import main.java.Fields.Pipe;
import main.java.Players.Player;
import main.java.StringResource.StringResourceController;
import main.java.control.Controller;
import main.java.fields.Pipe;
import main.java.players.Player;
import main.java.stringresource.StringResourceController;

import java.util.ArrayList;
import java.util.Random;
Expand Down Expand Up @@ -84,10 +84,10 @@ public Pipe pickUpPipe() {
@Override
public String toString() {
ArrayList<Player> players = this.getPlayers();
String playerBuilder = StringResourceController.stingBuilder(players);
String playerBuilder = StringResourceController.stringBuilder(players);

ArrayList<Pipe> pipes = this.getPipes();
String pipeBuilder = StringResourceController.stingBuilder(pipes);
String pipeBuilder = StringResourceController.stringBuilder(pipes);

return "name: "+ Controller.objectReverseNames.get(this)
+ "\noccupied: " + this.isOccupied()
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/Fields/ActiveFields/Pump.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main.java.Fields.ActiveFields;
package main.java.fields.activefields;

import main.java.Controll.Controller;
import main.java.Fields.Pipe;
import main.java.Players.Player;
import main.java.StringResource.StringResourceController;
import main.java.control.Controller;
import main.java.fields.Pipe;
import main.java.players.Player;
import main.java.stringresource.StringResourceController;

import java.util.ArrayList;
import java.util.Random;
Expand Down Expand Up @@ -156,12 +156,12 @@ public String toString() {

private String getPlayerNames() {
ArrayList<Player> players = this.getPlayers();
return StringResourceController.stingBuilder(players);
return StringResourceController.stringBuilder(players);
}


private String getPipeNames(){
ArrayList<Pipe> pipes = this.getPipes();
return StringResourceController.stingBuilder(pipes);
return StringResourceController.stringBuilder(pipes);
}
}
14 changes: 7 additions & 7 deletions src/main/java/Fields/ActiveFields/Spring.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main.java.Fields.ActiveFields;
package main.java.fields.activefields;

import main.java.Controll.Controller;
import main.java.Fields.Pipe;
import main.java.Players.Player;
import main.java.StringResource.StringResourceController;
import main.java.control.Controller;
import main.java.fields.Pipe;
import main.java.players.Player;
import main.java.stringresource.StringResourceController;

import java.util.ArrayList;

Expand Down Expand Up @@ -61,11 +61,11 @@ public void step() {
@Override
public String toString() {
ArrayList<Player> players = this.getPlayers();
String playerBuilder = StringResourceController.stingBuilder(players);
String playerBuilder = StringResourceController.stringBuilder(players);


ArrayList<Pipe> pipes = this.getPipes();
String pipeBuilder = StringResourceController.stingBuilder(pipes);
String pipeBuilder = StringResourceController.stringBuilder(pipes);

return "name: "+ Controller.objectReverseNames.get(this)
+ "\noccupied: " + this.isOccupied()
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/Fields/Field.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main.java.Fields;
package main.java.fields;

import main.java.Fields.ActiveFields.ActiveFields;
import main.java.Fields.ActiveFields.Pump;
import main.java.Interfaces.Steppable;
import main.java.Players.Player;
import main.java.fields.activefields.ActiveFields;
import main.java.fields.activefields.Pump;
import main.java.interfaces.Steppable;
import main.java.players.Player;

import java.util.ArrayList;

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/Fields/Pipe.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main.java.Fields;
package main.java.fields;

import main.java.Controll.Controller;
import main.java.Enums.Fluid;
import main.java.Fields.ActiveFields.ActiveFields;
import main.java.Fields.ActiveFields.Pump;
import main.java.Players.Player;
import main.java.StringResource.StringResourceController;
import main.java.control.Controller;
import main.java.enums.Fluid;
import main.java.fields.activefields.ActiveFields;
import main.java.fields.activefields.Pump;
import main.java.players.Player;
import main.java.stringresource.StringResourceController;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -342,10 +342,10 @@ public void step(){
@Override
public String toString() {
ArrayList<Player> players = this.getPlayers();
String playerBuilder = StringResourceController.stingBuilder(players);
String playerBuilder = StringResourceController.stringBuilder(players);

List<ActiveFields> localFields = this.getFields();
String fieldBuilder = StringResourceController.stingBuilder(localFields);
String fieldBuilder = StringResourceController.stringBuilder(localFields);
return "name: " + Controller.objectReverseNames.get(this)
+ "\noccupied: " + this.isOccupied()
+ "\nwater: " + getWaterNoChange()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Interfaces/Steppable.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main.java.Interfaces;
package main.java.interfaces;

/**
* Steppable interface.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/Players/Mechanic.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main.java.Players;
package main.java.players;

import main.java.Controll.Controller;
import main.java.Fields.ActiveFields.ActiveFields;
import main.java.Fields.ActiveFields.Pump;
import main.java.Fields.Pipe;
import main.java.control.Controller;
import main.java.fields.Pipe;
import main.java.fields.activefields.ActiveFields;
import main.java.fields.activefields.Pump;


/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/Players/Player.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main.java.Players;
package main.java.players;

import main.java.Fields.ActiveFields.Pump;
import main.java.Fields.Field;
import main.java.Fields.Pipe;
import main.java.fields.Field;
import main.java.fields.Pipe;
import main.java.fields.activefields.Pump;

/**
* Abstract class for the players.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/Players/Saboteur.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main.java.Players;
package main.java.players;

import main.java.Controll.Controller;
import main.java.control.Controller;


/**
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/StringResource/StringResourceController.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package main.java.StringResource;

import main.java.Controll.Controller;
package main.java.stringresource;

import java.util.List;

import main.java.control.Controller;

public final class StringResourceController {
private StringResourceController(){}
public static final String FALSE = "false";
public static final String FILE_NOT_FOUND = "File not found";
public static final String WRONG_PLAYER = "Nem te vagy a soron következő játékos!";
public static final String WRONG_ACTION = "Sikertelen művelet";
public static final String INVALID_ACTION = "A műveletet nem lehet végrehajtani";
public static final String GOOD_ACTION = "Sikeres művelet";
public static final String WATER = "water";
public static final String RANDOM_ON = "A véletlen események be lettek kapcsolva.";
public static final String INVALID_ACTION = "A műveletet nem lehet végrehajtani";

public static String stingBuilder(List collection){
public static String stringBuilder(List<?> collection){
StringBuilder builder = new StringBuilder("null");
if(collection != null) {
for (int i = 0; i < collection.size(); i++) {
Expand Down
Loading

0 comments on commit 3f5ddc6

Please sign in to comment.