001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search.filter;
016    
017    import com.liferay.portal.kernel.search.geolocation.GeoDistance;
018    import com.liferay.portal.kernel.search.geolocation.GeoLocationPoint;
019    
020    /**
021     * @author Michael C. Han
022     */
023    public class GeoDistanceFilter extends BaseFilter {
024    
025            public GeoDistanceFilter(
026                    String field, GeoLocationPoint pinGeoLocationPoint,
027                    GeoDistance geoDistance) {
028    
029                    _field = field;
030                    _pinGeoLocationPoint = pinGeoLocationPoint;
031                    _geoDistance = geoDistance;
032            }
033    
034            @Override
035            public <T> T accept(FilterVisitor<T> filterVisitor) {
036                    return filterVisitor.visit(this);
037            }
038    
039            public String getField() {
040                    return _field;
041            }
042    
043            public GeoDistance getGeoDistance() {
044                    return _geoDistance;
045            }
046    
047            public GeoLocationPoint getPinGeoLocationPoint() {
048                    return _pinGeoLocationPoint;
049            }
050    
051            @Override
052            public int getSortOrder() {
053                    return 100;
054            }
055    
056            private final String _field;
057            private final GeoDistance _geoDistance;
058            private final GeoLocationPoint _pinGeoLocationPoint;
059    
060    }