final variables and parameters

This commit is contained in:
thatsIch
2015-09-30 14:24:40 +02:00
parent 059523f543
commit 8b3a954f73
732 changed files with 9253 additions and 9256 deletions
@@ -36,7 +36,7 @@ public class AEExternalHandler implements IExternalStorageHandler
{
@Override
public boolean canHandle( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource mySrc )
public boolean canHandle( final TileEntity te, final EnumFacing d, final StorageChannel channel, final BaseActionSource mySrc )
{
if( channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable )
{
@@ -47,7 +47,7 @@ public class AEExternalHandler implements IExternalStorageHandler
}
@Override
public IMEInventory getInventory( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource src )
public IMEInventory getInventory( final TileEntity te, final EnumFacing d, final StorageChannel channel, final BaseActionSource src )
{
if( te instanceof TileCondenser )
{
@@ -63,12 +63,12 @@ public class AEExternalHandler implements IExternalStorageHandler
if( te instanceof ITileStorageMonitorable )
{
ITileStorageMonitorable iface = (ITileStorageMonitorable) te;
IStorageMonitorable sm = iface.getMonitorable( d, src );
final ITileStorageMonitorable iface = (ITileStorageMonitorable) te;
final IStorageMonitorable sm = iface.getMonitorable( d, src );
if( channel == StorageChannel.ITEMS && sm != null )
{
IMEInventory<IAEItemStack> ii = sm.getItemInventory();
final IMEInventory<IAEItemStack> ii = sm.getItemInventory();
if( ii != null )
{
return ii;
@@ -77,7 +77,7 @@ public class AEExternalHandler implements IExternalStorageHandler
if( channel == StorageChannel.FLUIDS && sm != null )
{
IMEInventory<IAEFluidStack> fi = sm.getFluidInventory();
final IMEInventory<IAEFluidStack> fi = sm.getFluidInventory();
if( fi != null )
{
return fi;
@@ -67,13 +67,13 @@ public class CellInventory implements ICellInventory
protected ItemStack i;
protected IStorageCell cellType;
protected CellInventory( NBTTagCompound data, ISaveProvider container )
protected CellInventory( final NBTTagCompound data, final ISaveProvider container )
{
this.tagCompound = data;
this.container = container;
}
protected CellInventory( ItemStack o, ISaveProvider container ) throws AppEngException
protected CellInventory( final ItemStack o, final ISaveProvider container ) throws AppEngException
{
if( itemSlots == null )
{
@@ -95,7 +95,7 @@ public class CellInventory implements ICellInventory
this.cellType = null;
this.i = o;
Item type = this.i.getItem();
final Item type = this.i.getItem();
if( type instanceof IStorageCell )
{
this.cellType = (IStorageCell) this.i.getItem();
@@ -128,19 +128,19 @@ public class CellInventory implements ICellInventory
this.cellItems = null;
}
public static IMEInventoryHandler getCell( ItemStack o, ISaveProvider container2 )
public static IMEInventoryHandler getCell( final ItemStack o, final ISaveProvider container2 )
{
try
{
return new CellInventoryHandler( new CellInventory( o, container2 ) );
}
catch( AppEngException e )
catch( final AppEngException e )
{
return null;
}
}
private static boolean isStorageCell( ItemStack i )
private static boolean isStorageCell( final ItemStack i )
{
if( i == null )
{
@@ -149,13 +149,13 @@ public class CellInventory implements ICellInventory
try
{
Item type = i.getItem();
final Item type = i.getItem();
if( type instanceof IStorageCell )
{
return !( (IStorageCell) type ).storableInStorageCell();
}
}
catch( Throwable err )
catch( final Throwable err )
{
return true;
}
@@ -163,14 +163,14 @@ public class CellInventory implements ICellInventory
return false;
}
public static boolean isCell( ItemStack i )
public static boolean isCell( final ItemStack i )
{
if( i == null )
{
return false;
}
Item type = i.getItem();
final Item type = i.getItem();
if( type instanceof IStorageCell )
{
return ( (IStorageCell) type ).isStorageCell( i );
@@ -179,12 +179,12 @@ public class CellInventory implements ICellInventory
return false;
}
public static void addBasicBlackList( int itemID, int meta )
public static void addBasicBlackList( final int itemID, final int meta )
{
BLACK_LIST.add( ( meta << Platform.DEF_OFFSET ) | itemID );
}
public static boolean isBlackListed( IAEItemStack input )
public static boolean isBlackListed( final IAEItemStack input )
{
if( BLACK_LIST.contains( ( OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET ) | Item.getIdFromItem( input.getItem() ) ) )
{
@@ -193,13 +193,13 @@ public class CellInventory implements ICellInventory
return BLACK_LIST.contains( ( input.getItemDamage() << Platform.DEF_OFFSET ) | Item.getIdFromItem( input.getItem() ) );
}
private boolean isEmpty( IMEInventory meInventory )
private boolean isEmpty( final IMEInventory meInventory )
{
return meInventory.getAvailableItems( AEApi.instance().storage().createItemList() ).isEmpty();
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
{
if( input == null )
{
@@ -215,21 +215,21 @@ public class CellInventory implements ICellInventory
return input;
}
ItemStack sharedItemStack = input.getItemStack();
final ItemStack sharedItemStack = input.getItemStack();
if( CellInventory.isStorageCell( sharedItemStack ) )
{
IMEInventory meInventory = getCell( sharedItemStack, null );
final IMEInventory meInventory = getCell( sharedItemStack, null );
if( meInventory != null && !this.isEmpty( meInventory ) )
{
return input;
}
}
IAEItemStack l = this.getCellItems().findPrecise( input );
final IAEItemStack l = this.getCellItems().findPrecise( input );
if( l != null )
{
long remainingItemSlots = this.getRemainingItemCount();
final long remainingItemSlots = this.getRemainingItemCount();
if( remainingItemSlots < 0 )
{
return input;
@@ -237,7 +237,7 @@ public class CellInventory implements ICellInventory
if( input.getStackSize() > remainingItemSlots )
{
IAEItemStack r = input.copy();
final IAEItemStack r = input.copy();
r.setStackSize( r.getStackSize() - remainingItemSlots );
if( mode == Actionable.MODULATE )
{
@@ -261,16 +261,16 @@ public class CellInventory implements ICellInventory
if( this.canHoldNewItem() ) // room for new type, and for at least one item!
{
int remainingItemCount = (int) this.getRemainingItemCount() - this.getBytesPerType() * 8;
final int remainingItemCount = (int) this.getRemainingItemCount() - this.getBytesPerType() * 8;
if( remainingItemCount > 0 )
{
if( input.getStackSize() > remainingItemCount )
{
ItemStack toReturn = Platform.cloneItemStack( sharedItemStack );
final ItemStack toReturn = Platform.cloneItemStack( sharedItemStack );
toReturn.stackSize = sharedItemStack.stackSize - remainingItemCount;
if( mode == Actionable.MODULATE )
{
ItemStack toWrite = Platform.cloneItemStack( sharedItemStack );
final ItemStack toWrite = Platform.cloneItemStack( sharedItemStack );
toWrite.stackSize = remainingItemCount;
this.cellItems.add( AEItemStack.create( toWrite ) );
@@ -296,18 +296,18 @@ public class CellInventory implements ICellInventory
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
if( request == null )
{
return null;
}
long size = Math.min( Integer.MAX_VALUE, request.getStackSize() );
final long size = Math.min( Integer.MAX_VALUE, request.getStackSize() );
IAEItemStack Results = null;
IAEItemStack l = this.getCellItems().findPrecise( request );
final IAEItemStack l = this.getCellItems().findPrecise( request );
if( l != null )
{
Results = l.copy();
@@ -348,7 +348,7 @@ public class CellInventory implements ICellInventory
return this.cellItems;
}
private void updateItemCount( long delta )
private void updateItemCount( final long delta )
{
this.storedItemCount += delta;
this.tagCompound.setInteger( ITEM_COUNT_TAG, this.storedItemCount );
@@ -361,18 +361,18 @@ public class CellInventory implements ICellInventory
// add new pretty stuff...
int x = 0;
for( IAEItemStack v : this.cellItems )
for( final IAEItemStack v : this.cellItems )
{
itemCount += v.getStackSize();
NBTBase c = this.tagCompound.getTag( itemSlots[x] );
final NBTBase c = this.tagCompound.getTag( itemSlots[x] );
if( c instanceof NBTTagCompound )
{
v.writeToNBT( (NBTTagCompound) c );
}
else
{
NBTTagCompound g = new NBTTagCompound();
final NBTTagCompound g = new NBTTagCompound();
v.writeToNBT( g );
this.tagCompound.setTag( itemSlots[x], g );
}
@@ -388,7 +388,7 @@ public class CellInventory implements ICellInventory
// NBTBase tagType = tagCompound.getTag( ITEM_TYPE_TAG );
// NBTBase tagCount = tagCompound.getTag( ITEM_COUNT_TAG );
short oldStoredItems = this.storedItems;
final short oldStoredItems = this.storedItems;
/*
* if ( tagType instanceof NBTTagShort ) ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size();
@@ -439,11 +439,11 @@ public class CellInventory implements ICellInventory
this.cellItems.resetStatus(); // clears totals and stuff.
int types = (int) this.getStoredItemTypes();
final int types = (int) this.getStoredItemTypes();
for( int x = 0; x < types; x++ )
{
ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( itemSlots[x] ) );
final ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( itemSlots[x] ) );
if( t != null )
{
t.stackSize = this.tagCompound.getInteger( itemSlotCount[x] );
@@ -459,9 +459,9 @@ public class CellInventory implements ICellInventory
}
@Override
public IItemList getAvailableItems( IItemList out )
public IItemList getAvailableItems( final IItemList out )
{
for( IAEItemStack i : this.getCellItems() )
for( final IAEItemStack i : this.getCellItems() )
{
out.add( i );
}
@@ -514,7 +514,7 @@ public class CellInventory implements ICellInventory
@Override
public boolean canHoldNewItem()
{
long bytesFree = this.getFreeBytes();
final long bytesFree = this.getFreeBytes();
return ( bytesFree > this.getBytesPerType() || ( bytesFree == this.getBytesPerType() && this.getUnusedItemCount() > 0 ) ) && this.getRemainingItemTypes() > 0;
}
@@ -533,7 +533,7 @@ public class CellInventory implements ICellInventory
@Override
public long getUsedBytes()
{
long bytesForItemCount = ( this.getStoredItemCount() + this.getUnusedItemCount() ) / 8;
final long bytesForItemCount = ( this.getStoredItemCount() + this.getUnusedItemCount() ) / 8;
return this.getStoredItemTypes() * this.getBytesPerType() + bytesForItemCount;
}
@@ -558,22 +558,22 @@ public class CellInventory implements ICellInventory
@Override
public long getRemainingItemTypes()
{
long basedOnStorage = this.getFreeBytes() / this.getBytesPerType();
long baseOnTotal = this.getTotalItemTypes() - this.getStoredItemTypes();
final long basedOnStorage = this.getFreeBytes() / this.getBytesPerType();
final long baseOnTotal = this.getTotalItemTypes() - this.getStoredItemTypes();
return basedOnStorage > baseOnTotal ? baseOnTotal : basedOnStorage;
}
@Override
public long getRemainingItemCount()
{
long remaining = this.getFreeBytes() * 8 + this.getUnusedItemCount();
final long remaining = this.getFreeBytes() * 8 + this.getUnusedItemCount();
return remaining > 0 ? remaining : 0;
}
@Override
public int getUnusedItemCount()
{
int div = (int) ( this.getStoredItemCount() % 8 );
final int div = (int) ( this.getStoredItemCount() % 8 );
if( div == 0 )
{
@@ -42,28 +42,28 @@ import appeng.util.prioitylist.PrecisePriorityList;
public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> implements ICellInventoryHandler
{
CellInventoryHandler( IMEInventory c )
CellInventoryHandler( final IMEInventory c )
{
super( c, StorageChannel.ITEMS );
ICellInventory ci = this.getCellInv();
final ICellInventory ci = this.getCellInv();
if( ci != null )
{
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
IInventory upgrades = ci.getUpgradesInventory();
IInventory config = ci.getConfigInventory();
FuzzyMode fzMode = ci.getFuzzyMode();
final IInventory upgrades = ci.getUpgradesInventory();
final IInventory config = ci.getConfigInventory();
final FuzzyMode fzMode = ci.getFuzzyMode();
boolean hasInverter = false;
boolean hasFuzzy = false;
for( int x = 0; x < upgrades.getSizeInventory(); x++ )
{
ItemStack is = upgrades.getStackInSlot( x );
final ItemStack is = upgrades.getStackInSlot( x );
if( is != null && is.getItem() instanceof IUpgradeModule )
{
Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
final Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
if( u != null )
{
switch( u )
@@ -82,7 +82,7 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
for( int x = 0; x < config.getSizeInventory(); x++ )
{
ItemStack is = config.getStackInSlot( x );
final ItemStack is = config.getStackInSlot( x );
if( is != null )
{
priorityList.add( AEItemStack.create( is ) );
@@ -37,29 +37,29 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
final IItemList<IAEItemStack> itemListCache = AEApi.instance().storage().createItemList();
protected CreativeCellInventory( ItemStack o )
protected CreativeCellInventory( final ItemStack o )
{
CellConfig cc = new CellConfig( o );
for( ItemStack is : cc )
final CellConfig cc = new CellConfig( o );
for( final ItemStack is : cc )
{
if( is != null )
{
IAEItemStack i = AEItemStack.create( is );
final IAEItemStack i = AEItemStack.create( is );
i.setStackSize( Integer.MAX_VALUE );
this.itemListCache.add( i );
}
}
}
public static IMEInventoryHandler getCell( ItemStack o )
public static IMEInventoryHandler getCell( final ItemStack o )
{
return new CellInventoryHandler( new CreativeCellInventory( o ) );
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
{
IAEItemStack local = this.itemListCache.findPrecise( input );
final IAEItemStack local = this.itemListCache.findPrecise( input );
if( local == null )
{
return input;
@@ -69,9 +69,9 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
IAEItemStack local = this.itemListCache.findPrecise( request );
final IAEItemStack local = this.itemListCache.findPrecise( request );
if( local == null )
{
return null;
@@ -81,9 +81,9 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
for( IAEItemStack ais : this.itemListCache )
for( final IAEItemStack ais : this.itemListCache )
{
out.add( ais );
}
@@ -103,13 +103,13 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return this.itemListCache.findPrecise( input ) != null;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
return this.itemListCache.findPrecise( input ) != null;
}
@@ -127,7 +127,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -36,7 +36,7 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
final ICellHandler handler;
final IChestOrDrive cord;
public DriveWatcher( IMEInventory<T> i, ItemStack is, ICellHandler han, IChestOrDrive cod )
public DriveWatcher( final IMEInventory<T> i, final ItemStack is, final ICellHandler han, final IChestOrDrive cod )
{
super( i, i.getChannel() );
this.is = is;
@@ -45,15 +45,15 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( final T input, final Actionable type, final BaseActionSource src )
{
long size = input.getStackSize();
final long size = input.getStackSize();
T a = super.injectItems( input, type, src );
final T a = super.injectItems( input, type, src );
if( a == null || a.getStackSize() != size )
{
int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
final int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
if( newStatus != this.oldStatus )
{
@@ -65,13 +65,13 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
}
@Override
public T extractItems( T request, Actionable type, BaseActionSource src )
public T extractItems( final T request, final Actionable type, final BaseActionSource src )
{
T a = super.extractItems( request, type, src );
final T a = super.extractItems( request, type, src );
if( a != null )
{
int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
final int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
if( newStatus != this.oldStatus )
{
@@ -39,7 +39,7 @@ public class ItemWatcher implements IStackWatcher
final IStackWatcherHost myObject;
final HashSet<IAEStack> myInterests = new HashSet<IAEStack>();
public ItemWatcher( GridStorageCache cache, IStackWatcherHost host )
public ItemWatcher( final GridStorageCache cache, final IStackWatcherHost host )
{
this.gsc = cache;
this.myObject = host;
@@ -63,7 +63,7 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean contains( Object o )
public boolean contains( final Object o )
{
return this.myInterests.contains( o );
}
@@ -81,13 +81,13 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public <T> T[] toArray( T[] a )
public <T> T[] toArray( final T[] a )
{
return this.myInterests.toArray( a );
}
@Override
public boolean add( IAEStack e )
public boolean add( final IAEStack e )
{
if( this.myInterests.contains( e ) )
{
@@ -98,23 +98,23 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean remove( Object o )
public boolean remove( final Object o )
{
return this.myInterests.remove( o ) && this.gsc.interestManager.remove( (IAEStack) o, this );
}
@Override
public boolean containsAll( Collection<?> c )
public boolean containsAll( final Collection<?> c )
{
return this.myInterests.containsAll( c );
}
@Override
public boolean addAll( Collection<? extends IAEStack> c )
public boolean addAll( final Collection<? extends IAEStack> c )
{
boolean didChange = false;
for( IAEStack o : c )
for( final IAEStack o : c )
{
didChange = this.add( o ) || didChange;
}
@@ -123,10 +123,10 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean removeAll( Collection<?> c )
public boolean removeAll( final Collection<?> c )
{
boolean didSomething = false;
for( Object o : c )
for( final Object o : c )
{
didSomething = this.remove( o ) || didSomething;
}
@@ -134,10 +134,10 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean retainAll( Collection<?> c )
public boolean retainAll( final Collection<?> c )
{
boolean changed = false;
Iterator<IAEStack> i = this.iterator();
final Iterator<IAEStack> i = this.iterator();
while( i.hasNext() )
{
@@ -154,7 +154,7 @@ public class ItemWatcher implements IStackWatcher
@Override
public void clear()
{
Iterator<IAEStack> i = this.myInterests.iterator();
final Iterator<IAEStack> i = this.myInterests.iterator();
while( i.hasNext() )
{
this.gsc.interestManager.remove( i.next(), this );
@@ -169,7 +169,7 @@ public class ItemWatcher implements IStackWatcher
final Iterator<IAEStack> interestIterator;
IAEStack myLast;
public ItemWatcherIterator( ItemWatcher parent, Iterator<IAEStack> i )
public ItemWatcherIterator( final ItemWatcher parent, final Iterator<IAEStack> i )
{
this.watcher = parent;
this.interestIterator = i;
@@ -38,20 +38,20 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
protected final IInventory target;
protected final InventoryAdaptor adaptor;
public MEIInventoryWrapper( IInventory m, InventoryAdaptor ia )
public MEIInventoryWrapper( final IInventory m, final InventoryAdaptor ia )
{
this.target = m;
this.adaptor = ia;
}
@Override
public IAEItemStack injectItems( IAEItemStack iox, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack iox, final Actionable mode, final BaseActionSource src )
{
ItemStack input = iox.getItemStack();
final ItemStack input = iox.getItemStack();
if( this.adaptor != null )
{
ItemStack is = mode == Actionable.SIMULATE ? this.adaptor.simulateAdd( input ) : this.adaptor.addItems( input );
final ItemStack is = mode == Actionable.SIMULATE ? this.adaptor.simulateAdd( input ) : this.adaptor.addItems( input );
if( is == null )
{
return null;
@@ -59,17 +59,17 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
return AEItemStack.create( is );
}
ItemStack out = Platform.cloneItemStack( input );
final ItemStack out = Platform.cloneItemStack( input );
if( mode == Actionable.MODULATE ) // absolutely no need for a first run in simulate mode.
{
for( int x = 0; x < this.target.getSizeInventory(); x++ )
{
ItemStack t = this.target.getStackInSlot( x );
final ItemStack t = this.target.getStackInSlot( x );
if( Platform.isSameItem( t, input ) )
{
int oriStack = t.stackSize;
final int oriStack = t.stackSize;
t.stackSize += out.stackSize;
this.target.setInventorySlotContents( x, t );
@@ -125,9 +125,9 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
ItemStack Req = request.getItemStack();
final ItemStack Req = request.getItemStack();
int request_stackSize = Req.stackSize;
@@ -151,7 +151,7 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
// try to find matching inventories that already have it...
for( int x = 0; x < this.target.getSizeInventory(); x++ )
{
ItemStack sub = this.target.getStackInSlot( x );
final ItemStack sub = this.target.getStackInSlot( x );
if( Platform.isSameItem( sub, Req ) )
{
@@ -206,7 +206,7 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList<IAEItemStack> out )
{
for( int x = 0; x < this.target.getSizeInventory(); x++ )
{
@@ -48,7 +48,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
private boolean hasReadAccess;
private boolean hasWriteAccess;
public MEInventoryHandler( IMEInventory<T> i, StorageChannel channel )
public MEInventoryHandler( final IMEInventory<T> i, final StorageChannel channel )
{
this.channel = channel;
@@ -74,7 +74,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myWhitelist;
}
public void setWhitelist( IncludeExclude myWhitelist )
public void setWhitelist( final IncludeExclude myWhitelist )
{
this.myWhitelist = myWhitelist;
}
@@ -84,7 +84,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myAccess;
}
public void setBaseAccess( AccessRestriction myAccess )
public void setBaseAccess( final AccessRestriction myAccess )
{
this.myAccess = myAccess;
this.cachedAccessRestriction = this.myAccess.restrictPermissions( this.internal.getAccess() );
@@ -97,13 +97,13 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myPartitionList;
}
public void setPartitionList( IPartitionList<T> myPartitionList )
public void setPartitionList( final IPartitionList<T> myPartitionList )
{
this.myPartitionList = myPartitionList;
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( final T input, final Actionable type, final BaseActionSource src )
{
if( !this.canAccept( input ) )
{
@@ -114,7 +114,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public T extractItems( T request, Actionable type, BaseActionSource src )
public T extractItems( final T request, final Actionable type, final BaseActionSource src )
{
if( !this.hasReadAccess )
{
@@ -125,7 +125,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public IItemList<T> getAvailableItems( IItemList<T> out )
public IItemList<T> getAvailableItems( final IItemList<T> out )
{
if( !this.hasReadAccess )
{
@@ -148,7 +148,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
if( this.myWhitelist == IncludeExclude.WHITELIST )
{
@@ -158,7 +158,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
if( !this.hasWriteAccess )
{
@@ -182,7 +182,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
return this.myPriority;
}
public void setPriority( int myPriority )
public void setPriority( final int myPriority )
{
this.myPriority = myPriority;
}
@@ -194,7 +194,7 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -53,26 +53,26 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
public BaseActionSource mySource;
public StorageFilter mode = StorageFilter.EXTRACTABLE_ONLY;
public MEMonitorIInventory( InventoryAdaptor adaptor )
public MEMonitorIInventory( final InventoryAdaptor adaptor )
{
this.adaptor = adaptor;
this.memory = new ConcurrentSkipListMap<Integer, CachedItemStack>();
}
@Override
public void addListener( IMEMonitorHandlerReceiver<IAEItemStack> l, Object verificationToken )
public void addListener( final IMEMonitorHandlerReceiver<IAEItemStack> l, final Object verificationToken )
{
this.listeners.put( l, verificationToken );
}
@Override
public void removeListener( IMEMonitorHandlerReceiver<IAEItemStack> l )
public void removeListener( final IMEMonitorHandlerReceiver<IAEItemStack> l )
{
this.listeners.remove( l );
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
{
ItemStack out = null;
@@ -96,13 +96,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
// better then doing construction from scratch :3
IAEItemStack o = input.copy();
final IAEItemStack o = input.copy();
o.setStackSize( out.stackSize );
return o;
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable type, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable type, final BaseActionSource src )
{
ItemStack out = null;
@@ -121,7 +121,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
// better then doing construction from scratch :3
IAEItemStack o = request.copy();
final IAEItemStack o = request.copy();
o.setStackSize( out.stackSize );
if( type == Actionable.MODULATE )
@@ -141,22 +141,22 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
public TickRateModulation onTick()
{
LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
final LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
this.list.resetStatus();
int high = 0;
boolean changed = false;
for( ItemSlot is : this.adaptor )
for( final ItemSlot is : this.adaptor )
{
CachedItemStack old = this.memory.get( is.slot );
final CachedItemStack old = this.memory.get( is.slot );
high = Math.max( high, is.slot );
ItemStack newIS = !is.isExtractable && this.mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
ItemStack oldIS = old == null ? null : old.itemStack;
final ItemStack newIS = !is.isExtractable && this.mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
final ItemStack oldIS = old == null ? null : old.itemStack;
if( this.isDifferent( newIS, oldIS ) )
{
CachedItemStack cis = new CachedItemStack( is.getItemStack() );
final CachedItemStack cis = new CachedItemStack( is.getItemStack() );
this.memory.put( is.slot, cis );
if( old != null && old.aeStack != null )
@@ -175,10 +175,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
else
{
int newSize = ( newIS == null ? 0 : newIS.stackSize );
int diff = newSize - ( oldIS == null ? 0 : oldIS.stackSize );
final int newSize = ( newIS == null ? 0 : newIS.stackSize );
final int diff = newSize - ( oldIS == null ? 0 : oldIS.stackSize );
IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance().storage().createItemStack( newIS ) : old.aeStack.copy() );
final IAEItemStack stack = ( old == null || old.aeStack == null ? AEApi.instance().storage().createItemStack( newIS ) : old.aeStack.copy() );
if( stack != null )
{
stack.setStackSize( newSize );
@@ -187,10 +187,10 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
if( diff != 0 && stack != null )
{
CachedItemStack cis = new CachedItemStack( is.getItemStack() );
final CachedItemStack cis = new CachedItemStack( is.getItemStack() );
this.memory.put( is.slot, cis );
IAEItemStack a = stack.copy();
final IAEItemStack a = stack.copy();
a.setStackSize( diff );
changes.add( a );
changed = true;
@@ -199,14 +199,14 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
// detect dropped items; should fix non IISided Inventory Changes.
NavigableMap<Integer, CachedItemStack> end = this.memory.tailMap( high, false );
final NavigableMap<Integer, CachedItemStack> end = this.memory.tailMap( high, false );
if( !end.isEmpty() )
{
for( CachedItemStack cis : end.values() )
for( final CachedItemStack cis : end.values() )
{
if( cis != null && cis.aeStack != null )
{
IAEItemStack a = cis.aeStack.copy();
final IAEItemStack a = cis.aeStack.copy();
a.setStackSize( -a.getStackSize() );
changes.add( a );
changed = true;
@@ -223,7 +223,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
}
private boolean isDifferent( ItemStack a, ItemStack b )
private boolean isDifferent( final ItemStack a, final ItemStack b )
{
if( a == b && b == null )
{
@@ -238,16 +238,16 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
return !Platform.isSameItemPrecise( a, b );
}
private void postDifference( Iterable<IAEItemStack> a )
private void postDifference( final Iterable<IAEItemStack> a )
{
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
if( a != null )
{
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.listeners.entrySet().iterator();
final Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.listeners.entrySet().iterator();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> l = i.next();
IMEMonitorHandlerReceiver<IAEItemStack> key = l.getKey();
final Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> l = i.next();
final IMEMonitorHandlerReceiver<IAEItemStack> key = l.getKey();
if( key.isValid( l.getValue() ) )
{
key.postChange( this, a, this.mySource );
@@ -267,13 +267,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return false;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
return true;
}
@@ -291,15 +291,15 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
for( CachedItemStack is : this.memory.values() )
for( final CachedItemStack is : this.memory.values() )
{
out.addStorage( is.aeStack );
}
@@ -319,7 +319,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
final ItemStack itemStack;
final IAEItemStack aeStack;
public CachedItemStack( ItemStack is )
public CachedItemStack( final ItemStack is )
{
if( is == null )
{
@@ -42,7 +42,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
public BaseActionSource changeSource;
IMEMonitor<T> monitor;
public MEMonitorPassThrough( IMEInventory<T> i, StorageChannel channel )
public MEMonitorPassThrough( final IMEInventory<T> i, final StorageChannel channel )
{
super( i, channel );
if( i instanceof IMEMonitor )
@@ -52,7 +52,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
@Override
public void setInternal( IMEInventory<T> i )
public void setInternal( final IMEInventory<T> i )
{
if( this.monitor != null )
{
@@ -60,7 +60,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
this.monitor = null;
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.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
super.setInternal( i );
if( i instanceof IMEMonitor )
@@ -68,7 +68,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
this.monitor = (IMEMonitor<T>) i;
}
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.channel.createList() : this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
if( this.monitor != null )
{
@@ -79,20 +79,20 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
@Override
public IItemList<T> getAvailableItems( IItemList out )
public IItemList<T> getAvailableItems( final IItemList out )
{
super.getAvailableItems( new ItemListIgnoreCrafting( out ) );
return out;
}
@Override
public void addListener( IMEMonitorHandlerReceiver<T> l, Object verificationToken )
public void addListener( final IMEMonitorHandlerReceiver<T> l, final Object verificationToken )
{
this.listeners.put( l, verificationToken );
}
@Override
public void removeListener( IMEMonitorHandlerReceiver<T> l )
public void removeListener( final IMEMonitorHandlerReceiver<T> l )
{
this.listeners.remove( l );
}
@@ -102,7 +102,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
{
if( this.monitor == null )
{
IItemList<T> out = this.channel.createList();
final IItemList<T> out = this.channel.createList();
this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( out ) );
return out;
}
@@ -110,19 +110,19 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
}
@Override
public boolean isValid( Object verificationToken )
public boolean isValid( final Object verificationToken )
{
return verificationToken == this.monitor;
}
@Override
public void postChange( IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source )
public void postChange( final IBaseMonitor<T> monitor, final Iterable<T> change, final BaseActionSource source )
{
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
IMEMonitorHandlerReceiver<T> receiver = e.getKey();
final Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
final IMEMonitorHandlerReceiver<T> receiver = e.getKey();
if( receiver.isValid( e.getValue() ) )
{
receiver.postChange( this, change, source );
@@ -137,11 +137,11 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
@Override
public void onListUpdate()
{
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
final Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
while( i.hasNext() )
{
Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
IMEMonitorHandlerReceiver<T> receiver = e.getKey();
final Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
final IMEMonitorHandlerReceiver<T> receiver = e.getKey();
if( receiver.isValid( e.getValue() ) )
{
receiver.onListUpdate();
@@ -35,7 +35,7 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
protected final StorageChannel channel;
private IMEInventory<T> internal;
public MEPassThrough( IMEInventory<T> i, StorageChannel channel )
public MEPassThrough( final IMEInventory<T> i, final StorageChannel channel )
{
this.channel = channel;
this.setInternal( i );
@@ -46,25 +46,25 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
return this.internal;
}
public void setInternal( IMEInventory<T> i )
public void setInternal( final IMEInventory<T> i )
{
this.internal = i;
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( final T input, final Actionable type, final BaseActionSource src )
{
return this.internal.injectItems( input, type, src );
}
@Override
public T extractItems( T request, Actionable type, BaseActionSource src )
public T extractItems( final T request, final Actionable type, final BaseActionSource src )
{
return this.internal.extractItems( request, type, src );
}
@Override
public IItemList<T> getAvailableItems( IItemList out )
public IItemList<T> getAvailableItems( final IItemList out )
{
return this.internal.getAvailableItems( out );
}
@@ -82,13 +82,13 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
return false;
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
return true;
}
@@ -106,7 +106,7 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -53,7 +53,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
{
@Override
public int compare( Integer o1, Integer o2 )
public int compare( final Integer o1, final Integer o2 )
{
return ItemSorters.compareInt( o2, o1 );
}
@@ -65,16 +65,16 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
private final NavigableMap<Integer, List<IMEInventoryHandler<T>>> priorityInventory;
int myPass = 0;
public NetworkInventoryHandler( StorageChannel chan, SecurityCache security )
public NetworkInventoryHandler( final StorageChannel chan, final SecurityCache security )
{
this.myChannel = chan;
this.security = security;
this.priorityInventory = new TreeMap<Integer, List<IMEInventoryHandler<T>>>( PRIORITY_SORTER ); // TreeMultimap.create( prioritySorter, hashSorter );
}
public void addNewStorage( IMEInventoryHandler<T> h )
public void addNewStorage( final IMEInventoryHandler<T> h )
{
int priority = h.getPriority();
final int priority = h.getPriority();
List<IMEInventoryHandler<T>> list = this.priorityInventory.get( priority );
if( list == null )
{
@@ -85,7 +85,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public T injectItems( T input, Actionable type, BaseActionSource src )
public T injectItems( T input, final Actionable type, final BaseActionSource src )
{
if( this.diveList( this, type ) )
{
@@ -98,12 +98,12 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return input;
}
for( List<IMEInventoryHandler<T>> invList : this.priorityInventory.values() )
for( final List<IMEInventoryHandler<T>> invList : this.priorityInventory.values() )
{
Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
while( ii.hasNext() && input != null )
{
IMEInventoryHandler<T> inv = ii.next();
final IMEInventoryHandler<T> inv = ii.next();
if( inv.validForPass( 1 ) && inv.canAccept( input ) && ( inv.isPrioritized( input ) || inv.extractItems( input, Actionable.SIMULATE, src ) != null ) )
{
@@ -118,7 +118,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
ii = invList.iterator();
while( ii.hasNext() && input != null )
{
IMEInventoryHandler<T> inv = ii.next();
final IMEInventoryHandler<T> inv = ii.next();
if( inv.validForPass( 2 ) && inv.canAccept( input ) && !inv.isPrioritized( input ) )
{
@@ -132,9 +132,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return input;
}
private boolean diveList( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
private boolean diveList( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
LinkedList cDepth = this.getDepth( type );
final LinkedList cDepth = this.getDepth( type );
if( cDepth.contains( networkInventoryHandler ) )
{
return true;
@@ -144,7 +144,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return false;
}
private boolean testPermission( BaseActionSource src, SecurityPermissions permission )
private boolean testPermission( final BaseActionSource src, final SecurityPermissions permission )
{
if( src.isPlayer() )
{
@@ -157,18 +157,18 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
{
if( this.security.isAvailable() )
{
IGridNode n = ( (MachineSource) src ).via.getActionableNode();
final IGridNode n = ( (MachineSource) src ).via.getActionableNode();
if( n == null )
{
return true;
}
IGrid gn = n.getGrid();
final IGrid gn = n.getGrid();
if( gn != this.security.myGrid )
{
ISecurityGrid sg = gn.getCache( ISecurityGrid.class );
int playerID = sg.getOwner();
final ISecurityGrid sg = gn.getCache( ISecurityGrid.class );
final int playerID = sg.getOwner();
if( !this.security.hasPermission( playerID, permission ) )
{
@@ -181,7 +181,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return false;
}
private void surface( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
private void surface( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
if( this.getDepth( type ).pop() != this )
{
@@ -189,9 +189,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
}
private LinkedList getDepth( Actionable type )
private LinkedList getDepth( final Actionable type )
{
ThreadLocal<LinkedList> depth = type == Actionable.MODULATE ? DEPTH_MOD : DEPTH_SIM;
final ThreadLocal<LinkedList> depth = type == Actionable.MODULATE ? DEPTH_MOD : DEPTH_SIM;
LinkedList s = depth.get();
@@ -204,7 +204,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public T extractItems( T request, Actionable mode, BaseActionSource src )
public T extractItems( T request, final Actionable mode, final BaseActionSource src )
{
if( this.diveList( this, mode ) )
{
@@ -217,21 +217,21 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return null;
}
Iterator<List<IMEInventoryHandler<T>>> i = this.priorityInventory.descendingMap().values().iterator();// priorityInventory.asMap().descendingMap().entrySet().iterator();
final Iterator<List<IMEInventoryHandler<T>>> i = this.priorityInventory.descendingMap().values().iterator();// priorityInventory.asMap().descendingMap().entrySet().iterator();
T output = request.copy();
final T output = request.copy();
request = request.copy();
output.setStackSize( 0 );
long req = request.getStackSize();
final long req = request.getStackSize();
while( i.hasNext() )
{
List<IMEInventoryHandler<T>> invList = i.next();
final List<IMEInventoryHandler<T>> invList = i.next();
Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
final Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
while( ii.hasNext() && output.getStackSize() < req )
{
IMEInventoryHandler<T> inv = ii.next();
final IMEInventoryHandler<T> inv = ii.next();
request.setStackSize( req - output.getStackSize() );
output.add( inv.extractItems( request, mode, src ) );
@@ -257,9 +257,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
// for (Entry<Integer, IMEInventoryHandler<T>> h : priorityInventory.entries())
for( List<IMEInventoryHandler<T>> i : this.priorityInventory.values() )
for( final List<IMEInventoryHandler<T>> i : this.priorityInventory.values() )
{
for( IMEInventoryHandler<T> j : i )
for( final IMEInventoryHandler<T> j : i )
{
out = j.getAvailableItems( out );
}
@@ -270,9 +270,9 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
return out;
}
private boolean diveIteration( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
private boolean diveIteration( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
LinkedList cDepth = this.getDepth( type );
final LinkedList cDepth = this.getDepth( type );
if( cDepth.isEmpty() )
{
currentPass++;
@@ -307,13 +307,13 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
return false;
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
return true;
}
@@ -331,7 +331,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -32,19 +32,19 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
{
@Override
public T injectItems( T input, Actionable mode, BaseActionSource src )
public T injectItems( final T input, final Actionable mode, final BaseActionSource src )
{
return input;
}
@Override
public T extractItems( T request, Actionable mode, BaseActionSource src )
public T extractItems( final T request, final Actionable mode, final BaseActionSource src )
{
return null;
}
@Override
public IItemList<T> getAvailableItems( IItemList out )
public IItemList<T> getAvailableItems( final IItemList out )
{
return out;
}
@@ -62,13 +62,13 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean isPrioritized( T input )
public boolean isPrioritized( final T input )
{
return false;
}
@Override
public boolean canAccept( T input )
public boolean canAccept( final T input )
{
return false;
}
@@ -86,7 +86,7 @@ public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return i == 2;
}
@@ -42,13 +42,13 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
public final IItemList<IAEItemStack> storedItems = AEApi.instance().storage().createItemList();
final TileSecurity securityTile;
public SecurityInventory( TileSecurity ts )
public SecurityInventory( final TileSecurity ts )
{
this.securityTile = ts;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable type, final BaseActionSource src )
{
if( this.hasPermission( src ) )
{
@@ -70,7 +70,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
return input;
}
private boolean hasPermission( BaseActionSource src )
private boolean hasPermission( final BaseActionSource src )
{
if( src.isPlayer() )
{
@@ -78,7 +78,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
{
return this.securityTile.getProxy().getSecurity().hasPermission( ( (PlayerSource) src ).player, SecurityPermissions.SECURITY );
}
catch( GridAccessException e )
catch( final GridAccessException e )
{
// :P
}
@@ -87,14 +87,14 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
if( this.hasPermission( src ) )
{
IAEItemStack target = this.storedItems.findPrecise( request );
final IAEItemStack target = this.storedItems.findPrecise( request );
if( target != null )
{
IAEItemStack output = target.copy();
final IAEItemStack output = target.copy();
if( mode == Actionable.SIMULATE )
{
@@ -110,9 +110,9 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
for( IAEItemStack ais : this.storedItems )
for( final IAEItemStack ais : this.storedItems )
{
out.add( ais );
}
@@ -133,30 +133,30 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return false;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
if( input.getItem() instanceof IBiometricCard )
{
IBiometricCard tbc = (IBiometricCard) input.getItem();
GameProfile newUser = tbc.getProfile( input.getItemStack() );
final IBiometricCard tbc = (IBiometricCard) input.getItem();
final GameProfile newUser = tbc.getProfile( input.getItemStack() );
int PlayerID = AEApi.instance().registries().players().getID( newUser );
final int PlayerID = AEApi.instance().registries().players().getID( newUser );
if( this.securityTile.getOwner() == PlayerID )
{
return false;
}
for( IAEItemStack ais : this.storedItems )
for( final IAEItemStack ais : this.storedItems )
{
if( ais.isMeaningful() )
{
GameProfile thisUser = tbc.getProfile( ais.getItemStack() );
final GameProfile thisUser = tbc.getProfile( ais.getItemStack() );
if( thisUser == newUser )
{
return false;
@@ -187,7 +187,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return true;
}
@@ -34,13 +34,13 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
final TileCondenser target;
public VoidFluidInventory( TileCondenser te )
public VoidFluidInventory( final TileCondenser te )
{
this.target = te;
}
@Override
public IAEFluidStack injectItems( IAEFluidStack input, Actionable mode, BaseActionSource src )
public IAEFluidStack injectItems( final IAEFluidStack input, final Actionable mode, final BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
@@ -55,13 +55,13 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
}
@Override
public IAEFluidStack extractItems( IAEFluidStack request, Actionable mode, BaseActionSource src )
public IAEFluidStack extractItems( final IAEFluidStack request, final Actionable mode, final BaseActionSource src )
{
return null;
}
@Override
public IItemList<IAEFluidStack> getAvailableItems( IItemList out )
public IItemList<IAEFluidStack> getAvailableItems( final IItemList out )
{
return out;
}
@@ -79,13 +79,13 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
}
@Override
public boolean isPrioritized( IAEFluidStack input )
public boolean isPrioritized( final IAEFluidStack input )
{
return false;
}
@Override
public boolean canAccept( IAEFluidStack input )
public boolean canAccept( final IAEFluidStack input )
{
return true;
}
@@ -103,7 +103,7 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return i == 2;
}
@@ -34,13 +34,13 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
final TileCondenser target;
public VoidItemInventory( TileCondenser te )
public VoidItemInventory( final TileCondenser te )
{
this.target = te;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
@@ -55,13 +55,13 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
public IAEItemStack extractItems( final IAEItemStack request, final Actionable mode, final BaseActionSource src )
{
return null;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
public IItemList<IAEItemStack> getAvailableItems( final IItemList out )
{
return out;
}
@@ -79,13 +79,13 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean isPrioritized( IAEItemStack input )
public boolean isPrioritized( final IAEItemStack input )
{
return false;
}
@Override
public boolean canAccept( IAEItemStack input )
public boolean canAccept( final IAEItemStack input )
{
return true;
}
@@ -103,7 +103,7 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
}
@Override
public boolean validForPass( int i )
public boolean validForPass( final int i )
{
return i == 2;
}