Make fields final if possible to ensure immutability

This commit is contained in:
thatsIch
2014-09-29 09:54:34 +02:00
parent 35f6c84d9f
commit 474596f095
261 changed files with 607 additions and 597 deletions
+8 -8
View File
@@ -68,19 +68,19 @@ import com.google.common.collect.SetMultimap;
public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper, ICellProvider, IMEInventoryHandler
{
HashSet<CraftingCPUCluster> cpuClusters = new HashSet<CraftingCPUCluster>();
HashSet<ICraftingProvider> providers = new HashSet<ICraftingProvider>();
final HashSet<CraftingCPUCluster> cpuClusters = new HashSet<CraftingCPUCluster>();
final HashSet<ICraftingProvider> providers = new HashSet<ICraftingProvider>();
private HashMap<IGridNode, ICraftingWatcher> watchers = new HashMap<IGridNode, ICraftingWatcher>();
private final HashMap<IGridNode, ICraftingWatcher> watchers = new HashMap<IGridNode, ICraftingWatcher>();
IGrid grid;
final IGrid grid;
IStorageGrid sg;
IEnergyGrid eg;
HashMap<ICraftingPatternDetails, List<ICraftingMedium>> craftingMethods = new HashMap<ICraftingPatternDetails, List<ICraftingMedium>>();
final HashMap<ICraftingPatternDetails, List<ICraftingMedium>> craftingMethods = new HashMap<ICraftingPatternDetails, List<ICraftingMedium>>();
HashMap<IAEItemStack, ImmutableList<ICraftingPatternDetails>> craftableItems = new HashMap<IAEItemStack, ImmutableList<ICraftingPatternDetails>>();
HashSet<IAEItemStack> emitableItems = new HashSet<IAEItemStack>();
HashMap<String, CraftingLinkNexus> links = new HashMap<String, CraftingLinkNexus>();
final HashSet<IAEItemStack> emitableItems = new HashSet<IAEItemStack>();
final HashMap<String, CraftingLinkNexus> links = new HashMap<String, CraftingLinkNexus>();
boolean updateList = false;
final private SetMultimap<IAEStack, CraftingWatcher> interests = HashMultimap.create();
@@ -287,7 +287,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
details.add( medium );
}
static Comparator<ICraftingPatternDetails> comp = new Comparator<ICraftingPatternDetails>(){
static final Comparator<ICraftingPatternDetails> comp = new Comparator<ICraftingPatternDetails>(){
@Override
public int compare(ICraftingPatternDetails o1,
ICraftingPatternDetails o2) {
+4 -4
View File
@@ -46,12 +46,12 @@ public class GridStorageCache implements IStorageGrid
final public IGrid myGrid;
private NetworkInventoryHandler<IAEItemStack> myItemNetwork;
private NetworkMonitor<IAEItemStack> itemMonitor = new NetworkMonitor<IAEItemStack>( this, StorageChannel.ITEMS );
private final NetworkMonitor<IAEItemStack> itemMonitor = new NetworkMonitor<IAEItemStack>( this, StorageChannel.ITEMS );
private NetworkInventoryHandler<IAEFluidStack> myFluidNetwork;
private NetworkMonitor<IAEFluidStack> fluidMonitor = new NetworkMonitor<IAEFluidStack>( this, StorageChannel.FLUIDS );
private final NetworkMonitor<IAEFluidStack> fluidMonitor = new NetworkMonitor<IAEFluidStack>( this, StorageChannel.FLUIDS );
private HashMap<IGridNode, IStackWatcher> watchers = new HashMap<IGridNode, IStackWatcher>();
private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<IGridNode, IStackWatcher>();
public GridStorageCache(IGrid g) {
myGrid = g;
@@ -95,7 +95,7 @@ public class GridStorageCache implements IStorageGrid
private class CellChangeTracker
{
List<CellChangeTrackerRecord> data = new LinkedList<CellChangeTrackerRecord>();
final List<CellChangeTrackerRecord> data = new LinkedList<CellChangeTrackerRecord>();
public void postChanges(StorageChannel channel, int i, IMEInventoryHandler<? extends IAEStack> h, BaseActionSource actionSrc)
{
+1 -1
View File
@@ -16,7 +16,7 @@ public class TickTracker implements Comparable<TickTracker>
public final IGridNode node;
public final TickManagerCache host;
public long LastFiveTicksTime = 0;
public final long LastFiveTicksTime = 0;
public long lastTick;
public int current_rate;
+2 -2
View File
@@ -8,8 +8,8 @@ import appeng.parts.p2p.PartP2PTunnel;
public class TunnelIterator<T extends PartP2PTunnel> implements Iterator<T>
{
Iterator<T> wrapped;
Class targetType;
final Iterator<T> wrapped;
final Class targetType;
T Next;
private void findNext()