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.geolocation;
016    
017    /**
018     * @author Michael C. Han
019     */
020    public class GeoDistance {
021    
022            public GeoDistance(double distance) {
023                    this(distance, DistanceUnit.METERS);
024            }
025    
026            public GeoDistance(double distance, DistanceUnit distanceUnit) {
027                    _distance = distance;
028                    _distanceUnit = distanceUnit;
029            }
030    
031            public double getDistance() {
032                    return _distance;
033            }
034    
035            public DistanceUnit getDistanceUnit() {
036                    return _distanceUnit;
037            }
038    
039            @Override
040            public String toString() {
041                    return _distance + _distanceUnit.toString();
042            }
043    
044            private final double _distance;
045            private final DistanceUnit _distanceUnit;
046    
047    }