addBidirectionalLink() публичный Метод

public addBidirectionalLink ( String fromLocation, String toLocation, Double distance ) : void
fromLocation String
toLocation String
distance Double
Результат void
        /**
         * Initializes a map with a simplified road map of Romania.
         */
        public static void initMap(ExtendableMap map)
        {
            // mapOfRomania
            map.clear();
            map.addBidirectionalLink(ORADEA, ZERIND, 71.0);
            map.addBidirectionalLink(ORADEA, SIBIU, 151.0);
            map.addBidirectionalLink(ZERIND, ARAD, 75.0);
            map.addBidirectionalLink(ARAD, TIMISOARA, 118.0);
            map.addBidirectionalLink(ARAD, SIBIU, 140.0);
            map.addBidirectionalLink(TIMISOARA, LUGOJ, 111.0);
            map.addBidirectionalLink(LUGOJ, MEHADIA, 70.0);
            map.addBidirectionalLink(MEHADIA, DOBRETA, 75.0);
            map.addBidirectionalLink(DOBRETA, CRAIOVA, 120.0);
            map.addBidirectionalLink(SIBIU, FAGARAS, 99.0);
            map.addBidirectionalLink(SIBIU, RIMNICU_VILCEA, 80.0);
            map.addBidirectionalLink(RIMNICU_VILCEA, PITESTI, 97.0);
            map.addBidirectionalLink(RIMNICU_VILCEA, CRAIOVA, 146.0);
            map.addBidirectionalLink(CRAIOVA, PITESTI, 138.0);
            map.addBidirectionalLink(FAGARAS, BUCHAREST, 211.0);
            map.addBidirectionalLink(PITESTI, BUCHAREST, 101.0);
            map.addBidirectionalLink(GIURGIU, BUCHAREST, 90.0);
            map.addBidirectionalLink(BUCHAREST, URZICENI, 85.0);
            map.addBidirectionalLink(NEAMT, IASI, 87.0);
            map.addBidirectionalLink(URZICENI, VASLUI, 142.0);
            map.addBidirectionalLink(URZICENI, HIRSOVA, 98.0);
            map.addBidirectionalLink(IASI, VASLUI, 92.0);
            // addBidirectionalLink(VASLUI - already all linked
            map.addBidirectionalLink(HIRSOVA, EFORIE, 86.0);
            // addBidirectionalLink(EFORIE - already all linked

            // distances and directions
            // reference location: Bucharest
            map.setDistAndDirToRefLocation(ARAD, 366, 117);
            map.setDistAndDirToRefLocation(BUCHAREST, 0, 360);
            map.setDistAndDirToRefLocation(CRAIOVA, 160, 74);
            map.setDistAndDirToRefLocation(DOBRETA, 242, 82);
            map.setDistAndDirToRefLocation(EFORIE, 161, 282);
            map.setDistAndDirToRefLocation(FAGARAS, 176, 142);
            map.setDistAndDirToRefLocation(GIURGIU, 77, 25);
            map.setDistAndDirToRefLocation(HIRSOVA, 151, 260);
            map.setDistAndDirToRefLocation(IASI, 226, 202);
            map.setDistAndDirToRefLocation(LUGOJ, 244, 102);
            map.setDistAndDirToRefLocation(MEHADIA, 241, 92);
            map.setDistAndDirToRefLocation(NEAMT, 234, 181);
            map.setDistAndDirToRefLocation(ORADEA, 380, 131);
            map.setDistAndDirToRefLocation(PITESTI, 100, 116);
            map.setDistAndDirToRefLocation(RIMNICU_VILCEA, 193, 115);
            map.setDistAndDirToRefLocation(SIBIU, 253, 123);
            map.setDistAndDirToRefLocation(TIMISOARA, 329, 105);
            map.setDistAndDirToRefLocation(URZICENI, 80, 247);
            map.setDistAndDirToRefLocation(VASLUI, 199, 222);
            map.setDistAndDirToRefLocation(ZERIND, 374, 125);
        }
Пример #2
0
        /**
         * Initializes a map with a simplified road map of Australia.
         */
        public static void initMap(ExtendableMap map)
        {
            map.clear();
            // Add links
            // Distances from http://maps.google.com
            map.addBidirectionalLink(PERTH, ALBANY, 417.0);
            map.addBidirectionalLink(PERTH, KALGOORLIE, 593.0);
            map.addBidirectionalLink(PERTH, GERALDTON, 424.0);
            map.addBidirectionalLink(PERTH, PORT_HEDLAND, 1637.0);
            map.addBidirectionalLink(ALBANY, ESPERANCE, 478.0);
            map.addBidirectionalLink(KALGOORLIE, NORSEMAN, 187.0);
            map.addBidirectionalLink(ESPERANCE, NORSEMAN, 204.0);
            map.addBidirectionalLink(NORSEMAN, PORT_AUGUSTA, 1668.0);
            map.addBidirectionalLink(GERALDTON, CAMARVON, 479.0);
            map.addBidirectionalLink(CAMARVON, PORT_HEDLAND, 872.0);
            map.addBidirectionalLink(PORT_HEDLAND, BROOME, 589.0);
            map.addBidirectionalLink(BROOME, HALLS_CREEK, 685.0);
            map.addBidirectionalLink(HALLS_CREEK, WYNDHAM, 370.0);
            map.addBidirectionalLink(HALLS_CREEK, KATHERINE, 874.0);
            map.addBidirectionalLink(WYNDHAM, KATHERINE, 613.0);
            map.addBidirectionalLink(KATHERINE, DARWIN, 317.0);
            map.addBidirectionalLink(KATHERINE, TENNANT_CREEK, 673.0);
            map.addBidirectionalLink(TENNANT_CREEK, MT_ISA, 663.0);
            map.addBidirectionalLink(TENNANT_CREEK, ALICE_SPRINGS, 508.0);
            map.addBidirectionalLink(ALICE_SPRINGS, COOBER_PEDY, 688.0);
            map.addBidirectionalLink(COOBER_PEDY, PORT_AUGUSTA, 539.0);
            map.addBidirectionalLink(MT_ISA, TOWNSVILLE, 918.0);
            map.addBidirectionalLink(TOWNSVILLE, CAIRNS, 346.0);
            map.addBidirectionalLink(MT_ISA, LONGREACH, 647.0);
            map.addBidirectionalLink(TOWNSVILLE, MACKAY, 388.0);
            map.addBidirectionalLink(MACKAY, ROCKHAMPTON, 336.0);
            map.addBidirectionalLink(LONGREACH, ROCKHAMPTON, 687.0);
            map.addBidirectionalLink(ROCKHAMPTON, BRISBANE, 616.0);
            map.addBidirectionalLink(LONGREACH, CHARLEVILLE, 515.0);
            map.addBidirectionalLink(CHARLEVILLE, BRISBANE, 744.0);
            map.addBidirectionalLink(CHARLEVILLE, NYNGAN, 657.0);
            map.addBidirectionalLink(NYNGAN, BROKEN_HILL, 588.0);
            map.addBidirectionalLink(BROKEN_HILL, PORT_AUGUSTA, 415.0);
            map.addBidirectionalLink(NYNGAN, DUBBO, 166.0);
            map.addBidirectionalLink(DUBBO, BRISBANE, 860.0);
            map.addBidirectionalLink(DUBBO, SYDNEY, 466.0);
            map.addBidirectionalLink(BRISBANE, TAMWORTH, 576.0);
            map.addBidirectionalLink(BRISBANE, PORT_MACQUARIE, 555.0);
            map.addBidirectionalLink(PORT_MACQUARIE, NEWCASTLE, 245.0);
            map.addBidirectionalLink(TAMWORTH, NEWCASTLE, 284.0);
            map.addBidirectionalLink(NEWCASTLE, SYDNEY, 159.0);
            map.addBidirectionalLink(SYDNEY, CANBERRA, 287.0);
            map.addBidirectionalLink(CANBERRA, WAGGA_WAGGA, 243.0);
            map.addBidirectionalLink(DUBBO, WAGGA_WAGGA, 400.0);
            map.addBidirectionalLink(SYDNEY, LAKES_ENTRANCE, 706.0);
            map.addBidirectionalLink(LAKES_ENTRANCE, MELBOURNE, 317.0);
            map.addBidirectionalLink(WAGGA_WAGGA, MELBOURNE, 476.0);
            map.addBidirectionalLink(WAGGA_WAGGA, HAY, 269.0);
            map.addBidirectionalLink(MELBOURNE, WARNAMBOOL, 269.0);
            map.addBidirectionalLink(WARNAMBOOL, MOUNT_GAMBIER, 185.0);
            map.addBidirectionalLink(MOUNT_GAMBIER, ADELAIDE, 449.0);
            map.addBidirectionalLink(HAY, ADELAIDE, 655.0);
            map.addBidirectionalLink(PORT_AUGUSTA, ADELAIDE, 306.0);
            map.addBidirectionalLink(MELBOURNE, ADELAIDE, 728.0);
            map.addBidirectionalLink(PORT_AUGUSTA, PORT_LINCOLN, 341.0);

            // Locations coordinates
            // Alice Springs is taken as central point with coordinates (0|0)
            // Therefore x and y coordinates refer to Alice Springs. Note that
            // the coordinates are not very precise and partly modified to
            // get a more real shape of Australia.
            map.setPosition(ADELAIDE, 417, 1289);
            map.setPosition(ALBANY, -1559, 1231);
            map.setPosition(ALICE_SPRINGS, 0, 0);
            map.setPosition(BRISBANE, 1882, 415);
            map.setPosition(BROKEN_HILL, 709, 873);
            map.setPosition(BROOME, -1189, -645);
            map.setPosition(CAIRNS, 1211, -791);
            map.setPosition(CAMARVON, -2004, -34);
            map.setPosition(CANBERRA, 1524, 1189);
            map.setPosition(CHARLEVILLE, 1256, 268);
            map.setPosition(COOBER_PEDY, 86, 593);
            map.setPosition(DARWIN, -328, -1237);
            map.setPosition(DUBBO, 1474, 881);
            map.setPosition(ESPERANCE, -1182, 1132);
            map.setPosition(GERALDTON, -1958, 405);
            map.setPosition(HALLS_CREEK, -630, -624);
            map.setPosition(HAY, 985, 1143);
            map.setPosition(KALGOORLIE, -1187, 729);
            map.setPosition(KATHERINE, -183, -1025);
            map.setPosition(LAKES_ENTRANCE, 1412, 1609);
            map.setPosition(LONGREACH, 1057, -49);
            map.setPosition(MACKAY, 1553, -316);
            map.setPosition(MELBOURNE, 1118, 1570);
            map.setPosition(MOUNT_GAMBIER, 602, 1531);
            map.setPosition(MT_ISA, 563, -344);
            map.setPosition(NEWCASTLE, 1841, 979);
            map.setPosition(NORSEMAN, -1162, 881);
            map.setPosition(NYNGAN, 1312, 781);
            map.setPosition(PERTH, -1827, 814);
            map.setPosition(PORT_AUGUSTA, 358, 996);
            map.setPosition(PORT_HEDLAND, -1558, -438);
            map.setPosition(PORT_LINCOLN, 169, 1205);
            map.setPosition(PORT_MACQUARIE, 1884, 849);
            map.setPosition(ROCKHAMPTON, 1693, -59);
            map.setPosition(SYDNEY, 1778, 1079);
            map.setPosition(TAMWORTH, 1752, 722);
            map.setPosition(TENNANT_CREEK, 30, -445);
            map.setPosition(TOWNSVILLE, 1318, -520);
            map.setPosition(WAGGA_WAGGA, 1322, 1125);
            map.setPosition(WARNAMBOOL, 761, 1665);
            map.setPosition(WYNDHAM, -572, -932);
        }
Пример #3
0
        /**
         * Initializes a map with a simplified road map of Romania.
         */
        public static void initMap(ExtendableMap map)
        {
            // mapOfRomania
            map.clear();
            map.addBidirectionalLink(ORADEA, ZERIND, 71.0);
            map.addBidirectionalLink(ORADEA, SIBIU, 151.0);
            map.addBidirectionalLink(ZERIND, ARAD, 75.0);
            map.addBidirectionalLink(ARAD, TIMISOARA, 118.0);
            map.addBidirectionalLink(ARAD, SIBIU, 140.0);
            map.addBidirectionalLink(TIMISOARA, LUGOJ, 111.0);
            map.addBidirectionalLink(LUGOJ, MEHADIA, 70.0);
            map.addBidirectionalLink(MEHADIA, DOBRETA, 75.0);
            map.addBidirectionalLink(DOBRETA, CRAIOVA, 120.0);
            map.addBidirectionalLink(SIBIU, FAGARAS, 99.0);
            map.addBidirectionalLink(SIBIU, RIMNICU_VILCEA, 80.0);
            map.addBidirectionalLink(RIMNICU_VILCEA, PITESTI, 97.0);
            map.addBidirectionalLink(RIMNICU_VILCEA, CRAIOVA, 146.0);
            map.addBidirectionalLink(CRAIOVA, PITESTI, 138.0);
            map.addBidirectionalLink(FAGARAS, BUCHAREST, 211.0);
            map.addBidirectionalLink(PITESTI, BUCHAREST, 101.0);
            map.addBidirectionalLink(GIURGIU, BUCHAREST, 90.0);
            map.addBidirectionalLink(BUCHAREST, URZICENI, 85.0);
            map.addBidirectionalLink(NEAMT, IASI, 87.0);
            map.addBidirectionalLink(URZICENI, VASLUI, 142.0);
            map.addBidirectionalLink(URZICENI, HIRSOVA, 98.0);
            map.addBidirectionalLink(IASI, VASLUI, 92.0);
            // addBidirectionalLink(VASLUI - already all linked
            map.addBidirectionalLink(HIRSOVA, EFORIE, 86.0);
            // addBidirectionalLink(EFORIE - already all linked

            // distances and directions
            // reference location: Bucharest
            map.setDistAndDirToRefLocation(ARAD, 366, 117);
            map.setDistAndDirToRefLocation(BUCHAREST, 0, 360);
            map.setDistAndDirToRefLocation(CRAIOVA, 160, 74);
            map.setDistAndDirToRefLocation(DOBRETA, 242, 82);
            map.setDistAndDirToRefLocation(EFORIE, 161, 282);
            map.setDistAndDirToRefLocation(FAGARAS, 176, 142);
            map.setDistAndDirToRefLocation(GIURGIU, 77, 25);
            map.setDistAndDirToRefLocation(HIRSOVA, 151, 260);
            map.setDistAndDirToRefLocation(IASI, 226, 202);
            map.setDistAndDirToRefLocation(LUGOJ, 244, 102);
            map.setDistAndDirToRefLocation(MEHADIA, 241, 92);
            map.setDistAndDirToRefLocation(NEAMT, 234, 181);
            map.setDistAndDirToRefLocation(ORADEA, 380, 131);
            map.setDistAndDirToRefLocation(PITESTI, 100, 116);
            map.setDistAndDirToRefLocation(RIMNICU_VILCEA, 193, 115);
            map.setDistAndDirToRefLocation(SIBIU, 253, 123);
            map.setDistAndDirToRefLocation(TIMISOARA, 329, 105);
            map.setDistAndDirToRefLocation(URZICENI, 80, 247);
            map.setDistAndDirToRefLocation(VASLUI, 199, 222);
            map.setDistAndDirToRefLocation(ZERIND, 374, 125);
        }
        /**
         * Initializes a map with a simplified road map of Australia.
         */
        public static void initMap(ExtendableMap map)
        {
            map.clear();
            // Add links
            // Distances from http://maps.google.com
            map.addBidirectionalLink(PERTH, ALBANY, 417.0);
            map.addBidirectionalLink(PERTH, KALGOORLIE, 593.0);
            map.addBidirectionalLink(PERTH, GERALDTON, 424.0);
            map.addBidirectionalLink(PERTH, PORT_HEDLAND, 1637.0);
            map.addBidirectionalLink(ALBANY, ESPERANCE, 478.0);
            map.addBidirectionalLink(KALGOORLIE, NORSEMAN, 187.0);
            map.addBidirectionalLink(ESPERANCE, NORSEMAN, 204.0);
            map.addBidirectionalLink(NORSEMAN, PORT_AUGUSTA, 1668.0);
            map.addBidirectionalLink(GERALDTON, CAMARVON, 479.0);
            map.addBidirectionalLink(CAMARVON, PORT_HEDLAND, 872.0);
            map.addBidirectionalLink(PORT_HEDLAND, BROOME, 589.0);
            map.addBidirectionalLink(BROOME, HALLS_CREEK, 685.0);
            map.addBidirectionalLink(HALLS_CREEK, WYNDHAM, 370.0);
            map.addBidirectionalLink(HALLS_CREEK, KATHERINE, 874.0);
            map.addBidirectionalLink(WYNDHAM, KATHERINE, 613.0);
            map.addBidirectionalLink(KATHERINE, DARWIN, 317.0);
            map.addBidirectionalLink(KATHERINE, TENNANT_CREEK, 673.0);
            map.addBidirectionalLink(TENNANT_CREEK, MT_ISA, 663.0);
            map.addBidirectionalLink(TENNANT_CREEK, ALICE_SPRINGS, 508.0);
            map.addBidirectionalLink(ALICE_SPRINGS, COOBER_PEDY, 688.0);
            map.addBidirectionalLink(COOBER_PEDY, PORT_AUGUSTA, 539.0);
            map.addBidirectionalLink(MT_ISA, TOWNSVILLE, 918.0);
            map.addBidirectionalLink(TOWNSVILLE, CAIRNS, 346.0);
            map.addBidirectionalLink(MT_ISA, LONGREACH, 647.0);
            map.addBidirectionalLink(TOWNSVILLE, MACKAY, 388.0);
            map.addBidirectionalLink(MACKAY, ROCKHAMPTON, 336.0);
            map.addBidirectionalLink(LONGREACH, ROCKHAMPTON, 687.0);
            map.addBidirectionalLink(ROCKHAMPTON, BRISBANE, 616.0);
            map.addBidirectionalLink(LONGREACH, CHARLEVILLE, 515.0);
            map.addBidirectionalLink(CHARLEVILLE, BRISBANE, 744.0);
            map.addBidirectionalLink(CHARLEVILLE, NYNGAN, 657.0);
            map.addBidirectionalLink(NYNGAN, BROKEN_HILL, 588.0);
            map.addBidirectionalLink(BROKEN_HILL, PORT_AUGUSTA, 415.0);
            map.addBidirectionalLink(NYNGAN, DUBBO, 166.0);
            map.addBidirectionalLink(DUBBO, BRISBANE, 860.0);
            map.addBidirectionalLink(DUBBO, SYDNEY, 466.0);
            map.addBidirectionalLink(BRISBANE, TAMWORTH, 576.0);
            map.addBidirectionalLink(BRISBANE, PORT_MACQUARIE, 555.0);
            map.addBidirectionalLink(PORT_MACQUARIE, NEWCASTLE, 245.0);
            map.addBidirectionalLink(TAMWORTH, NEWCASTLE, 284.0);
            map.addBidirectionalLink(NEWCASTLE, SYDNEY, 159.0);
            map.addBidirectionalLink(SYDNEY, CANBERRA, 287.0);
            map.addBidirectionalLink(CANBERRA, WAGGA_WAGGA, 243.0);
            map.addBidirectionalLink(DUBBO, WAGGA_WAGGA, 400.0);
            map.addBidirectionalLink(SYDNEY, LAKES_ENTRANCE, 706.0);
            map.addBidirectionalLink(LAKES_ENTRANCE, MELBOURNE, 317.0);
            map.addBidirectionalLink(WAGGA_WAGGA, MELBOURNE, 476.0);
            map.addBidirectionalLink(WAGGA_WAGGA, HAY, 269.0);
            map.addBidirectionalLink(MELBOURNE, WARNAMBOOL, 269.0);
            map.addBidirectionalLink(WARNAMBOOL, MOUNT_GAMBIER, 185.0);
            map.addBidirectionalLink(MOUNT_GAMBIER, ADELAIDE, 449.0);
            map.addBidirectionalLink(HAY, ADELAIDE, 655.0);
            map.addBidirectionalLink(PORT_AUGUSTA, ADELAIDE, 306.0);
            map.addBidirectionalLink(MELBOURNE, ADELAIDE, 728.0);
            map.addBidirectionalLink(PORT_AUGUSTA, PORT_LINCOLN, 341.0);

            // Locations coordinates
            // Alice Springs is taken as central point with coordinates (0|0)
            // Therefore x and y coordinates refer to Alice Springs. Note that
            // the coordinates are not very precise and partly modified to
            // get a more real shape of Australia.
            map.setPosition(ADELAIDE, 417, 1289);
            map.setPosition(ALBANY, -1559, 1231);
            map.setPosition(ALICE_SPRINGS, 0, 0);
            map.setPosition(BRISBANE, 1882, 415);
            map.setPosition(BROKEN_HILL, 709, 873);
            map.setPosition(BROOME, -1189, -645);
            map.setPosition(CAIRNS, 1211, -791);
            map.setPosition(CAMARVON, -2004, -34);
            map.setPosition(CANBERRA, 1524, 1189);
            map.setPosition(CHARLEVILLE, 1256, 268);
            map.setPosition(COOBER_PEDY, 86, 593);
            map.setPosition(DARWIN, -328, -1237);
            map.setPosition(DUBBO, 1474, 881);
            map.setPosition(ESPERANCE, -1182, 1132);
            map.setPosition(GERALDTON, -1958, 405);
            map.setPosition(HALLS_CREEK, -630, -624);
            map.setPosition(HAY, 985, 1143);
            map.setPosition(KALGOORLIE, -1187, 729);
            map.setPosition(KATHERINE, -183, -1025);
            map.setPosition(LAKES_ENTRANCE, 1412, 1609);
            map.setPosition(LONGREACH, 1057, -49);
            map.setPosition(MACKAY, 1553, -316);
            map.setPosition(MELBOURNE, 1118, 1570);
            map.setPosition(MOUNT_GAMBIER, 602, 1531);
            map.setPosition(MT_ISA, 563, -344);
            map.setPosition(NEWCASTLE, 1841, 979);
            map.setPosition(NORSEMAN, -1162, 881);
            map.setPosition(NYNGAN, 1312, 781);
            map.setPosition(PERTH, -1827, 814);
            map.setPosition(PORT_AUGUSTA, 358, 996);
            map.setPosition(PORT_HEDLAND, -1558, -438);
            map.setPosition(PORT_LINCOLN, 169, 1205);
            map.setPosition(PORT_MACQUARIE, 1884, 849);
            map.setPosition(ROCKHAMPTON, 1693, -59);
            map.setPosition(SYDNEY, 1778, 1079);
            map.setPosition(TAMWORTH, 1752, 722);
            map.setPosition(TENNANT_CREEK, 30, -445);
            map.setPosition(TOWNSVILLE, 1318, -520);
            map.setPosition(WAGGA_WAGGA, 1322, 1125);
            map.setPosition(WARNAMBOOL, 761, 1665);
            map.setPosition(WYNDHAM, -572, -932);
        }