mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-03 02:43:53 +00:00
Added correct parsing of rac, ccg, stl, cam, tmd messages
This commit is contained in:
1 parent
272ac6a5f3
commit
e4c046a114
21 files changed
+136
-763
No files matched your search
-42
@@ -54,47 +54,5 @@ public class ABSMessage {
|
||||
return "ABS|" + raceId + ";" + leg + ";" + sailNumber + ";" + speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((leg == null) ? 0 : leg.hashCode());
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
result = prime * result + ((sailNumber == null) ? 0 : sailNumber.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(speed);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ABSMessage other = (ABSMessage) obj;
|
||||
if (leg == null) {
|
||||
if (other.leg != null)
|
||||
return false;
|
||||
} else if (!leg.equals(other.leg))
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (sailNumber == null) {
|
||||
if (other.sailNumber != null)
|
||||
return false;
|
||||
} else if (!sailNumber.equals(other.sailNumber))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(speed) != Double.doubleToLongBits(other.speed))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-31
@@ -35,38 +35,8 @@ public class CAMMessage {
|
||||
for (ClockAtMarkElement m : markList) {
|
||||
s = s + m.toString();
|
||||
}
|
||||
return "CAM|" + markList.size() + s;
|
||||
return "CAM|" + raceId + "|"+ markList.size() + s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((markList == null) ? 0 : markList.hashCode());
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CAMMessage other = (CAMMessage) obj;
|
||||
if (markList == null) {
|
||||
if (other.markList != null)
|
||||
return false;
|
||||
} else if (!markList.equals(other.markList))
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
-33
@@ -36,37 +36,4 @@ public class CBSMessage {
|
||||
public String toString() {
|
||||
return "CBS|" + raceId + ";" + sailNumber + ";" + speed;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + raceId;
|
||||
result = prime * result + ((sailNumber == null) ? 0 : sailNumber.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(speed);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CBSMessage other = (CBSMessage) obj;
|
||||
if (raceId != other.raceId)
|
||||
return false;
|
||||
if (sailNumber == null) {
|
||||
if (other.sailNumber != null)
|
||||
return false;
|
||||
} else if (!sailNumber.equals(other.sailNumber))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(speed) != Double.doubleToLongBits(other.speed))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1
-52
@@ -48,58 +48,7 @@ public class CCGMessage {
|
||||
}
|
||||
s = s.substring(0, s.length() - 1);
|
||||
}
|
||||
return "CCG|" + markList.size() + s;
|
||||
return "CCG|" +raceId + "|" + markList.size() + s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((markList == null) ? 0 : markList.hashCode());
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CCGMessage other = (CCGMessage) obj;
|
||||
if (markList == null) {
|
||||
if (other.markList != null)
|
||||
return false;
|
||||
}
|
||||
//Iterate through Mark List
|
||||
for (int i = 0; i < other.getMarkList().size(); i++) {
|
||||
Mark m = other.getMarkList().get(i);
|
||||
Mark l = markList.get(i);
|
||||
if (!(m.getIndex() == l.getIndex()) & !m.getDescription().equals(l.getDescription())) {
|
||||
return false;
|
||||
}
|
||||
//
|
||||
Iterator<String> iterM = other.getMarkList().get(i).getDevices().iterator();
|
||||
Iterator<String> iterL = markList.get(i).getDevices().iterator();
|
||||
boolean b = iterM.hasNext() & iterL.hasNext();
|
||||
while (b) {
|
||||
String sM = iterM.next();
|
||||
String sL = iterL.next();
|
||||
if (!sM.equals(sL)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(!b){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-40
@@ -1,15 +1,16 @@
|
||||
package com.sap.sailing.domain.swisstimingadapter.classes.messages;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sailing.domain.base.TimePoint;
|
||||
|
||||
public class ClockAtMarkElement {
|
||||
private int markindex;
|
||||
private TimePoint marktime;
|
||||
private Date marktime;
|
||||
private String sailnumber;
|
||||
|
||||
public ClockAtMarkElement(int markindex, TimePoint marktime, String sailnumber) {
|
||||
public ClockAtMarkElement(int markindex, Date marktime, String sailnumber) {
|
||||
super();
|
||||
this.markindex = markindex;
|
||||
this.marktime = marktime;
|
||||
@@ -28,11 +29,12 @@ public class ClockAtMarkElement {
|
||||
this.markindex = markindex;
|
||||
}
|
||||
|
||||
public TimePoint getMarktime() {
|
||||
|
||||
public Date getMarktime() {
|
||||
return marktime;
|
||||
}
|
||||
|
||||
public void setMarktime(TimePoint marktime) {
|
||||
public void setMarktime(Date marktime) {
|
||||
this.marktime = marktime;
|
||||
}
|
||||
|
||||
@@ -45,44 +47,9 @@ public class ClockAtMarkElement {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd");
|
||||
SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss");
|
||||
return "|" + markindex + ";" + sd.format(marktime) + ";" + sailnumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + markindex;
|
||||
result = prime * result + ((marktime == null) ? 0 : marktime.hashCode());
|
||||
result = prime * result + ((sailnumber == null) ? 0 : sailnumber.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ClockAtMarkElement other = (ClockAtMarkElement) obj;
|
||||
if (markindex != other.markindex)
|
||||
return false;
|
||||
if (marktime == null) {
|
||||
if (other.marktime != null)
|
||||
return false;
|
||||
} else if (!marktime.equals(other.marktime))
|
||||
return false;
|
||||
if (sailnumber == null) {
|
||||
if (other.sailnumber != null)
|
||||
return false;
|
||||
} else if (!sailnumber.equals(other.sailnumber))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
-42
@@ -44,46 +44,4 @@ public class DBBMessage {
|
||||
public String toString() {
|
||||
return "DBB|" + raceId + ";" + sailNumber + ";" + sailNumber2;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(distance);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
result = prime * result + ((sailNumber == null) ? 0 : sailNumber.hashCode());
|
||||
result = prime * result + ((sailNumber2 == null) ? 0 : sailNumber2.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
DBBMessage other = (DBBMessage) obj;
|
||||
if (Double.doubleToLongBits(distance) != Double.doubleToLongBits(other.distance))
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (sailNumber == null) {
|
||||
if (other.sailNumber != null)
|
||||
return false;
|
||||
} else if (!sailNumber.equals(other.sailNumber))
|
||||
return false;
|
||||
if (sailNumber2 == null) {
|
||||
if (other.sailNumber2 != null)
|
||||
return false;
|
||||
} else if (!sailNumber2.equals(other.sailNumber2))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-41
@@ -55,45 +55,4 @@ public class DTMMessage {
|
||||
return "DTM|" + raceId + ";" + markIndex + ";" + sailNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(distance);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + markIndex;
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
result = prime * result + ((sailNumber == null) ? 0 : sailNumber.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
DTMMessage other = (DTMMessage) obj;
|
||||
if (Double.doubleToLongBits(distance) != Double.doubleToLongBits(other.distance))
|
||||
return false;
|
||||
if (markIndex != other.markIndex)
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (sailNumber == null) {
|
||||
if (other.sailNumber != null)
|
||||
return false;
|
||||
} else if (!sailNumber.equals(other.sailNumber))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
-30
@@ -34,35 +34,5 @@ public class RACMessage {
|
||||
return "RAC|" + raceList.size() + s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((raceList == null) ? 0 : raceList.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RACMessage other = (RACMessage) obj;
|
||||
if (raceList == null) {
|
||||
if (other.raceList != null)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < other.raceList.size(); i++) {
|
||||
Race rObj = other.raceList.get(i);
|
||||
Race lRace = raceList.get(i);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+36
-70
@@ -10,17 +10,15 @@ import com.sap.sailing.domain.base.TimePoint;
|
||||
public class RPDMessage {
|
||||
private String raceId;
|
||||
private int status;
|
||||
private TimePoint dataTime;
|
||||
private TimePoint startTime;
|
||||
private Date dataTime;
|
||||
private Date startTime;
|
||||
private Date raceTime;
|
||||
private int nextMarkLeader;
|
||||
private double distanceToNextMarkLeader;
|
||||
private List<RacePositionDataElement> racePositionElements;
|
||||
|
||||
|
||||
|
||||
public RPDMessage(String raceId, int status, TimePoint dataTime, TimePoint startTime, Date raceTime,
|
||||
int nextMarkLeader, double distanceToNextMarkLeader, List<RacePositionDataElement> racePositionElements) {
|
||||
|
||||
public RPDMessage(String raceId, int status, Date dataTime, Date startTime, Date raceTime, int nextMarkLeader,
|
||||
double distanceToNextMarkLeader, List<RacePositionDataElement> racePositionElements) {
|
||||
super();
|
||||
this.raceId = raceId;
|
||||
this.status = status;
|
||||
@@ -31,119 +29,87 @@ public class RPDMessage {
|
||||
this.distanceToNextMarkLeader = distanceToNextMarkLeader;
|
||||
this.racePositionElements = racePositionElements;
|
||||
}
|
||||
|
||||
public RPDMessage() {
|
||||
racePositionElements = new ArrayList<RacePositionDataElement>();
|
||||
}
|
||||
|
||||
public String getRaceId() {
|
||||
return raceId;
|
||||
}
|
||||
|
||||
public void setRaceId(String raceId) {
|
||||
this.raceId = raceId;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getRaceTime() {
|
||||
return raceTime;
|
||||
}
|
||||
|
||||
public void setRaceTime(Date raceTime) {
|
||||
this.raceTime = raceTime;
|
||||
}
|
||||
|
||||
public int getNextMarkLeader() {
|
||||
return nextMarkLeader;
|
||||
}
|
||||
|
||||
public void setNextMarkLeader(int nextMarkLeader) {
|
||||
this.nextMarkLeader = nextMarkLeader;
|
||||
}
|
||||
|
||||
public double getDistanceToNextMarkLeader() {
|
||||
return distanceToNextMarkLeader;
|
||||
}
|
||||
|
||||
public void setDistanceToNextMarkLeader(double distanceToNextMarkLeader) {
|
||||
this.distanceToNextMarkLeader = distanceToNextMarkLeader;
|
||||
}
|
||||
|
||||
public List<RacePositionDataElement> getRacePositionElements() {
|
||||
return racePositionElements;
|
||||
}
|
||||
|
||||
public void setRacePositionElements(List<RacePositionDataElement> racePositionElements) {
|
||||
this.racePositionElements = racePositionElements;
|
||||
}
|
||||
|
||||
|
||||
public TimePoint getDataTime() {
|
||||
|
||||
public Date getDataTime() {
|
||||
return dataTime;
|
||||
}
|
||||
public void setDataTime(TimePoint dataTime) {
|
||||
|
||||
public void setDataTime(Date dataTime) {
|
||||
this.dataTime = dataTime;
|
||||
}
|
||||
public TimePoint getStartTime() {
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(TimePoint startTime) {
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public String toString(){
|
||||
SimpleDateFormat sdataTime = new SimpleDateFormat("yyyy.MM.dd");
|
||||
SimpleDateFormat sstartTime = new SimpleDateFormat("yyyy.MM.dd");
|
||||
SimpleDateFormat sraceTime = new SimpleDateFormat("yyyy.MM.dd");
|
||||
|
||||
|
||||
public String toString() {
|
||||
SimpleDateFormat sdataTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
SimpleDateFormat sstartTime = new SimpleDateFormat("HH:mm:ss");
|
||||
SimpleDateFormat sraceTime = new SimpleDateFormat("HH:mm:ss");
|
||||
|
||||
String elements = "";
|
||||
for (RacePositionDataElement el : racePositionElements) {
|
||||
elements = elements + el.toString();
|
||||
}
|
||||
|
||||
return "RPD|" + raceId + "|" + status + "|" + sdataTime.format(dataTime) + "|" + sstartTime.format(startTime) + "|" + sraceTime.format(raceTime) + "|" + racePositionElements.size() + elements;
|
||||
|
||||
return "RPD|" + raceId + "|" + status + "|" + sdataTime.format(dataTime) + "|"
|
||||
+ sstartTime.format(startTime) + "|" + sraceTime.format(raceTime) + "|"
|
||||
+ racePositionElements.size() + elements;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(distanceToNextMarkLeader);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + nextMarkLeader;
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
result = prime * result + ((racePositionElements == null) ? 0 : racePositionElements.hashCode());
|
||||
result = prime * result + ((raceTime == null) ? 0 : raceTime.hashCode());
|
||||
result = prime * result + status;
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RPDMessage other = (RPDMessage) obj;
|
||||
if (Double.doubleToLongBits(distanceToNextMarkLeader) != Double
|
||||
.doubleToLongBits(other.distanceToNextMarkLeader))
|
||||
return false;
|
||||
if (nextMarkLeader != other.nextMarkLeader)
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (racePositionElements == null) {
|
||||
if (other.racePositionElements != null)
|
||||
return false;
|
||||
} else if (!racePositionElements.equals(other.racePositionElements))
|
||||
return false;
|
||||
if (raceTime == null) {
|
||||
if (other.raceTime != null)
|
||||
return false;
|
||||
} else if (!raceTime.equals(other.raceTime))
|
||||
return false;
|
||||
if (status != other.status)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
-72
@@ -149,76 +149,4 @@ public class RacePositionDataElement {
|
||||
public String toString(){
|
||||
return "|" + sailNumber + ";" + boatType + ";" + ageOfData + ";" + latitude + ";" + longitude + ";" + sog + ";" + vmg + ";" + als + ";" + cog + ";" +nextMark + ";" + rank + ";" + distanceToLeader + ";" + distanceToNextMark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (ageOfData ^ (ageOfData >>> 32));
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(als);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + boatType;
|
||||
temp = Double.doubleToLongBits(cog);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(distanceToLeader);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(distanceToNextMark);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(latitude);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(longitude);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + nextMark;
|
||||
result = prime * result + rank;
|
||||
result = prime * result + ((sailNumber == null) ? 0 : sailNumber.hashCode());
|
||||
temp = Double.doubleToLongBits(sog);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(vmg);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RacePositionDataElement other = (RacePositionDataElement) obj;
|
||||
if (ageOfData != other.ageOfData)
|
||||
return false;
|
||||
if (Double.doubleToLongBits(als) != Double.doubleToLongBits(other.als))
|
||||
return false;
|
||||
if (boatType != other.boatType)
|
||||
return false;
|
||||
if (Double.doubleToLongBits(cog) != Double.doubleToLongBits(other.cog))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(distanceToLeader) != Double.doubleToLongBits(other.distanceToLeader))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(distanceToNextMark) != Double.doubleToLongBits(other.distanceToNextMark))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(latitude) != Double.doubleToLongBits(other.latitude))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(longitude) != Double.doubleToLongBits(other.longitude))
|
||||
return false;
|
||||
if (nextMark != other.nextMark)
|
||||
return false;
|
||||
if (rank != other.rank)
|
||||
return false;
|
||||
if (sailNumber == null) {
|
||||
if (other.sailNumber != null)
|
||||
return false;
|
||||
} else if (!sailNumber.equals(other.sailNumber))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(sog) != Double.doubleToLongBits(other.sog))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(vmg) != Double.doubleToLongBits(other.vmg))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+10
-35
@@ -8,64 +8,39 @@ import com.sap.sailing.domain.swisstimingadapter.Competitor;
|
||||
public class STLMessage {
|
||||
private String raceId;
|
||||
private List<Competitor> competitorList;
|
||||
|
||||
|
||||
public STLMessage(String raceId, List<Competitor> competitorList) {
|
||||
super();
|
||||
this.raceId = raceId;
|
||||
this.competitorList = competitorList;
|
||||
}
|
||||
|
||||
public STLMessage() {
|
||||
competitorList = new ArrayList<Competitor>();
|
||||
competitorList = new ArrayList<Competitor>();
|
||||
}
|
||||
|
||||
public String getRaceId() {
|
||||
return raceId;
|
||||
}
|
||||
|
||||
public void setRaceId(String raceId) {
|
||||
this.raceId = raceId;
|
||||
}
|
||||
|
||||
public List<Competitor> getCompetitorList() {
|
||||
return competitorList;
|
||||
}
|
||||
|
||||
public void setCompetitorList(List<Competitor> competitorList) {
|
||||
this.competitorList = competitorList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = "";
|
||||
for(Competitor c : competitorList){
|
||||
for (Competitor c : competitorList) {
|
||||
s = s + "|" + c.getBoatID() + ";" + c.getThreeLetterIOCCode() + ";" + c.getName();
|
||||
}
|
||||
return "STL|" + competitorList.size() + s;
|
||||
return "STL|" + raceId + "|" + competitorList.size() + s;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((competitorList == null) ? 0 : competitorList.hashCode());
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
STLMessage other = (STLMessage) obj;
|
||||
if (competitorList == null) {
|
||||
if (other.competitorList != null)
|
||||
return false;
|
||||
} else if (!competitorList.equals(other.competitorList))
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-32
@@ -30,38 +30,7 @@ public class STTMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd");
|
||||
SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss");
|
||||
return "STT|" + raceId + sd.format(startTime);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
STTMessage other = (STTMessage) obj;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (startTime == null) {
|
||||
if (other.startTime != null)
|
||||
return false;
|
||||
} else if (!startTime.equals(other.startTime))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-39
@@ -53,43 +53,4 @@ public class TMDMessage {
|
||||
return "TMD|" + list.size() + s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((list == null) ? 0 : list.hashCode());
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
result = prime * result + ((sailNumber == null) ? 0 : sailNumber.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TMDMessage other = (TMDMessage) obj;
|
||||
if (list == null) {
|
||||
if (other.list != null)
|
||||
return false;
|
||||
} else if (!list.equals(other.list))
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (sailNumber == null) {
|
||||
if (other.sailNumber != null)
|
||||
return false;
|
||||
} else if (!sailNumber.equals(other.sailNumber))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+6
-38
@@ -1,15 +1,16 @@
|
||||
package com.sap.sailing.domain.swisstimingadapter.classes.messages;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sailing.domain.base.TimePoint;
|
||||
|
||||
public class TimingDataElement {
|
||||
private int markIndex;
|
||||
private int rank;
|
||||
private TimePoint timeSinceStart;
|
||||
private Date timeSinceStart;
|
||||
|
||||
public TimingDataElement(int markIndex, int rank, TimePoint timeSinceStart) {
|
||||
public TimingDataElement(int markIndex, int rank, Date timeSinceStart) {
|
||||
super();
|
||||
this.markIndex = markIndex;
|
||||
this.rank = rank;
|
||||
@@ -20,7 +21,6 @@ public class TimingDataElement {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public int getMarkIndex() {
|
||||
return markIndex;
|
||||
}
|
||||
@@ -37,50 +37,18 @@ public class TimingDataElement {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public TimePoint getTimeSinceStart() {
|
||||
public Date getTimeSinceStart() {
|
||||
return timeSinceStart;
|
||||
}
|
||||
|
||||
public void setTimeSinceStart(TimePoint timeSinceStart) {
|
||||
public void setTimeSinceStart(Date timeSinceStart) {
|
||||
this.timeSinceStart = timeSinceStart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd");
|
||||
SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss");
|
||||
return "|" + markIndex + ";" + rank + ";" + sd.format(timeSinceStart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + markIndex;
|
||||
result = prime * result + rank;
|
||||
result = prime * result + ((timeSinceStart == null) ? 0 : timeSinceStart.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TimingDataElement other = (TimingDataElement) obj;
|
||||
if (markIndex != other.markIndex)
|
||||
return false;
|
||||
if (rank != other.rank)
|
||||
return false;
|
||||
if (timeSinceStart == null) {
|
||||
if (other.timeSinceStart != null)
|
||||
return false;
|
||||
} else if (!timeSinceStart.equals(other.timeSinceStart))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-25
@@ -24,29 +24,4 @@ public class VERMessage {
|
||||
return "VER|" + version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((version == null) ? 0 : version.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VERMessage other = (VERMessage) obj;
|
||||
if (version == null) {
|
||||
if (other.version != null)
|
||||
return false;
|
||||
} else if (!version.equals(other.version))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
-42
@@ -43,47 +43,5 @@ public class WEAMessage {
|
||||
public String toString(){
|
||||
return "WEA|" + raceId + ";" + conditions + ";" + temperature + ";" +humidity;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((conditions == null) ? 0 : conditions.hashCode());
|
||||
result = prime * result + ((humidity == null) ? 0 : humidity.hashCode());
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
result = prime * result + ((temperature == null) ? 0 : temperature.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
WEAMessage other = (WEAMessage) obj;
|
||||
if (conditions == null) {
|
||||
if (other.conditions != null)
|
||||
return false;
|
||||
} else if (!conditions.equals(other.conditions))
|
||||
return false;
|
||||
if (humidity == null) {
|
||||
if (other.humidity != null)
|
||||
return false;
|
||||
} else if (!humidity.equals(other.humidity))
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (temperature == null) {
|
||||
if (other.temperature != null)
|
||||
return false;
|
||||
} else if (!temperature.equals(other.temperature))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+2
-41
@@ -50,46 +50,7 @@ public class WNDMessage {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "WND|" + raceId + ";" + markIndex + ";" + windDirection+ ";" +windSpeed;
|
||||
public String toString() {
|
||||
return "WND|" + raceId + ";" + markIndex + ";" + windDirection + ";" + windSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + markIndex;
|
||||
result = prime * result + ((raceId == null) ? 0 : raceId.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(windDirection);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(windSpeed);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
WNDMessage other = (WNDMessage) obj;
|
||||
if (markIndex != other.markIndex)
|
||||
return false;
|
||||
if (raceId == null) {
|
||||
if (other.raceId != null)
|
||||
return false;
|
||||
} else if (!raceId.equals(other.raceId))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(windDirection) != Double.doubleToLongBits(other.windDirection))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(windSpeed) != Double.doubleToLongBits(other.windSpeed))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+3
-4
@@ -1,14 +1,13 @@
|
||||
package com.sap.sailing.domain.swisstimingadapter.classes.services;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.swisstimingadapter.classes.services.Exceptions.MessageScriptParsingException;
|
||||
|
||||
public interface MessageFileService {
|
||||
void writeListToFile(String path, List<Object> msgList) throws IOException;
|
||||
List<Object> readListFromFile(String path) throws MessageScriptParsingException, IOException, ParseException;
|
||||
void writeListToFile(File path, List<Object> msgList) throws IOException;
|
||||
List<Object> readListFromFile(File path) throws MessageScriptParsingException, IOException, ParseException;
|
||||
}
|
||||
+61
-50
@@ -56,8 +56,7 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeListToFile(String path, List<Object> msgList) throws IOException {
|
||||
file = new File(path);
|
||||
public void writeListToFile(File path, List<Object> msgList) throws IOException {
|
||||
writer = new BufferedWriter(new FileWriter(path));
|
||||
String tmp = "";
|
||||
for (Object object : msgList) {
|
||||
@@ -69,8 +68,7 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> readListFromFile(String path) throws MessageScriptParsingException, IOException, ParseException {
|
||||
file = new File(path);
|
||||
public List<Object> readListFromFile(File path) throws MessageScriptParsingException, IOException, ParseException {
|
||||
List<Object> resultList = new ArrayList<Object>();
|
||||
|
||||
reader = new BufferedReader(new FileReader(path));
|
||||
@@ -84,16 +82,16 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
case RPD:
|
||||
resultList.add(getRPDMessage(sailMasterMessage));
|
||||
break;
|
||||
case RAC:
|
||||
case RAC: // /
|
||||
resultList.add(getRACMessage(sailMasterMessage));
|
||||
break;
|
||||
case CCG:
|
||||
case CCG: // /
|
||||
resultList.add(getCCGMessage(sailMasterMessage));
|
||||
break;
|
||||
case STL:
|
||||
case STL: // /
|
||||
resultList.add(getSTLMessage(sailMasterMessage));
|
||||
break;
|
||||
case CAM:
|
||||
case CAM: // /
|
||||
resultList.add(getCAMMessage(sailMasterMessage));
|
||||
break;
|
||||
case TMD:
|
||||
@@ -107,22 +105,22 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
}
|
||||
|
||||
private RPDMessage getRPDMessage(SailMasterMessage message) throws ParseException {
|
||||
String[] sections = message.getSections();
|
||||
|
||||
String[] sections = message.getSections();
|
||||
|
||||
String raceID = sections[1];
|
||||
int status = Integer.valueOf(sections[2]);
|
||||
TimePoint timePoint = new MillisecondsTimePoint(parseTimeAndDateISO(sections[3]));
|
||||
TimePoint startTimeEstimatedStartTime = sections[4].trim().length() == 0 ? null : new MillisecondsTimePoint(
|
||||
parseTimePrefixedWithISOToday(sections[4]));
|
||||
Date timePoint = parseTimeAndDateISO(sections[3]);
|
||||
Date startTimeEstimatedStartTime = sections[4].trim().length() == 0 ? null
|
||||
: parseTimePrefixedWithISOToday(sections[4]);
|
||||
Long millisecondsSinceRaceStart = sections[5].trim().length() == 0 ? null
|
||||
: parseHHMMSSToMilliseconds(sections[5]);
|
||||
Integer nextMarkIndexForLeader = sections[6].trim().length() == 0 ? null : Integer.valueOf(sections[6]);
|
||||
Distance distanceToNextMarkForLeader = sections[7].trim().length() == 0 ? null : new MeterDistance(
|
||||
Double.valueOf(sections[7]));
|
||||
int count = Integer.valueOf(sections[8]);
|
||||
|
||||
|
||||
List<RacePositionDataElement> racePositionElements = new ArrayList<RacePositionDataElement>();
|
||||
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
int fixDetailIndex = 0;
|
||||
String[] fixSections = sections[9 + i].split(";");
|
||||
@@ -141,7 +139,7 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
fixDetailIndex++;
|
||||
SpeedWithBearing speed = new KnotSpeedWithBearingImpl(speedOverGroundInKnots, new DegreeBearingImpl(
|
||||
Double.valueOf(fixSections[fixDetailIndex++])));
|
||||
|
||||
|
||||
Integer nextMarkIndex = fixSections.length <= fixDetailIndex
|
||||
|| fixSections[fixDetailIndex].trim().length() == 0 ? null : Integer
|
||||
.valueOf(fixSections[fixDetailIndex]);
|
||||
@@ -157,18 +155,23 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
|| fixSections[fixDetailIndex].trim().length() == 0 ? null : new MeterDistance(
|
||||
Double.valueOf(fixSections[fixDetailIndex]));
|
||||
fixDetailIndex++;
|
||||
|
||||
racePositionElements.add(new RacePositionDataElement(boatID, trackerTypeInt, ageOfDataInMilliseconds.longValue(), latitude, longitude, speedOverGroundInKnots.doubleValue(), velocityMadeGood.getKnots(), speed.getKnots(), speed.getBearing().getDegrees(), nextMarkIndex.intValue(), rank.intValue(), distanceToLeader.getMeters(), distanceToNextMark.getMeters()));
|
||||
|
||||
racePositionElements.add(new RacePositionDataElement(boatID, trackerTypeInt, ageOfDataInMilliseconds
|
||||
.longValue(), latitude, longitude, speedOverGroundInKnots.doubleValue(), velocityMadeGood
|
||||
.getKnots(), averageSpeedOverGround.getKnots(), speed.getBearing().getDegrees(), nextMarkIndex
|
||||
.intValue(), rank.intValue(), distanceToLeader.getMeters(), distanceToNextMark.getMeters()));
|
||||
}
|
||||
}
|
||||
return new RPDMessage(raceID, status, timePoint, startTimeEstimatedStartTime, new Date(millisecondsSinceRaceStart), nextMarkIndexForLeader.intValue(), distanceToNextMarkForLeader.getMeters(), racePositionElements);
|
||||
return new RPDMessage(raceID, status, timePoint, startTimeEstimatedStartTime, new Date(
|
||||
millisecondsSinceRaceStart), nextMarkIndexForLeader.intValue(),
|
||||
distanceToNextMarkForLeader.getMeters(), racePositionElements);
|
||||
}
|
||||
|
||||
private RACMessage getRACMessage(SailMasterMessage message) {
|
||||
int count = Integer.valueOf(message.getSections()[1]);
|
||||
List<Race> result = new ArrayList<Race>();
|
||||
for (int i=0; i<count; i++) {
|
||||
String[] idAndDescription = message.getSections()[2+i].split(";");
|
||||
for (int i = 0; i < count; i++) {
|
||||
String[] idAndDescription = message.getSections()[2 + i].split(";");
|
||||
result.add(new RaceImpl(idAndDescription[0], idAndDescription[1]));
|
||||
}
|
||||
return new RACMessage(result);
|
||||
@@ -178,9 +181,10 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
String raceId = message.getSections()[1];
|
||||
int count = Integer.valueOf(message.getSections()[2]);
|
||||
List<Mark> marks = new ArrayList<Mark>();
|
||||
for (int i=0; i<count; i++) {
|
||||
String[] markDetails = message.getSections()[3+i].split(";");
|
||||
marks.add(new MarkImpl(markDetails[1], Integer.valueOf(markDetails[0]), Arrays.asList(markDetails).subList(2, markDetails.length)));
|
||||
for (int i = 0; i < count; i++) {
|
||||
String[] markDetails = message.getSections()[3 + i].split(";");
|
||||
marks.add(new MarkImpl(markDetails[1], Integer.valueOf(markDetails[0]), Arrays.asList(markDetails).subList(
|
||||
2, markDetails.length)));
|
||||
}
|
||||
return new CCGMessage(raceId, marks);
|
||||
}
|
||||
@@ -189,8 +193,8 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
String raceId = message.getSections()[1];
|
||||
ArrayList<Competitor> competitors = new ArrayList<Competitor>();
|
||||
int count = Integer.valueOf(message.getSections()[2]);
|
||||
for (int i=0; i<count; i++) {
|
||||
String[] competitorDetails = message.getSections()[3+i].split(";");
|
||||
for (int i = 0; i < count; i++) {
|
||||
String[] competitorDetails = message.getSections()[3 + i].split(";");
|
||||
competitors.add(new CompetitorImpl(competitorDetails[0], competitorDetails[1], competitorDetails[2]));
|
||||
}
|
||||
return new STLMessage(raceId, competitors);
|
||||
@@ -200,12 +204,13 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
String raceId = message.getSections()[1];
|
||||
List<ClockAtMarkElement> result = new ArrayList<ClockAtMarkElement>();
|
||||
int count = Integer.valueOf(message.getSections()[2]);
|
||||
for (int i=0; i<count; i++) {
|
||||
String[] clockAtMarkDetail = message.getSections()[3+i].split(";");
|
||||
for (int i = 0; i < count; i++) {
|
||||
String[] clockAtMarkDetail = message.getSections()[3 + i].split(";");
|
||||
int markIndex = Integer.valueOf(clockAtMarkDetail[0]);
|
||||
TimePoint timePoint = clockAtMarkDetail.length <= 1 || clockAtMarkDetail[1].trim().length() == 0 ? null :
|
||||
new MillisecondsTimePoint(parseTimePrefixedWithISOToday(clockAtMarkDetail[1]));
|
||||
result.add(new ClockAtMarkElement(markIndex, timePoint, clockAtMarkDetail.length <= 2 ? null : clockAtMarkDetail[2]));
|
||||
Date timePoint = clockAtMarkDetail.length <= 1 || clockAtMarkDetail[1].trim().length() == 0 ? null
|
||||
: parseHHMMSSToDate(clockAtMarkDetail[1]);
|
||||
result.add(new ClockAtMarkElement(markIndex, timePoint, clockAtMarkDetail.length <= 2 ? null
|
||||
: clockAtMarkDetail[2]));
|
||||
}
|
||||
return new CAMMessage(raceId, result);
|
||||
}
|
||||
@@ -216,45 +221,54 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
int count = Integer.valueOf(message.getSections()[3]);
|
||||
List<TimingDataElement> timingDataelementList = new ArrayList<TimingDataElement>();
|
||||
for (int i = 0; i < count; i++) {
|
||||
String[] details = message.getSections()[4+i].split(";");
|
||||
Integer markIndex = details.length <= 0 || details[0].trim().length() == 0 ? null : Integer.valueOf(details[0]);
|
||||
Integer rank = details.length <= 1 || details[1].trim().length() == 0 ? null : Integer.valueOf(details[1]);
|
||||
TimePoint timeSinceStart = details[4].trim().length() == 0 ? null : new MillisecondsTimePoint(
|
||||
parseTimePrefixedWithISOToday(details[4]));
|
||||
String[] details = message.getSections()[4 + i].split(";");
|
||||
Integer markIndex = details.length <= 0 || details[0].trim().length() == 0 ? null : Integer
|
||||
.valueOf(details[0]);
|
||||
Integer rank = details.length <= 1 || details[1].trim().length() == 0 ? null : Integer.valueOf(details[1]);
|
||||
Date timeSinceStart = details[4].trim().length() == 0 ? null : parseTimePrefixedWithISOToday(details[4]);
|
||||
timingDataelementList.add(new TimingDataElement(markIndex, rank, timeSinceStart));
|
||||
}
|
||||
return new TMDMessage(raceID, boatID, timingDataelementList);
|
||||
}
|
||||
|
||||
|
||||
private Date parseTimeAndDateISO(String timeAndDateISO) throws ParseException {
|
||||
char timeZoneIndicator = timeAndDateISO.charAt(timeAndDateISO.length()-6);
|
||||
if ((timeZoneIndicator == '+' || timeZoneIndicator == '-') && timeAndDateISO.charAt(timeAndDateISO.length()-3) == ':') {
|
||||
timeAndDateISO = timeAndDateISO.substring(0, timeAndDateISO.length()-3)+timeAndDateISO.substring(timeAndDateISO.length()-2);
|
||||
lastTimeZoneSuffix = timeAndDateISO.substring(timeAndDateISO.length()-5);
|
||||
char timeZoneIndicator = timeAndDateISO.charAt(timeAndDateISO.length() - 6);
|
||||
if ((timeZoneIndicator == '+' || timeZoneIndicator == '-')
|
||||
&& timeAndDateISO.charAt(timeAndDateISO.length() - 3) == ':') {
|
||||
timeAndDateISO = timeAndDateISO.substring(0, timeAndDateISO.length() - 3)
|
||||
+ timeAndDateISO.substring(timeAndDateISO.length() - 2);
|
||||
lastTimeZoneSuffix = timeAndDateISO.substring(timeAndDateISO.length() - 5);
|
||||
}
|
||||
synchronized(dateFormat) {
|
||||
synchronized (dateFormat) {
|
||||
return dateFormat.parse(timeAndDateISO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Date parseTimePrefixedWithISOToday(String timeHHMMSS) throws ParseException {
|
||||
synchronized(dateFormat) {
|
||||
synchronized (dateFormat) {
|
||||
return dateFormat.parse(prefixTimeWithISOTodayAndSuffixWithTimezoneIndicator(timeHHMMSS));
|
||||
}
|
||||
}
|
||||
|
||||
private String prefixTimeWithISOTodayAndSuffixWithTimezoneIndicator(String time) {
|
||||
synchronized (dateFormat) {
|
||||
return dateFormat.format(new Date()).substring(0, "yyyy-mm-ddT".length())+time+lastTimeZoneSuffix;
|
||||
return dateFormat.format(new Date()).substring(0, "yyyy-mm-ddT".length()) + time + lastTimeZoneSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private long parseHHMMSSToMilliseconds(String hhmmss) {
|
||||
String[] timeDetail = hhmmss.split(":");
|
||||
long millisecondsSinceStart = 1000 * (Long.valueOf(timeDetail[2]) + 60 * Long.valueOf(timeDetail[1]) + 3600 * Long
|
||||
.valueOf(timeDetail[0]));
|
||||
return millisecondsSinceStart;
|
||||
}
|
||||
|
||||
private Date parseHHMMSSToDate(String hhmmss){
|
||||
String[] timeDetail = hhmmss.split(":");
|
||||
long millisecondsSinceStart = 1000 * (Long.valueOf(timeDetail[2]) + 60 * Long.valueOf(timeDetail[1]) + 3600 * Long
|
||||
.valueOf(timeDetail[0]));
|
||||
return new Date(millisecondsSinceStart);
|
||||
}
|
||||
|
||||
private List<SailMasterMessage> getSailMasterMessageList(List<String> strList) {
|
||||
// Add Strings of stringmessageList into a ArrayList of type SailMasterMessage
|
||||
@@ -266,13 +280,10 @@ public class MessageFileServiceImpl implements MessageFileService {
|
||||
}
|
||||
|
||||
private List<String> getFileIntoArrayListString(BufferedReader reader) throws IOException {
|
||||
// List<Object> list = new ArrayList<Object>();
|
||||
List<String> strList = new ArrayList<String>();
|
||||
|
||||
// Read Lines into ArrayList
|
||||
String tmp = "";
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
strList.add(reader.readLine());
|
||||
strList.add(tmp);
|
||||
}
|
||||
return strList;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.domain.swisstimingadapter.classes.services;
|
||||
package com.sap.sailing.domain.swisstimingadapter.classes.services.old;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
+7
-3
@@ -1,10 +1,12 @@
|
||||
package com.sap.sailing.domain.swisstimingadapter.classes.services;
|
||||
package com.sap.sailing.domain.swisstimingadapter.classes.services.old;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.swisstimingadapter.classes.services.MessageFileService;
|
||||
import com.sap.sailing.domain.swisstimingadapter.classes.services.MessageFileServiceImpl;
|
||||
import com.sap.sailing.domain.swisstimingadapter.classes.services.Exceptions.MessageScriptParsingException;
|
||||
|
||||
public class MessageScriptServiceImpl implements MessageScriptService{
|
||||
@@ -21,7 +23,8 @@ public class MessageScriptServiceImpl implements MessageScriptService{
|
||||
@Override
|
||||
public void updateMessage(Object message) {
|
||||
for (int i = 0; i < messageList.size(); i++) {
|
||||
if(messageList.get(i).equals(message)){
|
||||
// compare per refereence since 16.11.11 11:38
|
||||
if(messageList.get(i)==message){
|
||||
messageList.remove(i);
|
||||
messageList.add(i-1, message);
|
||||
}
|
||||
@@ -41,7 +44,8 @@ public class MessageScriptServiceImpl implements MessageScriptService{
|
||||
@Override
|
||||
public void deleteMessage(Object message) {
|
||||
for (int i = 0; i < messageList.size(); i++) {
|
||||
if(messageList.get(i).equals(message)){
|
||||
// compare per refereence since 16.11.11 11:38
|
||||
if(messageList.get(i)==message){
|
||||
messageList.remove(i);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user