From cf46bb0bd67dbf67f607f3555c8ceca29517241b Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sat, 12 Sep 2020 14:54:46 +0400 Subject: [PATCH] #2 -- add class for model time series --- .../controllers/TimeSeriesController.java | 8 ++++---- ...RequestParams.java => ForecastParams.java} | 2 +- .../java/ru/ulstu/models/ModelTimeSeries.java | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) rename src/main/java/ru/ulstu/models/{ForecastRequestParams.java => ForecastParams.java} (93%) create mode 100644 src/main/java/ru/ulstu/models/ModelTimeSeries.java diff --git a/src/main/java/ru/ulstu/controllers/TimeSeriesController.java b/src/main/java/ru/ulstu/controllers/TimeSeriesController.java index da0884f..48a4224 100644 --- a/src/main/java/ru/ulstu/controllers/TimeSeriesController.java +++ b/src/main/java/ru/ulstu/controllers/TimeSeriesController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import ru.ulstu.configurations.ApiConfiguration; import ru.ulstu.models.Forecast; -import ru.ulstu.models.ForecastRequestParams; +import ru.ulstu.models.ForecastParams; import ru.ulstu.models.TimeSeries; import ru.ulstu.services.TimeSeriesService; @@ -39,8 +39,8 @@ public class TimeSeriesController { @PostMapping("getForecast") @ApiOperation("Получить прогноз временного ряда") - public ResponseEntity getForecastTimeSeries(@RequestBody ForecastRequestParams forecastRequestParams) { - return new ResponseEntity<>(timeSeriesService.getForecast(forecastRequestParams.getOriginalTimeSeries(), - forecastRequestParams.getCountForecast()), HttpStatus.OK); + public ResponseEntity getForecastTimeSeries(@RequestBody ForecastParams forecastParams) { + return new ResponseEntity<>(timeSeriesService.getForecast(forecastParams.getOriginalTimeSeries(), + forecastParams.getCountForecast()), HttpStatus.OK); } } diff --git a/src/main/java/ru/ulstu/models/ForecastRequestParams.java b/src/main/java/ru/ulstu/models/ForecastParams.java similarity index 93% rename from src/main/java/ru/ulstu/models/ForecastRequestParams.java rename to src/main/java/ru/ulstu/models/ForecastParams.java index 3ec6f85..2375ac6 100644 --- a/src/main/java/ru/ulstu/models/ForecastRequestParams.java +++ b/src/main/java/ru/ulstu/models/ForecastParams.java @@ -1,6 +1,6 @@ package ru.ulstu.models; -public class ForecastRequestParams { +public class ForecastParams { private TimeSeries originalTimeSeries; private int countForecast; diff --git a/src/main/java/ru/ulstu/models/ModelTimeSeries.java b/src/main/java/ru/ulstu/models/ModelTimeSeries.java new file mode 100644 index 0000000..cd28be8 --- /dev/null +++ b/src/main/java/ru/ulstu/models/ModelTimeSeries.java @@ -0,0 +1,19 @@ +package ru.ulstu.models; + +public class ModelTimeSeries { + private TimeSeries originalTimeSeries; + private TimeSeries modelTimeSeries; + + public ModelTimeSeries(TimeSeries originalTimeSeries) { + this.originalTimeSeries = originalTimeSeries; + this.modelTimeSeries = new TimeSeries("Model time series of '" + originalTimeSeries.getName() + "'"); + } + + public TimeSeries getOriginalTimeSeries() { + return originalTimeSeries; + } + + public TimeSeries getModelTimeSeries() { + return modelTimeSeries; + } +}