mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
Implemented a stub for a function converter
Committing to be able to push the changes
This commit is contained in:
1 parent
1319bf390b
commit
02a07f0bb6
4 files changed
+103
-7
No files matched your search
+90
@@ -0,0 +1,90 @@
|
||||
package com.sap.sailing.datamining.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.datamining.impl.data.GPSFixWithContext;
|
||||
import com.sap.sailing.datamining.impl.data.TrackedLegOfCompetitorWithContext;
|
||||
import com.sap.sailing.datamining.shared.DimensionIdentifier;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sse.datamining.functions.Function;
|
||||
import com.sap.sse.datamining.shared.dto.FunctionDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.FunctionDTOImpl;
|
||||
|
||||
public class DeprecatedToFunctionConverter {
|
||||
|
||||
private static Map<StatisticType, FunctionDTO> statisticTypeToFunctionDTOMap = new HashMap<>();
|
||||
private static Map<DimensionIdentifier, FunctionDTO> dimensionIdentifierToFunctionDTOMap = new HashMap<>();
|
||||
|
||||
private static Map<FunctionDTO, Function<?>> functionDTOToFunctionMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
initializeDeprecatedEnumsToFunctionDTOMaps();
|
||||
initializeFunctionDTOToFunctionMap();
|
||||
}
|
||||
|
||||
public static FunctionDTO getFunctionDTOFor(StatisticType statisticType) {
|
||||
return statisticTypeToFunctionDTOMap.get(statisticType);
|
||||
}
|
||||
|
||||
private static void initializeDeprecatedEnumsToFunctionDTOMaps() {
|
||||
for (StatisticType statisticType : StatisticType.values()) {
|
||||
FunctionDTO functionDTO = null;
|
||||
switch (statisticType) {
|
||||
case Distance:
|
||||
functionDTO = new FunctionDTOImpl("Distance", GPSFixWithContext.class.getSimpleName(), "double", new ArrayList<String>(), "Distance", false);
|
||||
break;
|
||||
case Speed:
|
||||
functionDTO = new FunctionDTOImpl("Speed", TrackedLegOfCompetitorWithContext.class.getSimpleName(), "double", new ArrayList<String>(), "Speed", false);
|
||||
break;
|
||||
}
|
||||
statisticTypeToFunctionDTOMap.put(statisticType, functionDTO);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initializeFunctionDTOToFunctionMap() {
|
||||
for (DimensionIdentifier dimensionIdentifier : DimensionIdentifier.values()) {
|
||||
// FunctionDTO functionDTO = null;
|
||||
switch (dimensionIdentifier) {
|
||||
case BoatClassName:
|
||||
break;
|
||||
case CompetitorName:
|
||||
break;
|
||||
case CourseAreaName:
|
||||
break;
|
||||
case FleetName:
|
||||
break;
|
||||
case LegNumber:
|
||||
break;
|
||||
case LegType:
|
||||
break;
|
||||
case Nationality:
|
||||
break;
|
||||
case RaceName:
|
||||
break;
|
||||
case RegattaName:
|
||||
break;
|
||||
case SailID:
|
||||
break;
|
||||
case WindStrength:
|
||||
break;
|
||||
case Year:
|
||||
break;
|
||||
}
|
||||
dimensionIdentifierToFunctionDTOMap.put(dimensionIdentifier, functionDTO);
|
||||
}
|
||||
}
|
||||
|
||||
public static FunctionDTO getFunctionDTOFor(DimensionIdentifier dimensionIdentifier) {
|
||||
return dimensionIdentifierToFunctionDTOMap.get(dimensionIdentifier);
|
||||
}
|
||||
|
||||
public static Function<?> getFunctionFor(FunctionDTO functionDTO) {
|
||||
return functionDTOToFunctionMap.get(functionDTO);
|
||||
}
|
||||
|
||||
private DeprecatedToFunctionConverter() {
|
||||
}
|
||||
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,11 @@
|
||||
package com.sap.sailing.datamining.shared;
|
||||
package com.sap.sailing.datamining.impl;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.sap.sailing.datamining.shared.DimensionIdentifier;
|
||||
import com.sap.sailing.datamining.shared.QueryDefinition;
|
||||
import com.sap.sailing.datamining.shared.QueryDefinitionDeprecated;
|
||||
import com.sap.sailing.datamining.shared.StatisticType;
|
||||
import com.sap.sailing.datamining.shared.impl.QueryDefinitionImpl;
|
||||
import com.sap.sse.datamining.shared.dto.FunctionDTO;
|
||||
|
||||
@@ -26,15 +30,11 @@ public class QueryDefinitionConverter {
|
||||
}
|
||||
|
||||
private static FunctionDTO convertToFunctionDTO(StatisticType statisticType) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
// return null;
|
||||
return DeprecatedToFunctionConverter.getFunctionDTOFor(statisticType);
|
||||
}
|
||||
|
||||
private static FunctionDTO convertToFunctionDTO(DimensionIdentifier dimensionIdentifier) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
// return null;
|
||||
return DeprecatedToFunctionConverter.getFunctionDTOFor(dimensionIdentifier);
|
||||
}
|
||||
|
||||
private QueryDefinitionConverter() {
|
||||
@@ -2,6 +2,9 @@ package com.sap.sailing.domain.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sse.datamining.shared.Unit;
|
||||
import com.sap.sse.datamining.shared.annotations.SideEffectFreeValue;
|
||||
|
||||
/**
|
||||
* A speed, convertable in various units of measure. Can be negative.
|
||||
*
|
||||
@@ -48,6 +51,7 @@ public interface Speed extends Comparable<Speed>, Serializable {
|
||||
}
|
||||
};
|
||||
|
||||
@SideEffectFreeValue(messageKey="InKnots", resultDecimals=2, resultUnit=Unit.Knots)
|
||||
double getKnots();
|
||||
|
||||
double getMetersPerSecond();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sse.datamining.shared.annotations.SideEffectFreeValue;
|
||||
|
||||
public interface Moving {
|
||||
@SideEffectFreeValue(messageKey="Speed")
|
||||
SpeedWithBearing getSpeed();
|
||||
}
|
||||
Reference in new issue
Block a user