X: NFT - Add @NotNull
This commit is contained in:
@@ -28,9 +28,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
public final class EvelynMissionControlImpl implements
|
||||
EvelynMissionControl,
|
||||
NenjimProcess {
|
||||
public final class EvelynMissionControlImpl implements EvelynMissionControl, NenjimProcess {
|
||||
|
||||
// region Constructors
|
||||
public EvelynMissionControlImpl(
|
||||
@@ -55,7 +53,7 @@ public final class EvelynMissionControlImpl implements
|
||||
// endregion
|
||||
|
||||
// region Private methods
|
||||
private static StatusIndexChart createStatusIndexChart() {
|
||||
private static @NotNull StatusIndexChart createStatusIndexChart() {
|
||||
NumberAxis xAxis = new NumberAxis(0, 1, 1);
|
||||
xAxis.setLabel("Time");
|
||||
xAxis.setTickLabelFormatter(TIMESTAMP_FORMATTER);
|
||||
@@ -84,7 +82,7 @@ public final class EvelynMissionControlImpl implements
|
||||
return new StatusIndexChart(chart, xAxis, yAxis, priceIndexSeries);
|
||||
}
|
||||
|
||||
private static double calculateYBound(List<EvelynStatusIndexPoint> history) {
|
||||
private static double calculateYBound(@NotNull List<EvelynStatusIndexPoint> history) {
|
||||
BigDecimal maxAbsoluteValue = BigDecimal.ZERO;
|
||||
for (EvelynStatusIndexPoint point : history) {
|
||||
maxAbsoluteValue = max(maxAbsoluteValue, point.evelynPriceIndex());
|
||||
@@ -100,9 +98,9 @@ public final class EvelynMissionControlImpl implements
|
||||
}
|
||||
|
||||
private static void refreshChart(
|
||||
StatusIndexChart statusIndexChart,
|
||||
List<EvelynStatusIndexPoint> history
|
||||
) {
|
||||
@NotNull StatusIndexChart statusIndexChart,
|
||||
@NotNull List<EvelynStatusIndexPoint> history
|
||||
) throws IllegalStateException {
|
||||
if (!Platform.isFxApplicationThread()) {
|
||||
throw new IllegalStateException("Status-index charts must be updated on the JavaFX Application Thread");
|
||||
}
|
||||
@@ -134,7 +132,7 @@ public final class EvelynMissionControlImpl implements
|
||||
updateAxisBounds(statusIndexChart, history);
|
||||
}
|
||||
|
||||
private static BigDecimal max(BigDecimal currentMaximum, BigDecimal candidate) {
|
||||
private static @NotNull BigDecimal max(@NotNull BigDecimal currentMaximum, @NotNull BigDecimal candidate) {
|
||||
return currentMaximum.max(candidate.abs());
|
||||
}
|
||||
|
||||
@@ -156,7 +154,10 @@ public final class EvelynMissionControlImpl implements
|
||||
refreshTimeline.playFromStart();
|
||||
}
|
||||
|
||||
private TabPane createMissionControlTabs(String color, StatusIndexChart statusIndexChart) {
|
||||
private @NotNull TabPane createMissionControlTabs(
|
||||
@NotNull String color,
|
||||
@NotNull StatusIndexChart statusIndexChart
|
||||
) {
|
||||
TabPane tabs = new TabPane(
|
||||
createOverviewTab(color, statusIndexChart),
|
||||
createMissionControlTab("Portfolio", color),
|
||||
@@ -172,7 +173,7 @@ public final class EvelynMissionControlImpl implements
|
||||
return tabs;
|
||||
}
|
||||
|
||||
private Tab createOverviewTab(String color, StatusIndexChart statusIndexChart) {
|
||||
private @NotNull Tab createOverviewTab(@NotNull String color, @NotNull StatusIndexChart statusIndexChart) {
|
||||
StackPane content = new StackPane(statusIndexChart.chart());
|
||||
content.setStyle("-fx-background-color: " + color + ";");
|
||||
|
||||
@@ -181,10 +182,10 @@ public final class EvelynMissionControlImpl implements
|
||||
return tab;
|
||||
}
|
||||
|
||||
private static XYChart.Series<Number, Number> createSeries(
|
||||
String name,
|
||||
List<EvelynStatusIndexPoint> history,
|
||||
Function<EvelynStatusIndexPoint, BigDecimal> valueExtractor
|
||||
private static @NotNull XYChart.Series<Number, Number> createSeries(
|
||||
@NotNull String name,
|
||||
@NotNull List<EvelynStatusIndexPoint> history,
|
||||
@NotNull Function<EvelynStatusIndexPoint, BigDecimal> valueExtractor
|
||||
) {
|
||||
XYChart.Series<Number, Number> series = new XYChart.Series<>();
|
||||
series.setName(name);
|
||||
@@ -198,8 +199,8 @@ public final class EvelynMissionControlImpl implements
|
||||
}
|
||||
|
||||
private static void updateAxisBounds(
|
||||
StatusIndexChart statusIndexChart,
|
||||
List<EvelynStatusIndexPoint> history
|
||||
@NotNull StatusIndexChart statusIndexChart,
|
||||
@NotNull List<EvelynStatusIndexPoint> history
|
||||
) {
|
||||
long minimumTimestamp;
|
||||
long maximumTimestamp;
|
||||
@@ -225,7 +226,7 @@ public final class EvelynMissionControlImpl implements
|
||||
statusIndexChart.yAxis().setTickUnit(yBound / 5.0);
|
||||
}
|
||||
|
||||
private Tab createMissionControlTab(String title, String color) {
|
||||
private @NotNull Tab createMissionControlTab(@NotNull String title, @NotNull String color) {
|
||||
StackPane content = new StackPane();
|
||||
content.setStyle("-fx-background-color: " + color + ";");
|
||||
|
||||
@@ -235,7 +236,7 @@ public final class EvelynMissionControlImpl implements
|
||||
return tab;
|
||||
}
|
||||
|
||||
private TabPane createRootTabs() {
|
||||
private @NotNull TabPane createRootTabs() {
|
||||
productionChart = createStatusIndexChart();
|
||||
testChart = createStatusIndexChart();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user