mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
implemented new RaceLogWindFixEvent, extended persistence, serialization/deserialization, implemented tests
This commit is contained in:
1 parent
d9c0e831df
commit
cccd75f0bb
27 files changed
+513
-32
No files matched your search
+6
@@ -12,6 +12,7 @@ import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.domain.common.racelog.StartProcedureType;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogEventFactoryImpl;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
|
||||
public interface RaceLogEventFactory {
|
||||
RaceLogEventFactory INSTANCE = new RaceLogEventFactoryImpl();
|
||||
@@ -84,4 +85,9 @@ public interface RaceLogEventFactory {
|
||||
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint timePoint, int passId, TimePoint protestStartTime);
|
||||
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint eventTime, int currentPassId, Wind wind);
|
||||
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint timePoint, Serializable id,
|
||||
List<Competitor> competitors, int passId, Wind wind);
|
||||
|
||||
}
|
||||
+4
@@ -12,6 +12,7 @@ import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.domain.common.racelog.StartProcedureType;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogEventRestoreFactoryImpl;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
|
||||
public interface RaceLogEventRestoreFactory extends RaceLogEventFactory {
|
||||
RaceLogEventRestoreFactory INSTANCE = new RaceLogEventRestoreFactoryImpl();
|
||||
@@ -53,4 +54,7 @@ public interface RaceLogEventRestoreFactory extends RaceLogEventFactory {
|
||||
|
||||
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint createdAt, TimePoint timePoint,
|
||||
Serializable id, List<Competitor> competitors, int passId, TimePoint protestStartTime);
|
||||
|
||||
RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, TimePoint timePoint, Serializable id,
|
||||
List<Competitor> competitors, Integer passId, Wind wind);
|
||||
}
|
||||
+2
@@ -25,4 +25,6 @@ public interface RaceLogEventVisitor {
|
||||
public void visit(RaceLogStartProcedureChangedEvent event);
|
||||
|
||||
public void visit(RaceLogProtestStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogWindFixEvent event);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
|
||||
/**
|
||||
* Contains a wind fix that the race officers documented in the Race Committee App ashore
|
||||
*
|
||||
*/
|
||||
public interface RaceLogWindFixEvent extends RaceLogEvent {
|
||||
|
||||
/**
|
||||
* Returns the wind fix entered by the race committee
|
||||
*/
|
||||
Wind getWindFix();
|
||||
}
|
||||
+13
@@ -26,6 +26,8 @@ import com.sap.sailing.domain.racelog.RaceLogProtestStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartProcedureChangedEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
|
||||
public class RaceLogEventFactoryImpl implements RaceLogEventFactory {
|
||||
|
||||
@@ -187,4 +189,15 @@ public class RaceLogEventFactoryImpl implements RaceLogEventFactory {
|
||||
protestStartTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint timePoint, int passId, Wind wind) {
|
||||
return createWindFixEvent(timePoint, UUID.randomUUID(), new ArrayList<Competitor>(), passId, wind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint timePoint, Serializable id, List<Competitor> competitors,
|
||||
int passId, Wind wind) {
|
||||
return new RaceLogWindFixEventImpl(MillisecondsTimePoint.now(), timePoint, id, competitors, passId, wind);
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -24,6 +24,8 @@ import com.sap.sailing.domain.racelog.RaceLogProtestStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartProcedureChangedEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
|
||||
public class RaceLogEventRestoreFactoryImpl extends RaceLogEventFactoryImpl implements RaceLogEventRestoreFactory {
|
||||
|
||||
@@ -99,5 +101,11 @@ public class RaceLogEventRestoreFactoryImpl extends RaceLogEventFactoryImpl impl
|
||||
return new RaceLogProtestStartTimeEventImpl(createdAt, timePoint, id, competitors, passId, protestStartTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, TimePoint timePoint, Serializable id,
|
||||
List<Competitor> competitors, Integer passId, Wind wind) {
|
||||
return new RaceLogWindFixEventImpl(createdAt, timePoint, id, competitors, passId, wind);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.racelog.RaceLogWindFixEvent;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
|
||||
public class RaceLogWindFixEventImpl extends RaceLogEventImpl implements RaceLogWindFixEvent {
|
||||
private static final long serialVersionUID = 7879094280634905183L;
|
||||
|
||||
private final Wind windFix;
|
||||
|
||||
public RaceLogWindFixEventImpl(TimePoint createdAt, TimePoint pTimePoint, Serializable pId,
|
||||
List<Competitor> pInvolvedBoats, int pPassId, Wind windFix) {
|
||||
super(createdAt, pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.windFix = windFix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Wind getWindFix() {
|
||||
return windFix;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user