mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-05 03:43:52 +00:00
Refactored DTOs so we can show ranges in the UI
This commit is contained in:
1 parent
6432785f5c
commit
903595ad47
16 files changed
+149
-77
No files matched your search
+3
-1
@@ -19,7 +19,7 @@ import com.sap.sailing.gwt.ui.shared.dispatch.event.LiveRaceDTO;
|
||||
public class RacesListLive extends Composite implements RefreshableWidget<SortedSetResult<LiveRaceDTO>> {
|
||||
|
||||
private final RaceListLiveRaces raceList;
|
||||
|
||||
|
||||
public RacesListLive(EventView.Presenter presenter, boolean showRegattaDetails) {
|
||||
raceList = new RaceListLiveRaces(presenter, showRegattaDetails);
|
||||
initWidget(new RaceListContainer<LiveRaceDTO>(StringMessages.INSTANCE.liveNow(), raceList));
|
||||
@@ -46,6 +46,8 @@ public class RacesListLive extends Composite implements RefreshableWidget<Sorted
|
||||
private final SortableRaceListColumn<LiveRaceDTO, ?> courseAreaColumn = RaceListColumnFactory.getCourseAreaColumn();
|
||||
private final SortableRaceListColumn<LiveRaceDTO, ?> courseColumn = RaceListColumnFactory.getCourseColumn();
|
||||
private final SortableRaceListColumn<LiveRaceDTO, ?> raceViewStateColumn = RaceListColumnFactory.getRaceViewStateColumn();
|
||||
private final SortableRaceListColumn<LiveRaceDTO, ?> windSpeedColumn = RaceListColumnFactory
|
||||
.getWindSpeedColumn();
|
||||
|
||||
public RaceListLiveRaces(EventView.Presenter presenter, boolean showRegattaDetails) {
|
||||
super(presenter);
|
||||
|
||||
+3
-2
@@ -12,10 +12,11 @@ import com.sap.sailing.gwt.home.client.place.event.partials.raceListLive.RacesLi
|
||||
import com.sap.sailing.gwt.home.client.place.event.partials.raceListLive.RacesListLiveResources.LocalCss;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SortedCellTable;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.wind.AbstractWindDTO;
|
||||
import com.sap.sse.gwt.theme.client.component.celltable.CleanCellTableResources;
|
||||
import com.sap.sse.gwt.theme.client.component.celltable.StyledHeaderOrFooterBuilder;
|
||||
|
||||
public abstract class AbstractRaceList<T extends RaceMetadataDTO> extends Composite {
|
||||
public abstract class AbstractRaceList<T extends RaceMetadataDTO<? extends AbstractWindDTO>> extends Composite {
|
||||
|
||||
private static final LocalCss CSS = RacesListLiveResources.INSTANCE.css();
|
||||
|
||||
@@ -25,7 +26,7 @@ public abstract class AbstractRaceList<T extends RaceMetadataDTO> extends Compos
|
||||
protected final SortableRaceListColumn<T, ?> raceNameColumn = RaceListColumnFactory.getRaceNameColumn();
|
||||
protected final SortableRaceListColumn<T, ?> fleetNameColumn = RaceListColumnFactory.getFleetNameColumn();
|
||||
protected final SortableRaceListColumn<T, ?> startTimeColumn = RaceListColumnFactory.getStartTimeColumn();
|
||||
protected final SortableRaceListColumn<T, ?> windSpeedColumn = RaceListColumnFactory.getWindSpeedColumn();
|
||||
// protected final SortableRaceListColumn<T, ?> windSpeedColumn = RaceListColumnFactory.getWindSpeedColumn();
|
||||
protected final SortableRaceListColumn<T, ?> windDirectionColumn = RaceListColumnFactory.getWindDirectionColumn();
|
||||
protected final SortableRaceListColumn<T, ?> raceViewerButtonColumn;
|
||||
|
||||
|
||||
+53
-15
@@ -44,7 +44,7 @@ import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO.RaceTrackingState;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO.RaceViewState;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceProgressDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.SimpleWindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.wind.AbstractWindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.util.NullSafeComparableComparator;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.Util;
|
||||
@@ -82,7 +82,7 @@ public class RaceListColumnFactory {
|
||||
SafeHtml imageHeader(String styleNames, SafeUri imageURL);
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, FleetMetadataDTO> getFleetCornerColumn() {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, FleetMetadataDTO> getFleetCornerColumn() {
|
||||
Cell<FleetMetadataDTO> cell = new AbstractCell<FleetMetadataDTO>() {
|
||||
@Override
|
||||
public void render(Context context, FleetMetadataDTO value, SafeHtmlBuilder sb) {
|
||||
@@ -106,7 +106,7 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, String> getRegattaNameColumn() {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, String> getRegattaNameColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, String>(new NaturalComparator(false)) {
|
||||
@Override
|
||||
@@ -132,7 +132,7 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, String> getRaceNameColumn() {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, String> getRaceNameColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, String>(new NaturalComparator(false)) {
|
||||
@Override
|
||||
@@ -158,7 +158,7 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, String> getFleetNameColumn() {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, String> getFleetNameColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, String>(new NaturalComparator(false)) {
|
||||
@Override
|
||||
@@ -184,7 +184,7 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, Date> getStartTimeColumn() {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, Date> getStartTimeColumn() {
|
||||
Cell<Date> cell = new DateCell(DateTimeFormat.getFormat(PredefinedFormat.HOUR24_MINUTE));
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, Date>(new NullSafeComparableComparator<Date>()) {
|
||||
@Override
|
||||
@@ -265,7 +265,7 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, String> getWindSpeedColumn() {
|
||||
public static <T extends LiveRaceDTO> SortableRaceListColumn<T, String> getWindSpeedColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, Double>( new NullSafeComparableComparator<Double>()) {
|
||||
@Override
|
||||
@@ -291,10 +291,48 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, SimpleWindDTO> getWindDirectionColumn() {
|
||||
Cell<SimpleWindDTO> cell = new AbstractCell<SimpleWindDTO>() {
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, String> getWindRangeColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, Double>(
|
||||
new NullSafeComparableComparator<Double>()) {
|
||||
@Override
|
||||
public void render(Context context, SimpleWindDTO value, SafeHtmlBuilder sb) {
|
||||
protected Double getComparisonValue(T object) {
|
||||
return object.getWind() != null ? (object.getWind().getTrueUpperboundWindInKnots() + object.getWind()
|
||||
.getTrueLowerboundWindInKnots()) : null;
|
||||
}
|
||||
};
|
||||
return new SortableRaceListColumn<T, String>(I18N.wind(), cell, comparator) {
|
||||
@Override
|
||||
public String getHeaderStyle() {
|
||||
return CSS.raceslist_head_item();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnStyle() {
|
||||
return CSS.race_item();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null || object.getWind() == null) {
|
||||
return "";
|
||||
}
|
||||
Double trueUpperboundWindInKnots = Math.round(object.getWind().getTrueUpperboundWindInKnots()*10d)/10d;
|
||||
Double trueLowerboundWindInKnots = Math.round(object.getWind().getTrueLowerboundWindInKnots()*10d)/10d;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(I18N.knotsValue(trueLowerboundWindInKnots));
|
||||
if (trueUpperboundWindInKnots - trueLowerboundWindInKnots != 0d) {
|
||||
sb.append(" - ").append(I18N.knotsValue(trueUpperboundWindInKnots));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, AbstractWindDTO> getWindDirectionColumn() {
|
||||
Cell<AbstractWindDTO> cell = new AbstractCell<AbstractWindDTO>() {
|
||||
@Override
|
||||
public void render(Context context, AbstractWindDTO value, SafeHtmlBuilder sb) {
|
||||
if (value != null) {
|
||||
SafeStylesBuilder safeStyles = new SafeStylesBuilder();
|
||||
safeStyles.trustedNameAndValue("-webkit-transform", "rotate(" + value.getTrueWindFromDeg() + "deg)");
|
||||
@@ -310,7 +348,7 @@ public class RaceListColumnFactory {
|
||||
return object.getWind() != null ? object.getWind().getTrueWindFromDeg() : null;
|
||||
}
|
||||
};
|
||||
return new SortableRaceListColumn<T, SimpleWindDTO>(I18N.from(), cell, comparator) {
|
||||
return new SortableRaceListColumn<T, AbstractWindDTO>(I18N.from(), cell, comparator) {
|
||||
@Override
|
||||
public String getHeaderStyle() {
|
||||
return getStyleNamesString(CSS.raceslist_head_item(), MEDIA_CSS.hideonsmall());
|
||||
@@ -322,13 +360,13 @@ public class RaceListColumnFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleWindDTO getValue(T object) {
|
||||
public AbstractWindDTO getValue(T object) {
|
||||
return object.getWind();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, String> getCourseAreaColumn() {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, String> getCourseAreaColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, String>(new NaturalComparator(false)) {
|
||||
@Override
|
||||
@@ -354,7 +392,7 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, String> getCourseColumn() {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, String> getCourseColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, String>(new NaturalComparator(false)) {
|
||||
@Override
|
||||
@@ -502,7 +540,7 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> SortableRaceListColumn<T, T> getRaceViewerButtonColumn(final EventView.Presenter presenter) {
|
||||
public static <T extends RaceMetadataDTO<?>> SortableRaceListColumn<T, T> getRaceViewerButtonColumn(final EventView.Presenter presenter) {
|
||||
Cell<T> cell = new AbstractCell<T>() {
|
||||
private final String watchNowStyle = getButtonStyleNames(MAIN_CSS.buttonred());
|
||||
private final String analyseRaceStyle = getButtonStyleNames(MAIN_CSS.buttonprimary());
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.home.client.place.event.partials.raceListLive.RacesListLiveResources;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
|
||||
public class RaceListContainer<T extends RaceMetadataDTO> extends Composite {
|
||||
public class RaceListContainer<T extends RaceMetadataDTO<?>> extends Composite {
|
||||
|
||||
private static RaceListContainerUiBinder uiBinder = GWT.create(RaceListContainerUiBinder.class);
|
||||
|
||||
|
||||
+9
-9
@@ -5,7 +5,7 @@ import java.util.Collection;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.RaceListRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.FleetMetadataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.SimpleWindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.wind.AbstractWindDTO;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public class RaceListDataUtil {
|
||||
@@ -14,7 +14,7 @@ public class RaceListDataUtil {
|
||||
V getValue(T object);
|
||||
}
|
||||
|
||||
private static <T extends RaceMetadataDTO> boolean hasValues(Collection<T> races, ValueProvider<T, ?> valueProvider) {
|
||||
private static <T extends RaceMetadataDTO<?>> boolean hasValues(Collection<T> races, ValueProvider<T, ?> valueProvider) {
|
||||
for (T race : races) {
|
||||
if (valueProvider.getValue(race) != null) {
|
||||
return true;
|
||||
@@ -23,7 +23,7 @@ public class RaceListDataUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static <T extends RaceMetadataDTO> boolean hasNumberValues(Collection<T> races, ValueProvider<T, Number> valueProvider) {
|
||||
private static <T extends RaceMetadataDTO<?>> boolean hasNumberValues(Collection<T> races, ValueProvider<T, Number> valueProvider) {
|
||||
for (T race : races) {
|
||||
Number value = valueProvider.getValue(race);
|
||||
if (value != null && value.longValue() > 0) {
|
||||
@@ -33,7 +33,7 @@ public class RaceListDataUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> boolean hasFleets(Collection<T> data) {
|
||||
public static <T extends RaceMetadataDTO<?>> boolean hasFleets(Collection<T> data) {
|
||||
return hasValues(data, new ValueProvider<T, FleetMetadataDTO>() {
|
||||
@Override
|
||||
public FleetMetadataDTO getValue(T object) {
|
||||
@@ -51,10 +51,10 @@ public class RaceListDataUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> boolean hasWind(Collection<T> data) {
|
||||
return hasValues(data, new ValueProvider<T, SimpleWindDTO>() {
|
||||
public static <T extends RaceMetadataDTO<?>> boolean hasWind(Collection<T> data) {
|
||||
return hasValues(data, new ValueProvider<T, AbstractWindDTO>() {
|
||||
@Override
|
||||
public SimpleWindDTO getValue(T object) {
|
||||
public AbstractWindDTO getValue(T object) {
|
||||
return object.getWind();
|
||||
}
|
||||
});
|
||||
@@ -87,7 +87,7 @@ public class RaceListDataUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> boolean hasCourses(Collection<T> data) {
|
||||
public static <T extends RaceMetadataDTO<?>> boolean hasCourses(Collection<T> data) {
|
||||
return hasValues(data, new ValueProvider<T, String>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
@@ -96,7 +96,7 @@ public class RaceListDataUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static <T extends RaceMetadataDTO> boolean hasCourseAreas(Collection<T> data) {
|
||||
public static <T extends RaceMetadataDTO<?>> boolean hasCourseAreas(Collection<T> data) {
|
||||
return hasValues(data, new ValueProvider<T, String>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
|
||||
+3
-1
@@ -211,7 +211,9 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> videoCountColumn = RaceListColumnFactory.getVideoCountColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> audioCountColumn = RaceListColumnFactory.getAudioCountColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> winnerColumn = RaceListColumnFactory.getWinnerColumn();
|
||||
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> windSpeedColumn = RaceListColumnFactory
|
||||
.getWindRangeColumn();
|
||||
|
||||
public RaceListFinishedRaces(EventView.Presenter presenter) {
|
||||
super(presenter);
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,8 +3,9 @@ package com.sap.sailing.gwt.ui.shared.dispatch.event;
|
||||
import com.sap.sailing.gwt.ui.shared.race.FlagStateDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceProgressDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.wind.SimpleWindDTO;
|
||||
|
||||
public class LiveRaceDTO extends RaceMetadataDTO {
|
||||
public class LiveRaceDTO extends RaceMetadataDTO<SimpleWindDTO> {
|
||||
|
||||
private FlagStateDTO flagState;
|
||||
|
||||
|
||||
+4
-4
@@ -48,7 +48,7 @@ import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO.RaceTrackingState;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO.RaceViewState;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceProgressDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.SimpleWindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.wind.SimpleWindDTO;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
@@ -299,7 +299,7 @@ public class RaceContext {
|
||||
fillRaceData(liveRaceDTO);
|
||||
liveRaceDTO.setFlagState(getFlagStateOrNull());
|
||||
liveRaceDTO.setProgress(getProgressOrNull());
|
||||
|
||||
liveRaceDTO.setWind(getWindOrNull());
|
||||
return liveRaceDTO;
|
||||
}
|
||||
return null;
|
||||
@@ -391,7 +391,7 @@ public class RaceContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void fillRaceData(RaceMetadataDTO dto) {
|
||||
private void fillRaceData(RaceMetadataDTO<?> dto) {
|
||||
dto.setViewState(getLiveRaceViewState());
|
||||
dto.setRegattaDisplayName(getRegattaDisplayName());
|
||||
dto.setTrackedRaceName(trackedRace != null ? trackedRace.getRaceIdentifier().getRaceName() : null);
|
||||
@@ -401,7 +401,7 @@ public class RaceContext {
|
||||
dto.setBoatClass(HomeServiceUtil.getBoatClassName(leaderboard));
|
||||
dto.setCourseArea(getCourseAreaOrNull());
|
||||
dto.setCourse(getCourseNameOrNull());
|
||||
dto.setWind(getWindOrNull());
|
||||
|
||||
}
|
||||
|
||||
public boolean isLiveOrOfPublicInterest() {
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
package com.sap.sailing.gwt.ui.shared.dispatch.event;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.wind.WindStatisticsDTO;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public class RaceListRaceDTO extends RaceMetadataDTO {
|
||||
public class RaceListRaceDTO extends RaceMetadataDTO<WindStatisticsDTO> {
|
||||
|
||||
private Duration duration;
|
||||
private SimpleCompetitorDTO winner;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class RaceListViewDTO implements DTO {
|
||||
add(finishedRaces, finishedRace);
|
||||
}
|
||||
|
||||
private <T extends RaceMetadataDTO> void add(TreeSet<T> set, T race) {
|
||||
private <T extends RaceMetadataDTO<?>> void add(TreeSet<T> set, T race) {
|
||||
if (race != null) {
|
||||
set.add(race);
|
||||
}
|
||||
|
||||
+7
-6
@@ -4,9 +4,10 @@ import java.util.Date;
|
||||
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.DTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.wind.AbstractWindDTO;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
public class RaceMetadataDTO implements DTO, Comparable<RaceMetadataDTO> {
|
||||
public abstract class RaceMetadataDTO<WIND extends AbstractWindDTO> implements DTO, Comparable<RaceMetadataDTO<WIND>> {
|
||||
|
||||
public enum RaceViewState {
|
||||
PLANNED { // no start time set
|
||||
@@ -66,7 +67,7 @@ public class RaceMetadataDTO implements DTO, Comparable<RaceMetadataDTO> {
|
||||
private String boatClass;
|
||||
private RaceViewState state;
|
||||
private RaceTrackingState trackingState;
|
||||
private SimpleWindDTO wind;
|
||||
private WIND wind;
|
||||
|
||||
protected RaceMetadataDTO() {
|
||||
}
|
||||
@@ -148,11 +149,11 @@ public class RaceMetadataDTO implements DTO, Comparable<RaceMetadataDTO> {
|
||||
this.trackedRaceName = trackedRaceName;
|
||||
}
|
||||
|
||||
public SimpleWindDTO getWind() {
|
||||
public WIND getWind() {
|
||||
return wind;
|
||||
}
|
||||
|
||||
public void setWind(SimpleWindDTO wind) {
|
||||
public void setWind(WIND wind) {
|
||||
this.wind = wind;
|
||||
}
|
||||
|
||||
@@ -165,7 +166,7 @@ public class RaceMetadataDTO implements DTO, Comparable<RaceMetadataDTO> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(RaceMetadataDTO o) {
|
||||
public int compareTo(RaceMetadataDTO<WIND> o) {
|
||||
Date thisStart = getStart();
|
||||
Date otherStart = o.getStart();
|
||||
if(Util.equalsWithNull(thisStart, otherStart)) {
|
||||
@@ -181,7 +182,7 @@ public class RaceMetadataDTO implements DTO, Comparable<RaceMetadataDTO> {
|
||||
return -thisStart.compareTo(otherStart);
|
||||
}
|
||||
|
||||
private int compareBySecondaryCriteria(RaceMetadataDTO o) {
|
||||
private int compareBySecondaryCriteria(RaceMetadataDTO<?> o) {
|
||||
String thisRegattaName = getRegattaName();
|
||||
String otherRegattaName = o.getRegattaName();
|
||||
if(thisRegattaName != otherRegattaName) {
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.shared.race;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class SimpleWindDTO implements IsSerializable {
|
||||
private Double trueWindFromDeg;
|
||||
private Double trueWindSpeedInKnots;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private SimpleWindDTO() {
|
||||
}
|
||||
|
||||
public SimpleWindDTO(Double trueWindFromDeg, Double trueWindSpeedInKnots) {
|
||||
super();
|
||||
this.trueWindFromDeg = trueWindFromDeg;
|
||||
this.trueWindSpeedInKnots = trueWindSpeedInKnots;
|
||||
}
|
||||
|
||||
public Double getTrueWindFromDeg() {
|
||||
return trueWindFromDeg;
|
||||
}
|
||||
|
||||
public Double getTrueWindSpeedInKnots() {
|
||||
return trueWindSpeedInKnots;
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.shared.race;
|
||||
|
||||
public class WindStatisticsDTO extends SimpleWindDTO {
|
||||
|
||||
public WindStatisticsDTO(Double trueWindFromDeg, Double trueWindSpeedInKnots) {
|
||||
super(trueWindFromDeg, trueWindSpeedInKnots);
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.sap.sailing.gwt.ui.shared.race.wind;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public abstract class AbstractWindDTO implements IsSerializable {
|
||||
|
||||
private Double trueWindFromDeg;
|
||||
|
||||
protected AbstractWindDTO() {
|
||||
}
|
||||
|
||||
protected AbstractWindDTO(Double trueWindFromDeg) {
|
||||
this.trueWindFromDeg = trueWindFromDeg;
|
||||
}
|
||||
|
||||
public Double getTrueWindFromDeg() {
|
||||
return trueWindFromDeg;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.sap.sailing.gwt.ui.shared.race.wind;
|
||||
|
||||
|
||||
public class SimpleWindDTO extends AbstractWindDTO {
|
||||
private Double trueWindSpeedInKnots;
|
||||
|
||||
public SimpleWindDTO(Double trueWindFromDeg, Double trueWindSpeedInKnots) {
|
||||
super(trueWindFromDeg);
|
||||
this.trueWindSpeedInKnots = trueWindSpeedInKnots;
|
||||
}
|
||||
|
||||
public Double getTrueWindSpeedInKnots() {
|
||||
return trueWindSpeedInKnots;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.sap.sailing.gwt.ui.shared.race.wind;
|
||||
|
||||
public class WindStatisticsDTO extends AbstractWindDTO {
|
||||
|
||||
private Double trueLowerboundWindInKnots;
|
||||
private Double trueUpperboundWindInKnots;
|
||||
|
||||
public WindStatisticsDTO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public WindStatisticsDTO(Double trueWindFromDeg, Double trueLowerboundWindInKnots, Double trueUpperboundWindInKnots) {
|
||||
super(trueWindFromDeg);
|
||||
this.trueLowerboundWindInKnots = trueLowerboundWindInKnots;
|
||||
this.trueUpperboundWindInKnots = trueUpperboundWindInKnots;
|
||||
}
|
||||
|
||||
public Double getTrueLowerboundWindInKnots() {
|
||||
return trueLowerboundWindInKnots;
|
||||
}
|
||||
|
||||
public Double getTrueUpperboundWindInKnots() {
|
||||
return trueUpperboundWindInKnots;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user