mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 19:20:04 +00:00
normalized line endings
This commit is contained in:
1 parent
8cf9053d37
commit
9123771f34
2780 files changed
+301735
-301735
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -1,28 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.domain.shared.android</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.domain.shared.android</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,12 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
@@ -1,4 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
+81
-81
@@ -1,81 +1,81 @@
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Timed;
|
||||
import com.sap.sse.common.WithID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A {@link AbstractLogEvent} is an entry in an AbstractLog.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Such an entry may influence the state of a race (scheduled, started, finished, ...), contain information about the
|
||||
* current displayed flags (AP, N, X, P, etc.) of a race or indicate some other change regarding the race. See
|
||||
* subclasses of {@link AbstractLogEvent} for a full list of possibilities.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* A {@link AbstractLogEvent} may be associated to a certain pass. For a race a new pass is initiated whenever a new
|
||||
* start time is proposed (e.g. after the race was aborted). Currently the pass is only used by the RaceLog
|
||||
* implementation. It should be refactored out of AbstractLog to a later point in time.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Each {@link AbstractLogEvent} carries two timestamps.
|
||||
*
|
||||
* The timestamp received with {@link AbstractLogEvent#getCreatedAt()} denotes the point in time the event was created.
|
||||
*
|
||||
* The timestamp received with {@link AbstractLogEvent#getLogicalTimePoint()} denotes the logical point in time the
|
||||
* event has occurred (sometimes called 'event time'). This timestamp might be different from
|
||||
* {@link AbstractLogEvent#getCreatedAt()}. For example setting the start time of race to a point in time in the past,
|
||||
* results in a {@link AbstractLogEvent} returning "now" on {@link AbstractLogEvent#getCreatedAt()} and such a point in
|
||||
* time that a complete startphase could have occured on {@link AbstractLogEvent#getTimePoint()}.
|
||||
*
|
||||
* To ensure an ordering there should be no two {@link AbstractLogEvent}s returning the same point in time on
|
||||
* {@link AbstractLogEvent#getCreatedAt()} <b>per pass</b>.
|
||||
*
|
||||
* The {@link AbstractLogEvent}'s {@link Timed} interface redirects to {@link AbstractLogEvent#getCreatedAt()} (was
|
||||
* {@link AbstractLogEvent#getLogicalTimePoint()}!).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* AbstractLog events have an author that has a name and a priority assigned. This can be used to represent multiple
|
||||
* concurrent authors such as a device used on a starting vessel, another device used at the finish line and
|
||||
* yet another device used on shore. In case more than one device make a statement about something, such as the start
|
||||
* time or the start procedure, the statement from the device with the highest priority needs to take precedence.
|
||||
* </p>
|
||||
*/
|
||||
public interface AbstractLogEvent<VisitorT> extends Timed, WithID, Serializable {
|
||||
|
||||
/**
|
||||
* Gets the {@link TimePoint} this event was created at.
|
||||
*/
|
||||
TimePoint getCreatedAt();
|
||||
|
||||
/**
|
||||
* Gets the event's logical timestamp.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
TimePoint getLogicalTimePoint();
|
||||
|
||||
/**
|
||||
* Visitor pattern to implement certain {@link AbstractLogEvent} subclass specific behavior.
|
||||
*/
|
||||
void accept(VisitorT visitor);
|
||||
|
||||
/**
|
||||
* Gets the {@link AbstractLogEventAuthor} author of this event.
|
||||
*/
|
||||
AbstractLogEventAuthor getAuthor();
|
||||
|
||||
/**
|
||||
* Gets a short info about the most relevant data of the event.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getShortInfo();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Timed;
|
||||
import com.sap.sse.common.WithID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A {@link AbstractLogEvent} is an entry in an AbstractLog.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Such an entry may influence the state of a race (scheduled, started, finished, ...), contain information about the
|
||||
* current displayed flags (AP, N, X, P, etc.) of a race or indicate some other change regarding the race. See
|
||||
* subclasses of {@link AbstractLogEvent} for a full list of possibilities.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* A {@link AbstractLogEvent} may be associated to a certain pass. For a race a new pass is initiated whenever a new
|
||||
* start time is proposed (e.g. after the race was aborted). Currently the pass is only used by the RaceLog
|
||||
* implementation. It should be refactored out of AbstractLog to a later point in time.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Each {@link AbstractLogEvent} carries two timestamps.
|
||||
*
|
||||
* The timestamp received with {@link AbstractLogEvent#getCreatedAt()} denotes the point in time the event was created.
|
||||
*
|
||||
* The timestamp received with {@link AbstractLogEvent#getLogicalTimePoint()} denotes the logical point in time the
|
||||
* event has occurred (sometimes called 'event time'). This timestamp might be different from
|
||||
* {@link AbstractLogEvent#getCreatedAt()}. For example setting the start time of race to a point in time in the past,
|
||||
* results in a {@link AbstractLogEvent} returning "now" on {@link AbstractLogEvent#getCreatedAt()} and such a point in
|
||||
* time that a complete startphase could have occured on {@link AbstractLogEvent#getTimePoint()}.
|
||||
*
|
||||
* To ensure an ordering there should be no two {@link AbstractLogEvent}s returning the same point in time on
|
||||
* {@link AbstractLogEvent#getCreatedAt()} <b>per pass</b>.
|
||||
*
|
||||
* The {@link AbstractLogEvent}'s {@link Timed} interface redirects to {@link AbstractLogEvent#getCreatedAt()} (was
|
||||
* {@link AbstractLogEvent#getLogicalTimePoint()}!).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* AbstractLog events have an author that has a name and a priority assigned. This can be used to represent multiple
|
||||
* concurrent authors such as a device used on a starting vessel, another device used at the finish line and
|
||||
* yet another device used on shore. In case more than one device make a statement about something, such as the start
|
||||
* time or the start procedure, the statement from the device with the highest priority needs to take precedence.
|
||||
* </p>
|
||||
*/
|
||||
public interface AbstractLogEvent<VisitorT> extends Timed, WithID, Serializable {
|
||||
|
||||
/**
|
||||
* Gets the {@link TimePoint} this event was created at.
|
||||
*/
|
||||
TimePoint getCreatedAt();
|
||||
|
||||
/**
|
||||
* Gets the event's logical timestamp.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
TimePoint getLogicalTimePoint();
|
||||
|
||||
/**
|
||||
* Visitor pattern to implement certain {@link AbstractLogEvent} subclass specific behavior.
|
||||
*/
|
||||
void accept(VisitorT visitor);
|
||||
|
||||
/**
|
||||
* Gets the {@link AbstractLogEventAuthor} author of this event.
|
||||
*/
|
||||
AbstractLogEventAuthor getAuthor();
|
||||
|
||||
/**
|
||||
* Gets a short info about the most relevant data of the event.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getShortInfo();
|
||||
}
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
|
||||
/**
|
||||
* Analyzer to perform a query over a given AbstractLog. Each subclass defines its <code>ResultType</code>.
|
||||
*
|
||||
* @param <ResultT>
|
||||
* type of analysis result.
|
||||
*/
|
||||
public abstract class BaseLogAnalyzer<LogT extends AbstractLog<EventT, VisitorT>, EventT extends AbstractLogEvent<VisitorT>, VisitorT, ResultT>
|
||||
implements LogAnalyzer<ResultT> {
|
||||
|
||||
protected LogT log;
|
||||
|
||||
public BaseLogAnalyzer(LogT log) {
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public LogT getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultT analyze() {
|
||||
log.lockForRead();
|
||||
try {
|
||||
return performAnalysis();
|
||||
} finally {
|
||||
log.unlockAfterRead();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract ResultT performAnalysis();
|
||||
|
||||
protected Iterable<EventT> getAllEvents() {
|
||||
return log.getRawFixes();
|
||||
}
|
||||
|
||||
protected Iterable<EventT> getAllEventsDescending() {
|
||||
return log.getRawFixesDescending();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
|
||||
/**
|
||||
* Analyzer to perform a query over a given AbstractLog. Each subclass defines its <code>ResultType</code>.
|
||||
*
|
||||
* @param <ResultT>
|
||||
* type of analysis result.
|
||||
*/
|
||||
public abstract class BaseLogAnalyzer<LogT extends AbstractLog<EventT, VisitorT>, EventT extends AbstractLogEvent<VisitorT>, VisitorT, ResultT>
|
||||
implements LogAnalyzer<ResultT> {
|
||||
|
||||
protected LogT log;
|
||||
|
||||
public BaseLogAnalyzer(LogT log) {
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public LogT getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultT analyze() {
|
||||
log.lockForRead();
|
||||
try {
|
||||
return performAnalysis();
|
||||
} finally {
|
||||
log.unlockAfterRead();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract ResultT performAnalysis();
|
||||
|
||||
protected Iterable<EventT> getAllEvents() {
|
||||
return log.getRawFixes();
|
||||
}
|
||||
|
||||
protected Iterable<EventT> getAllEventsDescending() {
|
||||
return log.getRawFixesDescending();
|
||||
}
|
||||
}
|
||||
+31
-31
@@ -1,31 +1,31 @@
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
|
||||
/**
|
||||
* Revokes the event referenced by {@link #getRevokedEventId()}.
|
||||
* A {@link RevokeEvent} cannot itself be revoked. Instead, e.g. the original event should be resubmitted.
|
||||
* @author Fredrik Teschke
|
||||
* @see Revokable
|
||||
*
|
||||
*/
|
||||
public interface RevokeEvent<VisitorT> extends AbstractLogEvent<VisitorT> {
|
||||
Serializable getRevokedEventId();
|
||||
|
||||
/**
|
||||
* Short info of the revoked event, automatically added by {@link RaceLog#revokeEvent}.
|
||||
*/
|
||||
String getRevokedEventShortInfo();
|
||||
|
||||
/**
|
||||
* Optional reason for revocation of event.
|
||||
*/
|
||||
String getReason();
|
||||
|
||||
/**
|
||||
* {@link Class#getSimpleName() Simple class name} of the revoked event.
|
||||
*/
|
||||
String getRevokedEventType();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
|
||||
/**
|
||||
* Revokes the event referenced by {@link #getRevokedEventId()}.
|
||||
* A {@link RevokeEvent} cannot itself be revoked. Instead, e.g. the original event should be resubmitted.
|
||||
* @author Fredrik Teschke
|
||||
* @see Revokable
|
||||
*
|
||||
*/
|
||||
public interface RevokeEvent<VisitorT> extends AbstractLogEvent<VisitorT> {
|
||||
Serializable getRevokedEventId();
|
||||
|
||||
/**
|
||||
* Short info of the revoked event, automatically added by {@link RaceLog#revokeEvent}.
|
||||
*/
|
||||
String getRevokedEventShortInfo();
|
||||
|
||||
/**
|
||||
* Optional reason for revocation of event.
|
||||
*/
|
||||
String getReason();
|
||||
|
||||
/**
|
||||
* {@link Class#getSimpleName() Simple class name} of the revoked event.
|
||||
*/
|
||||
String getRevokedEventType();
|
||||
}
|
||||
+80
-80
@@ -1,80 +1,80 @@
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public abstract class AbstractLogEventImpl<VisitorT> implements AbstractLogEvent<VisitorT> {
|
||||
|
||||
private static final long serialVersionUID = -5810258278984777732L;
|
||||
|
||||
private final TimePoint createdAt;
|
||||
private final TimePoint logicalTimePoint;
|
||||
private final Serializable id;
|
||||
private final AbstractLogEventAuthor author;
|
||||
|
||||
public AbstractLogEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId) {
|
||||
this.createdAt = createdAt;
|
||||
this.author = author;
|
||||
this.logicalTimePoint = logicalTimePoint;
|
||||
this.id = pId;
|
||||
}
|
||||
|
||||
/**
|
||||
* To be used by constructors creating new events as the value for {@link #createdAt}.
|
||||
*/
|
||||
protected static final TimePoint now() {
|
||||
return MillisecondsTimePoint.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* To be used by constructors creating new events as the value for {@link #id}.
|
||||
*/
|
||||
protected static final Serializable randId() {
|
||||
return UUID.randomUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Redirects to getCreatedAt()
|
||||
*/
|
||||
@Override
|
||||
public TimePoint getTimePoint() {
|
||||
return getCreatedAt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getLogicalTimePoint() {
|
||||
return logicalTimePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractLogEventAuthor getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": createdAt: " + getCreatedAt() + ", logicalTimePoint: " + getLogicalTimePoint()
|
||||
+ ", id: " + getId() + ", author: "+ getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public abstract class AbstractLogEventImpl<VisitorT> implements AbstractLogEvent<VisitorT> {
|
||||
|
||||
private static final long serialVersionUID = -5810258278984777732L;
|
||||
|
||||
private final TimePoint createdAt;
|
||||
private final TimePoint logicalTimePoint;
|
||||
private final Serializable id;
|
||||
private final AbstractLogEventAuthor author;
|
||||
|
||||
public AbstractLogEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId) {
|
||||
this.createdAt = createdAt;
|
||||
this.author = author;
|
||||
this.logicalTimePoint = logicalTimePoint;
|
||||
this.id = pId;
|
||||
}
|
||||
|
||||
/**
|
||||
* To be used by constructors creating new events as the value for {@link #createdAt}.
|
||||
*/
|
||||
protected static final TimePoint now() {
|
||||
return MillisecondsTimePoint.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* To be used by constructors creating new events as the value for {@link #id}.
|
||||
*/
|
||||
protected static final Serializable randId() {
|
||||
return UUID.randomUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Redirects to getCreatedAt()
|
||||
*/
|
||||
@Override
|
||||
public TimePoint getTimePoint() {
|
||||
return getCreatedAt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getLogicalTimePoint() {
|
||||
return logicalTimePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractLogEventAuthor getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + ": createdAt: " + getCreatedAt() + ", logicalTimePoint: " + getLogicalTimePoint()
|
||||
+ ", id: " + getId() + ", author: "+ getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+53
-53
@@ -1,53 +1,53 @@
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.tracking.impl.TimedComparator;
|
||||
import com.sap.sse.common.Timed;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
* timestamp.
|
||||
*
|
||||
* If one of the passed objects is not a {@link RaceLogEvent}, sorting is done by {@link Timed#getTimePoint()}.
|
||||
*/
|
||||
public class LogEventComparator implements Comparator<Timed>, Serializable {
|
||||
private static final long serialVersionUID = -1337219742246147546L;
|
||||
private Comparator<Timed> timedComparator;
|
||||
|
||||
public LogEventComparator() {
|
||||
this.timedComparator = TimedComparator.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Timed o1, Timed o2) {
|
||||
if (o1 instanceof AbstractLogEvent && o2 instanceof AbstractLogEvent) {
|
||||
return compareEvents((AbstractLogEvent<?>) o1, (AbstractLogEvent<?>) o2);
|
||||
}
|
||||
|
||||
// fallback to timed comparison
|
||||
return timedComparator.compare(o1, o2);
|
||||
}
|
||||
|
||||
protected int compareEvents(AbstractLogEvent<?> e1, AbstractLogEvent<?> e2) {
|
||||
//compare author priorities
|
||||
int result = e1.getAuthor().compareTo(e2.getAuthor());
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare created at timepoints
|
||||
result = e1.getCreatedAt().compareTo(e2.getCreatedAt());
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare logical timepoints
|
||||
result = Util.compareToWithNull(e1.getLogicalTimePoint(), e2.getLogicalTimePoint(), /* nullIsLess */ false);
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare ids
|
||||
return e1.getId().toString().compareTo(e2.getId().toString());
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.tracking.impl.TimedComparator;
|
||||
import com.sap.sse.common.Timed;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
* timestamp.
|
||||
*
|
||||
* If one of the passed objects is not a {@link RaceLogEvent}, sorting is done by {@link Timed#getTimePoint()}.
|
||||
*/
|
||||
public class LogEventComparator implements Comparator<Timed>, Serializable {
|
||||
private static final long serialVersionUID = -1337219742246147546L;
|
||||
private Comparator<Timed> timedComparator;
|
||||
|
||||
public LogEventComparator() {
|
||||
this.timedComparator = TimedComparator.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Timed o1, Timed o2) {
|
||||
if (o1 instanceof AbstractLogEvent && o2 instanceof AbstractLogEvent) {
|
||||
return compareEvents((AbstractLogEvent<?>) o1, (AbstractLogEvent<?>) o2);
|
||||
}
|
||||
|
||||
// fallback to timed comparison
|
||||
return timedComparator.compare(o1, o2);
|
||||
}
|
||||
|
||||
protected int compareEvents(AbstractLogEvent<?> e1, AbstractLogEvent<?> e2) {
|
||||
//compare author priorities
|
||||
int result = e1.getAuthor().compareTo(e2.getAuthor());
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare created at timepoints
|
||||
result = e1.getCreatedAt().compareTo(e2.getCreatedAt());
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare logical timepoints
|
||||
result = Util.compareToWithNull(e1.getLogicalTimePoint(), e2.getLogicalTimePoint(), /* nullIsLess */ false);
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare ids
|
||||
return e1.getId().toString().compareTo(e2.getId().toString());
|
||||
}
|
||||
}
|
||||
+64
-64
@@ -1,64 +1,64 @@
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.RevokeEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public abstract class RevokeEventImpl<VisitorT> extends AbstractLogEventImpl<VisitorT> implements RevokeEvent<VisitorT> {
|
||||
private static final long serialVersionUID = -30864810737555657L;
|
||||
|
||||
private final Serializable revokedEventId;
|
||||
private final String reason;
|
||||
private final String revokedEventType;
|
||||
private final String revokedEventShortInfo;
|
||||
|
||||
public RevokeEventImpl(AbstractLogEventAuthor author, AbstractLogEvent<?> toRevoke, String reason) {
|
||||
this(MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), author, UUID.randomUUID(),
|
||||
toRevoke.getId(), toRevoke.getClass().getName(), toRevoke.getShortInfo(), reason);
|
||||
}
|
||||
|
||||
public RevokeEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, Serializable revokedEventId, String revokedEventType,
|
||||
String revokedEventShortInfo, String reason) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.revokedEventId = revokedEventId;
|
||||
this.reason = reason;
|
||||
this.revokedEventType = revokedEventType;
|
||||
this.revokedEventShortInfo = revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getRevokedEventId() {
|
||||
return revokedEventId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
if (revokedEventShortInfo == null) {
|
||||
return "No event revoked";
|
||||
} else {
|
||||
return "Revoked " + revokedEventType + "(" + revokedEventShortInfo + ")"
|
||||
+ reason == null ? "" : (" due to " + reason);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventType() {
|
||||
return revokedEventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventShortInfo() {
|
||||
return revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.RevokeEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public abstract class RevokeEventImpl<VisitorT> extends AbstractLogEventImpl<VisitorT> implements RevokeEvent<VisitorT> {
|
||||
private static final long serialVersionUID = -30864810737555657L;
|
||||
|
||||
private final Serializable revokedEventId;
|
||||
private final String reason;
|
||||
private final String revokedEventType;
|
||||
private final String revokedEventShortInfo;
|
||||
|
||||
public RevokeEventImpl(AbstractLogEventAuthor author, AbstractLogEvent<?> toRevoke, String reason) {
|
||||
this(MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), author, UUID.randomUUID(),
|
||||
toRevoke.getId(), toRevoke.getClass().getName(), toRevoke.getShortInfo(), reason);
|
||||
}
|
||||
|
||||
public RevokeEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, Serializable revokedEventId, String revokedEventType,
|
||||
String revokedEventShortInfo, String reason) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.revokedEventId = revokedEventId;
|
||||
this.reason = reason;
|
||||
this.revokedEventType = revokedEventType;
|
||||
this.revokedEventShortInfo = revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getRevokedEventId() {
|
||||
return revokedEventId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
if (revokedEventShortInfo == null) {
|
||||
return "No event revoked";
|
||||
} else {
|
||||
return "Revoked " + revokedEventType + "(" + revokedEventShortInfo + ")"
|
||||
+ reason == null ? "" : (" due to " + reason);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventType() {
|
||||
return revokedEventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRevokedEventShortInfo() {
|
||||
return revokedEventShortInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
}
|
||||
+30
-30
@@ -1,30 +1,30 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* holds the competitor ID, the competitor name, the finishing rank, an optional score, the optional {@link MaxPointReason} and
|
||||
* an optional finishing time, important for handicapped races. An optional comment for the competitor's result can also be
|
||||
* provided as a simple {@link String}, such as a reason for a disqualification or a redress given.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface CompetitorResult extends Serializable {
|
||||
Serializable getCompetitorId();
|
||||
|
||||
String getCompetitorDisplayName();
|
||||
|
||||
int getOneBasedRank();
|
||||
|
||||
MaxPointsReason getMaxPointsReason();
|
||||
|
||||
Double getScore();
|
||||
|
||||
TimePoint getFinishingTime();
|
||||
|
||||
String getComment();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* holds the competitor ID, the competitor name, the finishing rank, an optional score, the optional {@link MaxPointReason} and
|
||||
* an optional finishing time, important for handicapped races. An optional comment for the competitor's result can also be
|
||||
* provided as a simple {@link String}, such as a reason for a disqualification or a redress given.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface CompetitorResult extends Serializable {
|
||||
Serializable getCompetitorId();
|
||||
|
||||
String getCompetitorDisplayName();
|
||||
|
||||
int getOneBasedRank();
|
||||
|
||||
MaxPointsReason getMaxPointsReason();
|
||||
|
||||
Double getScore();
|
||||
|
||||
TimePoint getFinishingTime();
|
||||
|
||||
String getComment();
|
||||
}
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
public interface RaceLogChangedListener {
|
||||
|
||||
/**
|
||||
* Called when an event is added to the {@link RaceLog}.
|
||||
* @param event that was added
|
||||
*/
|
||||
public void eventAdded(RaceLogEvent event);
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
public interface RaceLogChangedListener {
|
||||
|
||||
/**
|
||||
* Called when an event is added to the {@link RaceLog}.
|
||||
* @param event that was added
|
||||
*/
|
||||
public void eventAdded(RaceLogEvent event);
|
||||
}
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface RaceLogCourseAreaChangedEvent extends RaceLogEvent {
|
||||
|
||||
Serializable getCourseAreaId();
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface RaceLogCourseAreaChangedEvent extends RaceLogEvent {
|
||||
|
||||
Serializable getCourseAreaId();
|
||||
|
||||
}
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.common.CourseDesignerMode;
|
||||
|
||||
public interface RaceLogCourseDesignChangedEvent extends RaceLogEvent {
|
||||
|
||||
CourseBase getCourseDesign();
|
||||
|
||||
CourseDesignerMode getCourseDesignerMode();
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.common.CourseDesignerMode;
|
||||
|
||||
public interface RaceLogCourseDesignChangedEvent extends RaceLogEvent {
|
||||
|
||||
CourseBase getCourseDesign();
|
||||
|
||||
CourseDesignerMode getCourseDesignerMode();
|
||||
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
|
||||
public interface RaceLogEndOfTrackingEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
|
||||
public interface RaceLogEndOfTrackingEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
|
||||
public interface RaceLogEvent extends AbstractLogEvent<RaceLogEventVisitor>, RaceLogEventData {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
|
||||
public interface RaceLogEvent extends AbstractLogEvent<RaceLogEventVisitor>, RaceLogEventData {
|
||||
|
||||
}
|
||||
+27
-27
@@ -1,27 +1,27 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RaceLogEventData extends Serializable {
|
||||
|
||||
/**
|
||||
* Gets the event's pass identifier.
|
||||
*
|
||||
* Each {@link RaceLogEventData} is associated to a certain pass. A pass is every attempt to start and run a race. A
|
||||
* new pass is initiated when a new start time is proposed (e.g. after the race was aborted). There might be certain
|
||||
* event type that are not strictly bound to its pass.
|
||||
*
|
||||
*/
|
||||
int getPassId();
|
||||
|
||||
/**
|
||||
* Gets the list of associated {@link Competitor}s.
|
||||
*
|
||||
* A {@link RaceLogEventData} might be associated with a list of competitors, which are somehow relevant for this
|
||||
* kind of event. An example is a list of competitors who are marked for an individual recall.
|
||||
*/
|
||||
List<Competitor> getInvolvedBoats();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RaceLogEventData extends Serializable {
|
||||
|
||||
/**
|
||||
* Gets the event's pass identifier.
|
||||
*
|
||||
* Each {@link RaceLogEventData} is associated to a certain pass. A pass is every attempt to start and run a race. A
|
||||
* new pass is initiated when a new start time is proposed (e.g. after the race was aborted). There might be certain
|
||||
* event type that are not strictly bound to its pass.
|
||||
*
|
||||
*/
|
||||
int getPassId();
|
||||
|
||||
/**
|
||||
* Gets the list of associated {@link Competitor}s.
|
||||
*
|
||||
* A {@link RaceLogEventData} might be associated with a list of competitors, which are somehow relevant for this
|
||||
* kind of event. An example is a list of competitors who are marked for an individual recall.
|
||||
*/
|
||||
List<Competitor> getInvolvedBoats();
|
||||
}
|
||||
+58
-58
@@ -1,58 +1,58 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.RaceLogAdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogRegisterCompetitorEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogStartTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogUseCompetitorsFromRaceLogEvent;
|
||||
|
||||
|
||||
public interface RaceLogEventVisitor {
|
||||
public void visit(RaceLogRevokeEvent event);
|
||||
|
||||
public void visit(RaceLogFlagEvent event);
|
||||
|
||||
public void visit(RaceLogPassChangeEvent event);
|
||||
|
||||
public void visit(RaceLogRaceStatusEvent event);
|
||||
|
||||
public void visit(RaceLogStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogCourseAreaChangedEvent event);
|
||||
|
||||
public void visit(RaceLogCourseDesignChangedEvent event);
|
||||
|
||||
public void visit(RaceLogFinishPositioningListChangedEvent event);
|
||||
|
||||
public void visit(RaceLogFinishPositioningConfirmedEvent event);
|
||||
|
||||
public void visit(RaceLogPathfinderEvent event);
|
||||
|
||||
public void visit(RaceLogGateLineOpeningTimeEvent event);
|
||||
|
||||
public void visit(RaceLogStartProcedureChangedEvent event);
|
||||
|
||||
public void visit(RaceLogProtestStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogWindFixEvent event);
|
||||
|
||||
public void visit(RaceLogDenoteForTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogStartTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogRegisterCompetitorEvent event);
|
||||
|
||||
public void visit(RaceLogAdditionalScoringInformationEvent additionalScoringInformation);
|
||||
|
||||
public void visit(RaceLogFixedMarkPassingEvent event);
|
||||
|
||||
public void visit(RaceLogSuppressedMarkPassingsEvent event);
|
||||
|
||||
public void visit(RaceLogDependentStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogStartOfTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogEndOfTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogUseCompetitorsFromRaceLogEvent event);
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.RaceLogAdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogRegisterCompetitorEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogStartTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogUseCompetitorsFromRaceLogEvent;
|
||||
|
||||
|
||||
public interface RaceLogEventVisitor {
|
||||
public void visit(RaceLogRevokeEvent event);
|
||||
|
||||
public void visit(RaceLogFlagEvent event);
|
||||
|
||||
public void visit(RaceLogPassChangeEvent event);
|
||||
|
||||
public void visit(RaceLogRaceStatusEvent event);
|
||||
|
||||
public void visit(RaceLogStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogCourseAreaChangedEvent event);
|
||||
|
||||
public void visit(RaceLogCourseDesignChangedEvent event);
|
||||
|
||||
public void visit(RaceLogFinishPositioningListChangedEvent event);
|
||||
|
||||
public void visit(RaceLogFinishPositioningConfirmedEvent event);
|
||||
|
||||
public void visit(RaceLogPathfinderEvent event);
|
||||
|
||||
public void visit(RaceLogGateLineOpeningTimeEvent event);
|
||||
|
||||
public void visit(RaceLogStartProcedureChangedEvent event);
|
||||
|
||||
public void visit(RaceLogProtestStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogWindFixEvent event);
|
||||
|
||||
public void visit(RaceLogDenoteForTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogStartTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogRegisterCompetitorEvent event);
|
||||
|
||||
public void visit(RaceLogAdditionalScoringInformationEvent additionalScoringInformation);
|
||||
|
||||
public void visit(RaceLogFixedMarkPassingEvent event);
|
||||
|
||||
public void visit(RaceLogSuppressedMarkPassingsEvent event);
|
||||
|
||||
public void visit(RaceLogDependentStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogStartOfTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogEndOfTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogUseCompetitorsFromRaceLogEvent event);
|
||||
}
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
|
||||
/**
|
||||
* This RaceLog event type confirms the entered positioning list. Since we do not guarantee the order of incoming events
|
||||
* from the app (due to possible connectivity issues), this event type contains the the confirmed positioning list
|
||||
* again. Although this racelog event type contains the same information such as
|
||||
* {@link RaceLogFinishPositioningListChangedEvent} we keep it for backwards compatibility reasons.
|
||||
*/
|
||||
public interface RaceLogFinishPositioningConfirmedEvent extends RaceLogFinishPositioningEvent {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
|
||||
/**
|
||||
* This RaceLog event type confirms the entered positioning list. Since we do not guarantee the order of incoming events
|
||||
* from the app (due to possible connectivity issues), this event type contains the the confirmed positioning list
|
||||
* again. Although this racelog event type contains the same information such as
|
||||
* {@link RaceLogFinishPositioningListChangedEvent} we keep it for backwards compatibility reasons.
|
||||
*/
|
||||
public interface RaceLogFinishPositioningConfirmedEvent extends RaceLogFinishPositioningEvent {
|
||||
|
||||
}
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
/**
|
||||
* Captures a temporary race result description. The result is not final yet and needs to be confirmed by
|
||||
* a {@link RaceLogFinishPositioningConfirmedEvent} before it is adopted by other parts of the model. This
|
||||
* type of event can be used to store the interims state of a result editing process before the result
|
||||
* if committed.
|
||||
*/
|
||||
public interface RaceLogFinishPositioningListChangedEvent extends RaceLogFinishPositioningEvent {
|
||||
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
/**
|
||||
* Captures a temporary race result description. The result is not final yet and needs to be confirmed by
|
||||
* a {@link RaceLogFinishPositioningConfirmedEvent} before it is adopted by other parts of the model. This
|
||||
* type of event can be used to store the interims state of a result editing process before the result
|
||||
* if committed.
|
||||
*/
|
||||
public interface RaceLogFinishPositioningListChangedEvent extends RaceLogFinishPositioningEvent {
|
||||
|
||||
}
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public interface RaceLogFixedMarkPassingEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
public TimePoint getTimePointOfFixedPassing();
|
||||
|
||||
Integer getZeroBasedIndexOfPassedWaypoint();
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public interface RaceLogFixedMarkPassingEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
public TimePoint getTimePointOfFixedPassing();
|
||||
|
||||
Integer getZeroBasedIndexOfPassedWaypoint();
|
||||
|
||||
}
|
||||
+12
-12
@@ -1,12 +1,12 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
|
||||
public interface RaceLogFlagEvent extends RaceLogEvent {
|
||||
|
||||
Flags getUpperFlag();
|
||||
|
||||
Flags getLowerFlag();
|
||||
|
||||
boolean isDisplayed();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
|
||||
public interface RaceLogFlagEvent extends RaceLogEvent {
|
||||
|
||||
Flags getUpperFlag();
|
||||
|
||||
Flags getLowerFlag();
|
||||
|
||||
boolean isDisplayed();
|
||||
}
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
/**
|
||||
* Special event type to indiate a pass change.
|
||||
*
|
||||
* Instances of this type already belong to the NEW pass.
|
||||
*/
|
||||
public interface RaceLogPassChangeEvent extends RaceLogEvent {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
/**
|
||||
* Special event type to indiate a pass change.
|
||||
*
|
||||
* Instances of this type already belong to the NEW pass.
|
||||
*/
|
||||
public interface RaceLogPassChangeEvent extends RaceLogEvent {
|
||||
|
||||
}
|
||||
+13
-13
@@ -1,13 +1,13 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
|
||||
/**
|
||||
* Events to indicate the new race status which is valid for all events
|
||||
* arriving after this event (on the same pass).
|
||||
*/
|
||||
public interface RaceLogRaceStatusEvent extends RaceLogEvent {
|
||||
|
||||
RaceLogRaceStatus getNextStatus();
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
|
||||
/**
|
||||
* Events to indicate the new race status which is valid for all events
|
||||
* arriving after this event (on the same pass).
|
||||
*/
|
||||
public interface RaceLogRaceStatusEvent extends RaceLogEvent {
|
||||
|
||||
RaceLogRaceStatus getNextStatus();
|
||||
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
|
||||
public interface RaceLogStartOfTrackingEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
|
||||
public interface RaceLogStartOfTrackingEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
}
|
||||
+15
-15
@@ -1,15 +1,15 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* A {@link RaceLogStartTimeEvent} denotes a new start time.
|
||||
*
|
||||
* Each {@link RaceLogStartTimeEvent} is also a {@link RaceLogRaceStatusEvent} with
|
||||
* {@link RaceLogRaceStatusEvent#getNextStatus()} returning {@link RaceLogRaceStatus#SCHEDULED}.
|
||||
*/
|
||||
public interface RaceLogStartTimeEvent extends RaceLogRaceStatusEvent {
|
||||
|
||||
TimePoint getStartTime();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* A {@link RaceLogStartTimeEvent} denotes a new start time.
|
||||
*
|
||||
* Each {@link RaceLogStartTimeEvent} is also a {@link RaceLogRaceStatusEvent} with
|
||||
* {@link RaceLogRaceStatusEvent#getNextStatus()} returning {@link RaceLogRaceStatus#SCHEDULED}.
|
||||
*/
|
||||
public interface RaceLogStartTimeEvent extends RaceLogRaceStatusEvent {
|
||||
|
||||
TimePoint getStartTime();
|
||||
}
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
|
||||
public interface RaceLogSuppressedMarkPassingsEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
public Integer getZeroBasedIndexOfFirstSuppressedWaypoint();
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
|
||||
public interface RaceLogSuppressedMarkPassingsEvent extends RaceLogEvent, Revokable {
|
||||
|
||||
public Integer getZeroBasedIndexOfFirstSuppressedWaypoint();
|
||||
|
||||
}
|
||||
+25
-25
@@ -1,25 +1,25 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningListChangedEvent;
|
||||
|
||||
public class FinishPositioningListFinder extends RaceLogAnalyzer<CompetitorResults> {
|
||||
|
||||
public FinishPositioningListFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompetitorResults performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogFinishPositioningListChangedEvent) {
|
||||
RaceLogFinishPositioningListChangedEvent finishPositioningEvent = (RaceLogFinishPositioningListChangedEvent) event;
|
||||
return finishPositioningEvent.getPositionedCompetitorsIDsNamesMaxPointsReasons();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningListChangedEvent;
|
||||
|
||||
public class FinishPositioningListFinder extends RaceLogAnalyzer<CompetitorResults> {
|
||||
|
||||
public FinishPositioningListFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompetitorResults performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogFinishPositioningListChangedEvent) {
|
||||
RaceLogFinishPositioningListChangedEvent finishPositioningEvent = (RaceLogFinishPositioningListChangedEvent) event;
|
||||
return finishPositioningEvent.getPositionedCompetitorsIDsNamesMaxPointsReasons();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+29
-29
@@ -1,29 +1,29 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class FinishedTimeFinder extends RaceLogAnalyzer<TimePoint> {
|
||||
|
||||
public FinishedTimeFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TimePoint performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogRaceStatusEvent) {
|
||||
RaceLogRaceStatusEvent statusEvent = (RaceLogRaceStatusEvent) event;
|
||||
if (statusEvent.getNextStatus().equals(RaceLogRaceStatus.FINISHED)) {
|
||||
return statusEvent.getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class FinishedTimeFinder extends RaceLogAnalyzer<TimePoint> {
|
||||
|
||||
public FinishedTimeFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TimePoint performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogRaceStatusEvent) {
|
||||
RaceLogRaceStatusEvent statusEvent = (RaceLogRaceStatusEvent) event;
|
||||
if (statusEvent.getNextStatus().equals(RaceLogRaceStatus.FINISHED)) {
|
||||
return statusEvent.getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+29
-29
@@ -1,29 +1,29 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class FinishingTimeFinder extends RaceLogAnalyzer<TimePoint> {
|
||||
|
||||
public FinishingTimeFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TimePoint performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogRaceStatusEvent) {
|
||||
RaceLogRaceStatusEvent statusEvent = (RaceLogRaceStatusEvent) event;
|
||||
if (statusEvent.getNextStatus().equals(RaceLogRaceStatus.FINISHING)) {
|
||||
return statusEvent.getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class FinishingTimeFinder extends RaceLogAnalyzer<TimePoint> {
|
||||
|
||||
public FinishingTimeFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TimePoint performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogRaceStatusEvent) {
|
||||
RaceLogRaceStatusEvent statusEvent = (RaceLogRaceStatusEvent) event;
|
||||
if (statusEvent.getNextStatus().equals(RaceLogRaceStatus.FINISHING)) {
|
||||
return statusEvent.getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+30
-30
@@ -1,30 +1,30 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFlagEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class IndividualRecallFinder extends RaceLogAnalyzer<TimePoint> {
|
||||
|
||||
public IndividualRecallFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
protected abstract boolean isRelevant(RaceLogFlagEvent flagEvent);
|
||||
|
||||
@Override
|
||||
protected TimePoint performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogFlagEvent) {
|
||||
RaceLogFlagEvent flagEvent = (RaceLogFlagEvent) event;
|
||||
if (isRelevant(flagEvent)) {
|
||||
return flagEvent.getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFlagEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class IndividualRecallFinder extends RaceLogAnalyzer<TimePoint> {
|
||||
|
||||
public IndividualRecallFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
protected abstract boolean isRelevant(RaceLogFlagEvent flagEvent);
|
||||
|
||||
@Override
|
||||
protected TimePoint performAnalysis() {
|
||||
for (RaceLogEvent event : getPassEventsDescending()) {
|
||||
if (event instanceof RaceLogFlagEvent) {
|
||||
RaceLogFlagEvent flagEvent = (RaceLogFlagEvent) event;
|
||||
if (isRelevant(flagEvent)) {
|
||||
return flagEvent.getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+49
-49
@@ -1,49 +1,49 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.common.CourseDesignerMode;
|
||||
|
||||
/**
|
||||
* A course design can be defined in the {@link RaceLog} using a {@link RaceLogCourseDesignChangedEvent}. These
|
||||
* events may carry information about the course designer that was used to create the course. Not all of them
|
||||
* support defining the waypoint sequence that sets the course. See {@link RaceLogCourseDesignChangedEvent#getCourseDesignerMode()}
|
||||
* and {@link CourseDesignerMode#isWaypointSequenceValid()}. Callers can tell whether they want to obtain {@link CourseBase}
|
||||
* objects regardless of whether their waypoint sequence is valid or not.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class LastPublishedCourseDesignFinder extends RaceLogAnalyzer<CourseBase> {
|
||||
|
||||
private final boolean onlyCoursesWithValidWaypointList;
|
||||
|
||||
/**
|
||||
* @param onlyCoursesWithValidWaypointList
|
||||
* if {@code true}, only {@link RaceLogCourseDesignChangedEvent} objects will be considered whose
|
||||
* {@link RaceLogCourseDesignChangedEvent#getCourseDesignerMode() course designer mode}
|
||||
* {@link CourseDesignerMode#isWaypointSequenceValid() guarantees} that the waypoint list is valid and
|
||||
* shall be applied to a race; otherwise, all other {@link RaceLogCourseDesignChangedEvent} as considered
|
||||
* as well.
|
||||
*/
|
||||
public LastPublishedCourseDesignFinder(RaceLog raceLog, boolean onlyCoursesWithValidWaypointList) {
|
||||
super(raceLog);
|
||||
this.onlyCoursesWithValidWaypointList = onlyCoursesWithValidWaypointList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CourseBase performAnalysis() {
|
||||
for (RaceLogEvent event : getAllEventsDescending()) {
|
||||
if (event instanceof RaceLogCourseDesignChangedEvent) {
|
||||
RaceLogCourseDesignChangedEvent courseDesignEvent = (RaceLogCourseDesignChangedEvent) event;
|
||||
if (!onlyCoursesWithValidWaypointList || (courseDesignEvent.getCourseDesignerMode() == null ||
|
||||
courseDesignEvent.getCourseDesignerMode().isWaypointSequenceValid())) {
|
||||
return courseDesignEvent.getCourseDesign();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.common.CourseDesignerMode;
|
||||
|
||||
/**
|
||||
* A course design can be defined in the {@link RaceLog} using a {@link RaceLogCourseDesignChangedEvent}. These
|
||||
* events may carry information about the course designer that was used to create the course. Not all of them
|
||||
* support defining the waypoint sequence that sets the course. See {@link RaceLogCourseDesignChangedEvent#getCourseDesignerMode()}
|
||||
* and {@link CourseDesignerMode#isWaypointSequenceValid()}. Callers can tell whether they want to obtain {@link CourseBase}
|
||||
* objects regardless of whether their waypoint sequence is valid or not.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class LastPublishedCourseDesignFinder extends RaceLogAnalyzer<CourseBase> {
|
||||
|
||||
private final boolean onlyCoursesWithValidWaypointList;
|
||||
|
||||
/**
|
||||
* @param onlyCoursesWithValidWaypointList
|
||||
* if {@code true}, only {@link RaceLogCourseDesignChangedEvent} objects will be considered whose
|
||||
* {@link RaceLogCourseDesignChangedEvent#getCourseDesignerMode() course designer mode}
|
||||
* {@link CourseDesignerMode#isWaypointSequenceValid() guarantees} that the waypoint list is valid and
|
||||
* shall be applied to a race; otherwise, all other {@link RaceLogCourseDesignChangedEvent} as considered
|
||||
* as well.
|
||||
*/
|
||||
public LastPublishedCourseDesignFinder(RaceLog raceLog, boolean onlyCoursesWithValidWaypointList) {
|
||||
super(raceLog);
|
||||
this.onlyCoursesWithValidWaypointList = onlyCoursesWithValidWaypointList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CourseBase performAnalysis() {
|
||||
for (RaceLogEvent event : getAllEventsDescending()) {
|
||||
if (event instanceof RaceLogCourseDesignChangedEvent) {
|
||||
RaceLogCourseDesignChangedEvent courseDesignEvent = (RaceLogCourseDesignChangedEvent) event;
|
||||
if (!onlyCoursesWithValidWaypointList || (courseDesignEvent.getCourseDesignerMode() == null ||
|
||||
courseDesignEvent.getCourseDesignerMode().isWaypointSequenceValid())) {
|
||||
return courseDesignEvent.getCourseDesign();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+22
-22
@@ -1,22 +1,22 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.BaseLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
|
||||
public abstract class RaceLogAnalyzer<ResultType> extends BaseLogAnalyzer
|
||||
<RaceLog, RaceLogEvent, RaceLogEventVisitor, ResultType> {
|
||||
|
||||
public RaceLogAnalyzer(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
protected Iterable<RaceLogEvent> getPassEvents() {
|
||||
return log.getFixes();
|
||||
}
|
||||
|
||||
protected Iterable<RaceLogEvent> getPassEventsDescending() {
|
||||
return log.getFixesDescending();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.BaseLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
|
||||
public abstract class RaceLogAnalyzer<ResultType> extends BaseLogAnalyzer
|
||||
<RaceLog, RaceLogEvent, RaceLogEventVisitor, ResultType> {
|
||||
|
||||
public RaceLogAnalyzer(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
protected Iterable<RaceLogEvent> getPassEvents() {
|
||||
return log.getFixes();
|
||||
}
|
||||
|
||||
protected Iterable<RaceLogEvent> getPassEventsDescending() {
|
||||
return log.getFixesDescending();
|
||||
}
|
||||
}
|
||||
+30
-30
@@ -1,30 +1,30 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogUsesOwnCompetitorsAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.CompetitorsInLogAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public class RaceLogRegisteredCompetitorsAnalyzer extends RaceLogAnalyzer<Set<Competitor>> {
|
||||
|
||||
public RaceLogRegisteredCompetitorsAnalyzer(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Competitor> performAnalysis() {
|
||||
final Set<Competitor> result;
|
||||
if (new RaceLogUsesOwnCompetitorsAnalyzer(getLog()).analyze()){
|
||||
// get Events from RaceLog
|
||||
result = new CompetitorsInLogAnalyzer<>(getLog()).analyze();
|
||||
} else {
|
||||
// as we're explicitly only trying to find those registrations in the RaceLog, we won't
|
||||
// return anything from the regatta log.
|
||||
result = Collections.emptySet();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogUsesOwnCompetitorsAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.CompetitorsInLogAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public class RaceLogRegisteredCompetitorsAnalyzer extends RaceLogAnalyzer<Set<Competitor>> {
|
||||
|
||||
public RaceLogRegisteredCompetitorsAnalyzer(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Competitor> performAnalysis() {
|
||||
final Set<Competitor> result;
|
||||
if (new RaceLogUsesOwnCompetitorsAnalyzer(getLog()).analyze()){
|
||||
// get Events from RaceLog
|
||||
result = new CompetitorsInLogAnalyzer<>(getLog()).analyze();
|
||||
} else {
|
||||
// as we're explicitly only trying to find those registrations in the RaceLog, we won't
|
||||
// return anything from the regatta log.
|
||||
result = Collections.emptySet();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+105
-105
@@ -1,106 +1,106 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.BaseRaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogRaceStatusEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.ReadonlyRacingProcedure;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.util.impl.ArrayListNavigableSet;
|
||||
|
||||
public class RaceStatusAnalyzer extends RaceLogAnalyzer<RaceLogRaceStatus> {
|
||||
|
||||
public interface Clock {
|
||||
TimePoint now();
|
||||
}
|
||||
|
||||
public final static class StandardClock implements Clock {
|
||||
@Override
|
||||
public TimePoint now() {
|
||||
return MillisecondsTimePoint.now();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private RaceLogResolver resolver;
|
||||
|
||||
public RaceStatusAnalyzer(RaceLogResolver resolver, RaceLog raceLog, ReadonlyRacingProcedure racingProcedure) {
|
||||
super(raceLog);
|
||||
this.eventDispatcher = new EventDispatcher(new StandardClock(), racingProcedure);
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
||||
public RaceStatusAnalyzer(RaceLogResolver resolver, RaceLog raceLog, Clock clock, ReadonlyRacingProcedure racingProcedure) {
|
||||
super(raceLog);
|
||||
this.eventDispatcher = new EventDispatcher(clock, racingProcedure);
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceLogRaceStatus performAnalysis() {
|
||||
ArrayListNavigableSet<RaceLogRaceStatusEvent> statusEvents = new ArrayListNavigableSet<>(
|
||||
RaceLogRaceStatusEventComparator.INSTANCE);
|
||||
for (RaceLogEvent event : getPassEvents()) {
|
||||
if (event instanceof RaceLogRaceStatusEvent) {
|
||||
statusEvents.add((RaceLogRaceStatusEvent) event);
|
||||
}
|
||||
}
|
||||
for (RaceLogRaceStatusEvent event : statusEvents.descendingSet()) {
|
||||
event.accept(eventDispatcher);
|
||||
return eventDispatcher.nextStatus;
|
||||
}
|
||||
return RaceLogRaceStatus.UNSCHEDULED;
|
||||
}
|
||||
|
||||
private class EventDispatcher extends BaseRaceLogEventVisitor {
|
||||
|
||||
private final Clock clock;
|
||||
private final ReadonlyRacingProcedure racingProcedure;
|
||||
public RaceLogRaceStatus nextStatus;
|
||||
|
||||
public EventDispatcher(Clock clock, ReadonlyRacingProcedure racingProcedure) {
|
||||
this.clock = clock;
|
||||
this.racingProcedure = racingProcedure;
|
||||
this.nextStatus = RaceLogRaceStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogStartTimeEvent event) {
|
||||
TimePoint startTime = event.getStartTime();
|
||||
setRaceLogStatusBasedOnStartTime(startTime);
|
||||
}
|
||||
|
||||
private void setRaceLogStatusBasedOnStartTime(TimePoint startTime) {
|
||||
if (startTime == null) {
|
||||
nextStatus = RaceLogRaceStatus.PRESCHEDULED;
|
||||
} else {
|
||||
TimePoint now = clock.now();
|
||||
if (racingProcedure.isStartphaseActive(startTime, now)) {
|
||||
nextStatus = RaceLogRaceStatus.STARTPHASE;
|
||||
} else if (now.before(startTime)) {
|
||||
nextStatus = RaceLogRaceStatus.SCHEDULED;
|
||||
} else {
|
||||
nextStatus = RaceLogRaceStatus.RUNNING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogRaceStatusEvent event) {
|
||||
nextStatus = event.getNextStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogDependentStartTimeEvent event) {
|
||||
DependentStartTimeResolver startTimeResolver = new DependentStartTimeResolver(resolver);
|
||||
TimePoint startTime = startTimeResolver.resolve(event).getStartTime();
|
||||
setRaceLogStatusBasedOnStartTime(startTime);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.BaseRaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogRaceStatusEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.ReadonlyRacingProcedure;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.util.impl.ArrayListNavigableSet;
|
||||
|
||||
public class RaceStatusAnalyzer extends RaceLogAnalyzer<RaceLogRaceStatus> {
|
||||
|
||||
public interface Clock {
|
||||
TimePoint now();
|
||||
}
|
||||
|
||||
public final static class StandardClock implements Clock {
|
||||
@Override
|
||||
public TimePoint now() {
|
||||
return MillisecondsTimePoint.now();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private RaceLogResolver resolver;
|
||||
|
||||
public RaceStatusAnalyzer(RaceLogResolver resolver, RaceLog raceLog, ReadonlyRacingProcedure racingProcedure) {
|
||||
super(raceLog);
|
||||
this.eventDispatcher = new EventDispatcher(new StandardClock(), racingProcedure);
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
||||
public RaceStatusAnalyzer(RaceLogResolver resolver, RaceLog raceLog, Clock clock, ReadonlyRacingProcedure racingProcedure) {
|
||||
super(raceLog);
|
||||
this.eventDispatcher = new EventDispatcher(clock, racingProcedure);
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceLogRaceStatus performAnalysis() {
|
||||
ArrayListNavigableSet<RaceLogRaceStatusEvent> statusEvents = new ArrayListNavigableSet<>(
|
||||
RaceLogRaceStatusEventComparator.INSTANCE);
|
||||
for (RaceLogEvent event : getPassEvents()) {
|
||||
if (event instanceof RaceLogRaceStatusEvent) {
|
||||
statusEvents.add((RaceLogRaceStatusEvent) event);
|
||||
}
|
||||
}
|
||||
for (RaceLogRaceStatusEvent event : statusEvents.descendingSet()) {
|
||||
event.accept(eventDispatcher);
|
||||
return eventDispatcher.nextStatus;
|
||||
}
|
||||
return RaceLogRaceStatus.UNSCHEDULED;
|
||||
}
|
||||
|
||||
private class EventDispatcher extends BaseRaceLogEventVisitor {
|
||||
|
||||
private final Clock clock;
|
||||
private final ReadonlyRacingProcedure racingProcedure;
|
||||
public RaceLogRaceStatus nextStatus;
|
||||
|
||||
public EventDispatcher(Clock clock, ReadonlyRacingProcedure racingProcedure) {
|
||||
this.clock = clock;
|
||||
this.racingProcedure = racingProcedure;
|
||||
this.nextStatus = RaceLogRaceStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogStartTimeEvent event) {
|
||||
TimePoint startTime = event.getStartTime();
|
||||
setRaceLogStatusBasedOnStartTime(startTime);
|
||||
}
|
||||
|
||||
private void setRaceLogStatusBasedOnStartTime(TimePoint startTime) {
|
||||
if (startTime == null) {
|
||||
nextStatus = RaceLogRaceStatus.PRESCHEDULED;
|
||||
} else {
|
||||
TimePoint now = clock.now();
|
||||
if (racingProcedure.isStartphaseActive(startTime, now)) {
|
||||
nextStatus = RaceLogRaceStatus.STARTPHASE;
|
||||
} else if (now.before(startTime)) {
|
||||
nextStatus = RaceLogRaceStatus.SCHEDULED;
|
||||
} else {
|
||||
nextStatus = RaceLogRaceStatus.RUNNING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogRaceStatusEvent event) {
|
||||
nextStatus = event.getNextStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogDependentStartTimeEvent event) {
|
||||
DependentStartTimeResolver startTimeResolver = new DependentStartTimeResolver(resolver);
|
||||
TimePoint startTime = startTimeResolver.resolve(event).getStartTime();
|
||||
setRaceLogStatusBasedOnStartTime(startTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
-45
@@ -1,45 +1,45 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEndOfTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartOfTrackingEvent;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
|
||||
public class TrackingTimesEventFinder extends RaceLogAnalyzer<Util.Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent>> {
|
||||
|
||||
public TrackingTimesEventFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Util.Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent> performAnalysis() {
|
||||
boolean startOfTrackingFound = false;
|
||||
boolean endOfTrackingFound = false;
|
||||
RaceLogStartOfTrackingEvent start = null;
|
||||
RaceLogEndOfTrackingEvent end = null;
|
||||
final RaceLog raceLog = getLog();
|
||||
for (RaceLogEvent event : raceLog.getUnrevokedEventsDescending()) {
|
||||
if (!startOfTrackingFound && event instanceof RaceLogStartOfTrackingEvent) {
|
||||
start = (RaceLogStartOfTrackingEvent) event;
|
||||
startOfTrackingFound = true;
|
||||
}
|
||||
if (!endOfTrackingFound && event instanceof RaceLogEndOfTrackingEvent) {
|
||||
end = (RaceLogEndOfTrackingEvent) event;
|
||||
endOfTrackingFound = true;
|
||||
}
|
||||
if (startOfTrackingFound && endOfTrackingFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
final Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent> result;
|
||||
if (startOfTrackingFound || endOfTrackingFound) {
|
||||
result = new Util.Pair<>(start, end);
|
||||
} else {
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEndOfTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartOfTrackingEvent;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
|
||||
public class TrackingTimesEventFinder extends RaceLogAnalyzer<Util.Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent>> {
|
||||
|
||||
public TrackingTimesEventFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Util.Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent> performAnalysis() {
|
||||
boolean startOfTrackingFound = false;
|
||||
boolean endOfTrackingFound = false;
|
||||
RaceLogStartOfTrackingEvent start = null;
|
||||
RaceLogEndOfTrackingEvent end = null;
|
||||
final RaceLog raceLog = getLog();
|
||||
for (RaceLogEvent event : raceLog.getUnrevokedEventsDescending()) {
|
||||
if (!startOfTrackingFound && event instanceof RaceLogStartOfTrackingEvent) {
|
||||
start = (RaceLogStartOfTrackingEvent) event;
|
||||
startOfTrackingFound = true;
|
||||
}
|
||||
if (!endOfTrackingFound && event instanceof RaceLogEndOfTrackingEvent) {
|
||||
end = (RaceLogEndOfTrackingEvent) event;
|
||||
endOfTrackingFound = true;
|
||||
}
|
||||
if (startOfTrackingFound && endOfTrackingFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
final Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent> result;
|
||||
if (startOfTrackingFound || endOfTrackingFound) {
|
||||
result = new Util.Pair<>(start, end);
|
||||
} else {
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+27
-27
@@ -1,27 +1,27 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEndOfTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartOfTrackingEvent;
|
||||
import com.sap.sailing.domain.common.abstractlog.TimePointSpecificationFoundInLog;
|
||||
import com.sap.sailing.domain.common.abstractlog.TimePointSpecificationFoundInLogImpl;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
|
||||
public class TrackingTimesFinder extends RaceLogAnalyzer<Util.Pair<TimePointSpecificationFoundInLog, TimePointSpecificationFoundInLog>> {
|
||||
private final TrackingTimesEventFinder trackingTimesEventFinder;
|
||||
|
||||
public TrackingTimesFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
this.trackingTimesEventFinder = new TrackingTimesEventFinder(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Util.Pair<TimePointSpecificationFoundInLog, TimePointSpecificationFoundInLog> performAnalysis() {
|
||||
Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent> preResult = trackingTimesEventFinder.performAnalysis();
|
||||
return preResult == null ? null :
|
||||
new Util.Pair<TimePointSpecificationFoundInLog, TimePointSpecificationFoundInLog>(
|
||||
preResult.getA()==null?null:new TimePointSpecificationFoundInLogImpl(preResult.getA().getLogicalTimePoint()),
|
||||
preResult.getB()==null?null:new TimePointSpecificationFoundInLogImpl(preResult.getB().getLogicalTimePoint()));
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEndOfTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartOfTrackingEvent;
|
||||
import com.sap.sailing.domain.common.abstractlog.TimePointSpecificationFoundInLog;
|
||||
import com.sap.sailing.domain.common.abstractlog.TimePointSpecificationFoundInLogImpl;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
|
||||
public class TrackingTimesFinder extends RaceLogAnalyzer<Util.Pair<TimePointSpecificationFoundInLog, TimePointSpecificationFoundInLog>> {
|
||||
private final TrackingTimesEventFinder trackingTimesEventFinder;
|
||||
|
||||
public TrackingTimesFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
this.trackingTimesEventFinder = new TrackingTimesEventFinder(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Util.Pair<TimePointSpecificationFoundInLog, TimePointSpecificationFoundInLog> performAnalysis() {
|
||||
Pair<RaceLogStartOfTrackingEvent, RaceLogEndOfTrackingEvent> preResult = trackingTimesEventFinder.performAnalysis();
|
||||
return preResult == null ? null :
|
||||
new Util.Pair<TimePointSpecificationFoundInLog, TimePointSpecificationFoundInLog>(
|
||||
preResult.getA()==null?null:new TimePointSpecificationFoundInLogImpl(preResult.getA().getLogicalTimePoint()),
|
||||
preResult.getB()==null?null:new TimePointSpecificationFoundInLogImpl(preResult.getB().getLogicalTimePoint()));
|
||||
}
|
||||
}
|
||||
+24
-24
@@ -1,24 +1,24 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogChangedListener;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* Forwards events received by this visitor to the listener passed to the constructor.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class RaceLogChangedVisitor extends AbstractRaceLogChangedVisitor {
|
||||
private final RaceLogChangedListener listener;
|
||||
|
||||
public RaceLogChangedVisitor(RaceLogChangedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void notifyListenerAboutEventAdded(RaceLogEvent event) {
|
||||
listener.eventAdded(event);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogChangedListener;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* Forwards events received by this visitor to the listener passed to the constructor.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class RaceLogChangedVisitor extends AbstractRaceLogChangedVisitor {
|
||||
private final RaceLogChangedListener listener;
|
||||
|
||||
public RaceLogChangedVisitor(RaceLogChangedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void notifyListenerAboutEventAdded(RaceLogEvent event) {
|
||||
listener.eventAdded(event);
|
||||
}
|
||||
|
||||
}
|
||||
+36
-36
@@ -1,36 +1,36 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseAreaChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogCourseAreaChangeEventImpl extends RaceLogEventImpl implements RaceLogCourseAreaChangedEvent {
|
||||
private static final long serialVersionUID = -3943108136024977860L;
|
||||
|
||||
private final Serializable courseAreaId;
|
||||
|
||||
public RaceLogCourseAreaChangeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, Serializable courseAreaId) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.courseAreaId = courseAreaId;
|
||||
}
|
||||
|
||||
public RaceLogCourseAreaChangeEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
Serializable courseAreaId) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, courseAreaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getCourseAreaId() {
|
||||
return courseAreaId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseAreaChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogCourseAreaChangeEventImpl extends RaceLogEventImpl implements RaceLogCourseAreaChangedEvent {
|
||||
private static final long serialVersionUID = -3943108136024977860L;
|
||||
|
||||
private final Serializable courseAreaId;
|
||||
|
||||
public RaceLogCourseAreaChangeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, Serializable courseAreaId) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.courseAreaId = courseAreaId;
|
||||
}
|
||||
|
||||
public RaceLogCourseAreaChangeEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
Serializable courseAreaId) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, courseAreaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getCourseAreaId() {
|
||||
return courseAreaId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
+51
-51
@@ -1,52 +1,52 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.common.CourseDesignerMode;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogCourseDesignChangedEventImpl extends RaceLogEventImpl implements RaceLogCourseDesignChangedEvent {
|
||||
private static final long serialVersionUID = 1565936170747420547L;
|
||||
|
||||
private final CourseBase courseDesign;
|
||||
|
||||
private final CourseDesignerMode courseDesignerMode;
|
||||
|
||||
public RaceLogCourseDesignChangedEventImpl(TimePoint createdAt, TimePoint pTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId,
|
||||
CourseBase courseDesign, CourseDesignerMode courseDesignerMode) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.courseDesign = courseDesign;
|
||||
this.courseDesignerMode = courseDesignerMode;
|
||||
}
|
||||
|
||||
public RaceLogCourseDesignChangedEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
CourseBase courseDesign, CourseDesignerMode courseDesignerMode) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, courseDesign, courseDesignerMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseBase getCourseDesign() {
|
||||
return courseDesign;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseDesignerMode getCourseDesignerMode() {
|
||||
return courseDesignerMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "courseDesign=" + courseDesign != null ? courseDesign.getName() : "null";
|
||||
}
|
||||
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.common.CourseDesignerMode;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogCourseDesignChangedEventImpl extends RaceLogEventImpl implements RaceLogCourseDesignChangedEvent {
|
||||
private static final long serialVersionUID = 1565936170747420547L;
|
||||
|
||||
private final CourseBase courseDesign;
|
||||
|
||||
private final CourseDesignerMode courseDesignerMode;
|
||||
|
||||
public RaceLogCourseDesignChangedEventImpl(TimePoint createdAt, TimePoint pTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId,
|
||||
CourseBase courseDesign, CourseDesignerMode courseDesignerMode) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.courseDesign = courseDesign;
|
||||
this.courseDesignerMode = courseDesignerMode;
|
||||
}
|
||||
|
||||
public RaceLogCourseDesignChangedEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
CourseBase courseDesign, CourseDesignerMode courseDesignerMode) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, courseDesign, courseDesignerMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseBase getCourseDesign() {
|
||||
return courseDesign;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseDesignerMode getCourseDesignerMode() {
|
||||
return courseDesignerMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "courseDesign=" + courseDesign != null ? courseDesign.getName() : "null";
|
||||
}
|
||||
|
||||
}
|
||||
+54
-54
@@ -1,54 +1,54 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.SimpleRaceLogIdentifier;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogDependentStartTimeEventImpl extends RaceLogRaceStatusEventImpl implements
|
||||
RaceLogDependentStartTimeEvent, Revokable {
|
||||
|
||||
private static final long serialVersionUID = -2555082771473210123L;
|
||||
private final Duration startTimeDifference;
|
||||
private SimpleRaceLogIdentifier dependentOnRace;
|
||||
|
||||
public RaceLogDependentStartTimeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, SimpleRaceLogIdentifier dependentOnRace,
|
||||
Duration startTimeDifference, RaceLogRaceStatus nextStatus) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, nextStatus);
|
||||
this.dependentOnRace = dependentOnRace;
|
||||
this.startTimeDifference = startTimeDifference;
|
||||
}
|
||||
|
||||
public RaceLogDependentStartTimeEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
SimpleRaceLogIdentifier dependentOnRace, Duration startTimeDifference) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, dependentOnRace, startTimeDifference, RaceLogRaceStatus.SCHEDULED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getStartTimeDifference() {
|
||||
return startTimeDifference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit((RaceLogDependentStartTimeEvent) this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "dependentOnRace=" + dependentOnRace + "startTimeDifference=" + startTimeDifference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleRaceLogIdentifier getDependentOnRaceIdentifier() {
|
||||
return dependentOnRace;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.SimpleRaceLogIdentifier;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogDependentStartTimeEventImpl extends RaceLogRaceStatusEventImpl implements
|
||||
RaceLogDependentStartTimeEvent, Revokable {
|
||||
|
||||
private static final long serialVersionUID = -2555082771473210123L;
|
||||
private final Duration startTimeDifference;
|
||||
private SimpleRaceLogIdentifier dependentOnRace;
|
||||
|
||||
public RaceLogDependentStartTimeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, SimpleRaceLogIdentifier dependentOnRace,
|
||||
Duration startTimeDifference, RaceLogRaceStatus nextStatus) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, nextStatus);
|
||||
this.dependentOnRace = dependentOnRace;
|
||||
this.startTimeDifference = startTimeDifference;
|
||||
}
|
||||
|
||||
public RaceLogDependentStartTimeEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
SimpleRaceLogIdentifier dependentOnRace, Duration startTimeDifference) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, dependentOnRace, startTimeDifference, RaceLogRaceStatus.SCHEDULED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getStartTimeDifference() {
|
||||
return startTimeDifference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit((RaceLogDependentStartTimeEvent) this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "dependentOnRace=" + dependentOnRace + "startTimeDifference=" + startTimeDifference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleRaceLogIdentifier getDependentOnRaceIdentifier() {
|
||||
return dependentOnRace;
|
||||
}
|
||||
|
||||
}
|
||||
+32
-32
@@ -1,32 +1,32 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEndOfTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogEndOfTrackingEventImpl extends RaceLogEventImpl implements RaceLogEndOfTrackingEvent {
|
||||
private static final long serialVersionUID = 3130293807404190473L;
|
||||
|
||||
public RaceLogEndOfTrackingEventImpl(TimePoint createdAt, TimePoint endOfTracking, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId) {
|
||||
super(createdAt, endOfTracking, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEndOfTrackingEventImpl(TimePoint endOfTracking, AbstractLogEventAuthor author, int pPassId) {
|
||||
super(endOfTracking, author, pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "endOfTrackingTime=" + getLogicalTimePoint();
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEndOfTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogEndOfTrackingEventImpl extends RaceLogEventImpl implements RaceLogEndOfTrackingEvent {
|
||||
private static final long serialVersionUID = 3130293807404190473L;
|
||||
|
||||
public RaceLogEndOfTrackingEventImpl(TimePoint createdAt, TimePoint endOfTracking, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId) {
|
||||
super(createdAt, endOfTracking, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEndOfTrackingEventImpl(TimePoint endOfTracking, AbstractLogEventAuthor author, int pPassId) {
|
||||
super(endOfTracking, author, pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "endOfTrackingTime=" + getLogicalTimePoint();
|
||||
}
|
||||
|
||||
}
|
||||
+30
-30
@@ -1,30 +1,30 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.LogEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sse.common.Timed;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
* timestamp.
|
||||
*
|
||||
* If one of the passed objects is not a {@link RaceLogEvent}, sorting is done by {@link Timed#getTimePoint()}.
|
||||
*/
|
||||
public class RaceLogEventComparator extends LogEventComparator implements Comparator<Timed>, Serializable {
|
||||
private static final long serialVersionUID = 6146135178558781346L;
|
||||
|
||||
protected int compareEvents(AbstractLogEvent<?> e1, AbstractLogEvent<?> e2) {
|
||||
//compare passes
|
||||
if (e1 instanceof RaceLogEvent && e2 instanceof RaceLogEvent) {
|
||||
int result = ((RaceLogEvent) e1).getPassId() - ((RaceLogEvent) e2).getPassId();
|
||||
if (result != 0) return result;
|
||||
}
|
||||
|
||||
return super.compareEvents(e1, e2);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.LogEventComparator;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sse.common.Timed;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
* timestamp.
|
||||
*
|
||||
* If one of the passed objects is not a {@link RaceLogEvent}, sorting is done by {@link Timed#getTimePoint()}.
|
||||
*/
|
||||
public class RaceLogEventComparator extends LogEventComparator implements Comparator<Timed>, Serializable {
|
||||
private static final long serialVersionUID = 6146135178558781346L;
|
||||
|
||||
protected int compareEvents(AbstractLogEvent<?> e1, AbstractLogEvent<?> e2) {
|
||||
//compare passes
|
||||
if (e1 instanceof RaceLogEvent && e2 instanceof RaceLogEvent) {
|
||||
int result = ((RaceLogEvent) e1).getPassId() - ((RaceLogEvent) e2).getPassId();
|
||||
if (result != 0) return result;
|
||||
}
|
||||
|
||||
return super.compareEvents(e1, e2);
|
||||
}
|
||||
}
|
||||
+52
-52
@@ -1,52 +1,52 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventData;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class RaceLogEventImpl extends AbstractLogEventImpl<RaceLogEventVisitor> implements RaceLogEvent {
|
||||
private static final long serialVersionUID = -2557594972618769182L;
|
||||
private final RaceLogEventData raceLogEventData;
|
||||
|
||||
public RaceLogEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.raceLogEventData = new RaceLogEventDataImpl(pInvolvedBoats, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId) {
|
||||
this(createdAt, logicalTimePoint, author, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Competitor competitor, int pPassId) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.singletonList(competitor), pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.<Competitor>emptyList(), pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Competitor> getInvolvedBoats() {
|
||||
return raceLogEventData.getInvolvedBoats();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassId() {
|
||||
return raceLogEventData.getPassId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return raceLogEventData.toString();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventData;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class RaceLogEventImpl extends AbstractLogEventImpl<RaceLogEventVisitor> implements RaceLogEvent {
|
||||
private static final long serialVersionUID = -2557594972618769182L;
|
||||
private final RaceLogEventData raceLogEventData;
|
||||
|
||||
public RaceLogEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.raceLogEventData = new RaceLogEventDataImpl(pInvolvedBoats, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEventImpl(TimePoint createdAt, TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId) {
|
||||
this(createdAt, logicalTimePoint, author, pId, Collections.<Competitor>emptyList(), pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, Competitor competitor, int pPassId) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.singletonList(competitor), pPassId);
|
||||
}
|
||||
|
||||
public RaceLogEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.<Competitor>emptyList(), pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Competitor> getInvolvedBoats() {
|
||||
return raceLogEventData.getInvolvedBoats();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassId() {
|
||||
return raceLogEventData.getPassId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return raceLogEventData.toString();
|
||||
}
|
||||
}
|
||||
+31
-31
@@ -1,31 +1,31 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningConfirmedEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFinishPositioningConfirmedEventImpl extends RaceLogFinishPositioningEventImpl implements
|
||||
RaceLogFinishPositioningConfirmedEvent {
|
||||
|
||||
private static final long serialVersionUID = 5028181339200048499L;
|
||||
|
||||
public RaceLogFinishPositioningConfirmedEventImpl(TimePoint createdAt, TimePoint pTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId,
|
||||
CompetitorResults positionedCompetitors) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
public RaceLogFinishPositioningConfirmedEventImpl(TimePoint pTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
CompetitorResults positionedCompetitors) {
|
||||
super(pTimePoint, author, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningConfirmedEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFinishPositioningConfirmedEventImpl extends RaceLogFinishPositioningEventImpl implements
|
||||
RaceLogFinishPositioningConfirmedEvent {
|
||||
|
||||
private static final long serialVersionUID = 5028181339200048499L;
|
||||
|
||||
public RaceLogFinishPositioningConfirmedEventImpl(TimePoint createdAt, TimePoint pTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId,
|
||||
CompetitorResults positionedCompetitors) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
public RaceLogFinishPositioningConfirmedEventImpl(TimePoint pTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
CompetitorResults positionedCompetitors) {
|
||||
super(pTimePoint, author, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
+31
-31
@@ -1,31 +1,31 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningListChangedEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFinishPositioningListChangedEventImpl extends RaceLogFinishPositioningEventImpl implements
|
||||
RaceLogFinishPositioningListChangedEvent {
|
||||
|
||||
private static final long serialVersionUID = -8167472925561954739L;
|
||||
|
||||
public RaceLogFinishPositioningListChangedEventImpl(TimePoint createdAt, TimePoint pTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId,
|
||||
CompetitorResults positionedCompetitors) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
public RaceLogFinishPositioningListChangedEventImpl(TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
int pPassId, CompetitorResults positionedCompetitors) {
|
||||
super(pTimePoint, author, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFinishPositioningListChangedEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFinishPositioningListChangedEventImpl extends RaceLogFinishPositioningEventImpl implements
|
||||
RaceLogFinishPositioningListChangedEvent {
|
||||
|
||||
private static final long serialVersionUID = -8167472925561954739L;
|
||||
|
||||
public RaceLogFinishPositioningListChangedEventImpl(TimePoint createdAt, TimePoint pTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId,
|
||||
CompetitorResults positionedCompetitors) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
public RaceLogFinishPositioningListChangedEventImpl(TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
int pPassId, CompetitorResults positionedCompetitors) {
|
||||
super(pTimePoint, author, pPassId, positionedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
+56
-56
@@ -1,56 +1,56 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFixedMarkPassingEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFixedMarkPassingEventImpl extends RaceLogEventImpl implements RaceLogFixedMarkPassingEvent {
|
||||
|
||||
private final Integer zeroBasedIndexOfWaypointOfPassing;
|
||||
|
||||
private final TimePoint timePointOfPassing;
|
||||
|
||||
public RaceLogFixedMarkPassingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId,
|
||||
TimePoint timePoint, Integer zeroBasedIndexOfWaypointOfPassing) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pInvolvedBoats, pPassId);
|
||||
this.timePointOfPassing = timePoint;
|
||||
this.zeroBasedIndexOfWaypointOfPassing = zeroBasedIndexOfWaypointOfPassing;
|
||||
}
|
||||
|
||||
public RaceLogFixedMarkPassingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor competitor, int pPassId, TimePoint timePoint, Integer zeroBasedIndexOfWaypointOfPassing) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.singletonList(competitor), pPassId, timePoint,
|
||||
zeroBasedIndexOfWaypointOfPassing);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -1796278009919318553L;
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getZeroBasedIndexOfPassedWaypoint() {
|
||||
return zeroBasedIndexOfWaypointOfPassing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getTimePointOfFixedPassing() {
|
||||
return timePointOfPassing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return (getInvolvedBoats() == null || getInvolvedBoats().get(0) == null ? "Unknown" :
|
||||
getInvolvedBoats().get(0).getName()) + " at mark " + getZeroBasedIndexOfPassedWaypoint() + " at "
|
||||
+ getTimePointOfFixedPassing();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFixedMarkPassingEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFixedMarkPassingEventImpl extends RaceLogEventImpl implements RaceLogFixedMarkPassingEvent {
|
||||
|
||||
private final Integer zeroBasedIndexOfWaypointOfPassing;
|
||||
|
||||
private final TimePoint timePointOfPassing;
|
||||
|
||||
public RaceLogFixedMarkPassingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId,
|
||||
TimePoint timePoint, Integer zeroBasedIndexOfWaypointOfPassing) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pInvolvedBoats, pPassId);
|
||||
this.timePointOfPassing = timePoint;
|
||||
this.zeroBasedIndexOfWaypointOfPassing = zeroBasedIndexOfWaypointOfPassing;
|
||||
}
|
||||
|
||||
public RaceLogFixedMarkPassingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor competitor, int pPassId, TimePoint timePoint, Integer zeroBasedIndexOfWaypointOfPassing) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.singletonList(competitor), pPassId, timePoint,
|
||||
zeroBasedIndexOfWaypointOfPassing);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -1796278009919318553L;
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getZeroBasedIndexOfPassedWaypoint() {
|
||||
return zeroBasedIndexOfWaypointOfPassing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getTimePointOfFixedPassing() {
|
||||
return timePointOfPassing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return (getInvolvedBoats() == null || getInvolvedBoats().get(0) == null ? "Unknown" :
|
||||
getInvolvedBoats().get(0).getName()) + " at mark " + getZeroBasedIndexOfPassedWaypoint() + " at "
|
||||
+ getTimePointOfFixedPassing();
|
||||
}
|
||||
}
|
||||
+57
-57
@@ -1,57 +1,57 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFlagEventImpl extends RaceLogEventImpl implements RaceLogFlagEvent {
|
||||
|
||||
private static final long serialVersionUID = 6333303528852541914L;
|
||||
private final Flags upperFlag;
|
||||
private final Flags lowerFlag;
|
||||
private final boolean isDisplayed;
|
||||
|
||||
public RaceLogFlagEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, Flags pUpperFlag, Flags pLowerFlag,
|
||||
boolean pIsDisplayed) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.upperFlag = pUpperFlag;
|
||||
this.lowerFlag = pLowerFlag;
|
||||
this.isDisplayed = pIsDisplayed;
|
||||
}
|
||||
|
||||
public RaceLogFlagEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId, Flags pUpperFlag,
|
||||
Flags pLowerFlag, boolean pIsDisplayed) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, pUpperFlag, pLowerFlag, pIsDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getUpperFlag() {
|
||||
return upperFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getLowerFlag() {
|
||||
return lowerFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayed() {
|
||||
return isDisplayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "upperFlag=" + upperFlag + ", lowerFlag=" + lowerFlag + ", isDisplayed=" + isDisplayed;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogFlagEventImpl extends RaceLogEventImpl implements RaceLogFlagEvent {
|
||||
|
||||
private static final long serialVersionUID = 6333303528852541914L;
|
||||
private final Flags upperFlag;
|
||||
private final Flags lowerFlag;
|
||||
private final boolean isDisplayed;
|
||||
|
||||
public RaceLogFlagEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, Flags pUpperFlag, Flags pLowerFlag,
|
||||
boolean pIsDisplayed) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.upperFlag = pUpperFlag;
|
||||
this.lowerFlag = pLowerFlag;
|
||||
this.isDisplayed = pIsDisplayed;
|
||||
}
|
||||
|
||||
public RaceLogFlagEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId, Flags pUpperFlag,
|
||||
Flags pLowerFlag, boolean pIsDisplayed) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, pUpperFlag, pLowerFlag, pIsDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getUpperFlag() {
|
||||
return upperFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getLowerFlag() {
|
||||
return lowerFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayed() {
|
||||
return isDisplayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "upperFlag=" + upperFlag + ", lowerFlag=" + lowerFlag + ", isDisplayed=" + isDisplayed;
|
||||
}
|
||||
|
||||
}
|
||||
+27
-27
@@ -1,27 +1,27 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPassChangeEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogPassChangeEventImpl extends RaceLogEventImpl implements RaceLogPassChangeEvent {
|
||||
private static final long serialVersionUID = -3737606977320640630L;
|
||||
|
||||
public RaceLogPassChangeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogPassChangeEventImpl(TimePoint pTimePoint, AbstractLogEventAuthor author, int pPassId) {
|
||||
super(pTimePoint, author, pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogPassChangeEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogPassChangeEventImpl extends RaceLogEventImpl implements RaceLogPassChangeEvent {
|
||||
private static final long serialVersionUID = -3737606977320640630L;
|
||||
|
||||
public RaceLogPassChangeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogPassChangeEventImpl(TimePoint pTimePoint, AbstractLogEventAuthor author, int pPassId) {
|
||||
super(pTimePoint, author, pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
+41
-41
@@ -1,41 +1,41 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogRaceStatusEventImpl extends RaceLogEventImpl implements RaceLogRaceStatusEvent {
|
||||
private static final long serialVersionUID = -8809758843066724482L;
|
||||
|
||||
private final RaceLogRaceStatus nextStatus;
|
||||
|
||||
public RaceLogRaceStatusEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, RaceLogRaceStatus nextStatus) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.nextStatus = nextStatus;
|
||||
}
|
||||
|
||||
public RaceLogRaceStatusEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
RaceLogRaceStatus nextStatus) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, nextStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogRaceStatus getNextStatus() {
|
||||
return nextStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "nextStatus=" + nextStatus;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogRaceStatusEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogRaceStatusEventImpl extends RaceLogEventImpl implements RaceLogRaceStatusEvent {
|
||||
private static final long serialVersionUID = -8809758843066724482L;
|
||||
|
||||
private final RaceLogRaceStatus nextStatus;
|
||||
|
||||
public RaceLogRaceStatusEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, RaceLogRaceStatus nextStatus) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId);
|
||||
this.nextStatus = nextStatus;
|
||||
}
|
||||
|
||||
public RaceLogRaceStatusEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
RaceLogRaceStatus nextStatus) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, nextStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogRaceStatus getNextStatus() {
|
||||
return nextStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "nextStatus=" + nextStatus;
|
||||
}
|
||||
}
|
||||
+31
-31
@@ -1,31 +1,31 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartOfTrackingEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogStartOfTrackingEventImpl extends RaceLogEventImpl implements RaceLogStartOfTrackingEvent {
|
||||
private static final long serialVersionUID = -4134608549471817247L;
|
||||
|
||||
public RaceLogStartOfTrackingEventImpl(TimePoint createdAt, TimePoint startOfTracking,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId) {
|
||||
super(createdAt, startOfTracking, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogStartOfTrackingEventImpl(TimePoint startOfTracking, AbstractLogEventAuthor author, int pPassId) {
|
||||
super(startOfTracking, author, pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "startOfTrackingTime=" + getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartOfTrackingEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogStartOfTrackingEventImpl extends RaceLogEventImpl implements RaceLogStartOfTrackingEvent {
|
||||
private static final long serialVersionUID = -4134608549471817247L;
|
||||
|
||||
public RaceLogStartOfTrackingEventImpl(TimePoint createdAt, TimePoint startOfTracking,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId) {
|
||||
super(createdAt, startOfTracking, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogStartOfTrackingEventImpl(TimePoint startOfTracking, AbstractLogEventAuthor author, int pPassId) {
|
||||
super(startOfTracking, author, pPassId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "startOfTrackingTime=" + getLogicalTimePoint();
|
||||
}
|
||||
}
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogStartTimeEventImpl extends RaceLogRaceStatusEventImpl implements RaceLogStartTimeEvent {
|
||||
|
||||
private static final long serialVersionUID = 8185811395997196162L;
|
||||
private final TimePoint startTime;
|
||||
|
||||
public RaceLogStartTimeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, TimePoint pStartTime, RaceLogRaceStatus nextStatus) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, nextStatus);
|
||||
this.startTime = pStartTime;
|
||||
}
|
||||
|
||||
public RaceLogStartTimeEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
TimePoint pStartTime) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, pStartTime, RaceLogRaceStatus.SCHEDULED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "startTime=" + startTime;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogStartTimeEventImpl extends RaceLogRaceStatusEventImpl implements RaceLogStartTimeEvent {
|
||||
|
||||
private static final long serialVersionUID = 8185811395997196162L;
|
||||
private final TimePoint startTime;
|
||||
|
||||
public RaceLogStartTimeEventImpl(TimePoint createdAt, TimePoint pTimePoint, AbstractLogEventAuthor author,
|
||||
Serializable pId, int pPassId, TimePoint pStartTime, RaceLogRaceStatus nextStatus) {
|
||||
super(createdAt, pTimePoint, author, pId, pPassId, nextStatus);
|
||||
this.startTime = pStartTime;
|
||||
}
|
||||
|
||||
public RaceLogStartTimeEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
TimePoint pStartTime) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, pStartTime, RaceLogRaceStatus.SCHEDULED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "startTime=" + startTime;
|
||||
}
|
||||
|
||||
}
|
||||
+47
-47
@@ -1,47 +1,47 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogSuppressedMarkPassingsEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogSuppressedMarkPassingsEventImpl extends RaceLogEventImpl implements
|
||||
RaceLogSuppressedMarkPassingsEvent {
|
||||
|
||||
private static final long serialVersionUID = 3665678555023150888L;
|
||||
|
||||
private final Integer indexOfFirstSuppressedWaypoint;
|
||||
|
||||
public RaceLogSuppressedMarkPassingsEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId,
|
||||
Integer indexOfFirstSuppressedWaypoint) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pInvolvedBoats, pPassId);
|
||||
this.indexOfFirstSuppressedWaypoint = indexOfFirstSuppressedWaypoint;
|
||||
}
|
||||
|
||||
public RaceLogSuppressedMarkPassingsEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor competitor, int pPassId, Integer indexOfFirstSuppressedWaypoint) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.singletonList(competitor), pPassId,
|
||||
indexOfFirstSuppressedWaypoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getZeroBasedIndexOfFirstSuppressedWaypoint() {
|
||||
return indexOfFirstSuppressedWaypoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return getInvolvedBoats().get(0).getName() + " at mark " + getZeroBasedIndexOfFirstSuppressedWaypoint();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogSuppressedMarkPassingsEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogSuppressedMarkPassingsEventImpl extends RaceLogEventImpl implements
|
||||
RaceLogSuppressedMarkPassingsEvent {
|
||||
|
||||
private static final long serialVersionUID = 3665678555023150888L;
|
||||
|
||||
private final Integer indexOfFirstSuppressedWaypoint;
|
||||
|
||||
public RaceLogSuppressedMarkPassingsEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId,
|
||||
Integer indexOfFirstSuppressedWaypoint) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pInvolvedBoats, pPassId);
|
||||
this.indexOfFirstSuppressedWaypoint = indexOfFirstSuppressedWaypoint;
|
||||
}
|
||||
|
||||
public RaceLogSuppressedMarkPassingsEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor competitor, int pPassId, Integer indexOfFirstSuppressedWaypoint) {
|
||||
this(now(), logicalTimePoint, author, randId(), Collections.singletonList(competitor), pPassId,
|
||||
indexOfFirstSuppressedWaypoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getZeroBasedIndexOfFirstSuppressedWaypoint() {
|
||||
return indexOfFirstSuppressedWaypoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return getInvolvedBoats().get(0).getName() + " at mark " + getZeroBasedIndexOfFirstSuppressedWaypoint();
|
||||
}
|
||||
}
|
||||
+24
-24
@@ -1,24 +1,24 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
|
||||
/**
|
||||
* The existence of this event in a {@link RaceLog} indicates that the necessary data
|
||||
* for creating this race will be accumulated in this RaceLog. Once it is present, the
|
||||
* actual {@link TrackedRace} can then be created from this information, and fixes for
|
||||
* competitors and marks that arrive on the server, for which a corresponding
|
||||
* {@link RegattaLogDeviceMappingEvent} exists will be added to the race.
|
||||
* @author Fredrik Teschke
|
||||
*
|
||||
*/
|
||||
public interface RaceLogDenoteForTrackingEvent extends RaceLogEvent, Revokable {
|
||||
String getRaceName();
|
||||
BoatClass getBoatClass();
|
||||
Serializable getRaceId();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
|
||||
/**
|
||||
* The existence of this event in a {@link RaceLog} indicates that the necessary data
|
||||
* for creating this race will be accumulated in this RaceLog. Once it is present, the
|
||||
* actual {@link TrackedRace} can then be created from this information, and fixes for
|
||||
* competitors and marks that arrive on the server, for which a corresponding
|
||||
* {@link RegattaLogDeviceMappingEvent} exists will be added to the race.
|
||||
* @author Fredrik Teschke
|
||||
*
|
||||
*/
|
||||
public interface RaceLogDenoteForTrackingEvent extends RaceLogEvent, Revokable {
|
||||
String getRaceName();
|
||||
BoatClass getBoatClass();
|
||||
Serializable getRaceId();
|
||||
}
|
||||
+16
-16
@@ -1,16 +1,16 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* Closes the phase during which {@link RaceLogDeviceCompetitorMappingEventImpl}s actually result
|
||||
* in competitors being added, and indicates that the server should create a {@link TrackedRace}
|
||||
* using the information in this {@link RaceLog}.
|
||||
*
|
||||
* @author Fredrik Teschke
|
||||
*
|
||||
*/
|
||||
public interface RaceLogStartTrackingEvent extends RaceLogEvent, Revokable {
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* Closes the phase during which {@link RaceLogDeviceCompetitorMappingEventImpl}s actually result
|
||||
* in competitors being added, and indicates that the server should create a {@link TrackedRace}
|
||||
* using the information in this {@link RaceLog}.
|
||||
*
|
||||
* @author Fredrik Teschke
|
||||
*
|
||||
*/
|
||||
public interface RaceLogStartTrackingEvent extends RaceLogEvent, Revokable {
|
||||
}
|
||||
+19
-19
@@ -1,19 +1,19 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogUsesOwnCompetitorsAnalyzer;
|
||||
|
||||
/**
|
||||
* This is a marker event, which marks a {@link RaceLog} for using it's own competitor registrations. When present,
|
||||
* competitors are not registered on the RegattaLog corresponding to the RaceLog, but on the RaceLog itself. This is for
|
||||
* example used for split fleets.
|
||||
*
|
||||
* See bug2851.
|
||||
*
|
||||
* @see RaceLogUsesOwnCompetitorsAnalyzer
|
||||
* @author Jan Bross (D056848)
|
||||
*
|
||||
*/
|
||||
public interface RaceLogUseCompetitorsFromRaceLogEvent extends RaceLogEvent, Revokable {
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogUsesOwnCompetitorsAnalyzer;
|
||||
|
||||
/**
|
||||
* This is a marker event, which marks a {@link RaceLog} for using it's own competitor registrations. When present,
|
||||
* competitors are not registered on the RegattaLog corresponding to the RaceLog, but on the RaceLog itself. This is for
|
||||
* example used for split fleets.
|
||||
*
|
||||
* See bug2851.
|
||||
*
|
||||
* @see RaceLogUsesOwnCompetitorsAnalyzer
|
||||
* @author Jan Bross (D056848)
|
||||
*
|
||||
*/
|
||||
public interface RaceLogUseCompetitorsFromRaceLogEvent extends RaceLogEvent, Revokable {
|
||||
}
|
||||
+23
-23
@@ -1,23 +1,23 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
|
||||
|
||||
public class RaceInformationFinder extends RaceLogAnalyzer<RaceLogDenoteForTrackingEvent> {
|
||||
public RaceInformationFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceLogDenoteForTrackingEvent performAnalysis() {
|
||||
for (RaceLogEvent event : getAllEvents()) {
|
||||
if (event instanceof RaceLogDenoteForTrackingEvent) {
|
||||
return (RaceLogDenoteForTrackingEvent) event;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
|
||||
|
||||
public class RaceInformationFinder extends RaceLogAnalyzer<RaceLogDenoteForTrackingEvent> {
|
||||
public RaceInformationFinder(RaceLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceLogDenoteForTrackingEvent performAnalysis() {
|
||||
for (RaceLogEvent event : getAllEvents()) {
|
||||
if (event instanceof RaceLogDenoteForTrackingEvent) {
|
||||
return (RaceLogDenoteForTrackingEvent) event;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+43
-43
@@ -1,43 +1,43 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.CompetitorsInLogAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
/**
|
||||
* Used to find competitors of a race based on {@link RaceLog} and {@link RegattaLog} contents. Checks whether the
|
||||
* competitors for the given race are registered on the RaceLog via {@link RaceLogUsesOwnCompetitorsAnalyzer} or on the
|
||||
* RegattaLog and fetches the competitors appropriately.
|
||||
*
|
||||
* Should not be used by clients directly. Instead, get the competitor set from the {@code RaceColumn}, using either one
|
||||
* of {@code getAllCompetitors()} and {@code getAllCompetitors(Fleet)}. Those methods automatically check whether a
|
||||
* tracked race is present, which takes precedence over the Race/RegattaLog.
|
||||
*
|
||||
* @author Jan Bross (D056848)
|
||||
*
|
||||
*/
|
||||
public class RegisteredCompetitorsAnalyzer extends RaceLogAnalyzer<Set<Competitor>> {
|
||||
private RegattaLog regattaLog;
|
||||
|
||||
public RegisteredCompetitorsAnalyzer(RaceLog raceLog, RegattaLog regattaLog) {
|
||||
super(raceLog);
|
||||
this.regattaLog = regattaLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Competitor> performAnalysis() {
|
||||
final Set<Competitor> result;
|
||||
if (new RaceLogUsesOwnCompetitorsAnalyzer(getLog()).analyze()) {
|
||||
// get Events from RaceLog
|
||||
result = new CompetitorsInLogAnalyzer<>(getLog()).analyze();
|
||||
} else {
|
||||
// get Events from RegattaLog
|
||||
result = new CompetitorsInLogAnalyzer<>(regattaLog).analyze();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.CompetitorsInLogAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
/**
|
||||
* Used to find competitors of a race based on {@link RaceLog} and {@link RegattaLog} contents. Checks whether the
|
||||
* competitors for the given race are registered on the RaceLog via {@link RaceLogUsesOwnCompetitorsAnalyzer} or on the
|
||||
* RegattaLog and fetches the competitors appropriately.
|
||||
*
|
||||
* Should not be used by clients directly. Instead, get the competitor set from the {@code RaceColumn}, using either one
|
||||
* of {@code getAllCompetitors()} and {@code getAllCompetitors(Fleet)}. Those methods automatically check whether a
|
||||
* tracked race is present, which takes precedence over the Race/RegattaLog.
|
||||
*
|
||||
* @author Jan Bross (D056848)
|
||||
*
|
||||
*/
|
||||
public class RegisteredCompetitorsAnalyzer extends RaceLogAnalyzer<Set<Competitor>> {
|
||||
private RegattaLog regattaLog;
|
||||
|
||||
public RegisteredCompetitorsAnalyzer(RaceLog raceLog, RegattaLog regattaLog) {
|
||||
super(raceLog);
|
||||
this.regattaLog = regattaLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Competitor> performAnalysis() {
|
||||
final Set<Competitor> result;
|
||||
if (new RaceLogUsesOwnCompetitorsAnalyzer(getLog()).analyze()) {
|
||||
// get Events from RaceLog
|
||||
result = new CompetitorsInLogAnalyzer<>(getLog()).analyze();
|
||||
} else {
|
||||
// get Events from RegattaLog
|
||||
result = new CompetitorsInLogAnalyzer<>(regattaLog).analyze();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+52
-52
@@ -1,52 +1,52 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogDenoteForTrackingEventImpl extends RaceLogEventImpl implements RaceLogDenoteForTrackingEvent {
|
||||
private static final long serialVersionUID = 6937741283401976385L;
|
||||
|
||||
private final String raceName;
|
||||
private final BoatClass boatClass;
|
||||
private final Serializable raceId;
|
||||
|
||||
public RaceLogDenoteForTrackingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId, String raceName,
|
||||
BoatClass boatClass, Serializable raceId) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pPassId);
|
||||
this.raceName = raceName;
|
||||
this.boatClass = boatClass;
|
||||
this.raceId = raceId;
|
||||
}
|
||||
|
||||
public RaceLogDenoteForTrackingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
String raceName, BoatClass boatClass, Serializable raceId) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, raceName, boatClass, raceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRaceName() {
|
||||
return raceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatClass getBoatClass() {
|
||||
return boatClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getRaceId() {
|
||||
return raceId;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogDenoteForTrackingEventImpl extends RaceLogEventImpl implements RaceLogDenoteForTrackingEvent {
|
||||
private static final long serialVersionUID = 6937741283401976385L;
|
||||
|
||||
private final String raceName;
|
||||
private final BoatClass boatClass;
|
||||
private final Serializable raceId;
|
||||
|
||||
public RaceLogDenoteForTrackingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId, String raceName,
|
||||
BoatClass boatClass, Serializable raceId) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pPassId);
|
||||
this.raceName = raceName;
|
||||
this.boatClass = boatClass;
|
||||
this.raceId = raceId;
|
||||
}
|
||||
|
||||
public RaceLogDenoteForTrackingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author, int pPassId,
|
||||
String raceName, BoatClass boatClass, Serializable raceId) {
|
||||
this(now(), logicalTimePoint, author, randId(), pPassId, raceName, boatClass, raceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRaceName() {
|
||||
return raceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatClass getBoatClass() {
|
||||
return boatClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getRaceId() {
|
||||
return raceId;
|
||||
}
|
||||
}
|
||||
+31
-31
@@ -1,31 +1,31 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogStartTrackingEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogStartTrackingEventImpl extends RaceLogEventImpl implements
|
||||
RaceLogStartTrackingEvent {
|
||||
private static final long serialVersionUID = 6017954368580125221L;
|
||||
|
||||
public RaceLogStartTrackingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogStartTrackingEventImpl(TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, int pPassId) {
|
||||
super(logicalTimePoint, author, pPassId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogStartTrackingEvent;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogStartTrackingEventImpl extends RaceLogEventImpl implements
|
||||
RaceLogStartTrackingEvent {
|
||||
private static final long serialVersionUID = 6017954368580125221L;
|
||||
|
||||
public RaceLogStartTrackingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int pPassId) {
|
||||
super(createdAt, logicalTimePoint, author, pId, pPassId);
|
||||
}
|
||||
|
||||
public RaceLogStartTrackingEventImpl(TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, int pPassId) {
|
||||
super(logicalTimePoint, author, pPassId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
+19
-19
@@ -1,19 +1,19 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorSensorDataMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
|
||||
/**
|
||||
* Used to dynamically dispatch calls for {@link RegattaLogDeviceMappingEvent}s depending on the concrete type.
|
||||
*/
|
||||
public interface MappingEventVisitor {
|
||||
|
||||
void visit(RegattaLogDeviceMarkMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorSensorDataMappingEvent event);
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorSensorDataMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
|
||||
/**
|
||||
* Used to dynamically dispatch calls for {@link RegattaLogDeviceMappingEvent}s depending on the concrete type.
|
||||
*/
|
||||
public interface MappingEventVisitor {
|
||||
|
||||
void visit(RegattaLogDeviceMarkMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorSensorDataMappingEvent event);
|
||||
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
|
||||
public interface RegattaLogEvent extends AbstractLogEvent<RegattaLogEventVisitor> {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
|
||||
public interface RegattaLogEvent extends AbstractLogEvent<RegattaLogEventVisitor> {
|
||||
|
||||
}
|
||||
+31
-31
@@ -1,31 +1,31 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogCloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDefineMarkEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorSensorDataMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogRegisterCompetitorEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogRevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnTimeFactorEvent;
|
||||
|
||||
public interface RegattaLogEventVisitor {
|
||||
void visit(RegattaLogRevokeEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceMarkMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorSensorDataMappingEvent event);
|
||||
|
||||
void visit(RegattaLogCloseOpenEndedDeviceMappingEvent event);
|
||||
|
||||
void visit(RegattaLogRegisterCompetitorEvent event);
|
||||
|
||||
void visit(RegattaLogSetCompetitorTimeOnTimeFactorEvent event);
|
||||
|
||||
void visit(RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent event);
|
||||
|
||||
void visit(RegattaLogDefineMarkEvent event);
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogCloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDefineMarkEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorSensorDataMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogRegisterCompetitorEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogRevokeEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnTimeFactorEvent;
|
||||
|
||||
public interface RegattaLogEventVisitor {
|
||||
void visit(RegattaLogRevokeEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceMarkMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorMappingEvent event);
|
||||
|
||||
void visit(RegattaLogDeviceCompetitorSensorDataMappingEvent event);
|
||||
|
||||
void visit(RegattaLogCloseOpenEndedDeviceMappingEvent event);
|
||||
|
||||
void visit(RegattaLogRegisterCompetitorEvent event);
|
||||
|
||||
void visit(RegattaLogSetCompetitorTimeOnTimeFactorEvent event);
|
||||
|
||||
void visit(RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent event);
|
||||
|
||||
void visit(RegattaLogDefineMarkEvent event);
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RegattaLogDeviceCompetitorMappingEvent extends RegattaLogDeviceMappingEvent<Competitor> {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RegattaLogDeviceCompetitorMappingEvent extends RegattaLogDeviceMappingEvent<Competitor> {
|
||||
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RegattaLogDeviceCompetitorSensorDataMappingEvent extends RegattaLogDeviceMappingEvent<Competitor> {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RegattaLogDeviceCompetitorSensorDataMappingEvent extends RegattaLogDeviceMappingEvent<Competitor> {
|
||||
|
||||
}
|
||||
+53
-53
@@ -1,53 +1,53 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl.RegattaLogDefinedMarkAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMapping;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
|
||||
/**
|
||||
* Event type for mapping {@link DeviceIdentifier devices} to {@code items} ({@link Competitor competitors} or {@link Mark marks}).
|
||||
* <p>
|
||||
* Not both {@link #getFrom()} and {@link #getToInclusive()} may be {@code null} at the same time (which would be a mapping for "all times",
|
||||
* as the semantics of somehow later limiting this range would become unclear
|
||||
* <p>
|
||||
* If one end of the time range enclosed by {@link #getFrom()} and {@link #getToInclusive()} is open, this can be closed
|
||||
* by a {@link RegattaLogCloseOpenEndedDeviceMappingEvent}.
|
||||
*
|
||||
* @see RegattaLogDefinedMarkAnalyzer for rules by which {@link DeviceMapping}s are derived from these events.
|
||||
* @author Fredrik Teschke
|
||||
*/
|
||||
public interface RegattaLogDeviceMappingEvent<ItemType extends WithID> extends RegattaLogEvent, Revokable {
|
||||
ItemType getMappedTo();
|
||||
DeviceIdentifier getDevice();
|
||||
|
||||
/**
|
||||
* The {@code return} value may be {@code null}, symbolizing an open range.
|
||||
* In that case the device should be mapped to the item for any timepoint before that specified by {@link #getToInclusive()}.
|
||||
*/
|
||||
TimePoint getFrom();
|
||||
|
||||
/**
|
||||
* The {@code return} value may be {@code null}, symbolizing an open range.
|
||||
* In that case the device should be mapped to the item for any timepoint after that specified by {@link #getFrom()}.
|
||||
* Otherwise, this marks the <em>inclusive</em> end of the interval, other than the {@link TimeRange#to()} semantics which
|
||||
* uses an <em>exclusive</em> interval end. To bridge this gap, whenever mapping this event's from/to interval to a
|
||||
* {@link TimeRange}, at least the resolution of the {@link TimePoint} representation must be added to the result of
|
||||
* this method to make it into a valid end of a {@link TimeRange} that includes the time interval covered by this mapping.
|
||||
*/
|
||||
TimePoint getToInclusive();
|
||||
|
||||
/**
|
||||
* Visitor patter implementation for event mapping handling differentiation.
|
||||
*
|
||||
* @param visitor
|
||||
*/
|
||||
void accept(MappingEventVisitor visitor);
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl.RegattaLogDefinedMarkAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMapping;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
|
||||
/**
|
||||
* Event type for mapping {@link DeviceIdentifier devices} to {@code items} ({@link Competitor competitors} or {@link Mark marks}).
|
||||
* <p>
|
||||
* Not both {@link #getFrom()} and {@link #getToInclusive()} may be {@code null} at the same time (which would be a mapping for "all times",
|
||||
* as the semantics of somehow later limiting this range would become unclear
|
||||
* <p>
|
||||
* If one end of the time range enclosed by {@link #getFrom()} and {@link #getToInclusive()} is open, this can be closed
|
||||
* by a {@link RegattaLogCloseOpenEndedDeviceMappingEvent}.
|
||||
*
|
||||
* @see RegattaLogDefinedMarkAnalyzer for rules by which {@link DeviceMapping}s are derived from these events.
|
||||
* @author Fredrik Teschke
|
||||
*/
|
||||
public interface RegattaLogDeviceMappingEvent<ItemType extends WithID> extends RegattaLogEvent, Revokable {
|
||||
ItemType getMappedTo();
|
||||
DeviceIdentifier getDevice();
|
||||
|
||||
/**
|
||||
* The {@code return} value may be {@code null}, symbolizing an open range.
|
||||
* In that case the device should be mapped to the item for any timepoint before that specified by {@link #getToInclusive()}.
|
||||
*/
|
||||
TimePoint getFrom();
|
||||
|
||||
/**
|
||||
* The {@code return} value may be {@code null}, symbolizing an open range.
|
||||
* In that case the device should be mapped to the item for any timepoint after that specified by {@link #getFrom()}.
|
||||
* Otherwise, this marks the <em>inclusive</em> end of the interval, other than the {@link TimeRange#to()} semantics which
|
||||
* uses an <em>exclusive</em> interval end. To bridge this gap, whenever mapping this event's from/to interval to a
|
||||
* {@link TimeRange}, at least the resolution of the {@link TimePoint} representation must be added to the result of
|
||||
* this method to make it into a valid end of a {@link TimeRange} that includes the time interval covered by this mapping.
|
||||
*/
|
||||
TimePoint getToInclusive();
|
||||
|
||||
/**
|
||||
* Visitor patter implementation for event mapping handling differentiation.
|
||||
*
|
||||
* @param visitor
|
||||
*/
|
||||
void accept(MappingEventVisitor visitor);
|
||||
}
|
||||
+66
-66
@@ -1,66 +1,66 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.WithID;
|
||||
|
||||
public abstract class RegattaLogDeviceMappingEventImpl<ItemType extends WithID> extends AbstractLogEventImpl<RegattaLogEventVisitor> implements
|
||||
RegattaLogDeviceMappingEvent<ItemType> {
|
||||
private static final long serialVersionUID = -8439653251231710356L;
|
||||
|
||||
private final ItemType mappedTo;
|
||||
private final DeviceIdentifier device;
|
||||
|
||||
/**
|
||||
* inclusive start time point
|
||||
*/
|
||||
private final TimePoint from;
|
||||
|
||||
/**
|
||||
* inclusive end time point
|
||||
*/
|
||||
private final TimePoint toInclusive;
|
||||
|
||||
/**
|
||||
* @param from inclusive
|
||||
* @param toInclusive inclusive
|
||||
*/
|
||||
public RegattaLogDeviceMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable id, ItemType mappedTo,
|
||||
DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
super(createdAt, logicalTimePoint, author, id);
|
||||
this.mappedTo = mappedTo;
|
||||
this.device = device;
|
||||
this.from = from;
|
||||
this.toInclusive = toInclusive;
|
||||
}
|
||||
|
||||
public RegattaLogDeviceMappingEventImpl(TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, ItemType mappedTo,
|
||||
DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
this(now(), logicalTimePoint, author, randId(), mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
public ItemType getMappedTo() {
|
||||
return mappedTo;
|
||||
}
|
||||
public DeviceIdentifier getDevice() {
|
||||
return device;
|
||||
}
|
||||
public TimePoint getFrom() {
|
||||
return from;
|
||||
}
|
||||
public TimePoint getToInclusive() {
|
||||
return toInclusive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "device: " + device + ", mapped to: " + mappedTo + ", from: " + from + ", to: " + toInclusive;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.WithID;
|
||||
|
||||
public abstract class RegattaLogDeviceMappingEventImpl<ItemType extends WithID> extends AbstractLogEventImpl<RegattaLogEventVisitor> implements
|
||||
RegattaLogDeviceMappingEvent<ItemType> {
|
||||
private static final long serialVersionUID = -8439653251231710356L;
|
||||
|
||||
private final ItemType mappedTo;
|
||||
private final DeviceIdentifier device;
|
||||
|
||||
/**
|
||||
* inclusive start time point
|
||||
*/
|
||||
private final TimePoint from;
|
||||
|
||||
/**
|
||||
* inclusive end time point
|
||||
*/
|
||||
private final TimePoint toInclusive;
|
||||
|
||||
/**
|
||||
* @param from inclusive
|
||||
* @param toInclusive inclusive
|
||||
*/
|
||||
public RegattaLogDeviceMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable id, ItemType mappedTo,
|
||||
DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
super(createdAt, logicalTimePoint, author, id);
|
||||
this.mappedTo = mappedTo;
|
||||
this.device = device;
|
||||
this.from = from;
|
||||
this.toInclusive = toInclusive;
|
||||
}
|
||||
|
||||
public RegattaLogDeviceMappingEventImpl(TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, ItemType mappedTo,
|
||||
DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
this(now(), logicalTimePoint, author, randId(), mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
public ItemType getMappedTo() {
|
||||
return mappedTo;
|
||||
}
|
||||
public DeviceIdentifier getDevice() {
|
||||
return device;
|
||||
}
|
||||
public TimePoint getFrom() {
|
||||
return from;
|
||||
}
|
||||
public TimePoint getToInclusive() {
|
||||
return toInclusive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
return "device: " + device + ", mapped to: " + mappedTo + ", from: " + from + ", to: " + toInclusive;
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
|
||||
|
||||
public interface RegattaLogDeviceMarkMappingEvent extends RegattaLogDeviceMappingEvent<Mark>, RegattaLogEvent {
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
|
||||
|
||||
public interface RegattaLogDeviceMarkMappingEvent extends RegattaLogDeviceMappingEvent<Mark>, RegattaLogEvent {
|
||||
|
||||
}
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RegattaLogSetCompetitorHandicapInfoEvent extends RegattaLogEvent, Revokable {
|
||||
Competitor getCompetitor();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.Revokable;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
|
||||
public interface RegattaLogSetCompetitorHandicapInfoEvent extends RegattaLogEvent, Revokable {
|
||||
Competitor getCompetitor();
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public interface RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent extends RegattaLogSetCompetitorHandicapInfoEvent {
|
||||
Duration getTimeOnDistanceAllowancePerNauticalMile();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public interface RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent extends RegattaLogSetCompetitorHandicapInfoEvent {
|
||||
Duration getTimeOnDistanceAllowancePerNauticalMile();
|
||||
}
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
public interface RegattaLogSetCompetitorTimeOnTimeFactorEvent extends RegattaLogSetCompetitorHandicapInfoEvent {
|
||||
Double getTimeOnTimeFactor();
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events;
|
||||
|
||||
public interface RegattaLogSetCompetitorTimeOnTimeFactorEvent extends RegattaLogSetCompetitorHandicapInfoEvent {
|
||||
Double getTimeOnTimeFactor();
|
||||
}
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorSensorDataMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* Mapping event for devices mapped for Bravo type fixes.
|
||||
*/
|
||||
public class RegattaLogDeviceCompetitorBravoMappingEventImpl extends RegattaLogDeviceMappingEventImpl<Competitor>
|
||||
implements RegattaLogDeviceCompetitorSensorDataMappingEvent {
|
||||
private static final long serialVersionUID = -1494030544804758753L;
|
||||
|
||||
|
||||
public RegattaLogDeviceCompetitorBravoMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor mappedTo, DeviceIdentifier device,
|
||||
TimePoint from, TimePoint to) {
|
||||
super(createdAt, logicalTimePoint, author, pId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
public RegattaLogDeviceCompetitorBravoMappingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor mappedTo, DeviceIdentifier device, TimePoint from, TimePoint to) {
|
||||
super(logicalTimePoint, author, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(MappingEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorSensorDataMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* Mapping event for devices mapped for Bravo type fixes.
|
||||
*/
|
||||
public class RegattaLogDeviceCompetitorBravoMappingEventImpl extends RegattaLogDeviceMappingEventImpl<Competitor>
|
||||
implements RegattaLogDeviceCompetitorSensorDataMappingEvent {
|
||||
private static final long serialVersionUID = -1494030544804758753L;
|
||||
|
||||
|
||||
public RegattaLogDeviceCompetitorBravoMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor mappedTo, DeviceIdentifier device,
|
||||
TimePoint from, TimePoint to) {
|
||||
super(createdAt, logicalTimePoint, author, pId, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
public RegattaLogDeviceCompetitorBravoMappingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor mappedTo, DeviceIdentifier device, TimePoint from, TimePoint to) {
|
||||
super(logicalTimePoint, author, mappedTo, device, from, to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(MappingEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
+38
-38
@@ -1,38 +1,38 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogDeviceCompetitorMappingEventImpl extends RegattaLogDeviceMappingEventImpl<Competitor> implements
|
||||
RegattaLogDeviceCompetitorMappingEvent {
|
||||
public RegattaLogDeviceCompetitorMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor mappedTo, DeviceIdentifier device,
|
||||
TimePoint from, TimePoint toInclusive) {
|
||||
super(createdAt, logicalTimePoint, author, pId, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
public RegattaLogDeviceCompetitorMappingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor mappedTo, DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
super(logicalTimePoint, author, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -1494030544804758753L;
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(MappingEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogDeviceCompetitorMappingEventImpl extends RegattaLogDeviceMappingEventImpl<Competitor> implements
|
||||
RegattaLogDeviceCompetitorMappingEvent {
|
||||
public RegattaLogDeviceCompetitorMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor mappedTo, DeviceIdentifier device,
|
||||
TimePoint from, TimePoint toInclusive) {
|
||||
super(createdAt, logicalTimePoint, author, pId, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
public RegattaLogDeviceCompetitorMappingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Competitor mappedTo, DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
super(logicalTimePoint, author, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -1494030544804758753L;
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(MappingEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
+38
-38
@@ -1,38 +1,38 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogDeviceMarkMappingEventImpl extends RegattaLogDeviceMappingEventImpl<Mark> implements
|
||||
RegattaLogDeviceMarkMappingEvent {
|
||||
private static final long serialVersionUID = -7223543830755457196L;
|
||||
|
||||
public RegattaLogDeviceMarkMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Mark mappedTo, DeviceIdentifier device, TimePoint from,
|
||||
TimePoint toInclusive) {
|
||||
super(createdAt, logicalTimePoint, author, pId, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
public RegattaLogDeviceMarkMappingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Mark mappedTo, DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
super(logicalTimePoint, author, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(MappingEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.MappingEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogDeviceMarkMappingEventImpl extends RegattaLogDeviceMappingEventImpl<Mark> implements
|
||||
RegattaLogDeviceMarkMappingEvent {
|
||||
private static final long serialVersionUID = -7223543830755457196L;
|
||||
|
||||
public RegattaLogDeviceMarkMappingEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Mark mappedTo, DeviceIdentifier device, TimePoint from,
|
||||
TimePoint toInclusive) {
|
||||
super(createdAt, logicalTimePoint, author, pId, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
public RegattaLogDeviceMarkMappingEventImpl(TimePoint logicalTimePoint, AbstractLogEventAuthor author,
|
||||
Mark mappedTo, DeviceIdentifier device, TimePoint from, TimePoint toInclusive) {
|
||||
super(logicalTimePoint, author, mappedTo, device, from, toInclusive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(MappingEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
}
|
||||
+28
-28
@@ -1,28 +1,28 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorHandicapInfoEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class RegattaLogSetCompetitorHandicapInfoEventImpl extends AbstractLogEventImpl<RegattaLogEventVisitor> implements
|
||||
RegattaLogSetCompetitorHandicapInfoEvent {
|
||||
private static final long serialVersionUID = -4865431949414981216L;
|
||||
|
||||
private final Competitor competitor;
|
||||
|
||||
protected RegattaLogSetCompetitorHandicapInfoEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor competitor) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.competitor = competitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Competitor getCompetitor() {
|
||||
return competitor;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorHandicapInfoEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class RegattaLogSetCompetitorHandicapInfoEventImpl extends AbstractLogEventImpl<RegattaLogEventVisitor> implements
|
||||
RegattaLogSetCompetitorHandicapInfoEvent {
|
||||
private static final long serialVersionUID = -4865431949414981216L;
|
||||
|
||||
private final Competitor competitor;
|
||||
|
||||
protected RegattaLogSetCompetitorHandicapInfoEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor competitor) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.competitor = competitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Competitor getCompetitor() {
|
||||
return competitor;
|
||||
}
|
||||
}
|
||||
+35
-35
@@ -1,35 +1,35 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEventImpl extends
|
||||
RegattaLogSetCompetitorHandicapInfoEventImpl implements
|
||||
RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent {
|
||||
private static final long serialVersionUID = 1603450814971358782L;
|
||||
private final Duration timeOnDistanceAllowancePerNauticalMile;
|
||||
|
||||
public RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEventImpl(TimePoint createdAt,
|
||||
TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable pId, Competitor competitor,
|
||||
Duration timeOnDistanceAllowancePerNauticalMile) {
|
||||
super(createdAt, logicalTimePoint, author, pId, competitor);
|
||||
this.timeOnDistanceAllowancePerNauticalMile = timeOnDistanceAllowancePerNauticalMile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getTimeOnDistanceAllowancePerNauticalMile() {
|
||||
return timeOnDistanceAllowancePerNauticalMile;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEventImpl extends
|
||||
RegattaLogSetCompetitorHandicapInfoEventImpl implements
|
||||
RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEvent {
|
||||
private static final long serialVersionUID = 1603450814971358782L;
|
||||
private final Duration timeOnDistanceAllowancePerNauticalMile;
|
||||
|
||||
public RegattaLogSetCompetitorTimeOnDistanceAllowancePerNauticalMileEventImpl(TimePoint createdAt,
|
||||
TimePoint logicalTimePoint, AbstractLogEventAuthor author, Serializable pId, Competitor competitor,
|
||||
Duration timeOnDistanceAllowancePerNauticalMile) {
|
||||
super(createdAt, logicalTimePoint, author, pId, competitor);
|
||||
this.timeOnDistanceAllowancePerNauticalMile = timeOnDistanceAllowancePerNauticalMile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getTimeOnDistanceAllowancePerNauticalMile() {
|
||||
return timeOnDistanceAllowancePerNauticalMile;
|
||||
}
|
||||
|
||||
}
|
||||
+30
-30
@@ -1,30 +1,30 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnTimeFactorEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogSetCompetitorTimeOnTimeFactorEventImpl extends RegattaLogSetCompetitorHandicapInfoEventImpl implements RegattaLogSetCompetitorTimeOnTimeFactorEvent {
|
||||
private static final long serialVersionUID = -7891407213804859604L;
|
||||
private final Double timeOnTimeFactor;
|
||||
|
||||
public RegattaLogSetCompetitorTimeOnTimeFactorEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor competitor, Double timeOnTimeFactor) {
|
||||
super(createdAt, logicalTimePoint, author, pId, competitor);
|
||||
this.timeOnTimeFactor = timeOnTimeFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getTimeOnTimeFactor() {
|
||||
return timeOnTimeFactor;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.events.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogSetCompetitorTimeOnTimeFactorEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RegattaLogSetCompetitorTimeOnTimeFactorEventImpl extends RegattaLogSetCompetitorHandicapInfoEventImpl implements RegattaLogSetCompetitorTimeOnTimeFactorEvent {
|
||||
private static final long serialVersionUID = -7891407213804859604L;
|
||||
private final Double timeOnTimeFactor;
|
||||
|
||||
public RegattaLogSetCompetitorTimeOnTimeFactorEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, Competitor competitor, Double timeOnTimeFactor) {
|
||||
super(createdAt, logicalTimePoint, author, pId, competitor);
|
||||
this.timeOnTimeFactor = timeOnTimeFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RegattaLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getTimeOnTimeFactor() {
|
||||
return timeOnTimeFactor;
|
||||
}
|
||||
}
|
||||
+79
-79
@@ -1,79 +1,79 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogCloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.common.abstractlog.NotRevokableException;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMapping;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
/**
|
||||
* Extracts the {@link DeviceMapping}s with the appropriate {@link TimeRange}s from the {@link RaceLog}.
|
||||
* Based on the {@link RegattaLogDeviceMappingEvent}s found in the {@code RaceLog} for the tracked {@code items}
|
||||
* ({@code Competitor}s and {@code Marks}), the actual mappings are created.
|
||||
* <p>
|
||||
* Mappings can be defined with an open-ended time range (e.g. track this from now on), which should then be
|
||||
* closed by a corresponding {@link RegattaLogCloseOpenEndedDeviceMappingEvent}.
|
||||
* <p>
|
||||
* The process of removing conflicts between mappings to ensure that only one mapping was active for
|
||||
* one tracked item has been removed. Instead, every {@code DeviceMappingEvent} now results directly in one
|
||||
* {@code DeviceMapping}, the only changes being introduced by closing open time ranges in cases where an
|
||||
* according {@code CloseOpenEndedDeviceMappingEvent} exists.
|
||||
*/
|
||||
public abstract class BaseRegattaLogDeviceMappingFinder<ItemT extends WithID>
|
||||
extends RegattaLogDeviceMappingFinder<ItemT> {
|
||||
|
||||
public BaseRegattaLogDeviceMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
/**
|
||||
* By revoking existing mappings for {@code item} and replacing them by mappings that exclude {@code fixTimePoint},
|
||||
* any fix at {@code fixTimePoint} will no longer be linked to {@code item}. If a mapping is limited to the exact
|
||||
* fix time point, the mapping is only revoked and not replaced. If one boundary is exactly the fix time point, the
|
||||
* interval is revoked and replaced by a single interval with that border adjusted so it excludes the fix.
|
||||
*/
|
||||
public void removeTimePointFromMapping(ItemT item, TimePoint fixTimePoint) throws NotRevokableException {
|
||||
Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> events = new HashMap<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>>();
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents = new HashMap<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent>();
|
||||
findUnrevokedMappingAndClosingEvents(events, closingEvents);
|
||||
for (final RegattaLogDeviceMappingEvent<ItemT> event : events.get(item)) {
|
||||
final TimePoint from = event.getFrom();
|
||||
final RegattaLogCloseOpenEndedDeviceMappingEvent closingEvent = closingEvents.get(event.getId());
|
||||
final TimePoint toInclusive = closingEvent != null ? closingEvent.getClosingTimePointInclusive() : event.getToInclusive();
|
||||
final TimeRange mappingTimeRange = new TimeRangeImpl(from, toInclusive, /* inclusive */ true);
|
||||
if (mappingTimeRange.includes(fixTimePoint)) {
|
||||
if (closingEvent != null) {
|
||||
log.revokeEvent(closingEvent.getAuthor(), closingEvent,
|
||||
"removing single time point " + fixTimePoint + " from mapping for " + item);
|
||||
}
|
||||
log.revokeEvent(event.getAuthor(), event,
|
||||
"removing single time point " + fixTimePoint + " from mapping for " + item);
|
||||
final TimePoint endOfFirstHalf = fixTimePoint.minus(1);
|
||||
final TimePoint startOfSecondHalf = fixTimePoint.plus(1);
|
||||
if (!endOfFirstHalf.before(from)) {
|
||||
log.add(createDeviceMappingEvent(item, event.getAuthor(), from, endOfFirstHalf, event.getDevice()));
|
||||
}
|
||||
if (toInclusive == null || !toInclusive.before(startOfSecondHalf)) {
|
||||
log.add(createDeviceMappingEvent(item, event.getAuthor(), startOfSecondHalf, toInclusive,
|
||||
event.getDevice()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract RegattaLogDeviceMappingEvent<ItemT> createDeviceMappingEvent(ItemT item,
|
||||
AbstractLogEventAuthor author, TimePoint plus, TimePoint toInclusive, DeviceIdentifier deviceId);
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogCloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.common.abstractlog.NotRevokableException;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMapping;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
/**
|
||||
* Extracts the {@link DeviceMapping}s with the appropriate {@link TimeRange}s from the {@link RaceLog}.
|
||||
* Based on the {@link RegattaLogDeviceMappingEvent}s found in the {@code RaceLog} for the tracked {@code items}
|
||||
* ({@code Competitor}s and {@code Marks}), the actual mappings are created.
|
||||
* <p>
|
||||
* Mappings can be defined with an open-ended time range (e.g. track this from now on), which should then be
|
||||
* closed by a corresponding {@link RegattaLogCloseOpenEndedDeviceMappingEvent}.
|
||||
* <p>
|
||||
* The process of removing conflicts between mappings to ensure that only one mapping was active for
|
||||
* one tracked item has been removed. Instead, every {@code DeviceMappingEvent} now results directly in one
|
||||
* {@code DeviceMapping}, the only changes being introduced by closing open time ranges in cases where an
|
||||
* according {@code CloseOpenEndedDeviceMappingEvent} exists.
|
||||
*/
|
||||
public abstract class BaseRegattaLogDeviceMappingFinder<ItemT extends WithID>
|
||||
extends RegattaLogDeviceMappingFinder<ItemT> {
|
||||
|
||||
public BaseRegattaLogDeviceMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
/**
|
||||
* By revoking existing mappings for {@code item} and replacing them by mappings that exclude {@code fixTimePoint},
|
||||
* any fix at {@code fixTimePoint} will no longer be linked to {@code item}. If a mapping is limited to the exact
|
||||
* fix time point, the mapping is only revoked and not replaced. If one boundary is exactly the fix time point, the
|
||||
* interval is revoked and replaced by a single interval with that border adjusted so it excludes the fix.
|
||||
*/
|
||||
public void removeTimePointFromMapping(ItemT item, TimePoint fixTimePoint) throws NotRevokableException {
|
||||
Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> events = new HashMap<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>>();
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents = new HashMap<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent>();
|
||||
findUnrevokedMappingAndClosingEvents(events, closingEvents);
|
||||
for (final RegattaLogDeviceMappingEvent<ItemT> event : events.get(item)) {
|
||||
final TimePoint from = event.getFrom();
|
||||
final RegattaLogCloseOpenEndedDeviceMappingEvent closingEvent = closingEvents.get(event.getId());
|
||||
final TimePoint toInclusive = closingEvent != null ? closingEvent.getClosingTimePointInclusive() : event.getToInclusive();
|
||||
final TimeRange mappingTimeRange = new TimeRangeImpl(from, toInclusive, /* inclusive */ true);
|
||||
if (mappingTimeRange.includes(fixTimePoint)) {
|
||||
if (closingEvent != null) {
|
||||
log.revokeEvent(closingEvent.getAuthor(), closingEvent,
|
||||
"removing single time point " + fixTimePoint + " from mapping for " + item);
|
||||
}
|
||||
log.revokeEvent(event.getAuthor(), event,
|
||||
"removing single time point " + fixTimePoint + " from mapping for " + item);
|
||||
final TimePoint endOfFirstHalf = fixTimePoint.minus(1);
|
||||
final TimePoint startOfSecondHalf = fixTimePoint.plus(1);
|
||||
if (!endOfFirstHalf.before(from)) {
|
||||
log.add(createDeviceMappingEvent(item, event.getAuthor(), from, endOfFirstHalf, event.getDevice()));
|
||||
}
|
||||
if (toInclusive == null || !toInclusive.before(startOfSecondHalf)) {
|
||||
log.add(createDeviceMappingEvent(item, event.getAuthor(), startOfSecondHalf, toInclusive,
|
||||
event.getDevice()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract RegattaLogDeviceMappingEvent<ItemT> createDeviceMappingEvent(ItemT item,
|
||||
AbstractLogEventAuthor author, TimePoint plus, TimePoint toInclusive, DeviceIdentifier deviceId);
|
||||
|
||||
}
|
||||
+22
-22
@@ -1,22 +1,22 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.BaseLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
|
||||
public abstract class RegattaLogAnalyzer<ResultType> extends BaseLogAnalyzer
|
||||
<RegattaLog, RegattaLogEvent, RegattaLogEventVisitor, ResultType> {
|
||||
|
||||
public RegattaLogAnalyzer(RegattaLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
protected Iterable<RegattaLogEvent> getPassEvents() {
|
||||
return log.getFixes();
|
||||
}
|
||||
|
||||
protected Iterable<RegattaLogEvent> getPassEventsDescending() {
|
||||
return log.getFixesDescending();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.BaseLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
|
||||
public abstract class RegattaLogAnalyzer<ResultType> extends BaseLogAnalyzer
|
||||
<RegattaLog, RegattaLogEvent, RegattaLogEventVisitor, ResultType> {
|
||||
|
||||
public RegattaLogAnalyzer(RegattaLog raceLog) {
|
||||
super(raceLog);
|
||||
}
|
||||
|
||||
protected Iterable<RegattaLogEvent> getPassEvents() {
|
||||
return log.getFixes();
|
||||
}
|
||||
|
||||
protected Iterable<RegattaLogEvent> getPassEventsDescending() {
|
||||
return log.getFixesDescending();
|
||||
}
|
||||
}
|
||||
+32
-32
@@ -1,32 +1,32 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceCompetitorMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class RegattaLogDeviceCompetitorMappingFinder extends BaseRegattaLogDeviceMappingFinder<Competitor> {
|
||||
|
||||
public RegattaLogDeviceCompetitorMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidMapping(RegattaLogDeviceMappingEvent<?> mapping) {
|
||||
return mapping instanceof RegattaLogDeviceCompetitorMappingEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RegattaLogDeviceCompetitorMappingEvent createDeviceMappingEvent(Competitor item, AbstractLogEventAuthor author,
|
||||
TimePoint from, TimePoint toInclusive, DeviceIdentifier deviceId) {
|
||||
final TimePoint now = MillisecondsTimePoint.now();
|
||||
return new RegattaLogDeviceCompetitorMappingEventImpl(now, now, author, UUID.randomUUID(), item, deviceId, from, toInclusive);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceCompetitorMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceCompetitorMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class RegattaLogDeviceCompetitorMappingFinder extends BaseRegattaLogDeviceMappingFinder<Competitor> {
|
||||
|
||||
public RegattaLogDeviceCompetitorMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidMapping(RegattaLogDeviceMappingEvent<?> mapping) {
|
||||
return mapping instanceof RegattaLogDeviceCompetitorMappingEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RegattaLogDeviceCompetitorMappingEvent createDeviceMappingEvent(Competitor item, AbstractLogEventAuthor author,
|
||||
TimePoint from, TimePoint toInclusive, DeviceIdentifier deviceId) {
|
||||
final TimePoint now = MillisecondsTimePoint.now();
|
||||
return new RegattaLogDeviceCompetitorMappingEventImpl(now, now, author, UUID.randomUUID(), item, deviceId, from, toInclusive);
|
||||
}
|
||||
}
|
||||
+112
-112
@@ -1,112 +1,112 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogCloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMapping;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMappingWithRegattaLogEvent;
|
||||
import com.sap.sailing.domain.racelogtracking.impl.DeviceMappingWithRegattaLogEventImpl;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
/**
|
||||
* Extracts the {@link DeviceMapping}s with the appropriate {@link TimeRange}s from the {@link RaceLog}.
|
||||
* Based on the {@link RegattaLogDeviceMappingEvent}s found in the {@code RaceLog} for the tracked {@code items}
|
||||
* ({@code Competitor}s and {@code Marks}), the actual mappings are created.
|
||||
* <p>
|
||||
* Mappings can be defined with an open-ended time range (e.g. track this from now on), which should then be
|
||||
* closed by a corresponding {@link RegattaLogCloseOpenEndedDeviceMappingEvent}.
|
||||
* <p>
|
||||
* The process of removing conflicts between mappings to ensure that only one mapping was active for
|
||||
* one tracked item has been removed. Instead, every {@code DeviceMappingEvent} now results directly in one
|
||||
* {@code DeviceMapping}, the only changes being introduced by closing open time ranges in cases where an
|
||||
* according {@code CloseOpenEndedDeviceMappingEvent} exists.
|
||||
*/
|
||||
public class RegattaLogDeviceMappingFinder<ItemT extends WithID>
|
||||
extends RegattaLogAnalyzer<Map<ItemT, List<DeviceMappingWithRegattaLogEvent<ItemT>>>> {
|
||||
private static Logger logger = Logger.getLogger(RegattaLogDeviceMappingFinder.class.getName());
|
||||
|
||||
public RegattaLogDeviceMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
protected boolean isValidMapping(RegattaLogDeviceMappingEvent<?> mapping) {
|
||||
return mapping instanceof RegattaLogDeviceMappingEvent;
|
||||
}
|
||||
|
||||
protected DeviceMappingWithRegattaLogEvent<ItemT> createMapping(DeviceIdentifier device, ItemT item,
|
||||
TimePoint from, TimePoint toInclusive, Serializable originalEventId, RegattaLogDeviceMappingEvent<ItemT> event) {
|
||||
return new DeviceMappingWithRegattaLogEventImpl<ItemT>(item, device, new TimeRangeImpl(from, toInclusive, /* inclusive */ true),
|
||||
Collections.singletonList(originalEventId), event);
|
||||
}
|
||||
|
||||
private List<RegattaLogDeviceMappingEvent<ItemT>> getMappingEventsForItem(Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> map, ItemT item) {
|
||||
List<RegattaLogDeviceMappingEvent<ItemT>> list = map.get(item);
|
||||
if (list == null) {
|
||||
list = new ArrayList<RegattaLogDeviceMappingEvent<ItemT>>();
|
||||
map.put(item, list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<ItemT, List<DeviceMappingWithRegattaLogEvent<ItemT>>> performAnalysis() {
|
||||
Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> events = new HashMap<>();
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents = new HashMap<>();
|
||||
findUnrevokedMappingAndClosingEvents(events, closingEvents);
|
||||
Map<ItemT, List<DeviceMappingWithRegattaLogEvent<ItemT>>> mappings = new HashMap<>();
|
||||
for (ItemT item : events.keySet()) {
|
||||
mappings.put(item, closeOpenRanges(events.get(item), item, closingEvents));
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
protected void findUnrevokedMappingAndClosingEvents(Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> events,
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents) {
|
||||
for (RegattaLogEvent e : getLog().getUnrevokedEvents()) {
|
||||
if (e instanceof RegattaLogDeviceMappingEvent && isValidMapping(((RegattaLogDeviceMappingEvent<?>) e))) {
|
||||
@SuppressWarnings("unchecked")
|
||||
RegattaLogDeviceMappingEvent<ItemT> mappingEvent = (RegattaLogDeviceMappingEvent<ItemT>) e;
|
||||
getMappingEventsForItem(events, mappingEvent.getMappedTo()).add(mappingEvent);
|
||||
} else if (e instanceof RegattaLogCloseOpenEndedDeviceMappingEvent) {
|
||||
//a higher priority closing events for the same mapping event overwrites the lower priority one
|
||||
RegattaLogCloseOpenEndedDeviceMappingEvent closingEvent = (RegattaLogCloseOpenEndedDeviceMappingEvent) e;
|
||||
closingEvents.put(closingEvent.getDeviceMappingEventId(), closingEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<DeviceMappingWithRegattaLogEvent<ItemT>> closeOpenRanges(
|
||||
List<RegattaLogDeviceMappingEvent<ItemT>> events, ItemT item,
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents) {
|
||||
List<DeviceMappingWithRegattaLogEvent<ItemT>> result = new ArrayList<>();
|
||||
for (final RegattaLogDeviceMappingEvent<ItemT> event : events) {
|
||||
TimePoint from = event.getFrom();
|
||||
TimePoint toInclusive = event.getToInclusive();
|
||||
TimePoint closingTimePointInclusive = closingEvents.containsKey(event.getId()) ? closingEvents.get(event.getId())
|
||||
.getClosingTimePointInclusive() : null;
|
||||
if (from == null) {
|
||||
logger.severe("No start time set for DeviceMappingEvent with ID: " + event.getId());
|
||||
}
|
||||
if (toInclusive == null) {
|
||||
toInclusive = closingTimePointInclusive;
|
||||
}
|
||||
result.add(createMapping(event.getDevice(), item, from, toInclusive, event.getId(), event));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogCloseOpenEndedDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMapping;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceMappingWithRegattaLogEvent;
|
||||
import com.sap.sailing.domain.racelogtracking.impl.DeviceMappingWithRegattaLogEventImpl;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
/**
|
||||
* Extracts the {@link DeviceMapping}s with the appropriate {@link TimeRange}s from the {@link RaceLog}.
|
||||
* Based on the {@link RegattaLogDeviceMappingEvent}s found in the {@code RaceLog} for the tracked {@code items}
|
||||
* ({@code Competitor}s and {@code Marks}), the actual mappings are created.
|
||||
* <p>
|
||||
* Mappings can be defined with an open-ended time range (e.g. track this from now on), which should then be
|
||||
* closed by a corresponding {@link RegattaLogCloseOpenEndedDeviceMappingEvent}.
|
||||
* <p>
|
||||
* The process of removing conflicts between mappings to ensure that only one mapping was active for
|
||||
* one tracked item has been removed. Instead, every {@code DeviceMappingEvent} now results directly in one
|
||||
* {@code DeviceMapping}, the only changes being introduced by closing open time ranges in cases where an
|
||||
* according {@code CloseOpenEndedDeviceMappingEvent} exists.
|
||||
*/
|
||||
public class RegattaLogDeviceMappingFinder<ItemT extends WithID>
|
||||
extends RegattaLogAnalyzer<Map<ItemT, List<DeviceMappingWithRegattaLogEvent<ItemT>>>> {
|
||||
private static Logger logger = Logger.getLogger(RegattaLogDeviceMappingFinder.class.getName());
|
||||
|
||||
public RegattaLogDeviceMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
protected boolean isValidMapping(RegattaLogDeviceMappingEvent<?> mapping) {
|
||||
return mapping instanceof RegattaLogDeviceMappingEvent;
|
||||
}
|
||||
|
||||
protected DeviceMappingWithRegattaLogEvent<ItemT> createMapping(DeviceIdentifier device, ItemT item,
|
||||
TimePoint from, TimePoint toInclusive, Serializable originalEventId, RegattaLogDeviceMappingEvent<ItemT> event) {
|
||||
return new DeviceMappingWithRegattaLogEventImpl<ItemT>(item, device, new TimeRangeImpl(from, toInclusive, /* inclusive */ true),
|
||||
Collections.singletonList(originalEventId), event);
|
||||
}
|
||||
|
||||
private List<RegattaLogDeviceMappingEvent<ItemT>> getMappingEventsForItem(Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> map, ItemT item) {
|
||||
List<RegattaLogDeviceMappingEvent<ItemT>> list = map.get(item);
|
||||
if (list == null) {
|
||||
list = new ArrayList<RegattaLogDeviceMappingEvent<ItemT>>();
|
||||
map.put(item, list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<ItemT, List<DeviceMappingWithRegattaLogEvent<ItemT>>> performAnalysis() {
|
||||
Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> events = new HashMap<>();
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents = new HashMap<>();
|
||||
findUnrevokedMappingAndClosingEvents(events, closingEvents);
|
||||
Map<ItemT, List<DeviceMappingWithRegattaLogEvent<ItemT>>> mappings = new HashMap<>();
|
||||
for (ItemT item : events.keySet()) {
|
||||
mappings.put(item, closeOpenRanges(events.get(item), item, closingEvents));
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
protected void findUnrevokedMappingAndClosingEvents(Map<ItemT, List<RegattaLogDeviceMappingEvent<ItemT>>> events,
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents) {
|
||||
for (RegattaLogEvent e : getLog().getUnrevokedEvents()) {
|
||||
if (e instanceof RegattaLogDeviceMappingEvent && isValidMapping(((RegattaLogDeviceMappingEvent<?>) e))) {
|
||||
@SuppressWarnings("unchecked")
|
||||
RegattaLogDeviceMappingEvent<ItemT> mappingEvent = (RegattaLogDeviceMappingEvent<ItemT>) e;
|
||||
getMappingEventsForItem(events, mappingEvent.getMappedTo()).add(mappingEvent);
|
||||
} else if (e instanceof RegattaLogCloseOpenEndedDeviceMappingEvent) {
|
||||
//a higher priority closing events for the same mapping event overwrites the lower priority one
|
||||
RegattaLogCloseOpenEndedDeviceMappingEvent closingEvent = (RegattaLogCloseOpenEndedDeviceMappingEvent) e;
|
||||
closingEvents.put(closingEvent.getDeviceMappingEventId(), closingEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<DeviceMappingWithRegattaLogEvent<ItemT>> closeOpenRanges(
|
||||
List<RegattaLogDeviceMappingEvent<ItemT>> events, ItemT item,
|
||||
Map<Serializable, RegattaLogCloseOpenEndedDeviceMappingEvent> closingEvents) {
|
||||
List<DeviceMappingWithRegattaLogEvent<ItemT>> result = new ArrayList<>();
|
||||
for (final RegattaLogDeviceMappingEvent<ItemT> event : events) {
|
||||
TimePoint from = event.getFrom();
|
||||
TimePoint toInclusive = event.getToInclusive();
|
||||
TimePoint closingTimePointInclusive = closingEvents.containsKey(event.getId()) ? closingEvents.get(event.getId())
|
||||
.getClosingTimePointInclusive() : null;
|
||||
if (from == null) {
|
||||
logger.severe("No start time set for DeviceMappingEvent with ID: " + event.getId());
|
||||
}
|
||||
if (toInclusive == null) {
|
||||
toInclusive = closingTimePointInclusive;
|
||||
}
|
||||
result.add(createMapping(event.getDevice(), item, from, toInclusive, event.getId(), event));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+32
-32
@@ -1,32 +1,32 @@
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceMarkMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class RegattaLogDeviceMarkMappingFinder extends BaseRegattaLogDeviceMappingFinder<Mark> {
|
||||
|
||||
public RegattaLogDeviceMarkMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidMapping(RegattaLogDeviceMappingEvent<?> mapping) {
|
||||
return mapping instanceof RegattaLogDeviceMarkMappingEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RegattaLogDeviceMarkMappingEvent createDeviceMappingEvent(Mark item, AbstractLogEventAuthor author,
|
||||
TimePoint from, TimePoint to, DeviceIdentifier deviceId) {
|
||||
final TimePoint now = MillisecondsTimePoint.now();
|
||||
return new RegattaLogDeviceMarkMappingEventImpl(now, now, author, UUID.randomUUID(), item, deviceId, from, to);
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDeviceMarkMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceMarkMappingEventImpl;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.racelogtracking.DeviceIdentifier;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class RegattaLogDeviceMarkMappingFinder extends BaseRegattaLogDeviceMappingFinder<Mark> {
|
||||
|
||||
public RegattaLogDeviceMarkMappingFinder(RegattaLog log) {
|
||||
super(log);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidMapping(RegattaLogDeviceMappingEvent<?> mapping) {
|
||||
return mapping instanceof RegattaLogDeviceMarkMappingEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RegattaLogDeviceMarkMappingEvent createDeviceMappingEvent(Mark item, AbstractLogEventAuthor author,
|
||||
TimePoint from, TimePoint to, DeviceIdentifier deviceId) {
|
||||
final TimePoint now = MillisecondsTimePoint.now();
|
||||
return new RegattaLogDeviceMarkMappingEventImpl(now, now, author, UUID.randomUUID(), item, deviceId, from, to);
|
||||
}
|
||||
}
|
||||
+14
-14
@@ -1,14 +1,14 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Named;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface Boat extends Named {
|
||||
BoatClass getBoatClass();
|
||||
|
||||
@Dimension(messageKey="SailID")
|
||||
String getSailID();
|
||||
|
||||
Color getColor();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Named;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface Boat extends Named {
|
||||
BoatClass getBoatClass();
|
||||
|
||||
@Dimension(messageKey="SailID")
|
||||
String getSailID();
|
||||
|
||||
Color getColor();
|
||||
}
|
||||
+67
-67
@@ -1,67 +1,67 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sailing.domain.common.BoatHullType;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.Named;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public interface BoatClass extends Named, IsManagedByCache<SharedDomainFactory> {
|
||||
final Duration APPROXIMATE_AVERAGE_MANEUVER_DURATION = Duration.ONE_SECOND.times(8); // as discussed with Dennis Gehrlein
|
||||
|
||||
/**
|
||||
* The distance returned by this method should be appropriate for use in
|
||||
* {@link TrackedRace#approximate(Competitor, Distance, TimePoint, TimePoint)} so that penalty circles and other
|
||||
* maneuvers are detected reliably.
|
||||
*/
|
||||
Distance getMaximumDistanceForCourseApproximation();
|
||||
|
||||
Duration getApproximateManeuverDuration();
|
||||
|
||||
long getApproximateManeuverDurationInMilliseconds();
|
||||
|
||||
/**
|
||||
* If the averaged courses over ground differ by at least this degree angle, a maneuver will
|
||||
* be assumed. Note that this should be much less than the tack angle because averaging may
|
||||
* span across the actual maneuver.
|
||||
*/
|
||||
double getManeuverDegreeAngleThreshold();
|
||||
|
||||
double getMinimumAngleBetweenDifferentTacksDownwind();
|
||||
|
||||
double getMinimumAngleBetweenDifferentTacksUpwind();
|
||||
|
||||
/**
|
||||
* Most olympic boat classes start their race with an upwind leg. Some other classes such
|
||||
* as the Extreme Sailing Series / Extreme40 do not necessarily start with an upwind leg.
|
||||
* Knowing this is relevant for the wind estimation fallback strategy. If the first leg of
|
||||
* a boat class doesn't have to be an upwind leg it's not permissible to estimate the wind
|
||||
* based on the course layout.<p>
|
||||
*
|
||||
* The result of calling this method suggests a good default for this boat class. It is
|
||||
* <em>not</em> an authoritative, prescriptive value. Races with this boat class may still
|
||||
* start with a non-upwind leg even though this method returns <code>true</code>.
|
||||
*/
|
||||
boolean typicallyStartsUpwind();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
Distance getHullLength();
|
||||
|
||||
Distance getHullBeam();
|
||||
|
||||
BoatHullType getHullType();
|
||||
|
||||
/**
|
||||
* Downwind leg-based wind estimations are inherently less confident than upwind leg-based estimations because
|
||||
* jibing angles vary more greatly from boat to boat than tacking angles.
|
||||
*
|
||||
* @param numberOfBoatsInSmallestCluster the larger the number of boats, the more confident the estimate is considered to be
|
||||
* ("wisdom of the crowds"). The minimum confidence for just one boat in the smallest cluster is still guaranteed to be
|
||||
* greater than zero.
|
||||
*/
|
||||
double getDownwindWindEstimationConfidence(int numberOfBoatsInSmallestCluster);
|
||||
|
||||
double getUpwindWindEstimationConfidence(int numberOfBoatsInSmallestCluster);
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sailing.domain.common.BoatHullType;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.Named;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public interface BoatClass extends Named, IsManagedByCache<SharedDomainFactory> {
|
||||
final Duration APPROXIMATE_AVERAGE_MANEUVER_DURATION = Duration.ONE_SECOND.times(8); // as discussed with Dennis Gehrlein
|
||||
|
||||
/**
|
||||
* The distance returned by this method should be appropriate for use in
|
||||
* {@link TrackedRace#approximate(Competitor, Distance, TimePoint, TimePoint)} so that penalty circles and other
|
||||
* maneuvers are detected reliably.
|
||||
*/
|
||||
Distance getMaximumDistanceForCourseApproximation();
|
||||
|
||||
Duration getApproximateManeuverDuration();
|
||||
|
||||
long getApproximateManeuverDurationInMilliseconds();
|
||||
|
||||
/**
|
||||
* If the averaged courses over ground differ by at least this degree angle, a maneuver will
|
||||
* be assumed. Note that this should be much less than the tack angle because averaging may
|
||||
* span across the actual maneuver.
|
||||
*/
|
||||
double getManeuverDegreeAngleThreshold();
|
||||
|
||||
double getMinimumAngleBetweenDifferentTacksDownwind();
|
||||
|
||||
double getMinimumAngleBetweenDifferentTacksUpwind();
|
||||
|
||||
/**
|
||||
* Most olympic boat classes start their race with an upwind leg. Some other classes such
|
||||
* as the Extreme Sailing Series / Extreme40 do not necessarily start with an upwind leg.
|
||||
* Knowing this is relevant for the wind estimation fallback strategy. If the first leg of
|
||||
* a boat class doesn't have to be an upwind leg it's not permissible to estimate the wind
|
||||
* based on the course layout.<p>
|
||||
*
|
||||
* The result of calling this method suggests a good default for this boat class. It is
|
||||
* <em>not</em> an authoritative, prescriptive value. Races with this boat class may still
|
||||
* start with a non-upwind leg even though this method returns <code>true</code>.
|
||||
*/
|
||||
boolean typicallyStartsUpwind();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
Distance getHullLength();
|
||||
|
||||
Distance getHullBeam();
|
||||
|
||||
BoatHullType getHullType();
|
||||
|
||||
/**
|
||||
* Downwind leg-based wind estimations are inherently less confident than upwind leg-based estimations because
|
||||
* jibing angles vary more greatly from boat to boat than tacking angles.
|
||||
*
|
||||
* @param numberOfBoatsInSmallestCluster the larger the number of boats, the more confident the estimate is considered to be
|
||||
* ("wisdom of the crowds"). The minimum confidence for just one boat in the smallest cluster is still guaranteed to be
|
||||
* greater than zero.
|
||||
*/
|
||||
double getDownwindWindEstimationConfidence(int numberOfBoatsInSmallestCluster);
|
||||
|
||||
double getUpwindWindEstimationConfidence(int numberOfBoatsInSmallestCluster);
|
||||
}
|
||||
+78
-78
@@ -1,78 +1,78 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.NamedWithID;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface Competitor extends NamedWithID, IsManagedByCache<SharedDomainFactory> {
|
||||
@Connector(messageKey="Team", ordinal=9)
|
||||
Team getTeam();
|
||||
|
||||
@Connector(messageKey="Boat", ordinal=10)
|
||||
Boat getBoat();
|
||||
|
||||
Color getColor();
|
||||
|
||||
String getEmail();
|
||||
|
||||
boolean hasEmail();
|
||||
|
||||
@Dimension(messageKey="SearchTag", ordinal=11)
|
||||
String getSearchTag();
|
||||
|
||||
/**
|
||||
* an alternative flag image (per default the nation flag
|
||||
* @return the URI of the flag image
|
||||
*/
|
||||
URI getFlagImage();
|
||||
|
||||
/**
|
||||
* Adds a listener to this competitor. The listener is also added to the boat and the team for changes.
|
||||
* Adding a listener that is already part of this competitor's listeners set remains without effect.
|
||||
*/
|
||||
void addCompetitorChangeListener(CompetitorChangeListener listener);
|
||||
|
||||
/**
|
||||
* Removes a listener from this competitor. The listener is also removed from the boat and the team.
|
||||
* Trying to remove a listener that is not currently in the set of this competitor's listener remains
|
||||
* without effect.
|
||||
*/
|
||||
void removeCompetitorChangeListener(CompetitorChangeListener listener);
|
||||
|
||||
/**
|
||||
* The default time-on-time handicap factor for this competitor. If <code>null</code>, no time-on-time handicap
|
||||
* factor is defined for this competitor. For a simple time-on-time scheme, the factor is multiplied with the actual
|
||||
* time sailed to obtain the corrected time. For a "performance line" system, afterwards an additional
|
||||
* distance-based allowance may be subtracted from the resulting time.
|
||||
* <p>
|
||||
*
|
||||
* A particular regatta can make specific arrangements and override this default value for this competitor in its
|
||||
* {@link RegattaLog}, accommodating for the fact that in between regattas competitors may get a new, different
|
||||
* rating, resulting in different handicaps for different regattas.
|
||||
*
|
||||
* @see #getTimeOnDistanceAllowancePerNauticalMile
|
||||
*/
|
||||
Double getTimeOnTimeFactor();
|
||||
|
||||
/**
|
||||
* The default time-on-distance time allowance for this competitor, used in handicap regattas. If <code>null</code>,
|
||||
* no time-on-distance allowance is defined for this competitor. For a simple time-on-distance scheme, the factor is
|
||||
* multiplied with the (windward) course length and the result is subtracted from the actual time sailed to obtain
|
||||
* the corrected time. For a "performance line" system, the actual time sailed will be multiplied with the
|
||||
* {@link #getTimeOnTimeFactor() time-on-time factor} before subtracting the time-on-distance allowance.
|
||||
* <p>
|
||||
*
|
||||
* A particular regatta can make specific arrangements and override this default value for this competitor in its
|
||||
* {@link RegattaLog}, accommodating for the fact that in between regattas competitors may get a new, different
|
||||
* rating, resulting in different handicaps for different regattas.
|
||||
*
|
||||
* @see #getTimeOnTimeFactor
|
||||
*/
|
||||
Duration getTimeOnDistanceAllowancePerNauticalMile();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.NamedWithID;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface Competitor extends NamedWithID, IsManagedByCache<SharedDomainFactory> {
|
||||
@Connector(messageKey="Team", ordinal=9)
|
||||
Team getTeam();
|
||||
|
||||
@Connector(messageKey="Boat", ordinal=10)
|
||||
Boat getBoat();
|
||||
|
||||
Color getColor();
|
||||
|
||||
String getEmail();
|
||||
|
||||
boolean hasEmail();
|
||||
|
||||
@Dimension(messageKey="SearchTag", ordinal=11)
|
||||
String getSearchTag();
|
||||
|
||||
/**
|
||||
* an alternative flag image (per default the nation flag
|
||||
* @return the URI of the flag image
|
||||
*/
|
||||
URI getFlagImage();
|
||||
|
||||
/**
|
||||
* Adds a listener to this competitor. The listener is also added to the boat and the team for changes.
|
||||
* Adding a listener that is already part of this competitor's listeners set remains without effect.
|
||||
*/
|
||||
void addCompetitorChangeListener(CompetitorChangeListener listener);
|
||||
|
||||
/**
|
||||
* Removes a listener from this competitor. The listener is also removed from the boat and the team.
|
||||
* Trying to remove a listener that is not currently in the set of this competitor's listener remains
|
||||
* without effect.
|
||||
*/
|
||||
void removeCompetitorChangeListener(CompetitorChangeListener listener);
|
||||
|
||||
/**
|
||||
* The default time-on-time handicap factor for this competitor. If <code>null</code>, no time-on-time handicap
|
||||
* factor is defined for this competitor. For a simple time-on-time scheme, the factor is multiplied with the actual
|
||||
* time sailed to obtain the corrected time. For a "performance line" system, afterwards an additional
|
||||
* distance-based allowance may be subtracted from the resulting time.
|
||||
* <p>
|
||||
*
|
||||
* A particular regatta can make specific arrangements and override this default value for this competitor in its
|
||||
* {@link RegattaLog}, accommodating for the fact that in between regattas competitors may get a new, different
|
||||
* rating, resulting in different handicaps for different regattas.
|
||||
*
|
||||
* @see #getTimeOnDistanceAllowancePerNauticalMile
|
||||
*/
|
||||
Double getTimeOnTimeFactor();
|
||||
|
||||
/**
|
||||
* The default time-on-distance time allowance for this competitor, used in handicap regattas. If <code>null</code>,
|
||||
* no time-on-distance allowance is defined for this competitor. For a simple time-on-distance scheme, the factor is
|
||||
* multiplied with the (windward) course length and the result is subtracted from the actual time sailed to obtain
|
||||
* the corrected time. For a "performance line" system, the actual time sailed will be multiplied with the
|
||||
* {@link #getTimeOnTimeFactor() time-on-time factor} before subtracting the time-on-distance allowance.
|
||||
* <p>
|
||||
*
|
||||
* A particular regatta can make specific arrangements and override this default value for this competitor in its
|
||||
* {@link RegattaLog}, accommodating for the fact that in between regattas competitors may get a new, different
|
||||
* rating, resulting in different handicaps for different regattas.
|
||||
*
|
||||
* @see #getTimeOnTimeFactor
|
||||
*/
|
||||
Duration getTimeOnDistanceAllowancePerNauticalMile();
|
||||
}
|
||||
+22
-22
@@ -1,22 +1,22 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public interface CompetitorChangeListener extends BoatChangeListener, NationalityChangeListener {
|
||||
void colorChanged(Color oldColor, Color newColor);
|
||||
|
||||
void nameChanged(String oldName, String newName);
|
||||
|
||||
void emailChanged(String oldEmail, String newEmail);
|
||||
|
||||
void searchTagChanged(String oldSearchTag, String newSearchTag);
|
||||
|
||||
void flagImageChanged(URI oldFlagImageURI, URI newFlagImageURI);
|
||||
|
||||
void timeOnTimeFactorChanged(Double oldTimeOnTimeFactor, Double newTimeOnTimeFactor);
|
||||
|
||||
void timeOnDistanceAllowancePerNauticalMileChanged(Duration oldTimeOnDistanceAllowancePerNauticalMile, Duration newTimeOnDistanceAllowancePerNauticalMile);
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public interface CompetitorChangeListener extends BoatChangeListener, NationalityChangeListener {
|
||||
void colorChanged(Color oldColor, Color newColor);
|
||||
|
||||
void nameChanged(String oldName, String newName);
|
||||
|
||||
void emailChanged(String oldEmail, String newEmail);
|
||||
|
||||
void searchTagChanged(String oldSearchTag, String newSearchTag);
|
||||
|
||||
void flagImageChanged(URI oldFlagImageURI, URI newFlagImageURI);
|
||||
|
||||
void timeOnTimeFactorChanged(Double oldTimeOnTimeFactor, Double newTimeOnTimeFactor);
|
||||
|
||||
void timeOnDistanceAllowancePerNauticalMileChanged(Duration oldTimeOnDistanceAllowancePerNauticalMile, Duration newTimeOnDistanceAllowancePerNauticalMile);
|
||||
}
|
||||
+33
-33
@@ -1,33 +1,33 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.DynamicBoat;
|
||||
import com.sap.sailing.domain.base.impl.DynamicTeam;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
/**
|
||||
* Base interface for classes managing a set of {@link Competitor} objects.
|
||||
*/
|
||||
public interface CompetitorFactory {
|
||||
/**
|
||||
* If a valid competitor is returned and the caller has information available that could be used to update the competitor,
|
||||
* the caller must check the result of {@link #isCompetitorToUpdateDuringGetOrCreate(Competitor)}, and if <code>true</code>,
|
||||
* must call {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)} to cause an update of the
|
||||
* competitor's values.
|
||||
*/
|
||||
Competitor getExistingCompetitorById(Serializable competitorId);
|
||||
|
||||
/**
|
||||
* Checks if the <code>competitor</code> shall be updated from the default provided by, e.g., a tracking infrastructure.
|
||||
* Callers of {@link #getExistingCompetitorById(Serializable)} or {@link #getExistingCompetitorByIdAsString(String)}
|
||||
* must call this method in case they retrieve a valid competitor by ID and have data available that can be used to update
|
||||
* the competitor.
|
||||
*/
|
||||
boolean isCompetitorToUpdateDuringGetOrCreate(Competitor result);
|
||||
|
||||
Competitor getOrCreateCompetitor(Serializable competitorId, String name, Color displayColor, String email,
|
||||
URI flagImageURI, DynamicTeam team, DynamicBoat boat, Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag);
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.DynamicBoat;
|
||||
import com.sap.sailing.domain.base.impl.DynamicTeam;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
/**
|
||||
* Base interface for classes managing a set of {@link Competitor} objects.
|
||||
*/
|
||||
public interface CompetitorFactory {
|
||||
/**
|
||||
* If a valid competitor is returned and the caller has information available that could be used to update the competitor,
|
||||
* the caller must check the result of {@link #isCompetitorToUpdateDuringGetOrCreate(Competitor)}, and if <code>true</code>,
|
||||
* must call {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)} to cause an update of the
|
||||
* competitor's values.
|
||||
*/
|
||||
Competitor getExistingCompetitorById(Serializable competitorId);
|
||||
|
||||
/**
|
||||
* Checks if the <code>competitor</code> shall be updated from the default provided by, e.g., a tracking infrastructure.
|
||||
* Callers of {@link #getExistingCompetitorById(Serializable)} or {@link #getExistingCompetitorByIdAsString(String)}
|
||||
* must call this method in case they retrieve a valid competitor by ID and have data available that can be used to update
|
||||
* the competitor.
|
||||
*/
|
||||
boolean isCompetitorToUpdateDuringGetOrCreate(Competitor result);
|
||||
|
||||
Competitor getOrCreateCompetitor(Serializable competitorId, String name, Color displayColor, String email,
|
||||
URI flagImageURI, DynamicTeam team, DynamicBoat boat, Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag);
|
||||
}
|
||||
+82
-82
@@ -1,82 +1,82 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.DynamicBoat;
|
||||
import com.sap.sailing.domain.base.impl.DynamicTeam;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
/**
|
||||
* Manages a set of {@link Competitor} objects. There may be a transient implementation based on a simple cache,
|
||||
* and there may be persistent implementations.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public interface CompetitorStore extends CompetitorFactory {
|
||||
public interface CompetitorUpdateListener {
|
||||
void competitorUpdated(Competitor competitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* If a valid competitor is returned and the caller has information available that could be used to update the competitor,
|
||||
* the caller must check the result of {@link #isCompetitorToUpdateDuringGetOrCreate(Competitor)}, and if <code>true</code>,
|
||||
* must call {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)} to cause an update of the
|
||||
* competitor's values.
|
||||
*/
|
||||
Competitor getExistingCompetitorByIdAsString(String idAsString);
|
||||
|
||||
/**
|
||||
* When a competitor is queried using {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)}
|
||||
* , and the competitor object for that ID already exists, it is generally returned unchanged, and the name, team
|
||||
* and boat parameters are not evaluated. This makes the data in this competitor store generally "write-once." This
|
||||
* method can be used to reset a competitor object to what a tracking provider or an external system supplies to
|
||||
* {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)}. After calling this method, the
|
||||
* next call to {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)} with
|
||||
* <code>competitor</code>'s {@link Competitor#getId() ID} will
|
||||
* {@link #updateCompetitor(String, String, String, Nationality)} the competitor in its updatable properties such as
|
||||
* the name, the sail ID and the nationality.
|
||||
*/
|
||||
void allowCompetitorResetToDefaults(Competitor competitor);
|
||||
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Removes all competitors from this store. Use with due care.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Obtains a non-live snapshot of the list of competitors managed by this store.
|
||||
*/
|
||||
Iterable<? extends Competitor> getCompetitors();
|
||||
|
||||
void removeCompetitor(Competitor competitor);
|
||||
|
||||
/**
|
||||
* Updates the competitor with {@link Competitor#getId() ID} <code>id</code> by setting the name, sail ID and nationality to
|
||||
* the values provided. Doing so will not fire any events nor will it replicate this change from a master to any replicas.
|
||||
* The calling client has to make sure that the changes applied will reach replicas and all other interested clients. It will
|
||||
* be sufficient to ensure that subsequent DTOs produced from the competitor modified will reflect the changes.<p>
|
||||
*
|
||||
* If no competitor with the ID requested is found, the call is a no-op, doing nothing, not even throwing an exception.
|
||||
*/
|
||||
Competitor updateCompetitor(String idAsString, String newName, Color newDisplayColor, String newEmail,
|
||||
String newSailId, Nationality newNationality, URI newTeamImageUri, URI newFlagImageUri,
|
||||
Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag);
|
||||
|
||||
void addCompetitors(Iterable<Competitor> competitors);
|
||||
|
||||
CompetitorDTO convertToCompetitorDTO(Competitor c);
|
||||
|
||||
/**
|
||||
* Listeners added here are notified whenever {@link #updateCompetitor(String, String, Color, String, Nationality)} is called
|
||||
* for any competitor in this store.
|
||||
*/
|
||||
void addCompetitorUpdateListener(CompetitorUpdateListener listener);
|
||||
|
||||
void removeCompetitorUpdateListener(CompetitorUpdateListener listener);
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.DynamicBoat;
|
||||
import com.sap.sailing.domain.base.impl.DynamicTeam;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
/**
|
||||
* Manages a set of {@link Competitor} objects. There may be a transient implementation based on a simple cache,
|
||||
* and there may be persistent implementations.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public interface CompetitorStore extends CompetitorFactory {
|
||||
public interface CompetitorUpdateListener {
|
||||
void competitorUpdated(Competitor competitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* If a valid competitor is returned and the caller has information available that could be used to update the competitor,
|
||||
* the caller must check the result of {@link #isCompetitorToUpdateDuringGetOrCreate(Competitor)}, and if <code>true</code>,
|
||||
* must call {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)} to cause an update of the
|
||||
* competitor's values.
|
||||
*/
|
||||
Competitor getExistingCompetitorByIdAsString(String idAsString);
|
||||
|
||||
/**
|
||||
* When a competitor is queried using {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)}
|
||||
* , and the competitor object for that ID already exists, it is generally returned unchanged, and the name, team
|
||||
* and boat parameters are not evaluated. This makes the data in this competitor store generally "write-once." This
|
||||
* method can be used to reset a competitor object to what a tracking provider or an external system supplies to
|
||||
* {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)}. After calling this method, the
|
||||
* next call to {@link #getOrCreateCompetitor(Serializable, String, DynamicTeam, DynamicBoat)} with
|
||||
* <code>competitor</code>'s {@link Competitor#getId() ID} will
|
||||
* {@link #updateCompetitor(String, String, String, Nationality)} the competitor in its updatable properties such as
|
||||
* the name, the sail ID and the nationality.
|
||||
*/
|
||||
void allowCompetitorResetToDefaults(Competitor competitor);
|
||||
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Removes all competitors from this store. Use with due care.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Obtains a non-live snapshot of the list of competitors managed by this store.
|
||||
*/
|
||||
Iterable<? extends Competitor> getCompetitors();
|
||||
|
||||
void removeCompetitor(Competitor competitor);
|
||||
|
||||
/**
|
||||
* Updates the competitor with {@link Competitor#getId() ID} <code>id</code> by setting the name, sail ID and nationality to
|
||||
* the values provided. Doing so will not fire any events nor will it replicate this change from a master to any replicas.
|
||||
* The calling client has to make sure that the changes applied will reach replicas and all other interested clients. It will
|
||||
* be sufficient to ensure that subsequent DTOs produced from the competitor modified will reflect the changes.<p>
|
||||
*
|
||||
* If no competitor with the ID requested is found, the call is a no-op, doing nothing, not even throwing an exception.
|
||||
*/
|
||||
Competitor updateCompetitor(String idAsString, String newName, Color newDisplayColor, String newEmail,
|
||||
String newSailId, Nationality newNationality, URI newTeamImageUri, URI newFlagImageUri,
|
||||
Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag);
|
||||
|
||||
void addCompetitors(Iterable<Competitor> competitors);
|
||||
|
||||
CompetitorDTO convertToCompetitorDTO(Competitor c);
|
||||
|
||||
/**
|
||||
* Listeners added here are notified whenever {@link #updateCompetitor(String, String, Color, String, Nationality)} is called
|
||||
* for any competitor in this store.
|
||||
*/
|
||||
void addCompetitorUpdateListener(CompetitorUpdateListener listener);
|
||||
|
||||
void removeCompetitorUpdateListener(CompetitorUpdateListener listener);
|
||||
}
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.NamedWithID;
|
||||
|
||||
public interface ControlPoint extends NamedWithID {
|
||||
Iterable<Mark> getMarks();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.NamedWithID;
|
||||
|
||||
public interface ControlPoint extends NamedWithID {
|
||||
Iterable<Mark> getMarks();
|
||||
}
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
public interface ControlPointWithTwoMarks extends ControlPoint {
|
||||
|
||||
Mark getLeft();
|
||||
|
||||
Mark getRight();
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
public interface ControlPointWithTwoMarks extends ControlPoint {
|
||||
|
||||
Mark getLeft();
|
||||
|
||||
Mark getRight();
|
||||
|
||||
}
|
||||
+17
-17
@@ -1,17 +1,17 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.NamedWithID;
|
||||
|
||||
/**
|
||||
* A named area in a sailing {@link Venue} where races take place. Usually, the areas carry names according to the NATO
|
||||
* alphabet, such as "Alpha", "Bravo" or "Charly".
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface CourseArea extends NamedWithID, IsManagedByCache<SharedDomainFactory> {
|
||||
UUID getId();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.NamedWithID;
|
||||
|
||||
/**
|
||||
* A named area in a sailing {@link Venue} where races take place. Usually, the areas carry names according to the NATO
|
||||
* alphabet, such as "Alpha", "Bravo" or "Charly".
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface CourseArea extends NamedWithID, IsManagedByCache<SharedDomainFactory> {
|
||||
UUID getId();
|
||||
}
|
||||
+50
-50
@@ -1,50 +1,50 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sse.common.Named;
|
||||
|
||||
/**
|
||||
* Base interface for courses consisting of all static information, which might be shared
|
||||
* by the server and an Android application.
|
||||
*/
|
||||
public interface CourseBase extends Named {
|
||||
/**
|
||||
* Clients can safely iterate over the resulting list because it's a copy which therefore won't reflect
|
||||
* waypoint additions and removals.
|
||||
*/
|
||||
List<Leg> getLegs();
|
||||
|
||||
/**
|
||||
* @return a non-live copy of the waypoints of this course; the creation of the copy is thread safe
|
||||
*/
|
||||
Iterable<Waypoint> getWaypoints();
|
||||
|
||||
/**
|
||||
* Starts searching at position <code>start</code> in {@link #getWaypoints()} for a waypoint
|
||||
* whose {@link Waypoint#getControlPoint() control point} is identical to <code>controlPoint</code>.
|
||||
* If no such waypoint is found, <code>null</code> is returned.
|
||||
*
|
||||
* @param start 0-based
|
||||
*/
|
||||
Waypoint getWaypointForControlPoint(ControlPoint controlPoint, int start);
|
||||
|
||||
/**
|
||||
* Position of the waypoint in {@link #getWaypoints()}, 0-based, or -1
|
||||
* if waypoint doesn't exist in {@link #getWaypoints()}.
|
||||
*/
|
||||
int getIndexOfWaypoint(Waypoint waypoint);
|
||||
|
||||
Waypoint getFirstWaypoint();
|
||||
|
||||
/**
|
||||
* @return the course's last waypoint if not empty, <code>null</code> otherwise. Acquires the course's read lock.
|
||||
*/
|
||||
Waypoint getLastWaypoint();
|
||||
|
||||
void addWaypoint(int zeroBasedPosition, Waypoint waypointToAdd);
|
||||
|
||||
void removeWaypoint(int zeroBasedPosition);
|
||||
|
||||
Leg getFirstLeg();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sse.common.Named;
|
||||
|
||||
/**
|
||||
* Base interface for courses consisting of all static information, which might be shared
|
||||
* by the server and an Android application.
|
||||
*/
|
||||
public interface CourseBase extends Named {
|
||||
/**
|
||||
* Clients can safely iterate over the resulting list because it's a copy which therefore won't reflect
|
||||
* waypoint additions and removals.
|
||||
*/
|
||||
List<Leg> getLegs();
|
||||
|
||||
/**
|
||||
* @return a non-live copy of the waypoints of this course; the creation of the copy is thread safe
|
||||
*/
|
||||
Iterable<Waypoint> getWaypoints();
|
||||
|
||||
/**
|
||||
* Starts searching at position <code>start</code> in {@link #getWaypoints()} for a waypoint
|
||||
* whose {@link Waypoint#getControlPoint() control point} is identical to <code>controlPoint</code>.
|
||||
* If no such waypoint is found, <code>null</code> is returned.
|
||||
*
|
||||
* @param start 0-based
|
||||
*/
|
||||
Waypoint getWaypointForControlPoint(ControlPoint controlPoint, int start);
|
||||
|
||||
/**
|
||||
* Position of the waypoint in {@link #getWaypoints()}, 0-based, or -1
|
||||
* if waypoint doesn't exist in {@link #getWaypoints()}.
|
||||
*/
|
||||
int getIndexOfWaypoint(Waypoint waypoint);
|
||||
|
||||
Waypoint getFirstWaypoint();
|
||||
|
||||
/**
|
||||
* @return the course's last waypoint if not empty, <code>null</code> otherwise. Acquires the course's read lock.
|
||||
*/
|
||||
Waypoint getLastWaypoint();
|
||||
|
||||
void addWaypoint(int zeroBasedPosition, Waypoint waypointToAdd);
|
||||
|
||||
void removeWaypoint(int zeroBasedPosition);
|
||||
|
||||
Leg getFirstLeg();
|
||||
}
|
||||
+34
-34
@@ -1,34 +1,34 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Named;
|
||||
|
||||
/**
|
||||
* For each fleet in a {@link Series} there is one {@link RaceDefinition race} per "race column." Competitor to fleet
|
||||
* assignment may vary per race in case of the fleets being unordered in their {@link Series}, or may be fixed in case
|
||||
* the fleets are ordered in their {@link Series}, as usually the case in finals and medal series.
|
||||
* <p>
|
||||
*
|
||||
* Fleets within the same {@link Series} as well as all fleets within the same {@link RaceColumn#getFleets() RaceColumn}
|
||||
* can be mutually compared to each other. Comparing fleets from different series produces undefined results. For a
|
||||
* {@link Series}, either all distinct fleets compare different (a series with ordered fleets such as Gold, Silver), or
|
||||
* all distinct fleets compare equal (e.g., for a qualifying series with fleets Yellow and Blue).
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface Fleet extends Named, Comparable<Fleet> {
|
||||
|
||||
/**
|
||||
* The comparability is implemented by an integer field. For fleets of a series to compare equal, the constructor
|
||||
* without this ordering criterion should be chosen (implicitly setting it to 0).
|
||||
*/
|
||||
int getOrdering();
|
||||
|
||||
/**
|
||||
* The color associated with the fleet.
|
||||
* Normally each fleet gets a color code to distinguish between the fleets like 'blue', 'yellow' etc.
|
||||
* @return
|
||||
*/
|
||||
Color getColor();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Named;
|
||||
|
||||
/**
|
||||
* For each fleet in a {@link Series} there is one {@link RaceDefinition race} per "race column." Competitor to fleet
|
||||
* assignment may vary per race in case of the fleets being unordered in their {@link Series}, or may be fixed in case
|
||||
* the fleets are ordered in their {@link Series}, as usually the case in finals and medal series.
|
||||
* <p>
|
||||
*
|
||||
* Fleets within the same {@link Series} as well as all fleets within the same {@link RaceColumn#getFleets() RaceColumn}
|
||||
* can be mutually compared to each other. Comparing fleets from different series produces undefined results. For a
|
||||
* {@link Series}, either all distinct fleets compare different (a series with ordered fleets such as Gold, Silver), or
|
||||
* all distinct fleets compare equal (e.g., for a qualifying series with fleets Yellow and Blue).
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface Fleet extends Named, Comparable<Fleet> {
|
||||
|
||||
/**
|
||||
* The comparability is implemented by an integer field. For fleets of a series to compare equal, the constructor
|
||||
* without this ordering criterion should be chosen (implicitly setting it to 0).
|
||||
*/
|
||||
int getOrdering();
|
||||
|
||||
/**
|
||||
* The color associated with the fleet.
|
||||
* Normally each fleet gets a color code to distinguish between the fleets like 'blue', 'yellow' etc.
|
||||
* @return
|
||||
*/
|
||||
Color getColor();
|
||||
}
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
public interface LeaderboardChangeListener {
|
||||
void nameChanged(String oldName, String newName);
|
||||
void displayNameChanged(String oldDisplayName, String newDisplayName);
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
public interface LeaderboardChangeListener {
|
||||
void nameChanged(String oldName, String newName);
|
||||
void displayNameChanged(String oldDisplayName, String newDisplayName);
|
||||
}
|
||||
+24
-24
@@ -1,24 +1,24 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* When two legs are compared, their natural order is by the index of their {@link #getFrom() start waypoint} in the
|
||||
* {@link Course} to which they belong. A leg closer to the beginning of the course ranks "less" than one that is closer
|
||||
* to the end of the course.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface Leg extends Serializable, Comparable<Leg> {
|
||||
Waypoint getFrom();
|
||||
|
||||
Waypoint getTo();
|
||||
|
||||
/**
|
||||
* The index of this leg's {@link #getFrom() start waypoint} in the sequence of the
|
||||
* {@link Course}'s {@link Course#getWaypoints waypoints}. The first waypoint in
|
||||
* the course has index 0.
|
||||
*/
|
||||
int getZeroBasedIndexOfStartWaypoint();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* When two legs are compared, their natural order is by the index of their {@link #getFrom() start waypoint} in the
|
||||
* {@link Course} to which they belong. A leg closer to the beginning of the course ranks "less" than one that is closer
|
||||
* to the end of the course.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface Leg extends Serializable, Comparable<Leg> {
|
||||
Waypoint getFrom();
|
||||
|
||||
Waypoint getTo();
|
||||
|
||||
/**
|
||||
* The index of this leg's {@link #getFrom() start waypoint} in the sequence of the
|
||||
* {@link Course}'s {@link Course#getWaypoints waypoints}. The first waypoint in
|
||||
* the course has index 0.
|
||||
*/
|
||||
int getZeroBasedIndexOfStartWaypoint();
|
||||
}
|
||||
+20
-20
@@ -1,20 +1,20 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sailing.domain.common.MarkType;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
|
||||
|
||||
/**
|
||||
* A marks name is used as its ID which is only identifying the mark uniquely within a single race or course
|
||||
* definition.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface Mark extends ControlPoint, IsManagedByCache<SharedDomainFactory> {
|
||||
public Color getColor();
|
||||
public String getShape();
|
||||
public String getPattern();
|
||||
public MarkType getType();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sailing.domain.common.MarkType;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
|
||||
|
||||
/**
|
||||
* A marks name is used as its ID which is only identifying the mark uniquely within a single race or course
|
||||
* definition.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public interface Mark extends ControlPoint, IsManagedByCache<SharedDomainFactory> {
|
||||
public Color getColor();
|
||||
public String getShape();
|
||||
public String getPattern();
|
||||
public MarkType getType();
|
||||
}
|
||||
+13
-13
@@ -1,13 +1,13 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.CountryCode;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.Named;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface Nationality extends Named, IsManagedByCache<SharedDomainFactory> {
|
||||
@Dimension(messageKey="Acronym")
|
||||
String getThreeLetterIOCAcronym();
|
||||
|
||||
CountryCode getCountryCode();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sse.common.CountryCode;
|
||||
import com.sap.sse.common.IsManagedByCache;
|
||||
import com.sap.sse.common.Named;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface Nationality extends Named, IsManagedByCache<SharedDomainFactory> {
|
||||
@Dimension(messageKey="Acronym")
|
||||
String getThreeLetterIOCAcronym();
|
||||
|
||||
CountryCode getCountryCode();
|
||||
}
|
||||
+9
-9
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sse.common.Named;
|
||||
|
||||
public interface Person extends Named, WithNationality, WithDescription {
|
||||
Date getDateOfBirth();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sse.common.Named;
|
||||
|
||||
public interface Person extends Named, WithNationality, WithDescription {
|
||||
Date getDateOfBirth();
|
||||
}
|
||||
+37
-37
@@ -1,37 +1,37 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sailing.domain.common.Renamable;
|
||||
|
||||
/**
|
||||
* Base interface for series consisting of static information describing the Series.
|
||||
*/
|
||||
public interface SeriesBase extends Renamable {
|
||||
|
||||
/**
|
||||
* Returns the fleets of this series, in ascending order, better fleets first.
|
||||
*/
|
||||
Iterable<? extends Fleet> getFleets();
|
||||
|
||||
/**
|
||||
* Tells whether this is the "last" / "medal" race series, usually having only one race. This may have implications
|
||||
* on the scoring scheme (usually, medal races scores are doubled and cannot be discarded).
|
||||
*/
|
||||
boolean isMedal();
|
||||
|
||||
/**
|
||||
* For a multi-{@link #getFleets() fleet} series, the races of different fleets may or may not run in parallel. If
|
||||
* they can not run in parallel, the fleet's ordering as returned by {@link #getFleets()} is assumed to be the order
|
||||
* in which the fleets' races are to be run.
|
||||
* <p>
|
||||
*
|
||||
* For example, if a league event defines a series with three fleets, Yellow, Blue and Red, and does not allow for
|
||||
* parallel fleet races and the series has race columns F1, F2, ..., then the execution order of those races is
|
||||
* assumed to be F1-Yellow, F1-Blue, F1-Red, F2-Yellow, F2-Blue, F2-Red, ...
|
||||
* <p>
|
||||
*
|
||||
* If the fleets are allowed to run their races in parallel, no assumption about the race execution order can be
|
||||
* made except that within a fleet the races are usually run in the order as defined by the {@link #getRaceColumns()
|
||||
* race columns}.
|
||||
*/
|
||||
boolean isFleetsCanRunInParallel();
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import com.sap.sailing.domain.common.Renamable;
|
||||
|
||||
/**
|
||||
* Base interface for series consisting of static information describing the Series.
|
||||
*/
|
||||
public interface SeriesBase extends Renamable {
|
||||
|
||||
/**
|
||||
* Returns the fleets of this series, in ascending order, better fleets first.
|
||||
*/
|
||||
Iterable<? extends Fleet> getFleets();
|
||||
|
||||
/**
|
||||
* Tells whether this is the "last" / "medal" race series, usually having only one race. This may have implications
|
||||
* on the scoring scheme (usually, medal races scores are doubled and cannot be discarded).
|
||||
*/
|
||||
boolean isMedal();
|
||||
|
||||
/**
|
||||
* For a multi-{@link #getFleets() fleet} series, the races of different fleets may or may not run in parallel. If
|
||||
* they can not run in parallel, the fleet's ordering as returned by {@link #getFleets()} is assumed to be the order
|
||||
* in which the fleets' races are to be run.
|
||||
* <p>
|
||||
*
|
||||
* For example, if a league event defines a series with three fleets, Yellow, Blue and Red, and does not allow for
|
||||
* parallel fleet races and the series has race columns F1, F2, ..., then the execution order of those races is
|
||||
* assumed to be F1-Yellow, F1-Blue, F1-Red, F2-Yellow, F2-Blue, F2-Red, ...
|
||||
* <p>
|
||||
*
|
||||
* If the fleets are allowed to run their races in parallel, no assumption about the race execution order can be
|
||||
* made except that within a fleet the races are usually run in the order as defined by the {@link #getRaceColumns()
|
||||
* race columns}.
|
||||
*/
|
||||
boolean isFleetsCanRunInParallel();
|
||||
}
|
||||
+116
-116
@@ -1,116 +1,116 @@
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogResolver;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.common.MarkType;
|
||||
import com.sap.sailing.domain.common.PassingInstruction;
|
||||
import com.sap.sse.common.Color;
|
||||
|
||||
public interface SharedDomainFactory extends CompetitorFactory {
|
||||
|
||||
/**
|
||||
* Looks up or, if not found, creates a {@link Nationality} object and re-uses <code>threeLetterIOCCode</code> also as the
|
||||
* nationality's name.
|
||||
*/
|
||||
Nationality getOrCreateNationality(String threeLetterIOCCode);
|
||||
|
||||
/**
|
||||
* The name will also be used as the mark's ID. If you have a unique ID, use {@link #getOrCreateMark(Serializable, String)} instead.
|
||||
*/
|
||||
Mark getOrCreateMark(String name);
|
||||
|
||||
/**
|
||||
* Since some ID types, such as {@link UUID}, cannot be serialized as objects to a GWT client, only the
|
||||
* {@link Object#toString()} representations of those IDs are serialized to the clients. When a client then requests
|
||||
* to identify a mark again, only the ID's string representation will be submitted to the server and now needs to be
|
||||
* mapped to the actual ID. This domain factory keeps a mapping of all mark ID's string representations to the
|
||||
* actual ID for all marks ever managed through any of the <code>getOrCreateMark(...)</code> overloads.
|
||||
* <p>
|
||||
*
|
||||
* This method first looks up the actual ID whose string representation is <code>toStringRepresentationOfID</code>
|
||||
* and then calls {@link #getOrCreateMark(Serializable, String)} with the result and the <code>name</code>
|
||||
* parameter, or with <code>ToStringRepresentationOfID</code> and <code>name</code> in case the string
|
||||
* representation of the ID is not known. So in the latter case, the string is used as the ID for the new mark.
|
||||
*/
|
||||
Mark getOrCreateMark(String toStringRepresentationOfID, String name);
|
||||
|
||||
Mark getOrCreateMark(Serializable id, String name);
|
||||
|
||||
/**
|
||||
* If the single mark with ID <code>id</code> already exists, it is returned. Its color may differ from <code>color</code>
|
||||
* in that case. Otherwise, a new {@link Mark} is created with <code>color</code> as its {@link Mark#getColor()}
|
||||
* and <code>shape</code> as its {@link Mark#getShape()}.
|
||||
*/
|
||||
Mark getOrCreateMark(Serializable id, String name, MarkType type, Color color, String shape, String pattern);
|
||||
|
||||
/**
|
||||
* @see #getOrCreateMark(String, String)
|
||||
*/
|
||||
Mark getOrCreateMark(String toStringRepresentationOfID, String name, MarkType type, Color color, String shape, String pattern);
|
||||
|
||||
/**
|
||||
* @param name also uses the name as the gate's ID; if you have a real ID, use {@link #createControlPointWithTwoMarks(Serializable, Mark, Mark, String)} instead
|
||||
*/
|
||||
ControlPointWithTwoMarks createControlPointWithTwoMarks(Mark left, Mark right, String name);
|
||||
|
||||
ControlPointWithTwoMarks createControlPointWithTwoMarks(Serializable id, Mark left, Mark right, String name);
|
||||
|
||||
/**
|
||||
* The waypoint created is weakly cached so that when requested again by
|
||||
* {@link #getExistingWaypointById(Waypoint)} it is found.
|
||||
*/
|
||||
Waypoint createWaypoint(ControlPoint controlPoint, PassingInstruction passingInstruction);
|
||||
|
||||
Waypoint getExistingWaypointById(Waypoint waypointPrototype);
|
||||
|
||||
/**
|
||||
* Atomically checks if a waypoint by an equal {@link Waypoint#getId()} as <code>waypoint</code> exists in this domain factory's
|
||||
* waypoint cache. If so, the cached waypoint is returned. Otherwise, <code>waypoint</code> is added to the cache and returned.
|
||||
*/
|
||||
Waypoint getExistingWaypointByIdOrCache(Waypoint waypoint);
|
||||
|
||||
BoatClass getOrCreateBoatClass(String name, boolean typicallyStartsUpwind);
|
||||
|
||||
/**
|
||||
* Like {@link #getOrCreateBoatClass(String, boolean)}, only that a default for <code>typicallyStartsUpwind</code> based
|
||||
* on the boat class name is calculated.
|
||||
*/
|
||||
BoatClass getOrCreateBoatClass(String name);
|
||||
|
||||
/**
|
||||
* Gets the {@link CompetitorStore} of this {@link SharedDomainFactory}.
|
||||
*/
|
||||
CompetitorStore getCompetitorStore();
|
||||
|
||||
/**
|
||||
* If a {@link CourseArea} with the given id already exists, it is returned. Otherwise a new {@link CourseArea}
|
||||
* is created.
|
||||
*/
|
||||
CourseArea getOrCreateCourseArea(UUID id, String name);
|
||||
|
||||
/**
|
||||
* Gets the {@link CourseArea} with passed id; if there is no such {@link CourseArea} <code>null</code> will be returned.
|
||||
*/
|
||||
CourseArea getExistingCourseAreaById(Serializable courseAreaId);
|
||||
|
||||
/**
|
||||
* Hm.
|
||||
*/
|
||||
DeviceConfigurationMatcher getOrCreateDeviceConfigurationMatcher(List<String> clientIdentifiers);
|
||||
|
||||
Mark getExistingMarkByIdAsString(String toStringRepresentationOfID);
|
||||
|
||||
Mark getExistingMarkById(Serializable id);
|
||||
|
||||
ControlPointWithTwoMarks getOrCreateControlPointWithTwoMarks(Serializable id, String name, Mark left, Mark right);
|
||||
|
||||
ControlPointWithTwoMarks getOrCreateControlPointWithTwoMarks(String id, String name, Mark left, Mark right);
|
||||
|
||||
RaceLogResolver getRaceLogResolver();
|
||||
|
||||
Mark getOrCreateMark(String name, MarkType markType);
|
||||
}
|
||||
package com.sap.sailing.domain.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogResolver;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.common.MarkType;
|
||||
import com.sap.sailing.domain.common.PassingInstruction;
|
||||
import com.sap.sse.common.Color;
|
||||
|
||||
public interface SharedDomainFactory extends CompetitorFactory {
|
||||
|
||||
/**
|
||||
* Looks up or, if not found, creates a {@link Nationality} object and re-uses <code>threeLetterIOCCode</code> also as the
|
||||
* nationality's name.
|
||||
*/
|
||||
Nationality getOrCreateNationality(String threeLetterIOCCode);
|
||||
|
||||
/**
|
||||
* The name will also be used as the mark's ID. If you have a unique ID, use {@link #getOrCreateMark(Serializable, String)} instead.
|
||||
*/
|
||||
Mark getOrCreateMark(String name);
|
||||
|
||||
/**
|
||||
* Since some ID types, such as {@link UUID}, cannot be serialized as objects to a GWT client, only the
|
||||
* {@link Object#toString()} representations of those IDs are serialized to the clients. When a client then requests
|
||||
* to identify a mark again, only the ID's string representation will be submitted to the server and now needs to be
|
||||
* mapped to the actual ID. This domain factory keeps a mapping of all mark ID's string representations to the
|
||||
* actual ID for all marks ever managed through any of the <code>getOrCreateMark(...)</code> overloads.
|
||||
* <p>
|
||||
*
|
||||
* This method first looks up the actual ID whose string representation is <code>toStringRepresentationOfID</code>
|
||||
* and then calls {@link #getOrCreateMark(Serializable, String)} with the result and the <code>name</code>
|
||||
* parameter, or with <code>ToStringRepresentationOfID</code> and <code>name</code> in case the string
|
||||
* representation of the ID is not known. So in the latter case, the string is used as the ID for the new mark.
|
||||
*/
|
||||
Mark getOrCreateMark(String toStringRepresentationOfID, String name);
|
||||
|
||||
Mark getOrCreateMark(Serializable id, String name);
|
||||
|
||||
/**
|
||||
* If the single mark with ID <code>id</code> already exists, it is returned. Its color may differ from <code>color</code>
|
||||
* in that case. Otherwise, a new {@link Mark} is created with <code>color</code> as its {@link Mark#getColor()}
|
||||
* and <code>shape</code> as its {@link Mark#getShape()}.
|
||||
*/
|
||||
Mark getOrCreateMark(Serializable id, String name, MarkType type, Color color, String shape, String pattern);
|
||||
|
||||
/**
|
||||
* @see #getOrCreateMark(String, String)
|
||||
*/
|
||||
Mark getOrCreateMark(String toStringRepresentationOfID, String name, MarkType type, Color color, String shape, String pattern);
|
||||
|
||||
/**
|
||||
* @param name also uses the name as the gate's ID; if you have a real ID, use {@link #createControlPointWithTwoMarks(Serializable, Mark, Mark, String)} instead
|
||||
*/
|
||||
ControlPointWithTwoMarks createControlPointWithTwoMarks(Mark left, Mark right, String name);
|
||||
|
||||
ControlPointWithTwoMarks createControlPointWithTwoMarks(Serializable id, Mark left, Mark right, String name);
|
||||
|
||||
/**
|
||||
* The waypoint created is weakly cached so that when requested again by
|
||||
* {@link #getExistingWaypointById(Waypoint)} it is found.
|
||||
*/
|
||||
Waypoint createWaypoint(ControlPoint controlPoint, PassingInstruction passingInstruction);
|
||||
|
||||
Waypoint getExistingWaypointById(Waypoint waypointPrototype);
|
||||
|
||||
/**
|
||||
* Atomically checks if a waypoint by an equal {@link Waypoint#getId()} as <code>waypoint</code> exists in this domain factory's
|
||||
* waypoint cache. If so, the cached waypoint is returned. Otherwise, <code>waypoint</code> is added to the cache and returned.
|
||||
*/
|
||||
Waypoint getExistingWaypointByIdOrCache(Waypoint waypoint);
|
||||
|
||||
BoatClass getOrCreateBoatClass(String name, boolean typicallyStartsUpwind);
|
||||
|
||||
/**
|
||||
* Like {@link #getOrCreateBoatClass(String, boolean)}, only that a default for <code>typicallyStartsUpwind</code> based
|
||||
* on the boat class name is calculated.
|
||||
*/
|
||||
BoatClass getOrCreateBoatClass(String name);
|
||||
|
||||
/**
|
||||
* Gets the {@link CompetitorStore} of this {@link SharedDomainFactory}.
|
||||
*/
|
||||
CompetitorStore getCompetitorStore();
|
||||
|
||||
/**
|
||||
* If a {@link CourseArea} with the given id already exists, it is returned. Otherwise a new {@link CourseArea}
|
||||
* is created.
|
||||
*/
|
||||
CourseArea getOrCreateCourseArea(UUID id, String name);
|
||||
|
||||
/**
|
||||
* Gets the {@link CourseArea} with passed id; if there is no such {@link CourseArea} <code>null</code> will be returned.
|
||||
*/
|
||||
CourseArea getExistingCourseAreaById(Serializable courseAreaId);
|
||||
|
||||
/**
|
||||
* Hm.
|
||||
*/
|
||||
DeviceConfigurationMatcher getOrCreateDeviceConfigurationMatcher(List<String> clientIdentifiers);
|
||||
|
||||
Mark getExistingMarkByIdAsString(String toStringRepresentationOfID);
|
||||
|
||||
Mark getExistingMarkById(Serializable id);
|
||||
|
||||
ControlPointWithTwoMarks getOrCreateControlPointWithTwoMarks(Serializable id, String name, Mark left, Mark right);
|
||||
|
||||
ControlPointWithTwoMarks getOrCreateControlPointWithTwoMarks(String id, String name, Mark left, Mark right);
|
||||
|
||||
RaceLogResolver getRaceLogResolver();
|
||||
|
||||
Mark getOrCreateMark(String name, MarkType markType);
|
||||
}
|
||||
Loaded 100 of 2780 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user