#2 -- add class for model time series

This commit is contained in:
Anton Romanov 2020-09-12 14:54:46 +04:00
parent 9ffb50d8c1
commit cf46bb0bd6
3 changed files with 24 additions and 5 deletions

View File

@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import ru.ulstu.configurations.ApiConfiguration; import ru.ulstu.configurations.ApiConfiguration;
import ru.ulstu.models.Forecast; import ru.ulstu.models.Forecast;
import ru.ulstu.models.ForecastRequestParams; import ru.ulstu.models.ForecastParams;
import ru.ulstu.models.TimeSeries; import ru.ulstu.models.TimeSeries;
import ru.ulstu.services.TimeSeriesService; import ru.ulstu.services.TimeSeriesService;
@ -39,8 +39,8 @@ public class TimeSeriesController {
@PostMapping("getForecast") @PostMapping("getForecast")
@ApiOperation("Получить прогноз временного ряда") @ApiOperation("Получить прогноз временного ряда")
public ResponseEntity<Forecast> getForecastTimeSeries(@RequestBody ForecastRequestParams forecastRequestParams) { public ResponseEntity<Forecast> getForecastTimeSeries(@RequestBody ForecastParams forecastParams) {
return new ResponseEntity<>(timeSeriesService.getForecast(forecastRequestParams.getOriginalTimeSeries(), return new ResponseEntity<>(timeSeriesService.getForecast(forecastParams.getOriginalTimeSeries(),
forecastRequestParams.getCountForecast()), HttpStatus.OK); forecastParams.getCountForecast()), HttpStatus.OK);
} }
} }

View File

@ -1,6 +1,6 @@
package ru.ulstu.models; package ru.ulstu.models;
public class ForecastRequestParams { public class ForecastParams {
private TimeSeries originalTimeSeries; private TimeSeries originalTimeSeries;
private int countForecast; private int countForecast;

View File

@ -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;
}
}