Added JavaDocs for SensorFixTrack/BravoFixTrack related classes

This commit is contained in:
Steffen Schaefer committed 2016-06-23 12:04:56 +02:00
1 parent 3c9f31eb3b
commit ec3c8d42ea
7 files changed
+94

No files matched your search

@@ -6,10 +6,33 @@ import com.sap.sailing.domain.common.tracking.BravoFix;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.WithID;
/**
* Specific {@link SensorFixTrack} for {@link BravoFix}es.
*
* @param <ItemType> the type of item mapped by this track
*/
public interface BravoFixTrack<ItemType extends WithID & Serializable> extends SensorFixTrack<ItemType, BravoFix> {
public static final String TRACK_NAME = "BravoFixTrack";
/**
* Calculates the ride height for a specific {@link TimePoint}
*
* @param timePoint
* the {@link TimePoint} to get the ride height for. Must not be <code>null</code>.
* @return the ride height for the given {@link TimePoint} or <code>null</code> if the {@link TimePoint} is not in the range
* where we have fixes for.
*/
Double getRideHeight(TimePoint timePoint);
/**
* Calculates the average ride height for the given time range.
*
* @param from
* the lower bound of the time range to get the ride height for. Must not be <code>null</code>.
* @param to
* the upper bound of the time range to get the ride height for. Must not be <code>null</code>.
* @return the average ride height for the given time range or <code>null</code> if there are no fixes in the given
* time range.
*/
Double getAverageRideHeight(TimePoint from, TimePoint to);
}
@@ -5,6 +5,11 @@ import java.io.Serializable;
import com.sap.sailing.domain.common.tracking.BravoFix;
import com.sap.sse.common.WithID;
/**
* Mutable/dynamic version of {@link BravoFixTrack}.
*
* @param <ItemType> the type of item this track is mapped to
*/
public interface DynamicBravoFixTrack<ItemType extends WithID & Serializable> extends BravoFixTrack<ItemType>,
DynamicSensorFixTrack<ItemType, BravoFix> {
}
@@ -5,6 +5,12 @@ import java.io.Serializable;
import com.sap.sailing.domain.common.tracking.SensorFix;
import com.sap.sse.common.WithID;
/**
* Mutable/dynamic version of {@link SensorFixTrack}.
*
* @param <ItemType> the type of item this track is mapped to
* @param <FixT> the type of fix that is contained in this track
*/
public interface DynamicSensorFixTrack<ItemType extends WithID & Serializable, FixT extends SensorFix> extends
SensorFixTrack<ItemType, FixT>, DynamicTrack<FixT> {
@@ -5,16 +5,33 @@ import java.io.Serializable;
import com.sap.sailing.domain.common.tracking.SensorFix;
import com.sap.sse.common.WithID;
/**
* {@link Track} that holds {@link SensorFix} instances.
*
* As {@link SensorFix}es allow value name based access, the track provides the supported value names.
*
* @param <ItemType> the type of item this track is mapped to
* @param <FixT> the type of fix that is contained in this track
*/
public interface SensorFixTrack<ItemType extends WithID & Serializable, FixT extends SensorFix> extends Track<FixT> {
/**
* @return the value names that fixes contained in this track support
*/
Iterable<String> getValueNames();
void addListener(SensorFixTrackListener<ItemType, FixT> listener);
void removeListener(SensorFixTrackListener<ItemType, FixT> listener);
/**
* @return the item this tracked is mapped to.
*/
ItemType getTrackedItem();
/**
* @return the associated track name by which this track can be obtained from the {@link TrackedRace}.
*/
String getTrackName();
}
@@ -2,8 +2,25 @@ package com.sap.sailing.domain.tracking;
import com.sap.sailing.domain.common.tracking.SensorFix;
/**
* Listener to observe a {@link com.sap.sailing.domain.tracking.SensorFixTrack} to get informed whenever a new fix is
* being added to the track.
*
* @param <ItemType>
* the type of item the {@link com.sap.sailing.domain.tracking.SensorFixTrack} is mapped to
* @param <FixType>
* the type of fix the {@link com.sap.sailing.domain.tracking.SensorFixTrack} contains
*/
public interface SensorFixTrackListener<ItemType, FixType extends SensorFix> extends TrackListener {
/**
* Called whenever a new fix is added to the {@link com.sap.sailing.domain.tracking.SensorFixTrack} the listener observes.
*
* @param fix the new fix
* @param item the item the track is mapped to
* @param trackName the name of the track
* @param firstFixInTrack <code>true</code> if the new fix is the first one that's added to the track, <code>false</code> otherwise.
*/
void fixReceived(FixType fix, ItemType item, String trackName, boolean firstFixInTrack);
}
@@ -9,13 +9,25 @@ import com.sap.sailing.domain.common.sensordata.BravoSensorDataMetadata;
import com.sap.sailing.domain.common.tracking.BravoFix;
import com.sap.sailing.domain.tracking.BravoFixTrack;
import com.sap.sailing.domain.tracking.DynamicBravoFixTrack;
import com.sap.sailing.domain.tracking.TrackedRace;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.WithID;
/**
* Specific {@link SensorFixTrackImpl} used for {@link BravoFix}es.
*
* @param <ItemType> the type of item this track is mapped to
*/
public class BravoFixTrackImpl<ItemType extends WithID & Serializable> extends SensorFixTrackImpl<ItemType, BravoFix>
implements DynamicBravoFixTrack<ItemType> {
private static final long serialVersionUID = 5517848726456424386L;
/**
* @param trackedItem
* the item this track is mapped to
* @param trackName
* the name of the track by which it can be obtained from the {@link TrackedRace}.
*/
public BravoFixTrackImpl(ItemType trackedItem, String trackName) {
super(trackedItem, trackName, BravoSensorDataMetadata.INSTANCE.getColumns(),
BravoFixTrack.TRACK_NAME + " for " + trackedItem);
@@ -5,9 +5,17 @@ import java.util.function.Consumer;
import com.sap.sailing.domain.common.tracking.SensorFix;
import com.sap.sailing.domain.tracking.DynamicSensorFixTrack;
import com.sap.sailing.domain.tracking.SensorFixTrack;
import com.sap.sailing.domain.tracking.SensorFixTrackListener;
import com.sap.sailing.domain.tracking.TrackedRace;
import com.sap.sse.common.WithID;
/**
* Implementation of {@link SensorFixTrack} and {@link DynamicSensorFixTrack}.
*
* @param <ItemType> the type of item this track is mapped to
* @param <FixT> the type of fix this track holds
*/
public class SensorFixTrackImpl<ItemType extends WithID & Serializable, FixT extends SensorFix> extends
DynamicTrackImpl<FixT> implements DynamicSensorFixTrack<ItemType, FixT> {
@@ -18,6 +26,12 @@ public class SensorFixTrackImpl<ItemType extends WithID & Serializable, FixT ext
private final String trackName;
private final TrackListenerCollection<ItemType, FixT, SensorFixTrackListener<ItemType, FixT>> listeners;
/**
* @param trackedItem the item this track is mapped to
* @param trackName the name of the track by which it can be obtained from the {@link TrackedRace}.
* @param valueNames the name of the values that can be obtained by fixes contained in the track
* @param nameForReadWriteLock the name to use for the lock object that is used internally
*/
public SensorFixTrackImpl(ItemType trackedItem, String trackName, Iterable<String> valueNames,
String nameForReadWriteLock) {
super(nameForReadWriteLock);