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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user