fc5cd0044710782b1deaddf1c447c3f69091b84d
java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/impl/DomainObjectFactoryImpl.java
| ... | ... | @@ -3366,17 +3366,15 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory { |
| 3366 | 3366 | final ManeuverCurveBoundaries mainCurveBoundaries = loadManeuverCurveBoundaries((Document) maneuverDoc.get(FieldNames.MAIN_CURVE_BOUNDARIES.name())); |
| 3367 | 3367 | final ManeuverCurveBoundaries maneuverCurveWithStableSpeedAndCourseBoundaries = loadManeuverCurveBoundaries((Document) maneuverDoc.get(FieldNames.MANEUVER_CURVE_WITH_STABLE_SPEED_AND_COURSE_BOUNDERIES.name())); |
| 3368 | 3368 | final ManeuverLoss maneuverLoss = loadManeuverLoss((Document) maneuverDoc.get(FieldNames.MANEUVER_LOSS.name())); |
| 3369 | - final MarkPassingProxy markPassingProxy = new MarkPassingProxy(timePoint, waypointIndex, competitor.getId(), trackedRace );// wie kommt man auf das Race? |
|
| 3370 | - final Maneuver maneuver; |
|
| 3369 | + final MarkPassing markPassing; |
|
| 3371 | 3370 | if (waypointIndex == -1) { |
| 3372 | - maneuver = new ManeuverWithMainCurveBoundariesImpl(type, newTack, position, timePoint, mainCurveBoundaries, maneuverCurveWithStableSpeedAndCourseBoundaries, |
|
| 3373 | - maxTurningRateInDegreesPerSecond, /* mark passing */ null, maneuverLoss); |
|
| 3371 | + markPassing = null; |
|
| 3374 | 3372 | } else { |
| 3375 | - final MarkPassing markpassing = new MarkPassingImpl(timePoint, markPassingProxy.getWaypoint(), competitor); |
|
| 3376 | - maneuver = new ManeuverWithMainCurveBoundariesImpl(type, newTack, position, timePoint, mainCurveBoundaries, maneuverCurveWithStableSpeedAndCourseBoundaries, |
|
| 3377 | - maxTurningRateInDegreesPerSecond, markpassing, maneuverLoss); |
|
| 3373 | + markPassing = new MarkPassingProxy(timePoint, waypointIndex, competitor.getId(), trackedRace); |
|
| 3378 | 3374 | } |
| 3379 | - return maneuver; |
|
| 3375 | + return new ManeuverWithMainCurveBoundariesImpl(type, newTack, position, timePoint, mainCurveBoundaries, |
|
| 3376 | + maneuverCurveWithStableSpeedAndCourseBoundaries, maxTurningRateInDegreesPerSecond, markPassing, |
|
| 3377 | + maneuverLoss); |
|
| 3380 | 3378 | } |
| 3381 | 3379 | |
| 3382 | 3380 | private ManeuverLoss loadManeuverLoss(Document document) { |
java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/impl/MongoObjectFactoryImpl.java
| ... | ... | @@ -2043,21 +2043,21 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory { |
| 2043 | 2043 | final Document competitorManeuver = new Document(); |
| 2044 | 2044 | competitorManeuver.put(FieldNames.COMPETITOR_ID.name(), e.getKey().getId()); |
| 2045 | 2045 | final List<Document> maneuverList = new ArrayList<>(); |
| 2046 | - for (final Maneuver f : e.getValue()) { |
|
| 2046 | + for (final Maneuver maneuver : e.getValue()) { |
|
| 2047 | 2047 | final Document maneuverDoc = new Document(); |
| 2048 | - maneuverDoc.put(FieldNames.TYPE.name(), f.getType().name()); |
|
| 2049 | - maneuverDoc.put(FieldNames.TACK.name(), f.getNewTack().name()); |
|
| 2050 | - maneuverDoc.put(FieldNames.POSITION_LAT_RAD.name(), f.getPosition().getLatRad()); |
|
| 2051 | - maneuverDoc.put(FieldNames.POSITION_LNG_RAD.name(), f.getPosition().getLngRad()); |
|
| 2052 | - maneuverDoc.put(FieldNames.TIMEPOINT.name(), f.getTimePoint().asMillis()); |
|
| 2048 | + maneuverDoc.put(FieldNames.TYPE.name(), maneuver.getType().name()); |
|
| 2049 | + maneuverDoc.put(FieldNames.TACK.name(), maneuver.getNewTack().name()); |
|
| 2050 | + maneuverDoc.put(FieldNames.POSITION_LAT_RAD.name(), maneuver.getPosition().getLatRad()); |
|
| 2051 | + maneuverDoc.put(FieldNames.POSITION_LNG_RAD.name(), maneuver.getPosition().getLngRad()); |
|
| 2052 | + maneuverDoc.put(FieldNames.TIMEPOINT.name(), maneuver.getTimePoint().asMillis()); |
|
| 2053 | 2053 | final Document mainCurveBoundariesDoc = new Document(); |
| 2054 | - maneuverDoc.put(FieldNames.MAIN_CURVE_BOUNDARIES.name(), storeMainCurveBoundaries(f.getMainCurveBoundaries(), mainCurveBoundariesDoc)); |
|
| 2054 | + maneuverDoc.put(FieldNames.MAIN_CURVE_BOUNDARIES.name(), storeMainCurveBoundaries(maneuver.getMainCurveBoundaries(), mainCurveBoundariesDoc)); |
|
| 2055 | 2055 | final Document maeuverCurveWithStableSpeedAndBoundariesDoc = new Document(); |
| 2056 | - maneuverDoc.put(FieldNames.MANEUVER_CURVE_WITH_STABLE_SPEED_AND_COURSE_BOUNDERIES.name(), storeMainCurveBoundaries(f.getManeuverCurveWithStableSpeedAndCourseBoundaries(), maeuverCurveWithStableSpeedAndBoundariesDoc)); |
|
| 2057 | - maneuverDoc.put(FieldNames.MAX_TURNING_RATE_IN_DEGREE_PER_SECOUND.name(), f.getMaxTurningRateInDegreesPerSecond()); |
|
| 2058 | - maneuverDoc.put(FieldNames.INDEX_OF_PASSED_WAYPOINT.name(), f.getMarkPassing() == null ? -1 : course.getIndexOfWaypoint(f.getMarkPassing().getWaypoint())); |
|
| 2059 | - maneuverDoc.put(FieldNames.TIME_AS_MILLIS.name(), f.getDuration().asMillis()); |
|
| 2060 | - maneuverDoc.put(FieldNames.MANEUVER_LOSS.name(), f.getManeuverLoss() == null ? null : storeManeuverLoss(f.getManeuverLoss())); |
|
| 2056 | + maneuverDoc.put(FieldNames.MANEUVER_CURVE_WITH_STABLE_SPEED_AND_COURSE_BOUNDERIES.name(), storeMainCurveBoundaries(maneuver.getManeuverCurveWithStableSpeedAndCourseBoundaries(), maeuverCurveWithStableSpeedAndBoundariesDoc)); |
|
| 2057 | + maneuverDoc.put(FieldNames.MAX_TURNING_RATE_IN_DEGREE_PER_SECOUND.name(), maneuver.getMaxTurningRateInDegreesPerSecond()); |
|
| 2058 | + maneuverDoc.put(FieldNames.INDEX_OF_PASSED_WAYPOINT.name(), maneuver.getMarkPassing() == null ? -1 : course.getIndexOfWaypoint(maneuver.getMarkPassing().getWaypoint())); |
|
| 2059 | + maneuverDoc.put(FieldNames.TIME_AS_MILLIS.name(), maneuver.getDuration().asMillis()); |
|
| 2060 | + maneuverDoc.put(FieldNames.MANEUVER_LOSS.name(), maneuver.getManeuverLoss() == null ? null : storeManeuverLoss(maneuver.getManeuverLoss())); |
|
| 2061 | 2061 | maneuverList.add(maneuverDoc); |
| 2062 | 2062 | } |
| 2063 | 2063 | competitorManeuver.put(FieldNames.MANEUVERS.name(), maneuverList); |
java/com.sap.sailing.domain/src/com/sap/sailing/domain/maneuverhash/MarkPassingProxy.java
| ... | ... | @@ -18,7 +18,7 @@ public class MarkPassingProxy implements MarkPassing { |
| 18 | 18 | private MarkPassing markPassing; |
| 19 | 19 | private final TimePoint timePoint; |
| 20 | 20 | |
| 21 | - public MarkPassingProxy(TimePoint timePoint, int waypointIndex, Serializable competitorId, TrackedRace trackedRace ) { |
|
| 21 | + public MarkPassingProxy(TimePoint timePoint, int waypointIndex, Serializable competitorId, TrackedRace trackedRace) { |
|
| 22 | 22 | super(); |
| 23 | 23 | this.timePoint = timePoint; |
| 24 | 24 | this.waypointIndex = waypointIndex; |
| ... | ... | @@ -28,30 +28,24 @@ public class MarkPassingProxy implements MarkPassing { |
| 28 | 28 | |
| 29 | 29 | @Override |
| 30 | 30 | public TimePoint getTimePoint() { |
| 31 | - return timePoint; |
|
| 31 | + return timePoint; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | @Override |
| 35 | 35 | public Waypoint getWaypoint() { |
| 36 | 36 | Iterable<Waypoint> waypoints = trackedRace.getRace().getCourse().getWaypoints(); |
| 37 | - return Util.get(waypoints, waypointIndex); |
|
| 37 | + return Util.get(waypoints, waypointIndex); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | @Override |
| 41 | 41 | public Competitor getCompetitor() { |
| 42 | - Iterable<Competitor> competitors = trackedRace.getRace().getCompetitors(); |
|
| 43 | - for (Competitor c : competitors ) { |
|
| 44 | - if( c.getId() == competitorId) { |
|
| 45 | - return c; |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - return null; |
|
| 42 | + return trackedRace.getRace().getCompetitorById(competitorId); |
|
| 49 | 43 | } |
| 50 | 44 | |
| 51 | 45 | @Override |
| 52 | 46 | public MarkPassing getOriginal() { |
| 53 | 47 | isMarkPassing(); |
| 54 | - return markPassing.getOriginal(); |
|
| 48 | + return markPassing == null ? null : markPassing.getOriginal(); |
|
| 55 | 49 | } |
| 56 | 50 | |
| 57 | 51 | private void isMarkPassing() { |