/** {@inheritDoc} */ @Override public boolean test(AisPacket p) { PositionTime pos = p.tryGetPositionTime(); if (pos == null) { return false; } boolean updateDistance = minDistanceInMeters != null && (latestPosition == null || latestPosition.rhumbLineDistanceTo(pos) >= minDistanceInMeters); boolean updateDuration = minDurationInMS != null && (latestTimestamp == null || pos.getTime() - latestTimestamp >= minDurationInMS); if (!updateDistance && !updateDuration) { return false; } // update latest positions latestPosition = pos; latestTimestamp = pos.getTime(); return true; }
/** {@inheritDoc} */ @Override public boolean test(AisPacket element) { AisMessage m = element.tryGetAisMessage(); return m != null && test(m); }