Merge branch 'bug3237'

This commit is contained in:
Axel Uhl committed 2015-08-19 13:15:45 +02:00
commit 253ee128e3
32 files changed
+113 -61

No files matched your search

@@ -6,10 +6,6 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: SAP
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: com.sap.sailing.domain,
com.sap.sailing.domain.common,
Require-Bundle: com.sap.sailing.domain.common,
com.sap.sse.common
Export-Package: com.sap.sailing.declination
Import-Package: com.sap.sailing.domain.common,
com.sap.sailing.domain.common.impl,
com.sap.sailing.domain.common.quadtree
@@ -7,7 +7,7 @@
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.sap.sailing.declination.impl.DeclinationStore"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="2015 2015 1"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="2016 2016 1"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.declination"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dhttp.proxyHost=proxy.wdf.sap.corp -Dhttp.proxyPort=8080"/>
</launchConfiguration>
@@ -32,7 +32,7 @@ public interface DeclinationService {
* constructing this service
*/
Declination getDeclination(TimePoint timePoint, Position position, long timeoutForOnlineFetchInMilliseconds) throws IOException,
ClassNotFoundException, ParseException;
ParseException;
/**
* Like {@link #getDeclination(TimePoint, Position, long)}, only that here the caller can specify a required spatial
@@ -50,5 +50,5 @@ public interface DeclinationService {
* <code>maxDistance</code> parameter
*/
Declination getDeclination(TimePoint timePoint, Position position, Distance maxDistance, long timeoutForOnlineFetchInMilliseconds) throws IOException,
ClassNotFoundException, ParseException;
ParseException;
}
@@ -42,13 +42,13 @@ public class DeclinationServiceImpl implements DeclinationService {
@Override
public Declination getDeclination(TimePoint timePoint, Position position,
long timeoutForOnlineFetchInMilliseconds) throws IOException, ClassNotFoundException, ParseException {
long timeoutForOnlineFetchInMilliseconds) throws IOException, ParseException {
return getDeclination(timePoint, position, defaultMaxDistance, timeoutForOnlineFetchInMilliseconds);
}
@Override
public Declination getDeclination(TimePoint timePoint, Position position, Distance maxDistance,
long timeoutForOnlineFetchInMilliseconds) throws IOException, ClassNotFoundException, ParseException {
long timeoutForOnlineFetchInMilliseconds) throws IOException, ParseException {
Calendar cal = new GregorianCalendar();
cal.setTime(timePoint.asDate());
Declination result = null;
@@ -98,8 +98,7 @@ public class DeclinationServiceImpl implements DeclinationService {
return result;
}
private QuadTree<Declination> getYearStore(int year) throws IOException, ClassNotFoundException,
ParseException {
private QuadTree<Declination> getYearStore(int year) throws IOException, ParseException {
QuadTree<Declination> result = yearStore.get(year);
if (result == null) {
result = persistentStore.getStoredDeclinations(year);
@@ -41,7 +41,7 @@ public class DeclinationStore {
/**
* Returns <code>null</code> if no stored declinations exist for the <code>year</code> requested.
*/
public QuadTree<Declination> getStoredDeclinations(int year) throws IOException, ClassNotFoundException, ParseException {
public QuadTree<Declination> getStoredDeclinations(int year) throws IOException, ParseException {
Declination record;
QuadTree<Declination> result = null;
InputStream is = getInputStreamForYear(year);
@@ -90,7 +90,7 @@ public class NOAAImporter {
* @throws IOException
*/
public Declination getDeclination(final Position position, final TimePoint timePoint,
long timeoutForOnlineFetchInMilliseconds) throws IOException, ClassNotFoundException, ParseException {
long timeoutForOnlineFetchInMilliseconds) throws IOException, ParseException {
final Declination[] result = new Declination[1];
Thread fetcher = new Thread("Declination fetcher for "+position+"@"+timePoint) {
@Override
@@ -10,7 +10,14 @@ import com.sap.sse.common.Timed;
*
* Note that sometimes a wind measurement is transmitted without its position. While this is useless
* for wind field interpolation, it can still serve good uses when some wind direction is better than
* no wind direction at all. In this case, {@link #getPosition()} will return <code>null</code>.
* no wind direction at all. In this case, {@link #getPosition()} will return <code>null</code>.<p>
*
* When processing wind in the scope of a {@link TrackedRace}, it should always use true, not magnetic,
* directions. However, during capturing wind, e.g., on a committee boat, sometimes it is easier for
* users to capture wind using a magnetic direction which needs to be corrected by the magnetic
* variation / declination in order to produce a true direction. It depends on the context in which
* objects of this type are produced and used whether this represents a true or magnetic wind direction.
* For conversion, use a {@link DeclinationService} instance.
*
* @author Axel Uhl (d043530)
*
@@ -1323,9 +1323,9 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
} else if (eventClass.equals(RaceLogStartProcedureChangedEvent.class.getSimpleName())) {
return loadRaceLogStartProcedureChangedEvent(createdAt, author, logicalTimePoint, id, passId, competitors, dbObject);
} else if (eventClass.equals(RaceLogProtestStartTimeEvent.class.getSimpleName())) {
return loadRaceLogRaceLogProtestStartTimeEvent(createdAt, author, logicalTimePoint, id, passId, competitors, dbObject);
return loadRaceLogProtestStartTimeEvent(createdAt, author, logicalTimePoint, id, passId, competitors, dbObject);
} else if (eventClass.equals(RaceLogWindFixEvent.class.getSimpleName())) {
return loadRaceLogRaceLogWindFixEvent(createdAt, author, logicalTimePoint, id, passId, competitors, dbObject);
return loadRaceLogWindFixEvent(createdAt, author, logicalTimePoint, id, passId, competitors, dbObject);
} else if (eventClass.equals(RaceLogDeviceCompetitorMappingEvent.class.getSimpleName())) {
return loadRaceLogDeviceCompetitorMappingEvent(createdAt, author, logicalTimePoint, id, passId, competitors, dbObject);
} else if (eventClass.equals(RaceLogDeviceMarkMappingEvent.class.getSimpleName())) {
@@ -1353,10 +1353,11 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
throw new IllegalStateException(String.format("Unknown RaceLogEvent type %s", eventClass));
}
private RaceLogEvent loadRaceLogRaceLogWindFixEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
private RaceLogEvent loadRaceLogWindFixEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
Serializable id, Integer passId, List<Competitor> competitors, DBObject dbObject) {
Wind wind = loadWind((DBObject) dbObject.get(FieldNames.WIND.name()));
return raceLogEventFactory.createWindFixEvent(createdAt, author, logicalTimePoint, id, competitors, passId, wind);
Boolean isMagnetic = (Boolean) dbObject.get(FieldNames.IS_MAGNETIC.name());
return raceLogEventFactory.createWindFixEvent(createdAt, author, logicalTimePoint, id, competitors, passId, wind, isMagnetic == null ? true : isMagnetic);
}
private RaceLogEvent loadRaceLogDeviceCompetitorMappingEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
@@ -1450,7 +1451,7 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
return raceLogEventFactory.createAdditionalScoringInformationEvent(createdAt, author, logicalTimePoint, id, competitors, passId, informationType);
}
private RaceLogEvent loadRaceLogRaceLogProtestStartTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
private RaceLogEvent loadRaceLogProtestStartTimeEvent(TimePoint createdAt, AbstractLogEventAuthor author,
TimePoint logicalTimePoint, Serializable id, Integer passId, List<Competitor> competitors, DBObject dbObject) {
TimePoint protestStartTime = loadTimePoint(dbObject, FieldNames.RACE_LOG_PROTEST_START_TIME);
return raceLogEventFactory.createProtestStartTimeEvent(createdAt, author, logicalTimePoint, id, competitors, passId, protestStartTime);
@@ -61,7 +61,7 @@ public enum FieldNames {
BOAT_CLASS_TYPICALLY_STARTS_UPWIND,
// wind:
WIND_SOURCE_NAME, WIND_SOURCE_ID, WIND,
WIND_SOURCE_NAME, WIND_SOURCE_ID, WIND, IS_MAGNETIC,
// SwissTiming configuration parameters:
ST_CONFIG_NAME, ST_CONFIG_HOSTNAME, ST_CONFIG_PORT,
@@ -935,6 +935,7 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
storeRaceLogEventProperties(event, result);
result.put(FieldNames.RACE_LOG_EVENT_CLASS.name(), RaceLogWindFixEvent.class.getSimpleName());
result.put(FieldNames.WIND.name(), storeWind(event.getWindFix()));
result.put(FieldNames.IS_MAGNETIC.name(), event.isMagnetic());
return result;
}
@@ -97,10 +97,10 @@ public interface RaceLogEventFactory {
RaceLogProtestStartTimeEvent createProtestStartTimeEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, TimePoint protestStartTime);
RaceLogWindFixEvent createWindFixEvent(TimePoint eventTime, AbstractLogEventAuthor author, int currentPassId, Wind wind);
RaceLogWindFixEvent createWindFixEvent(TimePoint eventTime, AbstractLogEventAuthor author, int currentPassId, Wind wind, boolean isMagnetic);
RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
Serializable id, List<Competitor> competitors, int passId, Wind wind);
Serializable id, List<Competitor> competitors, int passId, Wind wind, boolean isMagnetic);
RaceLogDeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
DeviceIdentifier device, Competitor mappedTo, int passId, TimePoint from, TimePoint to);
@@ -69,7 +69,7 @@ public interface RaceLogEventRestoreFactory extends RaceLogEventFactory {
TimePoint logicalTimePoint, Serializable id, List<Competitor> competitors, int passId, TimePoint protestStartTime);
RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
Serializable id, List<Competitor> competitors, Integer passId, Wind wind);
Serializable id, List<Competitor> competitors, Integer passId, Wind wind, boolean isMagnetic);
RaceLogDeviceCompetitorMappingEvent createDeviceCompetitorMappingEvent(TimePoint createdAt, AbstractLogEventAuthor author,
TimePoint logicalTimePoint, Serializable pId, DeviceIdentifier device, Competitor mappedTo, int passId, TimePoint from, TimePoint to);
@@ -12,4 +12,13 @@ public interface RaceLogWindFixEvent extends RaceLogEvent {
* Returns the wind fix entered by the race committee
*/
Wind getWindFix();
/**
* Usually, wind readings are expected to specify a true north-based direction. However, in some
* cases capturing a wind direction happens based on a magnetic compass and is not immediately corrected
* for the magnetic variation / declination. Should this be the case for the wind fix provided by this
* event, this method returns <code>true</code>, and a {@link DeclinationService} should be used to infer
* the true north-based wind direction.
*/
boolean isMagnetic();
}
@@ -234,14 +234,14 @@ public class RaceLogEventFactoryImpl implements RaceLogEventFactory {
}
@Override
public RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, Wind wind) {
return createWindFixEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, wind);
public RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int passId, Wind wind, boolean isMagnetic) {
return createWindFixEvent(logicalTimePoint, author, UUID.randomUUID(), new ArrayList<Competitor>(), passId, wind, isMagnetic);
}
@Override
public RaceLogWindFixEvent createWindFixEvent(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable id,
List<Competitor> competitors, int passId, Wind wind) {
return new RaceLogWindFixEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors, passId, wind);
List<Competitor> competitors, int passId, Wind wind, boolean isMagnetic) {
return new RaceLogWindFixEventImpl(MillisecondsTimePoint.now(), author, logicalTimePoint, id, competitors, passId, wind, isMagnetic);
}
@Override
@@ -129,8 +129,8 @@ public class RaceLogEventRestoreFactoryImpl extends RaceLogEventFactoryImpl impl
@Override
public RaceLogWindFixEvent createWindFixEvent(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint logicalTimePoint,
Serializable id, List<Competitor> competitors, Integer passId, Wind wind) {
return new RaceLogWindFixEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, wind);
Serializable id, List<Competitor> competitors, Integer passId, Wind wind, boolean isMagnetic) {
return new RaceLogWindFixEventImpl(createdAt, author, logicalTimePoint, id, competitors, passId, wind, isMagnetic);
}
@Override
@@ -14,11 +14,13 @@ public class RaceLogWindFixEventImpl extends RaceLogEventImpl implements RaceLog
private static final long serialVersionUID = 7879094280634905183L;
private final Wind windFix;
private final boolean isMagnetic;
public RaceLogWindFixEventImpl(TimePoint createdAt, AbstractLogEventAuthor author, TimePoint pTimePoint,
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Wind windFix) {
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Wind windFix, boolean isMagnetic) {
super(createdAt, author, pTimePoint, pId, pInvolvedBoats, pPassId);
this.windFix = windFix;
this.isMagnetic = isMagnetic;
}
@Override
@@ -30,6 +32,11 @@ public class RaceLogWindFixEventImpl extends RaceLogEventImpl implements RaceLog
public Wind getWindFix() {
return windFix;
}
@Override
public boolean isMagnetic() {
return isMagnetic;
}
@Override
public String getShortInfo() {
@@ -177,8 +177,9 @@ public interface RaceState extends ReadonlyRaceState {
/**
* Enters a new wind fix for this race.
* @param isMagnetic TODO
*/
void setWindFix(TimePoint now, Wind wind);
void setWindFix(TimePoint now, Wind wind, boolean isMagnetic);
/**
* Marks this race state with a new {@link RaceLogAdditionalScoringInformationEvent} or revokes
@@ -200,8 +200,8 @@ public class RaceStateImpl extends ReadonlyRaceStateImpl implements RaceState {
}
@Override
public void setWindFix(TimePoint timePoint, Wind wind) {
raceLog.add(factory.createWindFixEvent(timePoint, author, raceLog.getCurrentPassId(), wind));
public void setWindFix(TimePoint timePoint, Wind wind, boolean isMagnetic) {
raceLog.add(factory.createWindFixEvent(timePoint, author, raceLog.getCurrentPassId(), wind, isMagnetic));
}
@Override
@@ -41,4 +41,5 @@ Require-Bundle: com.googlecode.java-diff-utils;bundle-version="1.3.0",
com.sap.sse.common,
com.sap.sse,
com.sap.sse.shared.android,
org.apache.commons.math
org.apache.commons.math,
com.sap.sailing.declination
@@ -1,9 +1,14 @@
package com.sap.sailing.domain.tracking.impl;
import java.io.IOException;
import java.text.ParseException;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sap.sailing.declination.Declination;
import com.sap.sailing.declination.DeclinationService;
import com.sap.sailing.domain.abstractlog.race.RaceLog;
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
@@ -29,17 +34,20 @@ import com.sap.sailing.domain.base.CourseBase;
import com.sap.sailing.domain.common.Wind;
import com.sap.sailing.domain.common.WindSource;
import com.sap.sailing.domain.common.WindSourceType;
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
import com.sap.sailing.domain.common.impl.WindImpl;
import com.sap.sailing.domain.common.impl.WindSourceImpl;
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
import com.sap.sailing.domain.markpassingcalculation.MarkPassingUpdateListener;
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
import com.sap.sailing.domain.tracking.TrackedRace;
import com.sap.sse.common.Duration;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.Util.Triple;
/**
* TODO: this class could be a good place to leverage more information about a race containing in the {@link RaceLog}.
* This includes for example the {@link RaceLogRaceStatus} indicating the current race's start.
* Listens for changes on a {@link RaceLog} and forwards the relevant ones to a {@link TrackedRace}. Examples: start time changes;
* fixed mark passings changes; course design changes; wind fixes entered by the race committee.<p>
*/
public class DynamicTrackedRaceLogListener extends BaseRaceLogEventVisitor {
@@ -227,7 +235,28 @@ public class DynamicTrackedRaceLogListener extends BaseRaceLogEventVisitor {
@Override
public void visit(RaceLogWindFixEvent event) {
// add the wind fix to the race committee WindTrack
trackedRace.recordWind(event.getWindFix(), raceCommitteeWindSource);
Wind wind;
if (event.isMagnetic()) {
final Wind magneticNorthBasedWindFix = event.getWindFix();
final DeclinationService declinationService = DeclinationService.INSTANCE;
Declination declination;
try {
declination = declinationService.getDeclination(magneticNorthBasedWindFix.getTimePoint(),
magneticNorthBasedWindFix.getPosition(), /* timeoutForOnlineFetchInMilliseconds */
Duration.ONE_SECOND.times(5).asMillis());
wind = new WindImpl(magneticNorthBasedWindFix.getPosition(), magneticNorthBasedWindFix.getTimePoint(),
new KnotSpeedWithBearingImpl(magneticNorthBasedWindFix.getKnots(), magneticNorthBasedWindFix
.getBearing().add(
declination.getBearingCorrectedTo(magneticNorthBasedWindFix.getTimePoint()))));
} catch (IOException | ParseException e) {
logger.log(Level.SEVERE, "Error trying to correct magnetic wind fix "+magneticNorthBasedWindFix+" by declination. "+
"Using uncorrected magnetic wind direction instead.", e);
wind = magneticNorthBasedWindFix;
}
} else {
wind = event.getWindFix();
}
trackedRace.recordWind(wind, raceCommitteeWindSource);
}
@Override
@@ -205,7 +205,7 @@ public abstract class TrackedRaceImpl extends TrackedRaceWithWindEssentials impl
* Race start time as announced by the tracking infrastructure
*/
private TimePoint startTimeReceived;
/**
* The calculated race start time
*/
@@ -503,7 +503,7 @@ public class TestStoringAndRetrievingRaceLogInLeaderboards extends RaceLogMongoD
@Test
public void testStoreAndRetrieveSimpleLeaderboardWithRaceLogWindFixEvent() {
Wind wind = createWindFix();
RaceLogWindFixEvent event = RaceLogEventFactory.INSTANCE.createWindFixEvent(now, author, 0, wind);
RaceLogWindFixEvent event = RaceLogEventFactory.INSTANCE.createWindFixEvent(now, author, 0, wind, /* isMagnetic */ false);
addAndStoreRaceLogEvent(leaderboard, raceColumnName, event);
RaceLog loadedRaceLog = retrieveRaceLog();
loadedRaceLog.lockForRead();
@@ -412,7 +412,7 @@ public class TestStoringAndRetrievingRaceLogInRegatta extends AbstractTestStorin
@Test
public void testStoreAndRetrieveRegattaWithRaceLogWindFixEvent() {
Wind wind = createWindFix();
RaceLogWindFixEvent event = RaceLogEventFactory.INSTANCE.createWindFixEvent(now, author, 0, wind);
RaceLogWindFixEvent event = RaceLogEventFactory.INSTANCE.createWindFixEvent(now, author, 0, wind, /* isMagnetic */ false);
addAndStoreRaceLogEvent(regatta, raceColumnName, event);
@@ -27,11 +27,10 @@ public class RaceLogWindFixEventDeserializer extends BaseRaceLogEventDeserialize
@Override
protected RaceLogEvent deserialize(JSONObject object, Serializable id, TimePoint createdAt, AbstractLogEventAuthor author,
TimePoint timePoint, int passId, List<Competitor> competitors) throws JsonDeserializationException {
JSONObject windJsonObject = Helpers.getNestedObjectSafe(object, RaceLogWindFixEventSerializer.FIELD_WIND);
Wind wind = windDeserializer.deserialize(windJsonObject);
return factory.createWindFixEvent(createdAt, author, timePoint, id, competitors, passId, wind);
final JSONObject windJsonObject = Helpers.getNestedObjectSafe(object, RaceLogWindFixEventSerializer.FIELD_WIND);
final Wind wind = windDeserializer.deserialize(windJsonObject);
final Boolean isMagnetic = (Boolean) object.get(RaceLogWindFixEventSerializer.FIELD_MAGNETIC);
return factory.createWindFixEvent(createdAt, author, timePoint, id, competitors, passId, wind, isMagnetic == null ? true : isMagnetic);
}
}
@@ -12,6 +12,7 @@ public class RaceLogWindFixEventSerializer extends BaseRaceLogEventSerializer {
public static final String VALUE_CLASS = RaceLogWindFixEvent.class.getSimpleName();
public static final String FIELD_WIND = "wind";
public static final String FIELD_MAGNETIC = "magnetic";
JsonSerializer<Wind> windSerializer;
@@ -30,6 +31,7 @@ public class RaceLogWindFixEventSerializer extends BaseRaceLogEventSerializer {
RaceLogWindFixEvent event = (RaceLogWindFixEvent) object;
JSONObject result = super.serialize(event);
result.put(FIELD_WIND, windSerializer.serialize(event.getWindFix()));
result.put(FIELD_MAGNETIC, Boolean.valueOf(event.isMagnetic()));
return result;
}
@@ -200,7 +200,7 @@ public class RaceLogEventSerializerTest {
@Test
public void testWindFixSerializer() {
// we use the real event type here because we do not want to re-implement the dispatching.
RaceLogEvent event = factory.createWindFixEvent(null, author, 0, null);
RaceLogEvent event = factory.createWindFixEvent(null, author, 0, null, /* isMagnetic */ false);
serializer.serialize(event);
verify(windFixEventSerializer).serialize(event);
}
@@ -56,7 +56,7 @@ public class RaceLogWindFixEventSerializerTest {
now = MillisecondsTimePoint.now();
event = RaceLogEventFactory.INSTANCE.createWindFixEvent(now, author, 0, createWindFix());
event = RaceLogEventFactory.INSTANCE.createWindFixEvent(now, author, 0, createWindFix(), /* isMagnetic */ false);
}
@Test
@@ -151,7 +151,7 @@ public class InitialLoadReplicationObjectIdentityTest extends AbstractServerRepl
final WindImpl masterWindFix = new WindImpl(new DegreePosition(12, 13), MillisecondsTimePoint.now(),
new KnotSpeedWithBearingImpl(12.7, new DegreeBearingImpl(123)));
masterR1RaceLog.add(RaceLogEventFactoryImpl.INSTANCE.createWindFixEvent(MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0),
/* passId */ 1, masterWindFix));
/* passId */ 1, masterWindFix, /* isMagnetic */ false));
// assert that the wind fix shows up in the tracked race now because the tracked race has the DynamicTrackedRaceLogListener
// propagating the wind fix race log event into the wind track for source RACECOMMITTEE
WindTrack masterRCWindFixes = masterTrackedRace.getOrCreateWindTrack(new WindSourceImpl(WindSourceType.RACECOMMITTEE));
@@ -224,7 +224,7 @@ public class InitialLoadReplicationObjectIdentityTest extends AbstractServerRepl
final WindImpl replicaWindFix = new WindImpl(new DegreePosition(14, 15), MillisecondsTimePoint.now(),
new KnotSpeedWithBearingImpl(22.9, new DegreeBearingImpl(155)));
replicaR1RaceLog.add(RaceLogEventFactoryImpl.INSTANCE.createWindFixEvent(MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0),
/* passId */ 1, replicaWindFix));
/* passId */ 1, replicaWindFix, /* isMagnetic */ false));
// assert that the wind fix shows up in the tracked race now because the tracked race has the DynamicTrackedRaceLogListener
// propagating the wind fix race log event into the wind track for source RACECOMMITTEE
WindTrack replicaRCWindFixes = replicaTrackedRace.getOrCreateWindTrack(new WindSourceImpl(WindSourceType.RACECOMMITTEE));
@@ -261,7 +261,7 @@ public class MasterDataImportTest {
Position p = new DegreePosition(3, 3);
Wind wind = new WindImpl(p, logTimePoint2, new KnotSpeedWithBearingImpl(5, new DegreeBearingImpl(12)));
RaceLogWindFixEvent windEvent = new RaceLogWindFixEventImpl(logTimePoint2, author, logTimePoint2,
UUID.randomUUID(), new ArrayList<Competitor>(), 2, wind);
UUID.randomUUID(), new ArrayList<Competitor>(), 2, wind, /* isMagnetic */ false);
raceColumn.getRaceLog(testFleet1).add(windEvent);
storedLogUUIDs.add(logEvent.getId());
storedLogUUIDs.add(windEvent.getId());
@@ -2086,7 +2086,7 @@ public class MasterDataImportTest {
Position p = new DegreePosition(3, 3);
Wind wind = new WindImpl(p, logTimePoint2, new KnotSpeedWithBearingImpl(5, new DegreeBearingImpl(12)));
RaceLogWindFixEvent windEvent = factory.createWindFixEvent(logTimePoint2, author, UUID.randomUUID(),
new ArrayList<Competitor>(), 2, wind);
new ArrayList<Competitor>(), 2, wind, /* isMagnetic */ false);
raceColumnOnLeaderboard.getRaceLog(defaultFleet).add(windEvent);
storedLogUUIDs.add(logEvent.getId());
storedLogUUIDs.add(windEvent.getId());
@@ -133,8 +133,8 @@ public class WindByRaceLogTest {
new KnotSpeedWithBearingImpl(15, new DegreeBearingImpl(234)));
Wind wind2 = new WindImpl(new DegreePosition(49, 3), timeMinus2,
new KnotSpeedWithBearingImpl(12, new DegreeBearingImpl(123)));
RaceLogWindFixEvent windEvent1 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus3, author, 0, wind1);
RaceLogWindFixEvent windEvent2 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus2, author, 0, wind2);
RaceLogWindFixEvent windEvent1 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus3, author, 0, wind1, /* isMagnetic */ false);
RaceLogWindFixEvent windEvent2 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus2, author, 0, wind2, /* isMagnetic */ false);
raceLog.add(windEvent1);
raceLog.add(windEvent2);
@@ -163,7 +163,7 @@ public class WindByRaceLogTest {
Wind wind1 = new WindImpl(new DegreePosition(50, 4), timeMinus3,
new KnotSpeedWithBearingImpl(15, new DegreeBearingImpl(234)));
RaceLogWindFixEvent windEvent1 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus3, author, 0, wind1);
RaceLogWindFixEvent windEvent1 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus3, author, 0, wind1, /* isMagnetic */ false);
raceLog.add(windEvent1);
WindSource source = new WindSourceImpl(WindSourceType.RACECOMMITTEE);
@@ -192,9 +192,9 @@ public class WindByRaceLogTest {
new KnotSpeedWithBearingImpl(12, new DegreeBearingImpl(123)));
Wind wind3 = new WindImpl(new DegreePosition(48, 1), timeMinus2,
new KnotSpeedWithBearingImpl(18, new DegreeBearingImpl(270)));
RaceLogWindFixEvent windEvent1 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus3, author, 0, wind1);
RaceLogWindFixEvent windEvent2 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus2, author, 0, wind2);
RaceLogWindFixEvent windEvent3 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus1, author, 0, wind3);
RaceLogWindFixEvent windEvent1 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus3, author, 0, wind1, /* isMagnetic */ false);
RaceLogWindFixEvent windEvent2 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus2, author, 0, wind2, /* isMagnetic */ false);
RaceLogWindFixEvent windEvent3 = RaceLogEventFactory.INSTANCE.createWindFixEvent(timeMinus1, author, 0, wind3, /* isMagnetic */ false);
raceLog.add(windEvent1);
raceLog.add(windEvent2);
@@ -302,7 +302,7 @@ public class RacingActivity extends SessionActivity implements RaceInfoListener,
windValue.setText(String.format(getString(R.string.wind_info), windFix.getKnots(), windFix.getBearing().reverse().toString()));
}
if (mSelectedRace != null) {
mSelectedRace.getState().setWindFix(MillisecondsTimePoint.now(), windFix);
mSelectedRace.getState().setWindFix(MillisecondsTimePoint.now(), windFix, /* isMagnetic */ true);
}
mWind = windFix;
@@ -410,7 +410,7 @@ public class WindFragment extends BaseFragment
*/
private void onSendClick() {
Wind wind = getResultingWindFix();
getRaceState().setWindFix(MillisecondsTimePoint.now(), wind);
getRaceState().setWindFix(MillisecondsTimePoint.now(), wind, /* isMagnetic */ true);
saveEntriesInPreferences(wind);
switch (getArguments().getInt(START_MODE, 0)) {
case 1: