class GeoResultParser extends ResultParser {

  private static final Pattern GEO_URL_PATTERN = 
      Pattern.compile("geo:([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?:\\?(.*))?", Pattern.CASE_INSENSITIVE);
  
  @Override
  public GeoParsedResult parse(Result result) {<FILL_FUNCTION_BODY>}

}

    CharSequence rawText = getMassagedText(result);
    Matcher matcher = GEO_URL_PATTERN.matcher(rawText);
    if (!matcher.matches()) {
      return null;
    }

    String query = matcher.group(4);

    double latitude;
    double longitude;
    double altitude;
    try {
      latitude = Double.parseDouble(matcher.group(1));
      if (latitude > 90.0 || latitude < -90.0) {
        return null;
      }
      longitude = Double.parseDouble(matcher.group(2));
      if (longitude > 180.0 || longitude < -180.0) {
        return null;
      }
      if (matcher.group(3) == null) {
        altitude = 0.0;
      } else {
        altitude = Double.parseDouble(matcher.group(3));
        if (altitude < 0.0) {
          return null;
        }
      }
    } catch (NumberFormatException ignored) {
      return null;
    }
    return new GeoParsedResult(latitude, longitude, altitude, query);
  
<methods>public non-sealed void <init>() ,public abstract com.google.zxing.client.result.ParsedResult parse(com.google.zxing.Result) ,public static com.google.zxing.client.result.ParsedResult parseResult(com.google.zxing.Result) <variables>private static final java.util.regex.Pattern AMPERSAND,private static final java.lang.String BYTE_ORDER_MARK,private static final java.util.regex.Pattern DIGITS,static final java.lang.String[] EMPTY_STR_ARRAY,private static final java.util.regex.Pattern EQUALS,private static final com.google.zxing.client.result.ResultParser[] PARSERS