001    /*
002    Copyright (c) 1996-2012, Damon Hart-Davis
003    All rights reserved.
004    
005    Redistribution and use in source and binary forms, with or without
006    modification, are permitted provided that the following conditions are
007    met:
008    
009      * Redistributions of source code must retain the above copyright
010        notice, this list of conditions and the following disclaimer.
011    
012      * Redistributions in binary form must reproduce the above copyright
013        notice, this list of conditions and the following disclaimer in the
014        documentation and/or other materials provided with the
015        distribution.
016    
017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
018    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
019    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
020    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
021    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
022    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
023    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
024    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
025    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
026    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
027    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028    */
029    package org.hd.d.pg2k.svrCore.location;
030    
031    /**
032     * Created by IntelliJ IDEA.
033     * User: Damon
034     * Date: 10-Feb-2006
035     * Time: 15:57:00
036     */
037    
038    /**Defines some broad-brush, ordered, geographical Internet proximity values.
039     * Defines strictly-positive value for two points "close" to one another,
040     * indicating likely relative connectivity (cf two random points in the Net)
041     * including notions of bandwidth, packet loss, RTT, reliability, cost, etc,
042     * ie a blended QoS/cost for end user and provider.
043     * <p>
044     * I assume that international transit costs roughly 50x intra-country bandwidth,
045     * and that cheap peering is not available for all intra-country traffic.
046     * I also assume the performance of a long route from a user's point of view
047     * is usually somewhat less bad than the cost would imply.
048     * <p>
049     * The enum tag is the most important; the numerical values are very approximate
050     * and only to be used if nothing better is available.
051     * <p>
052     * The tag "NONE" has a value of exactly 1 to indicate no closeness
053     * or unknown closeness.
054     */
055    public enum GeoProximity
056        {
057        /**Typically MAN or LAN or closer; fast, reliable and almost free. */
058        VCLOSE(50),
059    
060        /**Within one country; usually reasonably fast, reliable and cheap. */
061        COUNTRY(4),
062    
063        /**Group of well-connected countries (eg uk and nl, or us and ca). */
064        COUNTRYGROUP(3),
065    
066        /**Within one continent or (more-or-less equivalently) one address-registry's ambit (eg RIPE). */
067        CONTINENT(2),
068    
069        /**No particular/known proximity, may well involve expensive/slow/unreliable transit. */
070        NONE(1);
071    
072    
073        private GeoProximity(final int closeness) { this.closeness = closeness; }
074    
075        /**The "closeness" factor higher meaning closer; strictly positive. */
076        private final int closeness;
077    
078        /**Get the "closeness" factor higher meaning closer; strictly positive. */
079        public final int getCloseness() { return(closeness); }
080        }