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
@@ -62,23 +62,23 @@ import appeng.util.Platform;
public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPriorityHost
{
final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
final ICellHandler[] handlersBySlot = new ICellHandler[10];
final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
final BaseActionSource mySrc;
boolean isCached = false;
List<MEInventoryHandler> items = new LinkedList<MEInventoryHandler>();
List<MEInventoryHandler> fluids = new LinkedList<MEInventoryHandler>();
long lastStateChange = 0;
int state = 0;
int priority = 0;
boolean wasActive = false;
private final int[] sides = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 10 );
private final ICellHandler[] handlersBySlot = new ICellHandler[10];
private final DriveWatcher<IAEItemStack>[] invBySlot = new DriveWatcher[10];
private final BaseActionSource mySrc;
private boolean isCached = false;
private List<MEInventoryHandler> items = new LinkedList<MEInventoryHandler>();
private List<MEInventoryHandler> fluids = new LinkedList<MEInventoryHandler>();
private long lastStateChange = 0;
private int state = 0;
private int priority = 0;
private boolean wasActive = false;
public TileDrive()
{
this.mySrc = new MachineSource( this );
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
}
@TileEvent( TileEventType.NETWORK_WRITE )
@@ -93,7 +93,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.state &= 0x24924924; // just keep the blinks...
}
if( this.gridProxy.isActive() )
if( this.getProxy().isActive() )
{
this.state |= 0x80000000;
}
@@ -160,7 +160,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return ( this.state & 0x80000000 ) == 0x80000000;
}
return this.gridProxy.isActive();
return this.getProxy().isActive();
}
@Override
@@ -206,7 +206,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
private void recalculateDisplay()
{
final boolean currentActive = this.gridProxy.isActive();
final boolean currentActive = this.getProxy().isActive();
if( currentActive )
{
this.state |= 0x80000000;
@@ -221,7 +221,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.wasActive = currentActive;
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{
@@ -282,9 +282,9 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
final IStorageGrid gs = this.gridProxy.getStorage();
final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc );
}
catch( final GridAccessException ignored )
@@ -300,7 +300,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return this.sides;
}
public void updateState()
private void updateState()
{
if( !this.isCached )
{
@@ -350,7 +350,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
}
this.gridProxy.setIdlePowerUsage( power );
this.getProxy().setIdlePowerUsage( power );
this.isCached = true;
}
@@ -366,7 +366,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
if( this.gridProxy.isActive() )
if( this.getProxy().isActive() )
{
this.updateState();
return (List) ( channel == StorageChannel.ITEMS ? this.items : this.fluids );
@@ -391,7 +391,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try
{
this.gridProxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
}
catch( final GridAccessException e )
{