Renamed constants
This commit is contained in:
@@ -67,7 +67,7 @@ public class Grid implements IGrid
|
||||
|
||||
this.postEvent( new MENetworkPostCacheConstruction() );
|
||||
|
||||
TickHandler.instance.addNetwork( this );
|
||||
TickHandler.INSTANCE.addNetwork( this );
|
||||
center.setGrid( this );
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class Grid implements IGrid
|
||||
else
|
||||
{
|
||||
this.pivot = null;
|
||||
TickHandler.instance.removeNetwork( this );
|
||||
TickHandler.INSTANCE.removeNetwork( this );
|
||||
this.myStorage.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import appeng.util.ReadOnlyCollection;
|
||||
public class GridConnection implements IGridConnection, IPathItem
|
||||
{
|
||||
|
||||
final static private MENetworkChannelsChanged event = new MENetworkChannelsChanged();
|
||||
private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
|
||||
|
||||
private GridNode sideA;
|
||||
private ForgeDirection fromAtoB;
|
||||
@@ -234,10 +234,10 @@ public class GridConnection implements IGridConnection, IPathItem
|
||||
this.channelData |= this.channelData << 8;
|
||||
|
||||
if ( this.sideA.getInternalGrid() != null )
|
||||
this.sideA.getInternalGrid().postEventTo( this.sideA, event );
|
||||
this.sideA.getInternalGrid().postEventTo( this.sideA, EVENT );
|
||||
|
||||
if ( this.sideB.getInternalGrid() != null )
|
||||
this.sideB.getInternalGrid().postEventTo( this.sideB, event );
|
||||
this.sideB.getInternalGrid().postEventTo( this.sideB, EVENT );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ import appeng.util.ReadOnlyCollection;
|
||||
|
||||
public class GridNode implements IGridNode, IPathItem
|
||||
{
|
||||
private static final MENetworkChannelsChanged event = new MENetworkChannelsChanged();
|
||||
private static final int[] channelCount = new int[] { 0, 8, 32 };
|
||||
private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
|
||||
private static final int[] CHANNEL_COUNT = new int[] { 0, 8, 32 };
|
||||
|
||||
private final List<IGridConnection> connections = new LinkedList<IGridConnection>();
|
||||
private final IGridBlock gridProxy;
|
||||
@@ -407,7 +407,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
}
|
||||
catch ( FailedConnection e )
|
||||
{
|
||||
TickHandler.instance.addCallable( node.getWorld(), new MachineSecurityBreak( this ) );
|
||||
TickHandler.INSTANCE.addCallable( node.getWorld(), new MachineSecurityBreak( this ) );
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -432,7 +432,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
}
|
||||
catch ( FailedConnection e )
|
||||
{
|
||||
TickHandler.instance.addCallable( node.getWorld(), new MachineSecurityBreak( this ) );
|
||||
TickHandler.INSTANCE.addCallable( node.getWorld(), new MachineSecurityBreak( this ) );
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -557,7 +557,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
|
||||
public int getMaxChannels()
|
||||
{
|
||||
return channelCount[this.compressedData & 0x03];
|
||||
return CHANNEL_COUNT[this.compressedData & 0x03];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -590,7 +590,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
this.channelData |= this.channelData << 8;
|
||||
|
||||
if ( this.getInternalGrid() != null )
|
||||
this.getInternalGrid().postEventTo( this, event );
|
||||
this.getInternalGrid().postEventTo( this, EVENT );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ import appeng.core.AELog;
|
||||
|
||||
public class NetworkEventBus
|
||||
{
|
||||
private static final Collection<Class> readClasses = new HashSet<Class>();
|
||||
private static final Map<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>> events = new HashMap<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>>();
|
||||
private static final Collection<Class> READ_CLASSES = new HashSet<Class>();
|
||||
private static final Map<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>> EVENTS = new HashMap<Class<? extends MENetworkEvent>, Map<Class, MENetworkEventInfo>>();
|
||||
|
||||
public void readClass( Class listAs, Class c )
|
||||
{
|
||||
if ( readClasses.contains( c ) )
|
||||
if ( READ_CLASSES.contains( c ) )
|
||||
return;
|
||||
readClasses.add( c );
|
||||
READ_CLASSES.add( c );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -58,9 +58,9 @@ public class NetworkEventBus
|
||||
if ( MENetworkEvent.class.isAssignableFrom( types[0] ) )
|
||||
{
|
||||
|
||||
Map<Class, MENetworkEventInfo> classEvents = events.get( types[0] );
|
||||
Map<Class, MENetworkEventInfo> classEvents = EVENTS.get( types[0] );
|
||||
if ( classEvents == null )
|
||||
events.put( types[0], classEvents = new HashMap<Class, MENetworkEventInfo>() );
|
||||
EVENTS.put( types[0], classEvents = new HashMap<Class, MENetworkEventInfo>() );
|
||||
|
||||
MENetworkEventInfo thisEvent = classEvents.get( listAs );
|
||||
if ( thisEvent == null )
|
||||
@@ -86,7 +86,7 @@ public class NetworkEventBus
|
||||
|
||||
public MENetworkEvent postEvent( Grid g, MENetworkEvent e )
|
||||
{
|
||||
Map<Class, MENetworkEventInfo> subscribers = events.get( e.getClass() );
|
||||
Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
|
||||
int x = 0;
|
||||
|
||||
try
|
||||
@@ -122,7 +122,7 @@ public class NetworkEventBus
|
||||
|
||||
public MENetworkEvent postEventTo( Grid grid, GridNode node, MENetworkEvent e )
|
||||
{
|
||||
Map<Class, MENetworkEventInfo> subscribers = events.get( e.getClass() );
|
||||
Map<Class, MENetworkEventInfo> subscribers = EVENTS.get( e.getClass() );
|
||||
int x = 0;
|
||||
|
||||
try
|
||||
|
||||
+5
-5
@@ -332,7 +332,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
}
|
||||
}
|
||||
|
||||
static final Comparator<ICraftingPatternDetails> comp = new Comparator<ICraftingPatternDetails>()
|
||||
static final Comparator<ICraftingPatternDetails> COMPARATOR = new Comparator<ICraftingPatternDetails>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ICraftingPatternDetails firstDetail, ICraftingPatternDetails nextDetail)
|
||||
@@ -374,7 +374,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
|
||||
if ( methods == null )
|
||||
{
|
||||
tmpCraft.put( out, methods = new TreeSet<ICraftingPatternDetails>( comp ) );
|
||||
tmpCraft.put( out, methods = new TreeSet<ICraftingPatternDetails>( COMPARATOR ) );
|
||||
}
|
||||
|
||||
methods.add( details );
|
||||
@@ -604,7 +604,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
return i == 1;
|
||||
}
|
||||
|
||||
final public static ExecutorService craftingPool;
|
||||
final public static ExecutorService CRAFTING_POOL;
|
||||
|
||||
static
|
||||
{
|
||||
@@ -618,7 +618,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
|
||||
};
|
||||
|
||||
craftingPool = Executors.newCachedThreadPool( factory );
|
||||
CRAFTING_POOL = Executors.newCachedThreadPool( factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -631,7 +631,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
|
||||
CraftingJob job = new CraftingJob( world, grid, actionSrc, slotItem, cb );
|
||||
|
||||
return craftingPool.submit( job, (ICraftingJob) job );
|
||||
return CRAFTING_POOL.submit( job, (ICraftingJob) job );
|
||||
}
|
||||
|
||||
public boolean hasCpu(ICraftingCPU cpu)
|
||||
|
||||
+4
-4
@@ -64,7 +64,7 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
this.myChannel = chan;
|
||||
}
|
||||
|
||||
final static public LinkedList depth = new LinkedList();
|
||||
final static public LinkedList DEPTH = new LinkedList();
|
||||
|
||||
@Override
|
||||
protected void postChangesToListeners(Iterable<T> changes, BaseActionSource src)
|
||||
@@ -74,10 +74,10 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
|
||||
protected void postChange(boolean Add, Iterable<T> changes, BaseActionSource src)
|
||||
{
|
||||
if ( depth.contains( this ) )
|
||||
if ( DEPTH.contains( this ) )
|
||||
return;
|
||||
|
||||
depth.push( this );
|
||||
DEPTH.push( this );
|
||||
|
||||
this.sendEvent = true;
|
||||
this.notifyListenersOfChange( changes, src );
|
||||
@@ -113,7 +113,7 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||
}
|
||||
}
|
||||
|
||||
Object last = depth.pop();
|
||||
Object last = DEPTH.pop();
|
||||
if ( last != this )
|
||||
throw new RuntimeException( "Invalid Access to Networked Storage API detected." );
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
||||
final Map<ICraftingPatternDetails, TaskProgress> tasks = new HashMap<ICraftingPatternDetails, TaskProgress>();
|
||||
IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().createItemList();
|
||||
|
||||
// instance sate
|
||||
// INSTANCE sate
|
||||
final private LinkedList<TileCraftingTile> tiles = new LinkedList<TileCraftingTile>();
|
||||
final private LinkedList<TileCraftingTile> storage = new LinkedList<TileCraftingTile>();
|
||||
final private LinkedList<TileCraftingMonitorTile> status = new LinkedList<TileCraftingMonitorTile>();
|
||||
|
||||
@@ -166,7 +166,7 @@ public class AENetworkProxy implements IGridBlock
|
||||
public void validate()
|
||||
{
|
||||
if ( this.gp instanceof AEBaseTile )
|
||||
TickHandler.instance.addInit( (AEBaseTile) this.gp );
|
||||
TickHandler.INSTANCE.addInit( (AEBaseTile) this.gp );
|
||||
}
|
||||
|
||||
public void onChunkUnload()
|
||||
|
||||
@@ -369,18 +369,18 @@ public class CellInventory implements ICellInventory
|
||||
return 8 - div;
|
||||
}
|
||||
|
||||
private static final HashSet<Integer> blackList = new HashSet<Integer>();
|
||||
private static final HashSet<Integer> BLACK_LIST = new HashSet<Integer>();
|
||||
|
||||
public static void addBasicBlackList(int itemID, int Meta)
|
||||
{
|
||||
blackList.add( (Meta << Platform.DEF_OFFSET) | itemID );
|
||||
BLACK_LIST.add( ( Meta << Platform.DEF_OFFSET ) | itemID );
|
||||
}
|
||||
|
||||
public static boolean isBlackListed(IAEItemStack input)
|
||||
{
|
||||
if ( blackList.contains( (OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) ) )
|
||||
if ( BLACK_LIST.contains( (OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) ) )
|
||||
return true;
|
||||
return blackList.contains( (input.getItemDamage() << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) );
|
||||
return BLACK_LIST.contains( (input.getItemDamage() << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) );
|
||||
}
|
||||
|
||||
private boolean isEmpty(IMEInventory meInventory)
|
||||
|
||||
@@ -45,7 +45,7 @@ import appeng.util.ItemSorters;
|
||||
public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T>
|
||||
{
|
||||
|
||||
private final static Comparator<Integer> prioritySorter = new Comparator<Integer>() {
|
||||
private final static Comparator<Integer> PRIORITY_SORTER = new Comparator<Integer>() {
|
||||
|
||||
@Override
|
||||
public int compare(Integer o1, Integer o2)
|
||||
@@ -64,7 +64,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
public NetworkInventoryHandler(StorageChannel chan, SecurityCache security) {
|
||||
this.myChannel = chan;
|
||||
this.security = security;
|
||||
this.priorityInventory = new ConcurrentSkipListMap<Integer, List<IMEInventoryHandler<T>>>( prioritySorter ); // TreeMultimap.create( prioritySorter, hashSorter );
|
||||
this.priorityInventory = new ConcurrentSkipListMap<Integer, List<IMEInventoryHandler<T>>>( PRIORITY_SORTER ); // TreeMultimap.create( prioritySorter, hashSorter );
|
||||
}
|
||||
|
||||
public void addNewStorage(IMEInventoryHandler<T> h)
|
||||
@@ -79,12 +79,12 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
|
||||
static int currentPass = 0;
|
||||
int myPass = 0;
|
||||
static final ThreadLocal<LinkedList> depthMod = new ThreadLocal<LinkedList>();
|
||||
static final ThreadLocal<LinkedList> depthSim = new ThreadLocal<LinkedList>();
|
||||
static final ThreadLocal<LinkedList> DEPTH_MOD = new ThreadLocal<LinkedList>();
|
||||
static final ThreadLocal<LinkedList> DEPTH_SIM = new ThreadLocal<LinkedList>();
|
||||
|
||||
private LinkedList getDepth(Actionable type)
|
||||
{
|
||||
ThreadLocal<LinkedList> depth = type == Actionable.MODULATE ? depthMod : depthSim;
|
||||
ThreadLocal<LinkedList> depth = type == Actionable.MODULATE ? DEPTH_MOD : DEPTH_SIM;
|
||||
|
||||
LinkedList s = depth.get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user