Big refactoring (server)

I used Intellij IDEA to automatically refactor code to achive 3 goals.
1) get rid of anonymouse classes, and replace the with lamba to get more readeable and clean code (like in TableWaitingDialog).
2) make effectively final  variables actually final to avoid inadvertent changes on it in further releases and keep objects as immutable, as possible.
3)  Get rid of unused imports (most of the changes) in whole project classes.
This commit is contained in:
vraskulin 2017-01-09 19:47:03 +03:00
parent 076840df53
commit 46d369c8ed
31 changed files with 510 additions and 822 deletions

View file

@ -73,16 +73,13 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
private final ConcurrentHashMap<UUID, Table> tables = new ConcurrentHashMap<>();
public GamesRoomImpl() {
UPDATE_EXECUTOR.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
update();
} catch (Exception ex) {
LOGGER.fatal("Games room update exception! " + ex.toString(), ex);
}
UPDATE_EXECUTOR.scheduleAtFixedRate(() -> {
try {
update();
} catch (Exception ex) {
LOGGER.fatal("Games room update exception! " + ex.toString(), ex);
}
}, 2, 2, TimeUnit.SECONDS);
}
@ -95,7 +92,7 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
ArrayList<TableView> tableList = new ArrayList<>();
ArrayList<MatchView> matchList = new ArrayList<>();
List<Table> allTables = new ArrayList<>(tables.values());
Collections.sort(allTables, new TableListSorter());
allTables.sort(new TableListSorter());
for (Table table : allTables) {
if (table.getState() != TableState.FINISHED) {
tableList.add(new TableView(table));
@ -136,7 +133,7 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
}
}
Collections.sort(users, new UserNameSorter());
users.sort(new UserNameSorter());
List<RoomUsersView> roomUserInfo = new ArrayList<>();
roomUserInfo.add(new RoomUsersView(users,
GameManager.getInstance().getNumberActiveGames(),