Added AverageWindEncoder.

Refactored AverageWindDecoder - it now implements MessageDecoder.
Refactored AverageWind - it now uses milliseconds and knots, instead of packed MMperSec and tenths of a second. It also exposes its attributes now.
Added (un)packAverageWindPeriod to AC35UnitConverter.
Added AverageWindDecoderTest.
issue #35 #36
#story[1095]
This commit is contained in:
fjc40
2017-08-06 20:31:21 +12:00
parent ce63f58429
commit da800e659a
9 changed files with 442 additions and 89 deletions
@@ -85,4 +85,23 @@ public class AC35UnitConverter {
}
/**
* Packs an average wind period, in milliseconds, into an int, in tenths of a second.
* @param periodMilliseconds Period in milliseconds.
* @return Period in tenths of a second.
*/
public static int packAverageWindPeriod(long periodMilliseconds) {
return (int) (periodMilliseconds / 100);
}
/**
* Unpacks an average wind period, in tenths of a second, into an long, in milliseconds.
* @param periodTenthsOfSecond Period in tenths of a second.
* @return Period in milliseconds
*/
public static long unpackAverageWindPeriod(int periodTenthsOfSecond) {
return (periodTenthsOfSecond * 100);
}
}