Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
Moving cache up to include a few more variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Reflex18 committed Apr 4, 2024
1 parent ec8daa7 commit 9996a88
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,10 @@ private long getAvgOut() {
return sum / Math.max(energyOutputValues.size(), 1);
}

// Caching avgin and avgout
double avgIn = getAvgIn();
double avgOut = getAvgOut();

@Override
public String[] getInfoData() {
NumberFormat nf = NumberFormat.getNumberInstance();
Expand All @@ -917,12 +921,8 @@ public String[] getInfoData() {
ll.add("Passive Loss: " + nf.format(passiveDischargeAmount) + "EU/t");
ll.add("EU IN: " + GT_Utility.formatNumbers(inputLastTick) + "EU/t");
ll.add("EU OUT: " + GT_Utility.formatNumbers(outputLastTick) + "EU/t");
ll.add("Avg EU IN: " + nf.format(getAvgIn()) + " (last " + secInterval + " seconds)");
ll.add("Avg EU OUT: " + nf.format(getAvgOut()) + " (last " + secInterval + " seconds)");

// Caching avgin and avgout
double avgIn = getAvgIn();
double avgOut = getAvgOut();
ll.add("Avg EU IN: " + nf.format(AvgIn) + " (last " + secInterval + " seconds)");
ll.add("Avg EU OUT: " + nf.format(AvgOut) + " (last " + secInterval + " seconds)");

// Check if the system is charging or discharging
if (avgIn > avgOut) {
Expand Down

0 comments on commit 9996a88

Please sign in to comment.