Example #1
0
  /**
   * Not all pattens might have filters. This "filter_out" implies you should evaluate the
   * MatchFilter.stop() method on any implementation.
   *
   * @param m
   * @return
   */
  public boolean filter_out(GeocoordMatch m) {
    // Different reasons to filter out coordinate matches.

    if (m.isFilteredOut()) {
      // Earlier parsing and normalization filtered this match out.
      return true;
    }

    // At this point the XY = (0,0).  This does not sound useful.
    //
    if (m.latitude == 0 && m.longitude == 0) {
      return true;
    }

    // A this point extractor does not have a valid coordinate text.  This is an engineering error.
    if (m.coord_text == null) {
      // The match parser has not generated a normalized version of the coordinate text
      // filter out.
      return true;
    }

    // Apply MGRS filter  -- IF static RUNTIME_FLAGS say it is enabled
    if (m.cce_family_id == XConstants.MGRS_PATTERN) {
      if ((XCoord.RUNTIME_FLAGS & XConstants.MGRS_FILTERS_ON) > 0) {
        return mgrs_filter.stop(m);
      }
    }
    /** Apply DMS filter also only if static flags say it is enabled. */
    else if (m.cce_family_id == XConstants.DMS_PATTERN) {
      if ((XCoord.RUNTIME_FLAGS & XConstants.DMS_FILTERS_ON) > 0) {
        return dms_filter.stop(m);
      }
    }
    // possibly others.
    return false;
  }