Starsector API
Loading...
Searching...
No Matches
BasePLStat.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.plog;
2
3import java.awt.Color;
4import java.util.ArrayList;
5import java.util.List;
6
7import com.fs.starfarer.api.util.Misc;
8
9public class BasePLStat implements PLStat {
10
11 List<Long> accrued = new ArrayList<Long>();
12
13 protected Object readResolve() {
14 if (accrued == null) {
15 accrued = new ArrayList<Long>();
16 }
17 return this;
18 }
19
20
21 public Color getGraphColor() {
22 return Color.white;
23 }
24
25 public String getGraphLabel() {
26 return "Override getGraphLabel()";
27 }
28
29 public String getId() {
30 return getClass().getSimpleName();
31 }
32
33 public void accrueValue() {
34 accrued.add(getCurrentValue());
35 }
36
37 public long getValueForAllAccrued() {
39 long best = 0;
40 long maxDiff = Integer.MIN_VALUE;
41 for (Long curr : accrued) {
42 long diff = Math.abs(curr - prev);
43 if (diff > maxDiff) {
44 maxDiff = diff;
45 best = curr;
46 }
47 }
48 accrued.clear();
49
50 return best;
51 }
52
53 public long getCurrentValue() {
54 return 0;
55 }
56
57
58 public long getGraphMax() {
59 return -1;
60 }
61
62 public String getHoverText(long value) {
63 return getGraphLabel() + ": " + Misc.getWithDGS(value);
64 }
65
66
67 public String getSharedCategory() {
68 return null;
69 }
70
71}
72
73