added test for delta clock at mark

This commit is contained in:
Axel Uhl committed 2011-11-04 16:15:42 +01:00
1 parent 05e1dcdcd4
commit d870388e65
4 files changed
+22 -4

No files matched your search

@@ -28,5 +28,10 @@ public class CompetitorImpl implements Competitor {
public String getName() {
return name;
}
@Override
public String toString() {
return name+"/"+boatID;
}
}
@@ -63,7 +63,7 @@ public class SailMasterConnectorImpl extends SailMasterTransceiver implements Sa
private final String host;
private final int port;
private Socket socket;
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
private final DateFormat dateFormat;
private final Set<SailMasterListener> listeners;
private final Thread receiverThread;
private boolean stopped;
@@ -72,6 +72,7 @@ public class SailMasterConnectorImpl extends SailMasterTransceiver implements Sa
public SailMasterConnectorImpl(String host, int port) {
super();
dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
this.host = host;
this.port = port;
this.listeners = new HashSet<SailMasterListener>();
@@ -387,7 +388,8 @@ public class SailMasterConnectorImpl extends SailMasterTransceiver implements Sa
for (int i=0; i<count; i++) {
String[] markTimeDetail = sections[3+i].split(";");
result.put(Integer.valueOf(markTimeDetail[0]), new Pair<TimePoint, String>(
new MillisecondsTimePoint(dateFormat.parse(prefixTimeWithISOToday(markTimeDetail[1]))), markTimeDetail[2]));
markTimeDetail.length <= 1 ? null : new MillisecondsTimePoint(dateFormat.parse(prefixTimeWithISOToday(markTimeDetail[1]))),
markTimeDetail.length <= 2 ? null : markTimeDetail[2]));
}
return result;
}
@@ -20,7 +20,7 @@ public class SailMasterTransceiver {
* Sends the string message to the output stream <code>os</code>, using the cp1252 character set
* for encoding and framing the message with the <code>STX</code> and <code>ETX</code> bytes.
*/
public void sendMessage(String message, OutputStream os) throws IOException {
public synchronized void sendMessage(String message, OutputStream os) throws IOException {
os.write(STX);
os.write(message.getBytes(Charset.forName("cp1252")));
os.write(ETX);