Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent f054bd699b
commit e94a0cfccf
497 changed files with 7865 additions and 6908 deletions
+21 -11
View File
@@ -58,11 +58,11 @@ import com.google.common.collect.SetMultimap;
public class GridStorageCache implements IStorageGrid
{
public final IGrid myGrid;
final HashSet<ICellProvider> activeCellProviders = new HashSet<ICellProvider>();
final HashSet<ICellProvider> inactiveCellProviders = new HashSet<ICellProvider>();
private final IGrid myGrid;
private final HashSet<ICellProvider> activeCellProviders = new HashSet<ICellProvider>();
private final HashSet<ICellProvider> inactiveCellProviders = new HashSet<ICellProvider>();
private final SetMultimap<IAEStack, ItemWatcher> interests = HashMultimap.create();
public final GenericInterestManager<ItemWatcher> interestManager = new GenericInterestManager<ItemWatcher>( this.interests );
private final GenericInterestManager<ItemWatcher> interestManager = new GenericInterestManager<ItemWatcher>( this.interests );
private final NetworkMonitor<IAEItemStack> itemMonitor = new NetworkMonitor<IAEItemStack>( this, StorageChannel.ITEMS );
private final NetworkMonitor<IAEFluidStack> fluidMonitor = new NetworkMonitor<IAEFluidStack>( this, StorageChannel.FLUIDS );
private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<IGridNode, IStackWatcher>();
@@ -88,7 +88,7 @@ public class GridStorageCache implements IStorageGrid
{
final ICellContainer cc = (ICellContainer) machine;
this.myGrid.postEvent( new MENetworkCellArrayUpdate() );
this.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.removeCellProvider( cc, new CellChangeTracker() ).applyChanges();
this.inactiveCellProviders.remove( cc );
}
@@ -112,7 +112,7 @@ public class GridStorageCache implements IStorageGrid
final ICellContainer cc = (ICellContainer) machine;
this.inactiveCellProviders.add( cc );
this.myGrid.postEvent( new MENetworkCellArrayUpdate() );
this.getGrid().postEvent( new MENetworkCellArrayUpdate() );
if( node.isActive() )
{
this.addCellProvider( cc, new CellChangeTracker() ).applyChanges();
@@ -146,7 +146,7 @@ public class GridStorageCache implements IStorageGrid
}
public CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
{
if( this.inactiveCellProviders.contains( cc ) )
{
@@ -173,7 +173,7 @@ public class GridStorageCache implements IStorageGrid
return tracker;
}
public CellChangeTracker removeCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
private CellChangeTracker removeCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
{
if( this.activeCellProviders.contains( cc ) )
{
@@ -259,7 +259,7 @@ public class GridStorageCache implements IStorageGrid
}
}
public IMEInventoryHandler<IAEItemStack> getItemInventoryHandler()
IMEInventoryHandler<IAEItemStack> getItemInventoryHandler()
{
if( this.myItemNetwork == null )
{
@@ -270,7 +270,7 @@ public class GridStorageCache implements IStorageGrid
private void buildNetworkStorage( final StorageChannel chan )
{
final SecurityCache security = this.myGrid.getCache( ISecurityGrid.class );
final SecurityCache security = this.getGrid().getCache( ISecurityGrid.class );
switch( chan )
{
@@ -298,7 +298,7 @@ public class GridStorageCache implements IStorageGrid
}
}
public IMEInventoryHandler<IAEFluidStack> getFluidInventoryHandler()
IMEInventoryHandler<IAEFluidStack> getFluidInventoryHandler()
{
if( this.myFluidNetwork == null )
{
@@ -346,6 +346,16 @@ public class GridStorageCache implements IStorageGrid
return this.fluidMonitor;
}
public GenericInterestManager<ItemWatcher> getInterestManager()
{
return this.interestManager;
}
IGrid getGrid()
{
return this.myGrid;
}
private class CellChangeTrackerRecord
{