Some refactoring.
This commit is contained in:
parent
298ae41198
commit
50b0285c15
11 changed files with 32 additions and 60 deletions
46
me/cache/EnergyGridCache.java
vendored
46
me/cache/EnergyGridCache.java
vendored
|
@ -58,11 +58,6 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
double tickDrainPerTick = 0;
|
||||
double tickInjectionPerTick = 0;
|
||||
|
||||
// Double[] totalDrainPastTicks = new Double[] { 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
// 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
// Double[] totalInjectionPastTicks = new Double[] { 0.0, 0.0, 0.0, 0.0,
|
||||
// 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
|
||||
/**
|
||||
* power status
|
||||
*/
|
||||
|
@ -76,13 +71,15 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
double extra = 0;
|
||||
|
||||
IAEPowerStorage lastProvider;
|
||||
Set<IAEPowerStorage> providers = new LinkedHashSet();
|
||||
final Set<IAEPowerStorage> providers = new LinkedHashSet();
|
||||
|
||||
IAEPowerStorage lastRequestor;
|
||||
Set<IAEPowerStorage> requesters = new LinkedHashSet();
|
||||
final Set<IAEPowerStorage> requesters = new LinkedHashSet();
|
||||
|
||||
public TreeSet<EnergyThreshold> interests = new TreeSet<EnergyThreshold>();
|
||||
private HashMap<IGridNode, IEnergyWatcher> watchers = new HashMap<IGridNode, IEnergyWatcher>();
|
||||
final public TreeSet<EnergyThreshold> interests = new TreeSet<EnergyThreshold>();
|
||||
final private HashMap<IGridNode, IEnergyWatcher> watchers = new HashMap<IGridNode, IEnergyWatcher>();
|
||||
|
||||
final private Set<IEnergyGrid> localSeen = new HashSet();
|
||||
|
||||
private double buffer()
|
||||
{
|
||||
|
@ -111,7 +108,7 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
return lastProvider;
|
||||
}
|
||||
|
||||
Multiset<IEnergyGridProvider> gproviders = HashMultiset.create();
|
||||
final Multiset<IEnergyGridProvider> gproviders = HashMultiset.create();
|
||||
|
||||
final IGrid myGrid;
|
||||
PathGridCache pgc;
|
||||
|
@ -259,8 +256,6 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
return Math.max( 0.0, amt - buffer() );
|
||||
}
|
||||
|
||||
Set<IEnergyGrid> localSeen = new HashSet();
|
||||
|
||||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, PowerMultiplier pm)
|
||||
{
|
||||
|
@ -388,15 +383,6 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
tickDrainPerTick = 0;
|
||||
tickInjectionPerTick = 0;
|
||||
|
||||
// next tick is here...
|
||||
// for (int x = 0; x < totalDrainPastTicks.length - 1; x++)
|
||||
// totalDrainPastTicks[x + 1] = totalDrainPastTicks[x];
|
||||
// totalDrainPastTicks[0] = 0.0;
|
||||
|
||||
// for (int x = 0; x < totalInjectionPastTicks.length - 1; x++)
|
||||
// totalInjectionPastTicks[x + 1] = totalInjectionPastTicks[x];
|
||||
// totalInjectionPastTicks[0] = 0.0;
|
||||
|
||||
// power information.
|
||||
double drained = extractAEPower( getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
boolean currentlyHasPower = drained >= drainPerTick - 0.001;
|
||||
|
@ -417,8 +403,6 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
publicPowerState( false, myGrid );
|
||||
|
||||
availableTicksSinceUpdate++;
|
||||
// if ( extra > 32 )
|
||||
// injectPower( 0.0, Actionable.MODULATE );
|
||||
}
|
||||
|
||||
private void publicPowerState(boolean newState, IGrid grid)
|
||||
|
@ -559,25 +543,13 @@ public class EnergyGridCache implements IEnergyGrid
|
|||
@Override
|
||||
public double getAvgPowerUsage()
|
||||
{
|
||||
return avgDrainPerTick;/*
|
||||
* double out = 0;
|
||||
*
|
||||
* for (double x : totalDrainPastTicks) out += x;
|
||||
*
|
||||
* return out / totalDrainPastTicks.length;
|
||||
*/
|
||||
return avgDrainPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAvgPowerInjection()
|
||||
{
|
||||
return avgInjectionPerTick;/*
|
||||
* double out = 0;
|
||||
*
|
||||
* for (double x : totalInjectionPastTicks) out += x;
|
||||
*
|
||||
* return out / totalInjectionPastTicks.length;
|
||||
*/
|
||||
return avgInjectionPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
8
me/cache/PathGridCache.java
vendored
8
me/cache/PathGridCache.java
vendored
|
@ -39,16 +39,16 @@ public class PathGridCache implements IPathingGrid
|
|||
boolean updateNetwork = true;
|
||||
boolean booting = false;
|
||||
|
||||
LinkedList<PathSegment> active = new LinkedList();
|
||||
final LinkedList<PathSegment> active = new LinkedList();
|
||||
|
||||
ControllerState controllerState = ControllerState.NO_CONTROLLER;
|
||||
|
||||
int instance = Integer.MIN_VALUE;
|
||||
|
||||
int ticksUntilReady = 20;
|
||||
Set<TileController> controllers = new HashSet();
|
||||
Set<IGridNode> requireChannels = new HashSet();
|
||||
Set<IGridNode> blockDense = new HashSet();
|
||||
final Set<TileController> controllers = new HashSet();
|
||||
final Set<IGridNode> requireChannels = new HashSet();
|
||||
final Set<IGridNode> blockDense = new HashSet();
|
||||
|
||||
final IGrid myGrid;
|
||||
private HashSet<IPathItem> semiOpen = new HashSet();
|
||||
|
|
4
me/cache/SecurityCache.java
vendored
4
me/cache/SecurityCache.java
vendored
|
@ -22,8 +22,8 @@ import appeng.me.GridNode;
|
|||
public class SecurityCache implements IGridCache, ISecurityGrid
|
||||
{
|
||||
|
||||
private List<ISecurityProvider> securityProvider = new ArrayList();
|
||||
private HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms = new HashMap<Integer, EnumSet<SecurityPermissions>>();
|
||||
final private List<ISecurityProvider> securityProvider = new ArrayList();
|
||||
final private HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms = new HashMap<Integer, EnumSet<SecurityPermissions>>();
|
||||
|
||||
public SecurityCache(IGrid g) {
|
||||
myGrid = g;
|
||||
|
|
8
me/cache/TickManagerCache.java
vendored
8
me/cache/TickManagerCache.java
vendored
|
@ -24,12 +24,12 @@ public class TickManagerCache implements ITickManager
|
|||
myGrid = g;
|
||||
}
|
||||
|
||||
HashMap<IGridNode, TickTracker> alertable = new HashMap<IGridNode, TickTracker>();
|
||||
final HashMap<IGridNode, TickTracker> alertable = new HashMap<IGridNode, TickTracker>();
|
||||
|
||||
HashMap<IGridNode, TickTracker> sleeping = new HashMap<IGridNode, TickTracker>();
|
||||
HashMap<IGridNode, TickTracker> awake = new HashMap<IGridNode, TickTracker>();
|
||||
final HashMap<IGridNode, TickTracker> sleeping = new HashMap<IGridNode, TickTracker>();
|
||||
final HashMap<IGridNode, TickTracker> awake = new HashMap<IGridNode, TickTracker>();
|
||||
|
||||
PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<TickTracker>();
|
||||
final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<TickTracker>();
|
||||
|
||||
public long getCurrentTick()
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ import appeng.util.Platform;
|
|||
public abstract class MBCalculator
|
||||
{
|
||||
|
||||
private IAEMultiBlock target;
|
||||
final private IAEMultiBlock target;
|
||||
|
||||
public MBCalculator(IAEMultiBlock t) {
|
||||
target = t;
|
||||
|
|
|
@ -17,8 +17,8 @@ import appeng.tile.crafting.TileCraftingTile;
|
|||
|
||||
public class CraftingCPUCalculator extends MBCalculator
|
||||
{
|
||||
|
||||
TileCraftingTile tqb;
|
||||
|
||||
final TileCraftingTile tqb;
|
||||
|
||||
public CraftingCPUCalculator(IAEMultiBlock t) {
|
||||
super( t );
|
||||
|
|
|
@ -75,9 +75,9 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
|
|||
IItemList<IAEItemStack> waitingFor = AEApi.instance().storage().createItemList();
|
||||
|
||||
// instance sate
|
||||
private LinkedList<TileCraftingTile> tiles = new LinkedList();
|
||||
private LinkedList<TileCraftingTile> storage = new LinkedList<TileCraftingTile>();
|
||||
private LinkedList<TileCraftingMonitorTile> status = new LinkedList<TileCraftingMonitorTile>();
|
||||
final private LinkedList<TileCraftingTile> tiles = new LinkedList();
|
||||
final private LinkedList<TileCraftingTile> storage = new LinkedList<TileCraftingTile>();
|
||||
final private LinkedList<TileCraftingMonitorTile> status = new LinkedList<TileCraftingMonitorTile>();
|
||||
|
||||
long availableStorage = 0;
|
||||
public ICraftingLink myLastLink;
|
||||
|
|
|
@ -13,7 +13,7 @@ import appeng.util.Platform;
|
|||
public class QuantumCalculator extends MBCalculator
|
||||
{
|
||||
|
||||
TileQuantumBridge tqb;
|
||||
final private TileQuantumBridge tqb;
|
||||
|
||||
public QuantumCalculator(IAEMultiBlock t) {
|
||||
super( t );
|
||||
|
|
|
@ -26,8 +26,8 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|||
public class QuantumCluster implements ILocatable, IAECluster
|
||||
{
|
||||
|
||||
public WorldCoord min;
|
||||
public WorldCoord max;
|
||||
final public WorldCoord min;
|
||||
final public WorldCoord max;
|
||||
public boolean isDestroyed = false;
|
||||
public boolean updateStatus = true;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import appeng.tile.spatial.TileSpatialPylon;
|
|||
public class SpatialPylonCalculator extends MBCalculator
|
||||
{
|
||||
|
||||
TileSpatialPylon tqb;
|
||||
private final TileSpatialPylon tqb;
|
||||
|
||||
public SpatialPylonCalculator(IAEMultiBlock t) {
|
||||
super( t );
|
||||
|
|
|
@ -17,13 +17,13 @@ public class SpatialPylonCluster implements IAECluster
|
|||
X, Y, Z, UNFORMED
|
||||
};
|
||||
|
||||
public DimensionalCoord min;
|
||||
public DimensionalCoord max;
|
||||
final public DimensionalCoord min;
|
||||
final public DimensionalCoord max;
|
||||
public boolean isDestroyed = false;
|
||||
|
||||
public Axis currentAxis = Axis.UNFORMED;
|
||||
|
||||
List<TileSpatialPylon> line = new ArrayList();
|
||||
final List<TileSpatialPylon> line = new ArrayList();
|
||||
public boolean isValid;
|
||||
public boolean hasPower;
|
||||
public boolean hasChannel;
|
||||
|
|
Loading…
Reference in a new issue