group list of time series tendencies
This commit is contained in:
parent
b3ab0496f8
commit
d4080e69c1
@ -88,8 +88,7 @@ public class TimeSeriesController {
|
|||||||
|
|
||||||
@PostMapping("getGroupedTendencies")
|
@PostMapping("getGroupedTendencies")
|
||||||
@Operation(description = "Получить список сгруппированных тенденций")
|
@Operation(description = "Получить список сгруппированных тенденций")
|
||||||
public ResponseEntity<TimeSeries> getGroupedTendencies(@RequestBody TimeSeries timeSeries) throws ModelingException, ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
public ResponseEntity<List<TimeSeries>> getGroupedTendencies(@RequestBody List<TimeSeries> timeSeriesList) {
|
||||||
return new ResponseEntity<>(timeSeriesService.getGroupedTendencies(timeSeries), HttpStatus.OK);
|
return new ResponseEntity<>(timeSeriesService.getGroupedTendencies(timeSeriesList), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import ru.ulstu.method.Method;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -43,8 +44,16 @@ public class TimeSeriesService {
|
|||||||
return methodParamBruteForce.getAvailableMethods();
|
return methodParamBruteForce.getAvailableMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimeSeries getGroupedTendencies(TimeSeries timeSeries) throws ModelingException, ExecutionException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
public List<TimeSeries> getGroupedTendencies(List<TimeSeries> timeSeriesList) {
|
||||||
timeSeries = smoothTimeSeries(timeSeries, "FTransform").getTimeSeries();
|
return timeSeriesList.stream().map(this::getGroupedTendencies).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSeries getGroupedTendencies(TimeSeries timeSeries) {
|
||||||
|
try {
|
||||||
|
timeSeries = smoothTimeSeries(timeSeries, "FTransform").getTimeSeries();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
int i = 2;
|
int i = 2;
|
||||||
double prevDiff = timeSeries.getNumericValue(1) -
|
double prevDiff = timeSeries.getNumericValue(1) -
|
||||||
timeSeries.getNumericValue(0);
|
timeSeries.getNumericValue(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user