add CompressionMetricClasses
This commit is contained in:
parent
a8b6cf7d29
commit
0da256106e
@ -0,0 +1,38 @@
|
|||||||
|
package ru.ulstu.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import ru.ulstu.configuration.ApiConfiguration;
|
||||||
|
import ru.ulstu.datamodel.exception.ModelingException;
|
||||||
|
import ru.ulstu.datamodel.ts.TimeSeries;
|
||||||
|
import ru.ulstu.estimate.CompressionMetricService;
|
||||||
|
import ru.ulstu.service.UtilService;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ApiConfiguration.API_1_0)
|
||||||
|
public class CompressionMetricController {
|
||||||
|
|
||||||
|
private final UtilService utilService;
|
||||||
|
private final CompressionMetricService compressionMetricService;
|
||||||
|
|
||||||
|
public CompressionMetricController(UtilService utilService, CompressionMetricService compressionMetricService) {
|
||||||
|
this.utilService = utilService;
|
||||||
|
this.compressionMetricService = compressionMetricService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("getMetricOfRandom")
|
||||||
|
@Operation(description = "Получить метрику сжатия")
|
||||||
|
public ResponseEntity<TimeSeries> getRandomTimeSeries(@RequestParam("length") int length) throws ModelingException, ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
||||||
|
var randomTS = utilService.getRandomTimeSeries(length);
|
||||||
|
var ts1 = compressionMetricService.getCompressionTimeSeries(randomTS);
|
||||||
|
return new ResponseEntity<>( null/*Сюда вывод*/, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package ru.ulstu.estimate;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import ru.ulstu.datamodel.ModelingResult;
|
||||||
|
import ru.ulstu.datamodel.exception.ModelingException;
|
||||||
|
import ru.ulstu.datamodel.ts.TimeSeries;
|
||||||
|
import ru.ulstu.service.TimeSeriesService;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CompressionMetricService {
|
||||||
|
|
||||||
|
private final TimeSeriesService timeSeriesService;
|
||||||
|
|
||||||
|
public CompressionMetricService(TimeSeriesService timeSeriesService) {
|
||||||
|
this.timeSeriesService = timeSeriesService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getCompressionMetric() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getCompressionMetricForAnomaly() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSeries getCompressionTimeSeries(TimeSeries ts) throws ModelingException, ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
||||||
|
ModelingResult modelingResult = timeSeriesService.smoothTimeSeries(ts, "FTransform");
|
||||||
|
//var ts1 = fTransform.getForecast(ts, )
|
||||||
|
return modelingResult.getTimeSeries();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user