Err too much.

This commit is contained in:
AlgorithmX2
2014-01-20 10:41:37 -06:00
parent 5652ec30ec
commit 834e9c04c5
159 changed files with 7953 additions and 1541 deletions
+11 -34
View File
@@ -6,80 +6,57 @@ import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.IGridStorage;
import appeng.me.cache.TickManagerCache;
import appeng.util.Platform;
public class GridCacheWrapper implements IGridCache
{
final IGridCache myCache;
final public boolean isTickHandler;
final IGridCache myCache;
final String name;
public long LastFiveTicksTime = 0;
public long LastFiveRemoveTime = 0;
public long LastFiveAddNode = 0;
public GridCacheWrapper(IGridCache gc) {
public GridCacheWrapper(final IGridCache gc) {
myCache = gc;
name = myCache.getClass().getName();
isTickHandler = myCache instanceof TickManagerCache;
}
@Override
public void onUpdateTick(IGrid grid)
public void onUpdateTick(final IGrid grid)
{
long startTime = Platform.nanoTime();
myCache.onUpdateTick( grid );
long estimatedTime = Platform.nanoTime() - startTime;
if ( isTickHandler ) // remove the ticking of tickables from the
// equation.
estimatedTime -= ((TickManagerCache) myCache).getInnerTime();
LastFiveTicksTime = ((LastFiveTicksTime * 4) / 5) + estimatedTime;
}
@Override
public void removeNode(IGrid grid, IGridNode gridNode, IGridHost machine)
public void removeNode(final IGrid grid, final IGridNode gridNode, final IGridHost machine)
{
long startTime = Platform.nanoTime();
myCache.removeNode( grid, gridNode, machine );
long estimatedTime = Platform.nanoTime() - startTime;
LastFiveRemoveTime = ((LastFiveRemoveTime * 4) / 5) + estimatedTime;
}
@Override
public void addNode(IGrid grid, IGridNode gridNode, IGridHost machine)
public void addNode(final IGrid grid, final IGridNode gridNode, final IGridHost machine)
{
long startTime = Platform.nanoTime();
myCache.addNode( grid, gridNode, machine );
long estimatedTime = Platform.nanoTime() - startTime;
LastFiveAddNode = ((LastFiveAddNode * 4) / 5) + estimatedTime;
}
public String getName()
{
return myCache.getClass().getName();
return name;
}
@Override
public void onSplit(IGridStorage storageB)
public void onSplit(final IGridStorage storageB)
{
myCache.onSplit( storageB );
}
@Override
public void onJoin(IGridStorage storageB)
public void onJoin(final IGridStorage storageB)
{
myCache.onJoin( storageB );
}
@Override
public void populateGridStorage(IGridStorage storage)
public void populateGridStorage(final IGridStorage storage)
{
myCache.populateGridStorage( storage );
}