mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
pulled Positioned.java to domain.shared.android, moved .coursedesign package
This commit is contained in:
1 parent
38d087ec80
commit
7dc5eb42b5
14 files changed
+148
-51
No files matched your search
+144
@@ -0,0 +1,144 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
@SuppressWarnings("serial")
|
||||
public enum BoatClassType {
|
||||
boatClass470erMen("470er Men", new HashMap<CourseLayout, Integer>() {
|
||||
{
|
||||
put(CourseLayoutsTrapezoid.innerLoopTrapezoid60, 60);
|
||||
put(CourseLayoutsTrapezoid.outerLoopTrapezoid60, 60);
|
||||
put(CourseLayoutsLeewardWindWard.windWardLeewardLeeward, 30);
|
||||
put(CourseLayoutsLeewardWindWard.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
put(PointOfSail.Reach, 8f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 13f);
|
||||
put(PointOfSail.Downwind, 10f);
|
||||
put(PointOfSail.Reach, 7f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 7.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 10f);
|
||||
put(PointOfSail.Downwind, 6.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 290),
|
||||
boatClass470eromen("470er Women", new HashMap<CourseLayout, Integer>() {
|
||||
{
|
||||
put(CourseLayoutsTrapezoid.innerLoopTrapezoid60, 60);
|
||||
put(CourseLayoutsTrapezoid.outerLoopTrapezoid60, 60);
|
||||
put(CourseLayoutsLeewardWindWard.windWardLeewardLeeward, 30);
|
||||
put(CourseLayoutsLeewardWindWard.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
put(PointOfSail.Reach, 8f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 13f);
|
||||
put(PointOfSail.Downwind, 10f);
|
||||
put(PointOfSail.Reach, 7f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 7.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 10f);
|
||||
put(PointOfSail.Downwind, 6.5f);
|
||||
put(PointOfSail.Reach, 5.5f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 110),
|
||||
boatClass49er("49er", new HashMap<CourseLayout, Integer>() {
|
||||
{
|
||||
put(CourseLayoutsLeewardWindWard.windWardLeewardLeeward, 30);
|
||||
put(CourseLayoutsLeewardWindWard.windWardLeewardWindward, 30);
|
||||
}
|
||||
}, new TreeMap<WindRange, Map<PointOfSail, Float>>() {
|
||||
{
|
||||
put(new WindRange(5, 8), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 15f);
|
||||
put(PointOfSail.Downwind, 11f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(8, 12), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 11f);
|
||||
put(PointOfSail.Downwind, 5.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(12, 15), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 9f);
|
||||
put(PointOfSail.Downwind, 4.5f);
|
||||
}
|
||||
});
|
||||
put(new WindRange(15, 99), new EnumMap<PointOfSail, Float>(PointOfSail.class) {
|
||||
{
|
||||
put(PointOfSail.Upwind, 7.5f);
|
||||
put(PointOfSail.Downwind, 4f);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 255);
|
||||
|
||||
private String displayName;
|
||||
private Map<CourseLayout, Integer> possipleCourseLayoutsWithStandardTargetTime;
|
||||
private Integer startLineLengthInMeters;
|
||||
|
||||
private BoatClassType(String displayName, Map<CourseLayout, Integer> possipleCourseLayoutsWithStandardTargetTime,
|
||||
Map<WindRange, Map<PointOfSail, Float>> boatSpeedTable, Integer startLineLengthInMeters) {
|
||||
this.displayName = displayName;
|
||||
this.possipleCourseLayoutsWithStandardTargetTime = possipleCourseLayoutsWithStandardTargetTime;
|
||||
this.startLineLengthInMeters = startLineLengthInMeters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public Map<CourseLayout, Integer> getPossibleCourseLayoutsWithTargetTime() {
|
||||
return possipleCourseLayoutsWithStandardTargetTime;
|
||||
}
|
||||
|
||||
public Integer getStartLineLengthInMeters() {
|
||||
return startLineLengthInMeters;
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public class CourseDesign {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public interface CourseLayout {
|
||||
public String getShortName();
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum CourseLayoutsLeewardWindWard implements CourseLayout{
|
||||
windWardLeewardWindward("Windward/Leeward with Windward finish", "W"),
|
||||
windWardLeewardLeeward("Windward/Leeward with Leeward finish", "L");
|
||||
|
||||
private String displayName;
|
||||
private String shortName;
|
||||
|
||||
@Override
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
private CourseLayoutsLeewardWindWard(String displayName, String shortName){
|
||||
this.displayName = displayName;
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum CourseLayoutsTrapezoid implements CourseLayout{
|
||||
innerLoopTrapezoid60("Trapezoid 60° Inner Loop", "I", 60),
|
||||
outerLoopTrapezoid60("Trapezoid 60° Outer Loop", "O", 60),
|
||||
innerLoopTrapezoid70("Trapezoid 70° Inner Loop", "I", 70),
|
||||
outerLoopTrapezoid70("Trapezoid 70° Outer Loop", "O", 70);
|
||||
|
||||
private String displayName;
|
||||
private String shortName;
|
||||
private Integer reachAngle;
|
||||
|
||||
public Integer getReachAngle() {
|
||||
return reachAngle;
|
||||
}
|
||||
@Override
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
private CourseLayoutsTrapezoid(String displayName, String shortName, Integer reachAngle){
|
||||
this.displayName = displayName;
|
||||
this.shortName = shortName;
|
||||
this.reachAngle = reachAngle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum NumberOfRounds {
|
||||
TWO(2),
|
||||
THREE(3),
|
||||
FOUR(4);
|
||||
|
||||
private final Integer numberOfRounds;
|
||||
|
||||
public Integer getNumberOfRounds() {
|
||||
return numberOfRounds;
|
||||
}
|
||||
|
||||
private NumberOfRounds(Integer numberOfRounds){
|
||||
this.numberOfRounds = numberOfRounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public
|
||||
String toString(){
|
||||
return this.numberOfRounds.toString();
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum PointOfSail{
|
||||
Upwind,
|
||||
Downwind,
|
||||
Reach
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
|
||||
public interface PositionedWaypoint extends Waypoint {
|
||||
//LatLng getPosition();
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public enum TargetTime {
|
||||
thirty(30),
|
||||
sixty(60);
|
||||
|
||||
private final Integer timeInMinutes;
|
||||
|
||||
public Integer getTimeInMinutes() {
|
||||
return timeInMinutes;
|
||||
}
|
||||
|
||||
private TargetTime(Integer timeInMinutes){
|
||||
this.timeInMinutes = timeInMinutes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public
|
||||
String toString(){
|
||||
return this.timeInMinutes.toString();
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.sap.sailing.domain.coursedesign;
|
||||
|
||||
public class WindRange implements Comparable<WindRange>{
|
||||
private final Integer lowerBound;
|
||||
private final Integer upperBound;
|
||||
|
||||
public WindRange(Integer lowerBound, Integer upperBound){
|
||||
this.lowerBound = lowerBound;
|
||||
this.upperBound = upperBound;
|
||||
}
|
||||
|
||||
public Integer getLowerBound() {
|
||||
return lowerBound;
|
||||
}
|
||||
|
||||
public Integer getUpperBound() {
|
||||
return upperBound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(WindRange o) {
|
||||
if(o.getUpperBound() <= this.lowerBound)
|
||||
return 1;
|
||||
if(o.getLowerBound() >= this.upperBound)
|
||||
return -1;
|
||||
if(o.getLowerBound().equals(this.lowerBound) && o.getUpperBound().equals(this.upperBound))
|
||||
return 0;
|
||||
else
|
||||
throw new IllegalArgumentException("WindRanges are not comparable");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.sap.sailing.domain.tracking;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
|
||||
public interface Positioned extends Serializable {
|
||||
Position getPosition();
|
||||
}
|
||||
Reference in new issue
Block a user