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
@@ -38,9 +38,9 @@ import appeng.util.inv.ItemListIgnoreCrafting;
public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T> implements IMEMonitor<T>, IMEMonitorHandlerReceiver<T>
{
final HashMap<IMEMonitorHandlerReceiver<T>, Object> listeners = new HashMap<IMEMonitorHandlerReceiver<T>, Object>();
public BaseActionSource changeSource;
IMEMonitor<T> monitor;
private final HashMap<IMEMonitorHandlerReceiver<T>, Object> listeners = new HashMap<IMEMonitorHandlerReceiver<T>, Object>();
private BaseActionSource changeSource;
private IMEMonitor<T> monitor;
public MEMonitorPassThrough( final IMEInventory<T> i, final StorageChannel channel )
{
@@ -60,7 +60,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
this.monitor = null;
final IItemList<T> before = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
final IItemList<T> before = this.getInternal() == null ? this.getWrappedChannel().createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.getWrappedChannel().createList() ) );
super.setInternal( i );
if( i instanceof IMEMonitor )
@@ -68,14 +68,14 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
this.monitor = (IMEMonitor<T>) i;
}
final IItemList<T> after = this.getInternal() == null ? this.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
final IItemList<T> after = this.getInternal() == null ? this.getWrappedChannel().createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.getWrappedChannel().createList() ) );
if( this.monitor != null )
{
this.monitor.addListener( this, this.monitor );
}
Platform.postListChanges( before, after, this, this.changeSource );
Platform.postListChanges( before, after, this, this.getChangeSource() );
}
@Override
@@ -102,7 +102,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
{
if( this.monitor == null )
{
final IItemList<T> out = this.channel.createList();
final IItemList<T> out = this.getWrappedChannel().createList();
this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( out ) );
return out;
}
@@ -152,4 +152,14 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
}
}
private BaseActionSource getChangeSource()
{
return this.changeSource;
}
public void setChangeSource( final BaseActionSource changeSource )
{
this.changeSource = changeSource;
}
}