public static VesselPosition toVesselPosition(Fix fix, Optional<?> data) {
        return VesselPosition.builder().id(new Mmsi(fix.mmsi())).lat(fix.lat()).lon(fix.lon())
                .time(fix.time()).cls(fix.aisClass() == AisClass.A ? VesselClass.A : VesselClass.B)
                .cogDegrees(toDouble(fix.courseOverGroundDegrees()))
                .headingDegrees(toDouble(fix.headingDegrees()))
                .speedMetresPerSecond(
                        multiply(fix.speedOverGroundKnots(), KNOTS_TO_METRES_PER_SECOND))
                .navigationalStatus(fix.navigationalStatus().isPresent()
                        ? NavigationalStatus.values()[fix.navigationalStatus().get().ordinal()]
                        : NavigationalStatus.NOT_DEFINED)
                .positionAisNmea(Optional.<String> absent())
                .shipStaticAisNmea(Optional.<String> absent())
                // set data
                .data(data)
                // build
                .build();
    }
public static VesselPosition toVesselPosition ( Fix fix , Optional < ? > data ) { return VesselPosition . builder ( ) . id ( new Mmsi ( fix . mmsi ( ) ) ) . lat ( fix . lat ( ) ) . lon ( fix . lon ( ) ) . time ( fix . time ( ) ) . cls ( fix . aisClass ( ) == AisClass . A ? VesselClass . A : VesselClass . B ) . cogDegrees ( toDouble ( fix . courseOverGroundDegrees ( ) ) ) . headingDegrees ( toDouble ( fix . headingDegrees ( ) ) ) . speedMetresPerSecond ( multiply ( fix . speedOverGroundKnots ( ) , KNOTS_TO_METRES_PER_SECOND ) ) . navigationalStatus ( fix . navigationalStatus ( ) . isPresent ( ) ? NavigationalStatus . values ( ) [ fix . navigationalStatus ( ) . get ( ) . ordinal ( ) ] : NavigationalStatus . NOT_DEFINED ) . positionAisNmea ( Optional . < String > absent ( ) ) . shipStaticAisNmea ( Optional . < String > absent ( ) ) . data ( data ) . build ( ) ; }
TODO unit test