示例#1
0
 /** {@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;
 }
示例#2
0
 /** {@inheritDoc} */
 @Override
 public boolean test(AisPacket element) {
   AisMessage m = element.tryGetAisMessage();
   return m != null && test(m);
 }