Finally use Java7 <>

This commit is contained in:
yueh
2017-07-20 21:21:45 +02:00
parent 8ec8babb6a
commit 7de90ed0ae
145 changed files with 315 additions and 315 deletions
+13 -13
View File
@@ -114,16 +114,16 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
CRAFTING_POOL = Executors.newCachedThreadPool( factory );
}
private final Set<CraftingCPUCluster> craftingCPUClusters = new HashSet<CraftingCPUCluster>();
private final Set<ICraftingProvider> craftingProviders = new HashSet<ICraftingProvider>();
private final Map<IGridNode, ICraftingWatcher> craftingWatchers = new HashMap<IGridNode, ICraftingWatcher>();
private final Set<CraftingCPUCluster> craftingCPUClusters = new HashSet<>();
private final Set<ICraftingProvider> craftingProviders = new HashSet<>();
private final Map<IGridNode, ICraftingWatcher> craftingWatchers = new HashMap<>();
private final IGrid grid;
private final Map<ICraftingPatternDetails, List<ICraftingMedium>> craftingMethods = new HashMap<ICraftingPatternDetails, List<ICraftingMedium>>();
private final Map<IAEItemStack, ImmutableList<ICraftingPatternDetails>> craftableItems = new HashMap<IAEItemStack, ImmutableList<ICraftingPatternDetails>>();
private final Set<IAEItemStack> emitableItems = new HashSet<IAEItemStack>();
private final Map<String, CraftingLinkNexus> craftingLinks = new HashMap<String, CraftingLinkNexus>();
private final Map<ICraftingPatternDetails, List<ICraftingMedium>> craftingMethods = new HashMap<>();
private final Map<IAEItemStack, ImmutableList<ICraftingPatternDetails>> craftableItems = new HashMap<>();
private final Set<IAEItemStack> emitableItems = new HashSet<>();
private final Map<String, CraftingLinkNexus> craftingLinks = new HashMap<>();
private final Multimap<IAEStack, CraftingWatcher> interests = HashMultimap.create();
private final GenericInterestManager<CraftingWatcher> interestManager = new GenericInterestManager<CraftingWatcher>( this.interests );
private final GenericInterestManager<CraftingWatcher> interestManager = new GenericInterestManager<>( this.interests );
private IStorageGrid storageGrid;
private IEnergyGrid energyGrid;
private boolean updateList = false;
@@ -271,7 +271,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
provider.provideCrafting( this );
}
final Map<IAEItemStack, Set<ICraftingPatternDetails>> tmpCraft = new HashMap<IAEItemStack, Set<ICraftingPatternDetails>>();
final Map<IAEItemStack, Set<ICraftingPatternDetails>> tmpCraft = new HashMap<>();
// new craftables!
for( final ICraftingPatternDetails details : this.craftingMethods.keySet() )
@@ -286,7 +286,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
if( methods == null )
{
tmpCraft.put( out, methods = new TreeSet<ICraftingPatternDetails>( COMPARATOR ) );
tmpCraft.put( out, methods = new TreeSet<>( COMPARATOR ) );
}
methods.add( details );
@@ -357,7 +357,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
List<ICraftingMedium> details = this.craftingMethods.get( api );
if( details == null )
{
details = new ArrayList<ICraftingMedium>();
details = new ArrayList<>();
details.add( medium );
this.craftingMethods.put( api, details );
}
@@ -376,7 +376,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
@Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{
final List<IMEInventoryHandler> list = new ArrayList<IMEInventoryHandler>( 1 );
final List<IMEInventoryHandler> list = new ArrayList<>( 1 );
if( channel == StorageChannel.ITEMS )
{
@@ -527,7 +527,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
if( target == null )
{
final List<CraftingCPUCluster> validCpusClusters = new ArrayList<CraftingCPUCluster>();
final List<CraftingCPUCluster> validCpusClusters = new ArrayList<>();
for( final CraftingCPUCluster cpu : this.craftingCPUClusters )
{
if( cpu.isActive() && !cpu.isBusy() && cpu.getAvailableStorage() >= job.getByteTotal() )
+5 -5
View File
@@ -61,12 +61,12 @@ public class EnergyGridCache implements IEnergyGrid
private final NavigableSet<EnergyThreshold> interests = Sets.newTreeSet();
private final double averageLength = 40.0;
private final Set<IAEPowerStorage> providers = new LinkedHashSet<IAEPowerStorage>();
private final Set<IAEPowerStorage> requesters = new LinkedHashSet<IAEPowerStorage>();
private final Set<IAEPowerStorage> providers = new LinkedHashSet<>();
private final Set<IAEPowerStorage> requesters = new LinkedHashSet<>();
private final Multiset<IEnergyGridProvider> energyGridProviders = HashMultiset.create();
private final IGrid myGrid;
private final HashMap<IGridNode, IEnergyWatcher> watchers = new HashMap<IGridNode, IEnergyWatcher>();
private final Set<IEnergyGrid> localSeen = new HashSet<IEnergyGrid>();
private final HashMap<IGridNode, IEnergyWatcher> watchers = new HashMap<>();
private final Set<IEnergyGrid> localSeen = new HashSet<>();
/**
* estimated power available.
*/
@@ -354,7 +354,7 @@ public class EnergyGridCache implements IEnergyGrid
while( amt > 0 && i.hasNext() )
{
final IEnergyGridProvider what = i.next();
final Set<IEnergyGrid> listCopy = new HashSet<IEnergyGrid>();
final Set<IEnergyGrid> listCopy = new HashSet<>();
listCopy.addAll( seen );
final double cannotHold = what.injectAEPower( amt, Actionable.SIMULATE, listCopy );
+9 -9
View File
@@ -59,13 +59,13 @@ public class GridStorageCache implements IStorageGrid
{
private final IGrid myGrid;
private final HashSet<ICellProvider> activeCellProviders = new HashSet<ICellProvider>();
private final HashSet<ICellProvider> inactiveCellProviders = new HashSet<ICellProvider>();
private final HashSet<ICellProvider> activeCellProviders = new HashSet<>();
private final HashSet<ICellProvider> inactiveCellProviders = new HashSet<>();
private final SetMultimap<IAEStack, ItemWatcher> interests = HashMultimap.create();
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>();
private final GenericInterestManager<ItemWatcher> interestManager = new GenericInterestManager<>( this.interests );
private final NetworkMonitor<IAEItemStack> itemMonitor = new NetworkMonitor<>( this, StorageChannel.ITEMS );
private final NetworkMonitor<IAEFluidStack> fluidMonitor = new NetworkMonitor<>( this, StorageChannel.FLUIDS );
private final HashMap<IGridNode, IStackWatcher> watchers = new HashMap<>();
private NetworkInventoryHandler<IAEItemStack> myItemNetwork;
private NetworkInventoryHandler<IAEFluidStack> myFluidNetwork;
@@ -284,7 +284,7 @@ public class GridStorageCache implements IStorageGrid
switch( chan )
{
case FLUIDS:
this.myFluidNetwork = new NetworkInventoryHandler<IAEFluidStack>( StorageChannel.FLUIDS, security );
this.myFluidNetwork = new NetworkInventoryHandler<>( StorageChannel.FLUIDS, security );
for( final ICellProvider cc : this.activeCellProviders )
{
for( final IMEInventoryHandler<IAEFluidStack> h : cc.getCellArray( chan ) )
@@ -294,7 +294,7 @@ public class GridStorageCache implements IStorageGrid
}
break;
case ITEMS:
this.myItemNetwork = new NetworkInventoryHandler<IAEItemStack>( StorageChannel.ITEMS, security );
this.myItemNetwork = new NetworkInventoryHandler<>( StorageChannel.ITEMS, security );
for( final ICellProvider cc : this.activeCellProviders )
{
for( final IMEInventoryHandler<IAEItemStack> h : cc.getCellArray( chan ) )
@@ -402,7 +402,7 @@ public class GridStorageCache implements IStorageGrid
private class CellChangeTracker
{
final List<CellChangeTrackerRecord> data = new LinkedList<CellChangeTrackerRecord>();
final List<CellChangeTrackerRecord> data = new LinkedList<>();
public void postChanges( final StorageChannel channel, final int i, final IMEInventoryHandler<? extends IAEStack> h, final BaseActionSource actionSrc )
{
+1 -1
View File
@@ -70,7 +70,7 @@ public class NetworkMonitor<T extends IAEStack<T>> implements IMEMonitor<T>
this.myGridCache = cache;
this.myChannel = chan;
this.cachedList = (IItemList<T>) chan.createList();
this.listeners = new HashMap<IMEMonitorHandlerReceiver<T>, Object>();
this.listeners = new HashMap<>();
}
@Override
+2 -2
View File
@@ -43,9 +43,9 @@ public class P2PCache implements IGridCache
{
private final IGrid myGrid;
private final HashMap<Long, PartP2PTunnel> inputs = new HashMap<Long, PartP2PTunnel>();
private final HashMap<Long, PartP2PTunnel> inputs = new HashMap<>();
private final Multimap<Long, PartP2PTunnel> outputs = LinkedHashMultimap.create();
private final TunnelCollection NullColl = new TunnelCollection<PartP2PTunnel>( null, null );
private final TunnelCollection NullColl = new TunnelCollection<>( null, null );
public P2PCache( final IGrid g )
{
+9 -9
View File
@@ -58,10 +58,10 @@ import appeng.tile.networking.TileController;
public class PathGridCache implements IPathingGrid
{
private final LinkedList<PathSegment> active = new LinkedList<PathSegment>();
private final Set<TileController> controllers = new HashSet<TileController>();
private final Set<IGridNode> requireChannels = new HashSet<IGridNode>();
private final Set<IGridNode> blockDense = new HashSet<IGridNode>();
private final LinkedList<PathSegment> active = new LinkedList<>();
private final Set<TileController> controllers = new HashSet<>();
private final Set<IGridNode> requireChannels = new HashSet<>();
private final Set<IGridNode> blockDense = new HashSet<>();
private final IGrid myGrid;
private int channelsInUse = 0;
private int channelsByBlocks = 0;
@@ -72,7 +72,7 @@ public class PathGridCache implements IPathingGrid
private ControllerState controllerState = ControllerState.NO_CONTROLLER;
private int ticksUntilReady = 20;
private int lastChannels = 0;
private HashSet<IPathItem> semiOpen = new HashSet<IPathItem>();
private HashSet<IPathItem> semiOpen = new HashSet<>();
public PathGridCache( final IGrid g )
{
@@ -136,8 +136,8 @@ public class PathGridCache implements IPathingGrid
{
final int nodes = this.myGrid.getNodes().size();
this.ticksUntilReady = 20 + Math.max( 0, nodes / 100 - 20 );
final HashSet<IPathItem> closedList = new HashSet<IPathItem>();
this.semiOpen = new HashSet<IPathItem>();
final HashSet<IPathItem> closedList = new HashSet<>();
this.semiOpen = new HashSet<>();
// myGrid.getPivot().beginVisit( new AdHocChannelUpdater( 0 )
// );
@@ -149,7 +149,7 @@ public class PathGridCache implements IPathingGrid
final GridConnection gc = (GridConnection) gcc;
if( !( gc.getOtherSide( node ).getMachine() instanceof TileController ) )
{
final List<IPathItem> open = new LinkedList<IPathItem>();
final List<IPathItem> open = new LinkedList<>();
closedList.add( gc );
open.add( gc );
gc.setControllerRoute( (GridNode) node, true );
@@ -344,7 +344,7 @@ public class PathGridCache implements IPathingGrid
final Achievements lastBracket = this.getAchievementBracket( this.lastChannels );
if( currentBracket != lastBracket && currentBracket != null )
{
final Set<Integer> players = new HashSet<Integer>();
final Set<Integer> players = new HashSet<>();
for( final IGridNode n : this.requireChannels )
{
players.add( n.getPlayerID() );
+2 -2
View File
@@ -46,8 +46,8 @@ public class SecurityCache implements ISecurityGrid
{
private final IGrid myGrid;
private final List<ISecurityProvider> securityProvider = new ArrayList<ISecurityProvider>();
private final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms = new HashMap<Integer, EnumSet<SecurityPermissions>>();
private final List<ISecurityProvider> securityProvider = new ArrayList<>();
private final HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms = new HashMap<>();
private long securityKey = -1;
public SecurityCache( final IGrid g )
+4 -4
View File
@@ -47,8 +47,8 @@ public class SpatialPylonCache implements ISpatialCache
private DimensionalCoord captureMin;
private DimensionalCoord captureMax;
private boolean isValid = false;
private List<TileSpatialIOPort> ioPorts = new LinkedList<TileSpatialIOPort>();
private HashMap<SpatialPylonCluster, SpatialPylonCluster> clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>();
private List<TileSpatialIOPort> ioPorts = new LinkedList<>();
private HashMap<SpatialPylonCluster, SpatialPylonCluster> clusters = new HashMap<>();
public SpatialPylonCache( final IGrid g )
{
@@ -64,8 +64,8 @@ public class SpatialPylonCache implements ISpatialCache
private void reset( final IGrid grid )
{
this.clusters = new HashMap<SpatialPylonCluster, SpatialPylonCluster>();
this.ioPorts = new LinkedList<TileSpatialIOPort>();
this.clusters = new HashMap<>();
this.ioPorts = new LinkedList<>();
for( final IGridNode gm : grid.getMachines( TileSpatialIOPort.class ) )
{
+4 -4
View File
@@ -41,10 +41,10 @@ public class TickManagerCache implements ITickManager
{
private final IGrid myGrid;
private final HashMap<IGridNode, TickTracker> alertable = new HashMap<IGridNode, TickTracker>();
private final HashMap<IGridNode, TickTracker> sleeping = new HashMap<IGridNode, TickTracker>();
private final HashMap<IGridNode, TickTracker> awake = new HashMap<IGridNode, TickTracker>();
private final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<TickTracker>();
private final HashMap<IGridNode, TickTracker> alertable = new HashMap<>();
private final HashMap<IGridNode, TickTracker> sleeping = new HashMap<>();
private final HashMap<IGridNode, TickTracker> awake = new HashMap<>();
private final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<>();
private long currentTick = 0;
public TickManagerCache( final IGrid g )
+1 -1
View File
@@ -31,7 +31,7 @@ import appeng.util.IWorldCallable;
public class Connections implements IWorldCallable<Void>
{
private final HashMap<IGridNode, TunnelConnection> connections = new HashMap<IGridNode, TunnelConnection>();
private final HashMap<IGridNode, TunnelConnection> connections = new HashMap<>();
private final PartP2PTunnelME me;
private boolean create = false;
private boolean destroy = false;
@@ -53,9 +53,9 @@ public class TunnelCollection<T extends PartP2PTunnel> implements Iterable<T>
{
if( this.tunnelSources == null )
{
return new NullIterator<T>();
return new NullIterator<>();
}
return new TunnelIterator<T>( this.tunnelSources, this.clz );
return new TunnelIterator<>( this.tunnelSources, this.clz );
}
public boolean matches( final Class<? extends PartP2PTunnel> c )