Network:
Moved the Network message classes from the Utils package to the Messages package.
Renamed BoatLocationMessage to BoatLocation and BoatStatusMessage to BoatStatus to be consistent with other message classes.
Renamed the BoatStatus enumeration to BoatStatusEnum as it conflicted with BoatStatus (the message).
Moved the BoatStatusEnum and MessageType enumerations from the Utils package to the Messages/Enums package.
Changed the BoatStatusEnum and MessageType enumerations to use map look ups in the enum.fromByte(b) method - this means that there's less copy and pasted values, and the fromByte function doesn't need to be modified if new enumerations are added.
Added a sequenceNumber member to the Heartbeat class.
Added an InvalidMessageException in the package Networking/Exceptions. This is thrown when a message is read, but it is invalid in some way.
Refactored/tidied up the Networking/BinaryMessageEncoder and Decoder classes. The decoder throws InvalidMessageExceptions instead of returning null.
Visualiser:
VisualiserInput now wraps a DataInputStream around the socket. This provides the stream.readFully(buffer) function, which is a blocking read, removing the need for busy wait loops. Replaced the getBytes() function with getNextMessage() and getNextMessageBytes(). These read the next message from the socket, and return it as a message object and a byte array, respectively.
Changed the current heartbeat timeout to 10 seconds. Added some work-in-progress code to attempt to reconnect when connection is lost. It currently doesn't work. I think Fan-Wu was doing a proper implementation, however.
VisualiserInput also has a queue of received events. Currently not really used, but could be useful in the future. Events get added as they are read.
Changed VisualiserInputs main loop to use instanceOf instead of switch+case. Feedback wanted - are there any downsides to using this instanceOf method?
#story[778,782]