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.GeoLocationPoint;
018    
019    import java.util.Collections;
020    import java.util.HashSet;
021    import java.util.Set;
022    
023    /**
024     * @author Michael C. Han
025     */
026    public class GeoPolygonFilter extends BaseFilter {
027    
028            public GeoPolygonFilter(String field) {
029                    _field = field;
030            }
031    
032            @Override
033            public <T> T accept(FilterVisitor<T> filterVisitor) {
034                    return filterVisitor.visit(this);
035            }
036    
037            public void addGeoLocationPoint(GeoLocationPoint geoLocationPoint) {
038                    _geoLocationPoints.add(geoLocationPoint);
039            }
040    
041            public String getField() {
042                    return _field;
043            }
044    
045            public Set<GeoLocationPoint> getGeoLocationPoints() {
046                    return Collections.unmodifiableSet(_geoLocationPoints);
047            }
048    
049            @Override
050            public int getSortOrder() {
051                    return 140;
052            }
053    
054            private final String _field;
055            private final Set<GeoLocationPoint> _geoLocationPoints = new HashSet<>();
056    
057    }