Added abstraction for tracks, which are mapped to a specific items

This commit is contained in:
Benjamin Barth committed 2016-07-27 15:52:29 +02:00
1 parent df4710f34a
commit 187d0e9271
4 files changed
+110

No files matched your search

@@ -0,0 +1,20 @@
package com.sap.sailing.domain.tracking;
import com.sap.sse.common.Timed;
/**
* {@link Track} specialization, which is mapped to a specific type of items.
*
* @param <ItemType>
* the type of item this track is mapped to
* @param <FixType>
* the type of fix that is contained in this track
*/
public interface MappedTrack<ItemType, FixType extends Timed> extends Track<FixType> {
/**
* @return the item this track is mapped to.
*/
ItemType getTrackedItem();
}
@@ -0,0 +1,39 @@
package com.sap.sailing.domain.tracking.impl;
import com.sap.sailing.domain.tracking.MappedTrack;
import com.sap.sse.common.Timed;
import com.sap.sse.util.impl.ArrayListNavigableSet;
/**
* Default implementation of {@link MappedTrack} interface.
*
* @param <ItemType>
* the type of item this track is mapped to
* @param <FixType>
* the type of fix that is contained in this track
*/
public class MappedTrackImpl<ItemType, FixType extends Timed> extends TrackImpl<FixType>
implements MappedTrack<ItemType, FixType> {
private static final long serialVersionUID = 6165693342087329096L;
private final ItemType trackedItem;
/** @see TrackImpl#TrackImpl(String) */
public MappedTrackImpl(ItemType trackedItem, String nameForReadWriteLock) {
super(nameForReadWriteLock);
this.trackedItem = trackedItem;
}
/** @see TrackImpl#TrackImpl(ArrayListNavigableSet, String) */
protected MappedTrackImpl(ItemType trackedItem, ArrayListNavigableSet<Timed> fixes, String nameForReadWriteLock) {
super(fixes, nameForReadWriteLock);
this.trackedItem = trackedItem;
}
@Override
public ItemType getTrackedItem() {
return trackedItem;
}
}