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