Big refactoring

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:16:47 +03:00
parent a9f2c8c407
commit 076840df53
247 changed files with 1919 additions and 3682 deletions

View file

@ -37,8 +37,6 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
@ -210,7 +208,7 @@ public class Cards extends javax.swing.JPanel {
tmp.setIsAbility(true);
tmp.overrideTargets(card.getTargets());
tmp.overrideId(card.getId());
tmp.setAbilityType(((StackAbilityView) card).getAbilityType());
tmp.setAbilityType(card.getAbilityType());
card = tmp;
} else {
card.setAbilityType(null);
@ -258,7 +256,7 @@ public class Cards extends javax.swing.JPanel {
this.cardDimension = dimension;
for (Component component : cardArea.getComponents()) {
if (component instanceof CardPanel) {
((CardPanel) component).setBounds(0, 0, dimension.width, dimension.height);
component.setBounds(0, 0, dimension.width, dimension.height);
}
}
layoutCards();
@ -358,12 +356,7 @@ public class Cards extends javax.swing.JPanel {
}
}
// sort the cards
Collections.sort(cardsToLayout, new Comparator<CardPanel>() {
@Override
public int compare(CardPanel cp1, CardPanel cp2) {
return Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x);
}
});
cardsToLayout.sort((cp1, cp2) -> Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x));
// relocate the cards
int dx = 0;
for (Component component : cardsToLayout) {